mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-13 10:11:50 +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");
|
||||
}
|
||||
if (G_IS_DEV && globalConfig.debug.externalModUrl) {
|
||||
const response = await fetch(globalConfig.debug.externalModUrl, {
|
||||
method: "GET",
|
||||
});
|
||||
if (response.status !== 200) {
|
||||
throw new Error(
|
||||
"Failed to load " +
|
||||
globalConfig.debug.externalModUrl +
|
||||
": " +
|
||||
response.status +
|
||||
" " +
|
||||
response.statusText
|
||||
);
|
||||
let modURLs = Array.isArray(globalConfig.debug.externalModUrl) ?
|
||||
globalConfig.debug.externalModUrl : [globalConfig.debug.externalModUrl];
|
||||
|
||||
for(let i = 0; i < modURLs.length; i++) {
|
||||
const response = await fetch(modURLs[i], {
|
||||
method: "GET",
|
||||
});
|
||||
if (response.status !== 200) {
|
||||
throw new Error(
|
||||
"Failed to load " +
|
||||
modURLs[i] +
|
||||
": " +
|
||||
response.status +
|
||||
" " +
|
||||
response.statusText
|
||||
);
|
||||
}
|
||||
mods.push(await response.text());
|
||||
}
|
||||
|
||||
mods.push(await response.text());
|
||||
}
|
||||
|
||||
window.$shapez_registerMod = (modClass, meta) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user