feat: reorganize settings and add synced appearance preferences

This commit is contained in:
NoSetViolin committed 2026-10-12 18:26:53 +09:00
1 parent 28c128d0c9
commit 8d750d19b0
30 files changed
+835 -98

No files matched your search

+8
View File
@@ -22,6 +22,8 @@ export interface UserRow {
}
export interface UserStore {
getAccentColor(userId: string): string;
setAccentColor(userId: string, color: string): boolean;
countUsers(): number;
countAdmins(): number;
createUser(username: string, password: string, role: UserRole): Promise<UserRow>;
@@ -68,6 +70,12 @@ export function createUserStore(db: Database.Database): UserStore {
const deleteUserStmt = db.prepare("DELETE FROM users WHERE id = ?");
return {
getAccentColor(userId) {
return (db.prepare("SELECT accentColor FROM users WHERE id = ?").get(userId) as { accentColor: string } | undefined)?.accentColor ?? "#335eea";
},
setAccentColor(userId, color) {
return db.prepare("UPDATE users SET accentColor = ?, updatedAt = ? WHERE id = ? AND role != 'guest'").run(color, Date.now(), userId).changes > 0;
},
countUsers() {
return (countStmt.get() as { n: number }).n;
},