Feature+Security: DSGVO-Datenexport, auth-geschützte Media, Datenschutzerklärung v2 (SW by-v880)
This commit is contained in:
parent
465dc2e4d3
commit
bf1087c5e1
7 changed files with 264 additions and 27 deletions
|
|
@ -294,6 +294,15 @@ window.Page_settings = (() => {
|
|||
<svg class="ph-icon" aria-hidden="true"><use href="/icons/phosphor.svg#sign-out"></use></svg>
|
||||
Abmelden
|
||||
</button>
|
||||
<button id="settings-export-btn"
|
||||
style="width:100%;margin-top:var(--space-2);display:flex;align-items:center;justify-content:center;
|
||||
gap:var(--space-2);padding:var(--space-2) var(--space-4);
|
||||
border-radius:var(--radius-md);border:none;
|
||||
background:none;color:var(--c-text-secondary);
|
||||
font-size:var(--text-xs);cursor:pointer">
|
||||
<svg class="ph-icon" aria-hidden="true" style="width:12px;height:12px"><use href="/icons/phosphor.svg#download-simple"></use></svg>
|
||||
Meine Daten exportieren (DSGVO Art. 20)
|
||||
</button>
|
||||
<button id="settings-delete-account-btn"
|
||||
style="width:100%;margin-top:var(--space-2);display:flex;align-items:center;justify-content:center;
|
||||
gap:var(--space-2);padding:var(--space-2) var(--space-4);
|
||||
|
|
@ -892,6 +901,32 @@ window.Page_settings = (() => {
|
|||
_render();
|
||||
});
|
||||
|
||||
document.getElementById('settings-export-btn')?.addEventListener('click', async () => {
|
||||
const btn = document.getElementById('settings-export-btn');
|
||||
await UI.asyncButton(btn, async () => {
|
||||
try {
|
||||
const resp = await fetch('/api/profile/export', {
|
||||
credentials: 'include',
|
||||
headers: { 'Authorization': `Bearer ${localStorage.getItem('by_token') || ''}` },
|
||||
});
|
||||
if (!resp.ok) throw new Error('Export fehlgeschlagen.');
|
||||
const data = await resp.json();
|
||||
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `banyaro-export-${new Date().toISOString().slice(0,10)}.json`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
URL.revokeObjectURL(url);
|
||||
UI.toast.success('Export heruntergeladen.');
|
||||
} catch (err) {
|
||||
UI.toast.error(err.message || 'Fehler beim Export.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('settings-delete-account-btn')?.addEventListener('click', async () => {
|
||||
const ok = await UI.modal.confirm({
|
||||
title: 'Konto unwiderruflich löschen?',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue