mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Add account.source.ditto.captch_solved field
This commit is contained in:
parent
3b5b4cbd6b
commit
1cd7c99bda
3 changed files with 23 additions and 4 deletions
|
|
@ -49,17 +49,26 @@ const verifyCredentialsController: AppController = async (c) => {
|
|||
const signer = c.get('signer')!;
|
||||
const pubkey = await signer.getPublicKey();
|
||||
|
||||
const eventsDB = await Storages.db();
|
||||
const store = await Storages.db();
|
||||
|
||||
const [author, [settingsStore]] = await Promise.all([
|
||||
const [author, [settingsStore], [captcha]] = await Promise.all([
|
||||
getAuthor(pubkey, { signal: AbortSignal.timeout(5000) }),
|
||||
|
||||
eventsDB.query([{
|
||||
authors: [pubkey],
|
||||
store.query([{
|
||||
kinds: [30078],
|
||||
authors: [pubkey],
|
||||
'#d': ['pub.ditto.pleroma_settings_store'],
|
||||
limit: 1,
|
||||
}]),
|
||||
|
||||
store.query([{
|
||||
kinds: [1985],
|
||||
authors: [Conf.pubkey],
|
||||
'#L': ['pub.ditto.captcha'],
|
||||
'#l': ['solved'],
|
||||
'#p': [pubkey],
|
||||
limit: 1,
|
||||
}]),
|
||||
]);
|
||||
|
||||
const account = author
|
||||
|
|
@ -74,6 +83,10 @@ const verifyCredentialsController: AppController = async (c) => {
|
|||
}
|
||||
}
|
||||
|
||||
if (captcha && account.source) {
|
||||
account.source.ditto.captcha_solved = true;
|
||||
}
|
||||
|
||||
return c.json(account);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ export interface MastodonAccount {
|
|||
nostr: {
|
||||
nip05?: string;
|
||||
};
|
||||
ditto: {
|
||||
captcha_solved: boolean;
|
||||
};
|
||||
};
|
||||
statuses_count: number;
|
||||
uri: string;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ async function renderAccount(
|
|||
nostr: {
|
||||
nip05,
|
||||
},
|
||||
ditto: {
|
||||
captcha_solved: false,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
statuses_count: event.author_stats?.notes_count ?? 0,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue