Admin: Gmail and Discord-bot settings for password reset, setup warning on open; export notes admin guard

This commit is contained in:
Jonathan Sykes
2026-10-15 19:02:53 +08:00
parent 69704d3e1a
commit 63cea89b68
5 changed files with 232 additions and 7 deletions

View File

@@ -1887,7 +1887,10 @@ app.get('/api/profile/info', async (c) => {
200, { 'Cache-Control': 'no-store' });
});
const profileRecovery = registerProfileRecoveryRoutes(app, { db: notesDb.db, getProfile, setProfileSecret, profileGate });
// adminAuth is wired in once notes.js is registered (further down).
const recoveryAdmin = { auth: null };
const profileRecovery = registerProfileRecoveryRoutes(app, { db: notesDb.db, getProfile, setProfileSecret, profileGate,
adminAuth: (c, next) => (recoveryAdmin.auth ? recoveryAdmin.auth(c, next) : c.json({ ok: false, error: 'admin unavailable' }, 503)) });
// POST /api/profile/secret
// Body: { name, current?, secret: <new password/key> | null, kind: 'password'|'key' }
@@ -2364,6 +2367,7 @@ const notes = registerNoteRoutes(app, {
{ label: 'Database', path: dirname(process.env.DB_PATH || './data/ytplayer.db') },
] },
});
recoveryAdmin.auth = notes.requireAdmin;
const deepSearch = registerDeepSearchRoutes(app, { db: notesDb.db, adminAuth: notes.requireAdminOrToken, autoStart: false,
searchDeep: innertube.searchDeep, related: innertube.related, browseUploads: innertube.browseUploads,
ingest: collectVideoMetadata, putSearch: searchCacheDb.put });