Admin: Gmail and Discord-bot settings for password reset, setup warning on open; export notes admin guard
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user