mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-02-11 10:29:19 +00:00
Allow external URL to load more than one mod (#1337)
* Allow external URL to load more than one mod Instead of loading the text returned from the remote server, load a JSON object with a `mods` field, containing strings of all the mods. This lets us work on more than one mod at a time or without separate repos. This will break tooling such as `create-shapezio-mod` though. * Update modloader.js
This commit is contained in:
parent
6a57448fab
commit
30beb7df5f
@ -103,21 +103,25 @@ export class ModLoader {
|
|||||||
mods = await ipcRenderer.invoke("get-mods");
|
mods = await ipcRenderer.invoke("get-mods");
|
||||||
}
|
}
|
||||||
if (G_IS_DEV && globalConfig.debug.externalModUrl) {
|
if (G_IS_DEV && globalConfig.debug.externalModUrl) {
|
||||||
const response = await fetch(globalConfig.debug.externalModUrl, {
|
let modURLs = Array.isArray(globalConfig.debug.externalModUrl) ?
|
||||||
method: "GET",
|
globalConfig.debug.externalModUrl : [globalConfig.debug.externalModUrl];
|
||||||
});
|
|
||||||
if (response.status !== 200) {
|
for(let i = 0; i < modURLs.length; i++) {
|
||||||
throw new Error(
|
const response = await fetch(modURLs[i], {
|
||||||
"Failed to load " +
|
method: "GET",
|
||||||
globalConfig.debug.externalModUrl +
|
});
|
||||||
": " +
|
if (response.status !== 200) {
|
||||||
response.status +
|
throw new Error(
|
||||||
" " +
|
"Failed to load " +
|
||||||
response.statusText
|
modURLs[i] +
|
||||||
);
|
": " +
|
||||||
|
response.status +
|
||||||
|
" " +
|
||||||
|
response.statusText
|
||||||
|
);
|
||||||
|
}
|
||||||
|
mods.push(await response.text());
|
||||||
}
|
}
|
||||||
|
|
||||||
mods.push(await response.text());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.$shapez_registerMod = (modClass, meta) => {
|
window.$shapez_registerMod = (modClass, meta) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user