From d4c94ba549df8c7ec771af1f5f36694de9b856fc Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 29 Mar 2024 11:51:32 -0500 Subject: [PATCH] Remove DITTO_ENV config, make registrations always open --- src/config.ts | 4 ---- src/controllers/api/accounts.ts | 11 ----------- src/controllers/api/instance.ts | 2 +- src/controllers/well-known/nodeinfo.ts | 2 +- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/config.ts b/src/config.ts index cdd07ba..e43dab1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -126,10 +126,6 @@ const Conf = { 'system', ]; }, - /** Whether registrations are open or closed. */ - get registrations() { - return optionalBooleanSchema.parse(Deno.env.get('DITTO_REGISTRATIONS')) ?? false; - }, /** Proof-of-work configuration. */ pow: { get registrations() { diff --git a/src/controllers/api/accounts.ts b/src/controllers/api/accounts.ts index efe5050..92e2045 100644 --- a/src/controllers/api/accounts.ts +++ b/src/controllers/api/accounts.ts @@ -1,7 +1,6 @@ import { NostrFilter } from '@soapbox/nspec'; import { type AppController } from '@/app.ts'; import { Conf } from '@/config.ts'; -import { insertUser } from '@/db/users.ts'; import { nip19, z } from '@/deps.ts'; import { getAuthor, getFollowedPubkeys } from '@/queries.ts'; import { booleanParamSchema, fileSchema } from '@/schema.ts'; @@ -28,10 +27,6 @@ const createAccountSchema = z.object({ }); const createAccountController: AppController = async (c) => { - if (!Conf.registrations) { - return c.json({ error: 'Registrations are disabled.' }, 403); - } - const pubkey = c.get('pubkey')!; 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); } - await insertUser({ - pubkey, - inserted_at: new Date(), - admin: false, - }); - return c.json({ access_token: nip19.npubEncode(pubkey), token_type: 'Bearer', diff --git a/src/controllers/api/instance.ts b/src/controllers/api/instance.ts index b4035bb..15a99c3 100644 --- a/src/controllers/api/instance.ts +++ b/src/controllers/api/instance.ts @@ -18,7 +18,7 @@ const instanceController: AppController = async (c) => { title: meta.name ?? 'Ditto', description: 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, configuration: { media_attachments: { diff --git a/src/controllers/well-known/nodeinfo.ts b/src/controllers/well-known/nodeinfo.ts index 47bf6d8..4f03f42 100644 --- a/src/controllers/well-known/nodeinfo.ts +++ b/src/controllers/well-known/nodeinfo.ts @@ -33,7 +33,7 @@ const nodeInfoSchemaController: AppController = (c) => { inbound: [], outbound: [], }, - openRegistrations: false, + openRegistrations: true, usage: { users: { total: 0,