Merge remote-tracking branch 'origin/main' into recompute
This commit is contained in:
commit
374dc3495c
|
@ -1,7 +1,7 @@
|
||||||
import { JsonParseStream } from '@std/json/json-parse-stream';
|
import { JsonParseStream } from '@std/json/json-parse-stream';
|
||||||
import { TextLineStream } from '@std/streams/text-line-stream';
|
import { TextLineStream } from '@std/streams/text-line-stream';
|
||||||
|
|
||||||
import { db } from '@/db.ts';
|
import { DittoDB } from '@/db/DittoDB.ts';
|
||||||
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||||
import { EventsDB } from '@/storages/events-db.ts';
|
import { EventsDB } from '@/storages/events-db.ts';
|
||||||
import { type EventStub } from '@/utils/api.ts';
|
import { type EventStub } from '@/utils/api.ts';
|
||||||
|
@ -9,7 +9,8 @@ import { nostrNow } from '@/utils.ts';
|
||||||
|
|
||||||
const signer = new AdminSigner();
|
const signer = new AdminSigner();
|
||||||
|
|
||||||
const eventsDB = new EventsDB(db);
|
const kysely = await DittoDB.getInstance();
|
||||||
|
const eventsDB = new EventsDB(kysely);
|
||||||
|
|
||||||
const readable = Deno.stdin.readable
|
const readable = Deno.stdin.readable
|
||||||
.pipeThrough(new TextDecoderStream())
|
.pipeThrough(new TextDecoderStream())
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import { NSchema } from '@nostrify/nostrify';
|
import { NSchema } from '@nostrify/nostrify';
|
||||||
|
|
||||||
import { db } from '@/db.ts';
|
import { DittoDB } from '@/db/DittoDB.ts';
|
||||||
import { Conf } from '@/config.ts';
|
import { Conf } from '@/config.ts';
|
||||||
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||||
import { EventsDB } from '@/storages/events-db.ts';
|
import { EventsDB } from '@/storages/events-db.ts';
|
||||||
import { nostrNow } from '@/utils.ts';
|
import { nostrNow } from '@/utils.ts';
|
||||||
|
|
||||||
const eventsDB = new EventsDB(db);
|
const kysely = await DittoDB.getInstance();
|
||||||
|
const eventsDB = new EventsDB(kysely);
|
||||||
|
|
||||||
const [pubkey, role] = Deno.args;
|
const [pubkey, role] = Deno.args;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { NostrEvent, NostrFilter, NSchema as n } from '@nostrify/nostrify';
|
import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
|
||||||
import ISO6391 from 'iso-639-1';
|
import ISO6391 from 'iso-639-1';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
|
|
@ -68,15 +68,16 @@ const streamingController: AppController = (c) => {
|
||||||
if (!filter) return;
|
if (!filter) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const store = await Storages.pubsub();
|
const pubsub = await Storages.pubsub();
|
||||||
|
const optimizer = await Storages.optimizer();
|
||||||
|
|
||||||
for await (const msg of store.req([filter], { signal: controller.signal })) {
|
for await (const msg of pubsub.req([filter], { signal: controller.signal })) {
|
||||||
if (msg[0] === 'EVENT') {
|
if (msg[0] === 'EVENT') {
|
||||||
const event = msg[2];
|
const event = msg[2];
|
||||||
|
|
||||||
await hydrateEvents({
|
await hydrateEvents({
|
||||||
events: [event],
|
events: [event],
|
||||||
store,
|
store: optimizer,
|
||||||
signal: AbortSignal.timeout(1000),
|
signal: AbortSignal.timeout(1000),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ async function renderStatuses(c: AppContext, filters: NostrFilter[]) {
|
||||||
return renderReblog(event, { viewerPubkey });
|
return renderReblog(event, { viewerPubkey });
|
||||||
}
|
}
|
||||||
return renderStatus(event, { viewerPubkey });
|
return renderStatus(event, { viewerPubkey });
|
||||||
}))).filter((boolean) => boolean);
|
}))).filter(Boolean);
|
||||||
|
|
||||||
if (!statuses.length) {
|
if (!statuses.length) {
|
||||||
return c.json([]);
|
return c.json([]);
|
||||||
|
|
Loading…
Reference in New Issue