Add account.source.ditto.captch_solved field

This commit is contained in:
Alex Gleason
2024-10-04 19:26:47 -05:00
parent 3b5b4cbd6b
commit 1cd7c99bda
3 changed files with 23 additions and 4 deletions

View File

@@ -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);
};