- Timestamp:
- 06/23/2026 06:14:27 PM (3 months ago)
- Branches:
- main
- Children:
- d774679
- Parents:
- bb42dfb
- Location:
- scripts
- Files:
-
- 2 edited
-
backfill-durations.mjs (modified) (2 diffs)
-
reset-admin.mjs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
scripts/backfill-durations.mjs
rbb42dfb r834bcc3 1 1 #!/usr/bin/env node 2 2 /** 3 * Backfill audio_tracks.duration voor bestaande tracks die nog géén duur hebben.4 * Leest de duur uit het mp3-bestand via ffmpeg (probeDuration — geen aparte5 * ffprobe -binary nodig). Idempotent: pakt alleen rijen met duration NULL of0,6 * dus veilig herhaalbaar.3 * Backfill audio_tracks.duration for existing tracks that have no duration yet. 4 * Reads the duration from the mp3 file via ffmpeg (probeDuration — no separate 5 * ffprobe binary required). Idempotent: only touches rows with duration NULL or 0, 6 * so it is safe to run repeatedly. 7 7 * 8 8 * npm run backfill:durations 9 9 * 10 * Respect eert AUDIO_PATH (env) net als de upload-route.10 * Respects AUDIO_PATH (env) just like the upload route. 11 11 */ 12 12 import path from 'path'; … … 21 21 ); 22 22 23 // storage_path is absolu ut (opgeslagen bij upload); val terug opAUDIO_DIR/filename.23 // storage_path is absolute (stored at upload time); fall back to AUDIO_DIR/filename. 24 24 function resolveFile(t) { 25 25 const candidates = [t.storage_path, t.filename ? path.join(AUDIO_DIR, t.filename) : null].filter(Boolean); 26 26 for (const c of candidates) { 27 try { if (fs.statSync(c).isFile()) return c; } catch { /* volgende kandidaat*/ }27 try { if (fs.statSync(c).isFile()) return c; } catch { /* try next candidate */ } 28 28 } 29 29 return null; -
scripts/reset-admin.mjs
rbb42dfb r834bcc3 1 1 #!/usr/bin/env node 2 // Break-glass: reset (o f zet) het wachtwoord van een beheerder. Werkt altijd,3 // zonder e-mail — de self-hoster heeft immers shell-/servertoegang.2 // Break-glass: reset (or set) the password of an admin account. Always works, 3 // no email required — the self-hoster has shell/server access. 4 4 // 5 // Gebruik:6 // npm run reset-admin # reset de (eerste) god-user, print nieuw wachtwoord7 // npm run reset-admin -- <user|email> # reset specifieke user, print nieuw wachtwoord8 // npm run reset-admin -- <user|email> <pw> # zet een gekozen wachtwoord5 // Usage: 6 // npm run reset-admin # reset the (first) god user, print new password 7 // npm run reset-admin -- <user|email> # reset a specific user, print new password 8 // npm run reset-admin -- <user|email> <pw> # set a chosen password 9 9 // 10 // Draai dit vanuit de projectroot zodat DATABASE_PATH/.env correct geladen wordt.10 // Run from the project root so DATABASE_PATH/.env is loaded correctly. 11 11 12 12 import 'dotenv/config'; … … 22 22 user = db.prepare('SELECT * FROM users WHERE username = ? OR LOWER(email) = LOWER(?)').get(arg, arg); 23 23 } else { 24 // Geen arg: pak de beheerder (god of admin), anders de allereersteuser.24 // No arg: pick the admin (god or admin role), otherwise the very first user. 25 25 user = 26 26 db.prepare("SELECT * FROM users WHERE role IN ('god','admin') ORDER BY created_at LIMIT 1").get() ||
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)