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