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

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
data/ data/
.fsdb .fsdb
public/files/* public/files/*
.vscode/*

View file

@ -10,6 +10,7 @@ import * as CANNED_RESPONSES from '../../../utils/canned_responses.ts';
import * as bcrypt from '@da/bcrypt'; import * as bcrypt from '@da/bcrypt';
import { INVITE_CODE, INVITE_CODES } from '../../../models/invites.ts'; import { INVITE_CODE, INVITE_CODES } from '../../../models/invites.ts';
// TODO: figure out a better solution for doling out permissions // TODO: figure out a better solution for doling out permissions
const DEFAULT_USER_PERMISSIONS: string[] = [ const DEFAULT_USER_PERMISSIONS: string[] = [
'files.write.own', 'files.write.own',
@ -36,6 +37,14 @@ const DEFAULT_USER_PERMISSIONS: string[] = [
'watches.write.own' '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 = {}; export const PRECHECKS: PRECHECK_TABLE = {};
// GET /api/users - get users // 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({ const at_least_one_existing_user = (await USERS.all({
limit: 1, limit: 1,
offset: 0 offset: 0
})).shift()?.load(); })).shift();
let root_invite_code_secret = undefined; let root_invite_code_secret = undefined;
if (!at_least_one_existing_user) { 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); await USERS.create(user);
// automatically salted // automatically salted

View file

@ -16,7 +16,7 @@
--border-highlight: hsl(from var(--base-color) h 50% 75%); --border-highlight: hsl(from var(--base-color) h 50% 75%);
--icon-scale: 1; --icon-scale: 1;
--border-radius: 4px; --border-radius: 12px;
} }
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {

View file

@ -35,9 +35,11 @@
width: 95%; width: 95%;
min-height: 24rem; min-height: 24rem;
position: relative; position: relative;
background: hsl(from var(--bg) h s 15); background: hsl(from var(--bg) h s calc(l/1.1));
max-width: 40em; max-width: 40em;
margin: 0 auto; margin: 0 auto;
border-radius: var(--border-radius);
overflow: hidden;
} }
#signup-login-wall form { #signup-login-wall form {
@ -138,7 +140,6 @@
id="signup-invite-code" id="signup-invite-code"
type="text" type="text"
name="invite_code" name="invite_code"
required
/> />
<label class="placeholder" for="signup-invite-code">invite code</label> <label class="placeholder" for="signup-invite-code">invite code</label>
</div> </div>