mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-22 10:46:19 +01:00
web/ManageSettings: use downloadFile
for exporting settings
and also use 4 spaces for formatting the json file cuz 2 spaces is foul
This commit is contained in:
parent
b036437871
commit
277a6caefa
1 changed files with 9 additions and 15 deletions
|
@ -1,12 +1,9 @@
|
|||
<script lang="ts">
|
||||
import { t } from "$lib/i18n/translations";
|
||||
import { downloadFile } from "$lib/download";
|
||||
import { createDialog } from "$lib/state/dialogs";
|
||||
import {
|
||||
storedSettings,
|
||||
updateSetting,
|
||||
loadFromString,
|
||||
} from "$lib/state/settings";
|
||||
import { validateSettings } from "$lib/settings/validate";
|
||||
import { storedSettings, updateSetting, loadFromString } from "$lib/state/settings";
|
||||
|
||||
import ActionButton from "$components/buttons/ActionButton.svelte";
|
||||
import ResetSettingsButton from "$components/settings/ResetSettingsButton.svelte";
|
||||
|
@ -87,16 +84,13 @@
|
|||
pseudoinput.click();
|
||||
};
|
||||
|
||||
const exportSettings = () => {
|
||||
const blob = new Blob(
|
||||
[JSON.stringify($storedSettings, null, 2)],
|
||||
{ type: "application/json" }
|
||||
);
|
||||
|
||||
const pseudolink = document.createElement("a");
|
||||
pseudolink.href = URL.createObjectURL(blob);
|
||||
pseudolink.download = "settings.json";
|
||||
pseudolink.click();
|
||||
const exportSettings = async () => {
|
||||
return await downloadFile({
|
||||
file: new File(
|
||||
[JSON.stringify($storedSettings, null, 4)],
|
||||
"settings.json", { type: "application/json" }
|
||||
),
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue