0
0
Fork 0

fix: separate whitelist and no new user

This commit is contained in:
아르페 2024-02-10 00:13:06 +09:00
parent 9f4b54f53b
commit 31ee293b7a
No known key found for this signature in database
GPG key ID: B1EFBBF5C93FF78F
5 changed files with 12 additions and 3 deletions

View file

@ -180,11 +180,16 @@ router.get('(.*)', async (ctx) => {
async function login(ctx: Context, user: Record<string, unknown>, host: string, token: string) {
const isNewcomer = !(await getUser(user.username as string, host));
if (isNewcomer && config.whitelist.enabled && !config.whitelist.instances.includes(host)) {
if (isNewcomer && config.noNewUserAllowed) {
await die(ctx, 'noNewUserAllowed', 403);
return;
}
if (config.whitelist.enabled && !config.whitelist.instances.includes(host)) {
await die(ctx, 'notWhitelisted', 403);
return;
}
await upsertUser(user.username as string, host, token);
const u = await getUser(user.username as string, host);