Merge branch 'no-pool-queries' into 'main'
No pool queries See merge request soapbox-pub/ditto!53
This commit is contained in:
commit
6c2c9541be
|
@ -3,7 +3,7 @@ import { Conf } from '@/config.ts';
|
||||||
import { insertUser } from '@/db/users.ts';
|
import { insertUser } from '@/db/users.ts';
|
||||||
import { type Filter, findReplyTag, nip19, z } from '@/deps.ts';
|
import { type Filter, findReplyTag, nip19, z } from '@/deps.ts';
|
||||||
import * as mixer from '@/mixer.ts';
|
import * as mixer from '@/mixer.ts';
|
||||||
import { getAuthor, getFollowedPubkeys, getFollows, syncUser } from '@/queries.ts';
|
import { getAuthor, getFollowedPubkeys, getFollows } from '@/queries.ts';
|
||||||
import { booleanParamSchema, fileSchema } from '@/schema.ts';
|
import { booleanParamSchema, fileSchema } from '@/schema.ts';
|
||||||
import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
|
import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
|
||||||
import { uploadFile } from '@/upload.ts';
|
import { uploadFile } from '@/upload.ts';
|
||||||
|
@ -58,8 +58,6 @@ const createAccountController: AppController = async (c) => {
|
||||||
const verifyCredentialsController: AppController = async (c) => {
|
const verifyCredentialsController: AppController = async (c) => {
|
||||||
const pubkey = c.get('pubkey')!;
|
const pubkey = c.get('pubkey')!;
|
||||||
|
|
||||||
await syncUser(pubkey);
|
|
||||||
|
|
||||||
const event = await getAuthor(pubkey);
|
const event = await getAuthor(pubkey);
|
||||||
if (event) {
|
if (event) {
|
||||||
return c.json(await renderAccount(event, { withSource: true }));
|
return c.json(await renderAccount(event, { withSource: true }));
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { type Event, matchFilters } from '@/deps.ts';
|
import { type Event, matchFilters } from '@/deps.ts';
|
||||||
|
|
||||||
import * as client from '@/client.ts';
|
|
||||||
import * as eventsDB from '@/db/events.ts';
|
import * as eventsDB from '@/db/events.ts';
|
||||||
import { dedupeEvents, eventDateComparator } from '@/utils.ts';
|
import { dedupeEvents, eventDateComparator } from '@/utils.ts';
|
||||||
|
|
||||||
|
@ -14,7 +13,6 @@ async function getFilters<K extends number>(
|
||||||
if (!filters.length) return Promise.resolve([]);
|
if (!filters.length) return Promise.resolve([]);
|
||||||
|
|
||||||
const results = await Promise.allSettled([
|
const results = await Promise.allSettled([
|
||||||
client.getFilters(filters.filter((filter) => !filter.local), opts),
|
|
||||||
eventsDB.getFilters(filters, opts),
|
eventsDB.getFilters(filters, opts),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import * as client from '@/client.ts';
|
|
||||||
import * as eventsDB from '@/db/events.ts';
|
import * as eventsDB from '@/db/events.ts';
|
||||||
import { type Event, type Filter, findReplyTag } from '@/deps.ts';
|
import { type Event, type Filter, findReplyTag } from '@/deps.ts';
|
||||||
import * as mixer from '@/mixer.ts';
|
import * as mixer from '@/mixer.ts';
|
||||||
|
@ -80,13 +79,6 @@ async function isLocallyFollowed(pubkey: string): Promise<boolean> {
|
||||||
return Boolean(event);
|
return Boolean(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sync the user's state from other relays. */
|
|
||||||
async function syncUser(pubkey: string): Promise<void> {
|
|
||||||
await client.getFilters([
|
|
||||||
{ authors: [pubkey], kinds: [0, 3, 10000, 10001, 10002] },
|
|
||||||
], { timeout: 5000 });
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getAncestors,
|
getAncestors,
|
||||||
getAuthor,
|
getAuthor,
|
||||||
|
@ -96,5 +88,4 @@ export {
|
||||||
getFollowedPubkeys,
|
getFollowedPubkeys,
|
||||||
getFollows,
|
getFollows,
|
||||||
isLocallyFollowed,
|
isLocallyFollowed,
|
||||||
syncUser,
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue