Merge branch 'registrations-true' into 'main'
Remove DITTO_REGISTRATIONS config, make registrations always open See merge request soapbox-pub/ditto!119
This commit is contained in:
commit
ea05b07448
|
@ -126,10 +126,6 @@ const Conf = {
|
||||||
'system',
|
'system',
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
/** Whether registrations are open or closed. */
|
|
||||||
get registrations() {
|
|
||||||
return optionalBooleanSchema.parse(Deno.env.get('DITTO_REGISTRATIONS')) ?? false;
|
|
||||||
},
|
|
||||||
/** Proof-of-work configuration. */
|
/** Proof-of-work configuration. */
|
||||||
pow: {
|
pow: {
|
||||||
get registrations() {
|
get registrations() {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { NostrFilter } from '@soapbox/nspec';
|
import { NostrFilter } from '@soapbox/nspec';
|
||||||
import { type AppController } from '@/app.ts';
|
import { type AppController } from '@/app.ts';
|
||||||
import { Conf } from '@/config.ts';
|
import { Conf } from '@/config.ts';
|
||||||
import { insertUser } from '@/db/users.ts';
|
|
||||||
import { nip19, z } from '@/deps.ts';
|
import { nip19, z } from '@/deps.ts';
|
||||||
import { getAuthor, getFollowedPubkeys } from '@/queries.ts';
|
import { getAuthor, getFollowedPubkeys } from '@/queries.ts';
|
||||||
import { booleanParamSchema, fileSchema } from '@/schema.ts';
|
import { booleanParamSchema, fileSchema } from '@/schema.ts';
|
||||||
|
@ -28,10 +27,6 @@ const createAccountSchema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
const createAccountController: AppController = async (c) => {
|
const createAccountController: AppController = async (c) => {
|
||||||
if (!Conf.registrations) {
|
|
||||||
return c.json({ error: 'Registrations are disabled.' }, 403);
|
|
||||||
}
|
|
||||||
|
|
||||||
const pubkey = c.get('pubkey')!;
|
const pubkey = c.get('pubkey')!;
|
||||||
const result = createAccountSchema.safeParse(await c.req.json());
|
const result = createAccountSchema.safeParse(await c.req.json());
|
||||||
|
|
||||||
|
@ -39,12 +34,6 @@ const createAccountController: AppController = async (c) => {
|
||||||
return c.json({ error: 'Bad request', schema: result.error }, 400);
|
return c.json({ error: 'Bad request', schema: result.error }, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
await insertUser({
|
|
||||||
pubkey,
|
|
||||||
inserted_at: new Date(),
|
|
||||||
admin: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
return c.json({
|
return c.json({
|
||||||
access_token: nip19.npubEncode(pubkey),
|
access_token: nip19.npubEncode(pubkey),
|
||||||
token_type: 'Bearer',
|
token_type: 'Bearer',
|
||||||
|
|
|
@ -18,7 +18,7 @@ const instanceController: AppController = async (c) => {
|
||||||
title: meta.name ?? 'Ditto',
|
title: meta.name ?? 'Ditto',
|
||||||
description: meta.about ?? 'Nostr and the Fediverse',
|
description: meta.about ?? 'Nostr and the Fediverse',
|
||||||
short_description: meta.tagline ?? meta.about ?? 'Nostr and the Fediverse',
|
short_description: meta.tagline ?? meta.about ?? 'Nostr and the Fediverse',
|
||||||
registrations: Conf.registrations,
|
registrations: true,
|
||||||
max_toot_chars: Conf.postCharLimit,
|
max_toot_chars: Conf.postCharLimit,
|
||||||
configuration: {
|
configuration: {
|
||||||
media_attachments: {
|
media_attachments: {
|
||||||
|
|
|
@ -33,7 +33,7 @@ const nodeInfoSchemaController: AppController = (c) => {
|
||||||
inbound: [],
|
inbound: [],
|
||||||
outbound: [],
|
outbound: [],
|
||||||
},
|
},
|
||||||
openRegistrations: false,
|
openRegistrations: true,
|
||||||
usage: {
|
usage: {
|
||||||
users: {
|
users: {
|
||||||
total: 0,
|
total: 0,
|
||||||
|
|
Loading…
Reference in New Issue