Add master server Web Root config

Add web_root option to the master server and use it create URLs for
resources hosted by it.  This permits hosting the master server web
interface behind reverse proxy under a dedicated path.
This commit is contained in:
Hornwitser committed 2020-04-04 10:05:37 +02:00
1 parent 5e9d9097e1
commit 8ebf0fc754
9 files changed
+27 -15

No files matched your search

+2 -2
View File
@@ -198,7 +198,7 @@ function getImageFromName(name){
return "https://wiki.factorio.com/images/" + capitalizeFirstLetter(replaceAll(factorioLocale["fluid-name"][name], ' ', '_').toLowerCase()) + ".png";
} else if(factorioLocale["equipment-name"] && factorioLocale["equipment-name"][name]){
return "https://wiki.factorio.com/images/" + capitalizeFirstLetter(replaceAll(factorioLocale["equipment-name"][name], ' ', '_').toLowerCase()) + ".png";
} else return "/pictures/unknown-item.png";
} else return `${root}pictures/unknown-item.png`;
}
window.factorioLocale = {};
$.getJSON("/api/getFactorioLocale", (locale) => {
@@ -252,6 +252,6 @@ var imagelinks = {
"battery-mk2-equipment": "/pictures/Battery_MK2.png",
"personal-roboport-mk2-equipment": "/pictures/Personal_roboport_MK2.png",
}
var populateImageLinks = async () => (await getJSON("/api/getPictures")).forEach(img => imagelinks[img.name] = img.path)
var populateImageLinks = async () => (await getJSON(`${root}api/getPictures`)).forEach(img => imagelinks[img.name] = img.path)
populateImageLinks()