Repository Public
1// Set (or reset) the owner password. Reads it from the SPTV_PASSWORD variable or generates one and prints it once.2// tsx scripts/set-password.ts → generates a password3// SPTV_PASSWORD='…' tsx scripts/set-password.ts4import crypto from "node:crypto";5import { closeDb, run } from "@/server/db";6import { setPassword } from "@/server/auth";78const given = process.env.SPTV_PASSWORD;9const pw = given || crypto.randomBytes(18).toString("base64url");10setPassword(pw);11run("DELETE FROM sessions"); run("DELETE FROM login_attempts");12console.log(given ? "Mot de passe mis à jour ; toutes les sessions ont été fermées." : `Nouveau mot de passe : ${pw}\nToutes les sessions ont été fermées.`);13closeDb();14