Add explicit cors mode to all pu-saves fetch calls

This commit is contained in:
Johannes
2026-03-13 00:08:22 +01:00
parent d3ad761c0b
commit 5ad44a216a

View File

@@ -5881,6 +5881,7 @@
const blob = new Blob([compressed], { type: "application/octet-stream" }); const blob = new Blob([compressed], { type: "application/octet-stream" });
await fetch(`https://pu-saves.burrson.de/saves/${encodeURIComponent(save_name)}`, { await fetch(`https://pu-saves.burrson.de/saves/${encodeURIComponent(save_name)}`, {
method: "POST", method: "POST",
mode: "cors",
body: blob, body: blob,
}); });
n.showToast("Save stored", `"${save_name}" was saved to the server.`, "success"); n.showToast("Save stored", `"${save_name}" was saved to the server.`, "success");
@@ -5892,7 +5893,7 @@
} }
static async populateServerSaves() { static async populateServerSaves() {
try { try {
const res = await fetch("https://pu-saves.burrson.de/saves"); const res = await fetch("https://pu-saves.burrson.de/saves", { mode: "cors" });
const saves = await res.json(); const saves = await res.json();
const select = $("#server-saves-select"); const select = $("#server-saves-select");
if (!select.length) return; if (!select.length) return;
@@ -5910,7 +5911,7 @@
const save_name = $("#server-saves-select").val(); const save_name = $("#server-saves-select").val();
if (!save_name) return; if (!save_name) return;
try { try {
const res = await fetch(`https://pu-saves.burrson.de/saves/${encodeURIComponent(save_name)}`); const res = await fetch(`https://pu-saves.burrson.de/saves/${encodeURIComponent(save_name)}`, { mode: "cors" });
if (!res.ok) throw "Not found"; if (!res.ok) throw "Not found";
const text = await res.text(); const text = await res.text();
if (n.hasScript(text)) throw "Script found!"; if (n.hasScript(text)) throw "Script found!";