diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-10-17 09:33:45 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-10-17 09:33:45 +0200 |
| commit | 38477bab6c1c736a2d1e7dd79b75c6e122502622 (patch) | |
| tree | 6ba730a50db5994d8ce5ed9d5a6547ba983b26e7 | |
| parent | 876e43accbf52d3a670e4dc8bb6806533f0b6268 (diff) | |
| download | bycs-sol-38477bab6c1c736a2d1e7dd79b75c6e122502622.tar.gz bycs-sol-38477bab6c1c736a2d1e7dd79b75c6e122502622.zip | |
database: add export method
| -rw-r--r-- | src/database-prod.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/database-prod.ts b/src/database-prod.ts index 7f50a35..d079e67 100644 --- a/src/database-prod.ts +++ b/src/database-prod.ts @@ -90,6 +90,25 @@ class DB { if (this.d === null) this.d = fetchDFromDatabaseActivity(this); return this.d; } + + async exportEntries() { + const d = await this.getD(); + let exportUrl = `${window.location.origin}/mod/data/export.php?d=${d}`; + const exportRes = await fetch(encodeURI(exportUrl)); + const exportDoc = new DOMParser().parseFromString(await exportRes.text(), "text/html"); + + const form = exportDoc.querySelector<HTMLFormElement>('div[role="main"] > form'); + + const formData = new FormData(form!); + formData.set("submitbutton", "Einträge exportieren"); + formData.set("exporttime", "1"); + formData.delete("includefiles"); + + return await fetch("/mod/data/export.php", { + method: "POST", + body: formData, + }); + } } const dRegex = /d=(\d+)/; |
