From f85a8b99a35a8fb45764f0d6694ea9e52e93114f Mon Sep 17 00:00:00 2001 From: mleku Date: Thu, 9 Oct 2025 14:30:32 +0100 Subject: [PATCH] Update export functionality in App.svelte to allow both admin and owner roles to export all events. Adjust permission checks and UI components to reflect new role-based access for exporting events, enhancing user experience and security. --- app/web/src/App.svelte | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/web/src/App.svelte b/app/web/src/App.svelte index c40da13..17a00a9 100644 --- a/app/web/src/App.svelte +++ b/app/web/src/App.svelte @@ -231,14 +231,14 @@ // Export functionality async function exportAllEvents() { - if (!isLoggedIn || userRole !== 'owner') { - alert('Owner permission required'); + if (!isLoggedIn || (userRole !== 'admin' && userRole !== 'owner')) { + alert('Admin or owner permission required'); return; } try { - const authHeader = await createNIP98AuthHeader('/export', 'GET'); - const response = await fetch('/export', { + const authHeader = await createNIP98AuthHeader('/api/export', 'GET'); + const response = await fetch('/api/export', { method: 'GET', headers: { 'Authorization': authHeader @@ -515,15 +515,7 @@ {#if selectedTab === 'export'}

Export Events

- {#if isLoggedIn && userRole === 'owner'} -
-

Export All Events

-

Download the complete database as a JSONL file. This includes all events from all users.

- -
- {:else if isLoggedIn} + {#if isLoggedIn}

Export My Events

Download your personal events as a JSONL file.

@@ -531,6 +523,15 @@ 📤 Export My Events
+ {#if userRole === 'admin' || userRole === 'owner'} +
+

Export All Events

+

Download the complete database as a JSONL file. This includes all events from all users.

+ +
+ {/if} {:else}