Merge branch ditto:main into main

This commit is contained in:
P. Reis 2024-03-29 17:45:03 +00:00
commit c0858e184f
4 changed files with 2 additions and 17 deletions

View File

@ -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() {

View File

@ -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',

View File

@ -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: {

View File

@ -33,7 +33,7 @@ const nodeInfoSchemaController: AppController = (c) => {
inbound: [], inbound: [],
outbound: [], outbound: [],
}, },
openRegistrations: false, openRegistrations: true,
usage: { usage: {
users: { users: {
total: 0, total: 0,