Fix ddosing wiki.factorio.com with 404 picture requests
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<title>Clusterio</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<script src="https://code.jquery.com/jquery.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/canvasjs/1.7.0/canvasjs.js" type="text/javascript"></script>
|
||||
<script src="http://momentjs.com/downloads/moment.min.js" type="text/javascript"></script>
|
||||
<script src="main.js"></script>
|
||||
|
||||
@@ -61,60 +61,52 @@ Date.prototype.yyyymmdd = function(time) { // http://stackoverflow.com/questions
|
||||
return this.getFullYear()+""+mm+""+dd+ ""; // padding
|
||||
};
|
||||
var date = new Date();
|
||||
String.prototype.replaceAll = function(search, replacement) {
|
||||
var target = this;
|
||||
function replaceAll(target, search, replacement) {
|
||||
return target.split(search).join(replacement);
|
||||
};
|
||||
|
||||
function getImageFromName(name){
|
||||
if(imagelinks[name]){
|
||||
return imagelinks[name];
|
||||
} else if(imagedata[name]) {
|
||||
return "https://wiki.factorio.com/images/" + imagedata[name] + ".png"
|
||||
} else if(factorioLocale["entity-name"][name]){
|
||||
return "https://wiki.factorio.com/images/" + capitalizeFirstLetter(replaceAll(factorioLocale["entity-name"][name], ' ', '_').toLowerCase()) + ".png";
|
||||
} else if(factorioLocale["item-name"][name]){
|
||||
return "https://wiki.factorio.com/images/" + capitalizeFirstLetter(replaceAll(factorioLocale["item-name"][name], ' ', '_').toLowerCase()) + ".png";
|
||||
} else if(factorioLocale["fluid-name"][name]){
|
||||
return "https://wiki.factorio.com/images/" + capitalizeFirstLetter(replaceAll(factorioLocale["fluid-name"][name], ' ', '_').toLowerCase()) + ".png";
|
||||
} else if(factorioLocale["equipment-name"][name]){
|
||||
return "https://wiki.factorio.com/images/" + capitalizeFirstLetter(replaceAll(factorioLocale["equipment-name"][name], ' ', '_').toLowerCase()) + ".png";
|
||||
} else return "";
|
||||
}
|
||||
$.getJSON("/api/getFactorioLocale", (locale) => {
|
||||
window.factorioLocale = locale;
|
||||
});
|
||||
// image data
|
||||
// key is the name of the item in the database, value is the name of the image on wiki.factorio.com/images/*
|
||||
// this list has to include all entities that doesn't just follow the simple capitalize first letter convention
|
||||
var imagedata = {};
|
||||
/* Notice: All icon images hosted on this Wiki have been renamed to use their in-game names, with underscores. If your external tool references these icons, please correct your links.
|
||||
/* Notice: All icon images hosted on this Wiki have been renamed to use their in-game names, with underscores. If your external tool references these icons, please correct your links. */
|
||||
var imagedata = {
|
||||
["empty-barrel"]: "Barrel-empty",
|
||||
["transport-belt"]: "Basic-transport-belt",
|
||||
["underground-belt"]: "Basic-transport-belt-to-ground",
|
||||
["fast-underground-belt"]: "Fast-transport-belt-to-ground",
|
||||
["express-underground-belt"]: "Express-transport-belt-to-ground",
|
||||
["splitter"]: "Basic-splitter",
|
||||
["inserter"]: "Inserter-icon",
|
||||
["stack-inserter"]: "Stack_inserter",
|
||||
["stack-filter-inserter"]: "Stack_filter_inserter",
|
||||
["efficiency-module"]: "Effectivity-module",
|
||||
["efficiency-module_2"]: "Effectivity-module-2",
|
||||
["efficiency-module_3"]: "Effectivity-module-3",
|
||||
["low-density-structure"]: "Rocket-structure",
|
||||
["electric-mining-drill"]: "Basic-mining-drill",
|
||||
["burner-mining-drill"]: "Burner-mining-drill",
|
||||
["active-provider-chest"]: "Logistic-chest-active-provider",
|
||||
["passive-provider-chest"]: "Logistic-chest-passive-provider",
|
||||
["storage-chest"]: "Logistic-chest-storage",
|
||||
["requester-chest"]: "Logistic-chest-requester",
|
||||
["wall"]: "Stone-wall",
|
||||
["medium-electric-pole"]: "Medium-electric-pole",
|
||||
["lamp"]: "Small-lamp",
|
||||
["regular-magazine"]: "Basic-bullet-magazine",
|
||||
["piercing-rounds_magazine"]: "Piercing-bullet-magazine",
|
||||
["flamethrower-ammo"]: "Flame-thrower-ammo",
|
||||
["cannon-shells"]: "Cannon-shell",
|
||||
["explosive-cannon-shells"]: "Explosive-cannon-shell",
|
||||
["land-mine"]: "Land-mine-research",
|
||||
["cluster-grenade"]: "Cluster_grenade",
|
||||
["shotgun-shells"]: "Shotgun-shell",
|
||||
["piercing-shotgun-shells"]: "Piercing-shotgun-shell",
|
||||
["accumulator"]: "Basic-accumulator",
|
||||
["beacon"]: "Basic-beacon",
|
||||
["rail"]: "Straight-rail",
|
||||
["piercing-rounds-magazine"]: "Piercing-bullet-magazine",
|
||||
["grenade"]: "Basic-grenade",
|
||||
["raw-fish"]: "Fish",
|
||||
["water-barrel"]: "Barrel-empty",
|
||||
["smart-train-stop"]: "Train-stop",
|
||||
["put-combinator"]: "Decider-combinator",
|
||||
}*/
|
||||
"put-combinator": "Decider_combinator",
|
||||
"smart-train-stop": "Train_stop",
|
||||
"raw-fish": "Fish",
|
||||
"solar-panel-equipment": "Portable_solar_panel",
|
||||
"diesel-locomotive": "Locomotive", // pre 0.15 loco name
|
||||
"small-lamp": "Lamp",
|
||||
|
||||
}
|
||||
|
||||
// value:link pairs where you can add modded item icons that are missing
|
||||
var imagelinks = {
|
||||
"fictional-modded-item": "/pictures/fictional-modded-item.png"
|
||||
"fictional-modded-item": "/pictures/fictional-modded-item.png",
|
||||
"raw-fish": "/pictures/Fish.png",
|
||||
"rail": "/pictures/rail.png",
|
||||
"effectivity-module-1": "/pictures/green_module_1.png",
|
||||
"effectivity-module-2": "/pictures/green_module_2.png",
|
||||
"effectivity-module-3": "/pictures/green_module_3.png",
|
||||
"piercing-shotgun-shell": "/pictures/piercing_shotgun_shells.png",
|
||||
"energy-shield-mk2-equipment": "/pictures/Energy_shield_MK2.png",
|
||||
"battery-mk2-equipment": "/pictures/Battery_MK2.png",
|
||||
"personal-roboport-mk2-equipment": "/pictures/Personal_roboport_MK2.png"
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
<!doctype HTML>
|
||||
<head>
|
||||
<%- include("head.html") %>
|
||||
<script src="https://code.jquery.com/jquery.js"></script>
|
||||
<script src="lib/terminal.js"></script>
|
||||
<script src="nodeDetails.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="nodeDetails.css">
|
||||
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
@@ -3,14 +3,7 @@ function drawcontents(data) {
|
||||
data = sortByKey(data, "count");
|
||||
let result = "<table>";
|
||||
for(i = 0;i < data.length; i++) {
|
||||
var img = "";
|
||||
if(imagedata[data[i].name]) {
|
||||
img = "https://wiki.factorio.com/images/" + imagedata[data[i].name] + ".png"
|
||||
} else if(imagelinks[data[i].name]) {
|
||||
img = imagelinks[data[i].name];
|
||||
} else {
|
||||
img = "https://wiki.factorio.com/images/" + capitalizeFirstLetter(data[i].name.replaceAll('-','_')) + ".png";
|
||||
}
|
||||
var img = getImageFromName(data[i].name);
|
||||
var searchField = document.querySelector("#search");
|
||||
if(!searchField.value || data[i].name.includes(searchField.value)) {
|
||||
result = result + "<tr><td><image src='" + img + "' onerror='hideThis(this);'></td><td>" + data[i].name + "</td><td>" + data[i].count + "</td></tr>";
|
||||
|
||||