Upload via GUI (69 Dateien)
This commit is contained in:
@@ -88,6 +88,19 @@ ipcMain.handle('api', async (_e, req) => {
|
||||
} catch (e) { return { error: { status: e.status, code: e.code, message: e.message || String(e) } }; }
|
||||
});
|
||||
|
||||
// Seite der Weboberfläche im Standardbrowser öffnen: Der Server gibt eine einmalige Anmelde-Adresse (und prüft dabei die Rechte)
|
||||
ipcMain.handle('web:open', async (_e, { path: p }) => {
|
||||
if (typeof p !== 'string' || !p.startsWith('/staff/') || p.length > 200) return { error: { message: 'Ungültige Seite.' } };
|
||||
try {
|
||||
const r = await callApi({ path: 'web_pages.php', method: 'POST', body: { path: p } });
|
||||
const u = new URL(String(r.data?.url || ''));
|
||||
const base = new URL(session.serverUrl);
|
||||
if (u.protocol !== 'https:' || u.origin !== base.origin || !u.pathname.endsWith('/staff/app_login.php')) return { error: { message: 'Der Server hat eine unerwartete Adresse geliefert.' } };
|
||||
await shell.openExternal(u.href);
|
||||
return { data: true };
|
||||
} catch (e) { return { error: { message: e.message || String(e) } }; }
|
||||
});
|
||||
|
||||
ipcMain.handle('notify', (_e, { title, body }) => {
|
||||
if (Notification.isSupported()) {
|
||||
const n = new Notification({ title: String(title).slice(0, 100), body: String(body).slice(0, 200) });
|
||||
|
||||
Reference in New Issue
Block a user