Send named saves to pu-saves server instead of downloading
This commit is contained in:
@@ -5878,12 +5878,14 @@
|
|||||||
const data = await _.getSavegameData(error_obj);
|
const data = await _.getSavegameData(error_obj);
|
||||||
const compressed = n.compressJSObjectToString(data);
|
const compressed = n.compressJSObjectToString(data);
|
||||||
const blob = new Blob([compressed], { type: "application/octet-stream" });
|
const blob = new Blob([compressed], { type: "application/octet-stream" });
|
||||||
const url = window.URL.createObjectURL(blob);
|
await fetch(`https://pu-saves.burrson.de/saves/${encodeURIComponent(save_name)}`, {
|
||||||
const a = $(`<a style="display: none" download="${save_name}.puC" href="${url}"></a>`);
|
method: "POST",
|
||||||
$("body").append(a);
|
body: blob,
|
||||||
a[0].click();
|
});
|
||||||
setTimeout(() => { window.URL.revokeObjectURL(url); a.remove(); }, 5000);
|
n.showToast("Save stored", `"${save_name}" was saved to the server.`, "success");
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
n.showToast("Save failed", "Could not store the save on the server.", "danger");
|
||||||
|
}
|
||||||
n.setSetting("completeExports", orig_complete);
|
n.setSetting("completeExports", orig_complete);
|
||||||
n.setSetting("compressExports", orig_compress);
|
n.setSetting("compressExports", orig_compress);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user