Add vscode dir to gitignore, fix light mode css, add SU default perms

This commit is contained in:
Tim Ristau 2025-10-25 20:48:33 -04:00
parent 9a8a1e034e
commit 7972efdbac
4 changed files with 19 additions and 4 deletions

View file

@ -10,6 +10,7 @@ import * as CANNED_RESPONSES from '../../../utils/canned_responses.ts';
import * as bcrypt from '@da/bcrypt';
import { INVITE_CODE, INVITE_CODES } from '../../../models/invites.ts';
// TODO: figure out a better solution for doling out permissions
const DEFAULT_USER_PERMISSIONS: string[] = [
'files.write.own',
@ -36,6 +37,14 @@ const DEFAULT_USER_PERMISSIONS: string[] = [
'watches.write.own'
];
// TODO: figure out a better solution for doling out permissions
const DEFAULT_SUPERUSER_PERMISSIONS: string[] = [
...DEFAULT_USER_PERMISSIONS,
'topics.create',
'topics.delete',
'topics.write',
];
export const PRECHECKS: PRECHECK_TABLE = {};
// GET /api/users - get users
@ -120,7 +129,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
const at_least_one_existing_user = (await USERS.all({
limit: 1,
offset: 0
})).shift()?.load();
})).shift();
let root_invite_code_secret = undefined;
if (!at_least_one_existing_user) {
@ -201,6 +210,10 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
}
};
if (!at_least_one_existing_user) {
user.permissions = DEFAULT_SUPERUSER_PERMISSIONS;
}
await USERS.create(user);
// automatically salted