client: remove `publish` function, create statuses through pipeline
This commit is contained in:
parent
0158a6979e
commit
719b703e7c
|
@ -38,7 +38,7 @@ function getFilters<K extends number>(filters: Filter<K>[], opts: GetFiltersOpts
|
||||||
Conf.poolRelays,
|
Conf.poolRelays,
|
||||||
(event: Event | null) => {
|
(event: Event | null) => {
|
||||||
if (event && matchFilters(filters, event)) {
|
if (event && matchFilters(filters, event)) {
|
||||||
pipeline.handleEvent(event);
|
pipeline.handleEvent(event).catch(() => {});
|
||||||
results.push({
|
results.push({
|
||||||
id: event.id,
|
id: event.id,
|
||||||
kind: event.kind,
|
kind: event.kind,
|
||||||
|
@ -72,14 +72,4 @@ function getFilters<K extends number>(filters: Filter<K>[], opts: GetFiltersOpts
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Publish an event to the Nostr relay. */
|
export { getFilters };
|
||||||
function publish(event: Event, relays = Conf.publishRelays): void {
|
|
||||||
console.log('Publishing event', event, relays);
|
|
||||||
try {
|
|
||||||
getPool().publish(event, relays);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { getFilters, publish };
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { type AppController } from '@/app.ts';
|
import { type AppController } from '@/app.ts';
|
||||||
import { type Filter, findReplyTag, z } from '@/deps.ts';
|
import { type Filter, findReplyTag, z } from '@/deps.ts';
|
||||||
import { publish } from '@/client.ts';
|
|
||||||
import * as mixer from '@/mixer.ts';
|
import * as mixer from '@/mixer.ts';
|
||||||
import * as pipeline from '@/pipeline.ts';
|
import * as pipeline from '@/pipeline.ts';
|
||||||
import { getAuthor, getFollows } from '@/queries.ts';
|
import { getAuthor, getFollows } from '@/queries.ts';
|
||||||
|
@ -8,7 +7,6 @@ import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
|
||||||
import { signEvent } from '@/sign.ts';
|
import { signEvent } from '@/sign.ts';
|
||||||
import { toAccount, toStatus } from '@/transformers/nostr-to-mastoapi.ts';
|
import { toAccount, toStatus } from '@/transformers/nostr-to-mastoapi.ts';
|
||||||
import { buildLinkHeader, eventDateComparator, lookupAccount, nostrNow, paginationSchema, parseBody } from '@/utils.ts';
|
import { buildLinkHeader, eventDateComparator, lookupAccount, nostrNow, paginationSchema, parseBody } from '@/utils.ts';
|
||||||
import pipe from 'https://deno.land/x/ramda@v0.27.2/source/pipe.js';
|
|
||||||
|
|
||||||
const createAccountController: AppController = (c) => {
|
const createAccountController: AppController = (c) => {
|
||||||
return c.json({ error: 'Please log in with Nostr.' }, 405);
|
return c.json({ error: 'Please log in with Nostr.' }, 405);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { type AppController } from '@/app.ts';
|
import { type AppController } from '@/app.ts';
|
||||||
import { publish } from '@/client.ts';
|
|
||||||
import { ISO6391, Kind, z } from '@/deps.ts';
|
import { ISO6391, Kind, z } from '@/deps.ts';
|
||||||
import * as pipeline from '@/pipeline.ts';
|
import * as pipeline from '@/pipeline.ts';
|
||||||
import { getAncestors, getDescendants, getEvent } from '@/queries.ts';
|
import { getAncestors, getDescendants, getEvent } from '@/queries.ts';
|
||||||
|
|
Loading…
Reference in New Issue