Compare commits

...

2 commits

4 changed files with 19 additions and 4 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
data/
.fsdb
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 { 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

View file

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

View file

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