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 signer = c.get('signer')!;
|
||||||
const pubkey = await signer.getPublicKey();
|
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) }),
|
getAuthor(pubkey, { signal: AbortSignal.timeout(5000) }),
|
||||||
|
|
||||||
eventsDB.query([{
|
store.query([{
|
||||||
authors: [pubkey],
|
|
||||||
kinds: [30078],
|
kinds: [30078],
|
||||||
|
authors: [pubkey],
|
||||||
'#d': ['pub.ditto.pleroma_settings_store'],
|
'#d': ['pub.ditto.pleroma_settings_store'],
|
||||||
limit: 1,
|
limit: 1,
|
||||||
}]),
|
}]),
|
||||||
|
|
||||||
|
store.query([{
|
||||||
|
kinds: [1985],
|
||||||
|
authors: [Conf.pubkey],
|
||||||
|
'#L': ['pub.ditto.captcha'],
|
||||||
|
'#l': ['solved'],
|
||||||
|
'#p': [pubkey],
|
||||||
|
limit: 1,
|
||||||
|
}]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const account = author
|
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);
|
return c.json(account);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ export interface MastodonAccount {
|
||||||
nostr: {
|
nostr: {
|
||||||
nip05?: string;
|
nip05?: string;
|
||||||
};
|
};
|
||||||
|
ditto: {
|
||||||
|
captcha_solved: boolean;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
statuses_count: number;
|
statuses_count: number;
|
||||||
uri: string;
|
uri: string;
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,9 @@ async function renderAccount(
|
||||||
nostr: {
|
nostr: {
|
||||||
nip05,
|
nip05,
|
||||||
},
|
},
|
||||||
|
ditto: {
|
||||||
|
captcha_solved: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
statuses_count: event.author_stats?.notes_count ?? 0,
|
statuses_count: event.author_stats?.notes_count ?? 0,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue