Make POW configurable, expose over the API
This commit is contained in:
parent
b725550fc4
commit
607ef4b980
|
@ -1,3 +1,4 @@
|
|||
import { Conf } from '@/config.ts';
|
||||
import '@/cron.ts';
|
||||
import {
|
||||
type Context,
|
||||
|
@ -103,7 +104,7 @@ app.post('/oauth/revoke', emptyObjectController);
|
|||
app.post('/oauth/authorize', oauthAuthorizeController);
|
||||
app.get('/oauth/authorize', oauthController);
|
||||
|
||||
app.post('/api/v1/acccounts', requireProof({ pow: 20 }), createAccountController);
|
||||
app.post('/api/v1/acccounts', requireProof({ pow: Conf.pow.registrations }), createAccountController);
|
||||
app.get('/api/v1/accounts/verify_credentials', requirePubkey, verifyCredentialsController);
|
||||
app.patch('/api/v1/accounts/update_credentials', requirePubkey, updateCredentialsController);
|
||||
app.get('/api/v1/accounts/search', accountSearchController);
|
||||
|
|
|
@ -126,6 +126,12 @@ const Conf = {
|
|||
'system',
|
||||
];
|
||||
},
|
||||
/** Proof-of-work configuration. */
|
||||
pow: {
|
||||
get registrations() {
|
||||
return Number(Deno.env.get('DITTO_POW_REGISTRATIONS') ?? 20);
|
||||
},
|
||||
},
|
||||
/** Domain of the Ditto server as a `URL` object, for easily grabbing the `hostname`, etc. */
|
||||
get url() {
|
||||
return new URL(Conf.localDomain);
|
||||
|
|
|
@ -53,6 +53,9 @@ const instanceController: AppController = (c) => {
|
|||
nostr: {
|
||||
pubkey: Conf.pubkey,
|
||||
relay: `${wsProtocol}//${host}/relay`,
|
||||
pow: {
|
||||
registrations: Conf.pow.registrations,
|
||||
},
|
||||
},
|
||||
rules: [],
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue