Merge branch 'nostr-tools-alias' into 'main'
Move nostr-tools to an import alias See merge request soapbox-pub/ditto!199
This commit is contained in:
commit
c2608f9b11
|
@ -26,6 +26,8 @@
|
|||
"@std/streams": "jsr:@std/streams@^0.223.0",
|
||||
"hono": "https://deno.land/x/hono@v3.10.1/mod.ts",
|
||||
"hono/middleware": "https://deno.land/x/hono@v3.10.1/middleware.ts",
|
||||
"nostr-tools": "npm:nostr-tools@^2.5.1",
|
||||
"nostr-wasm": "npm:nostr-wasm@^0.1.0",
|
||||
"kysely": "npm:kysely@^0.26.3",
|
||||
"kysely_deno_postgres": "https://deno.land/x/kysely_deno_postgres@v0.4.0/mod.ts",
|
||||
"zod": "npm:zod@^3.23.4",
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import url from 'node:url';
|
||||
|
||||
import { getPublicKey, nip19 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { dotenv, getPublicKey, nip19 } from '@/deps.ts';
|
||||
import { dotenv } from '@/deps.ts';
|
||||
|
||||
/** Load environment config from `.env` */
|
||||
await dotenv.load({
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { NostrFilter } from '@nostrify/nostrify';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { type AppController } from '@/app.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
import { nip19 } from '@/deps.ts';
|
||||
import { getAuthor, getFollowedPubkeys } from '@/queries.ts';
|
||||
import { booleanParamSchema, fileSchema } from '@/schema.ts';
|
||||
import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { nip19 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { lodash, nip19 } from '@/deps.ts';
|
||||
import { lodash } from '@/deps.ts';
|
||||
import { AppController } from '@/app.ts';
|
||||
import { nostrNow } from '@/utils.ts';
|
||||
import { parseBody } from '@/utils/api.ts';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { AppController } from '@/app.ts';
|
||||
import { nip19 } from '@/deps.ts';
|
||||
import { booleanParamSchema } from '@/schema.ts';
|
||||
import { nostrIdSchema } from '@/schemas/nostr.ts';
|
||||
import { searchStore } from '@/storages.ts';
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { NIP05, NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { type AppController } from '@/app.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
import { getUnattachedMediaByIds } from '@/db/unattached-media.ts';
|
||||
import { ISO6391, nip19 } from '@/deps.ts';
|
||||
import { ISO6391 } from '@/deps.ts';
|
||||
import { getAncestors, getAuthor, getDescendants, getEvent } from '@/queries.ts';
|
||||
import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
|
||||
import { addTag, deleteTag } from '@/tags.ts';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { nip19 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { nip19 } from '@/deps.ts';
|
||||
import { localNip05Lookup } from '@/utils/nip05.ts';
|
||||
|
||||
import type { AppContext, AppController } from '@/app.ts';
|
||||
|
|
18
src/deps.ts
18
src/deps.ts
|
@ -1,18 +1,5 @@
|
|||
import 'https://gitlab.com/soapbox-pub/deno-safe-fetch/-/raw/v1.0.0/load.ts';
|
||||
export { RelayPoolWorker } from 'npm:nostr-relaypool2@0.6.34';
|
||||
export {
|
||||
type EventTemplate,
|
||||
getEventHash,
|
||||
matchFilter,
|
||||
matchFilters,
|
||||
nip05,
|
||||
nip13,
|
||||
nip19,
|
||||
nip21,
|
||||
type UnsignedEvent,
|
||||
type VerifiedEvent,
|
||||
} from 'npm:nostr-tools@^2.3.1';
|
||||
export { finalizeEvent, getPublicKey, verifyEvent } from 'npm:nostr-tools@^2.3.1/wasm';
|
||||
export { parseFormData } from 'npm:formdata-helper@^0.3.0';
|
||||
// @deno-types="npm:@types/lodash@4.14.194"
|
||||
export { default as lodash } from 'https://esm.sh/lodash@4.17.21';
|
||||
|
@ -69,8 +56,3 @@ export { default as Debug } from 'https://gitlab.com/soapbox-pub/stickynotes/-/r
|
|||
export { Stickynotes } from 'https://gitlab.com/soapbox-pub/stickynotes/-/raw/v0.3.0/mod.ts';
|
||||
|
||||
export type * as TypeFest from 'npm:type-fest@^4.3.0';
|
||||
|
||||
import { setNostrWasm } from 'npm:nostr-tools@^2.3.1/wasm';
|
||||
import { initNostrWasm } from 'npm:nostr-wasm@^0.1.0';
|
||||
|
||||
await initNostrWasm().then(setNostrWasm);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { HTTPException } from 'hono';
|
||||
import { getPublicKey, nip19 } from 'nostr-tools';
|
||||
|
||||
import { type AppMiddleware } from '@/app.ts';
|
||||
import { getPublicKey, nip19 } from '@/deps.ts';
|
||||
|
||||
/** We only accept "Bearer" type. */
|
||||
const BEARER_REGEX = new RegExp(`^Bearer (${nip19.BECH32_REGEX.source})$`);
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
import { setNostrWasm } from 'nostr-tools/wasm';
|
||||
import { initNostrWasm } from 'nostr-wasm';
|
||||
|
||||
await initNostrWasm().then(setNostrWasm);
|
|
@ -1,5 +1,7 @@
|
|||
import { nip19, nip21 } from 'nostr-tools';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { linkify, linkifyStr, mime, nip19, nip21 } from '@/deps.ts';
|
||||
import { linkify, linkifyStr, mime } from '@/deps.ts';
|
||||
import { type DittoAttachment } from '@/views/mastodon/attachments.ts';
|
||||
|
||||
linkify.registerCustomProtocol('nostr', true);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { getEventHash, verifyEvent } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { getEventHash, verifyEvent } from '@/deps.ts';
|
||||
import { jsonSchema, safeUrlSchema } from '@/schema.ts';
|
||||
|
||||
/** Schema to validate Nostr hex IDs such as event IDs and pubkeys. */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import '@/precheck.ts';
|
||||
import '@/sentry.ts';
|
||||
import '@/nostr-wasm.ts';
|
||||
import app from '@/app.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ import {
|
|||
NRelay,
|
||||
} from '@nostrify/nostrify';
|
||||
import { Machina } from '@nostrify/nostrify/utils';
|
||||
import { matchFilter } from 'nostr-tools';
|
||||
|
||||
import { matchFilter } from '@/deps.ts';
|
||||
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||
import { purifyEvent } from '@/storages/hydrate.ts';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NostrEvent, NStore } from '@nostrify/nostrify';
|
||||
import { matchFilter } from 'nostr-tools';
|
||||
|
||||
import { db } from '@/db.ts';
|
||||
import { matchFilter } from '@/deps.ts';
|
||||
import { type DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||
import { DittoTables } from '@/db/DittoTables.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { NostrEvent, NostrFilter, NSet, NStore } from '@nostrify/nostrify';
|
||||
import { Debug, matchFilters, type RelayPoolWorker } from '@/deps.ts';
|
||||
import { matchFilters } from 'nostr-tools';
|
||||
|
||||
import { Debug, type RelayPoolWorker } from '@/deps.ts';
|
||||
import { normalizeFilters } from '@/filter.ts';
|
||||
import { purifyEvent } from '@/storages/hydrate.ts';
|
||||
import { abortError } from '@/utils/abort.ts';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NostrEvent } from '@nostrify/nostrify';
|
||||
import { EventTemplate, getEventHash, nip19 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { type EventTemplate, getEventHash, nip19 } from '@/deps.ts';
|
||||
import { nostrIdSchema } from '@/schemas/nostr.ts';
|
||||
|
||||
/** Get the current time in Nostr format. */
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
||||
import { type Context, HTTPException } from 'hono';
|
||||
import { EventTemplate } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { type AppContext } from '@/app.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
import { Debug, EventTemplate, parseFormData, type TypeFest } from '@/deps.ts';
|
||||
import { Debug, parseFormData, type TypeFest } from '@/deps.ts';
|
||||
import * as pipeline from '@/pipeline.ts';
|
||||
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||
import { APISigner } from '@/signers/APISigner.ts';
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { NIP05 } from '@nostrify/nostrify';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { Debug, nip19 } from '@/deps.ts';
|
||||
import { Debug } from '@/deps.ts';
|
||||
import { SimpleLRU } from '@/utils/SimpleLRU.ts';
|
||||
import { Time } from '@/utils/time.ts';
|
||||
import { eventsDB } from '@/storages.ts';
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { NostrEvent } from '@nostrify/nostrify';
|
||||
import { type EventTemplate, nip13 } from '@/deps.ts';
|
||||
import { EventTemplate, nip13 } from 'nostr-tools';
|
||||
|
||||
import { decode64Schema, jsonSchema } from '@/schema.ts';
|
||||
import { signedEventSchema } from '@/schemas/nostr.ts';
|
||||
import { eventAge, findTag, nostrNow, sha256 } from '@/utils.ts';
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { nip19, UnsignedEvent } from 'nostr-tools';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { lodash, nip19, type UnsignedEvent } from '@/deps.ts';
|
||||
import { lodash } from '@/deps.ts';
|
||||
import { type DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||
import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
|
||||
import { getLnurl } from '@/utils/lnurl.ts';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { UnsignedEvent } from '@/deps.ts';
|
||||
import { UnsignedEvent } from 'nostr-tools';
|
||||
|
||||
import { EmojiTag, emojiTagSchema } from '@/schemas/nostr.ts';
|
||||
import { filteredArray } from '@/schema.ts';
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { NostrEvent } from '@nostrify/nostrify';
|
||||
import { isCWTag } from 'https://gitlab.com/soapbox-pub/mostr/-/raw/c67064aee5ade5e01597c6d23e22e53c628ef0e2/src/nostr/tags.ts';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { nip19 } from '@/deps.ts';
|
||||
import { type DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||
import { getMediaLinks, parseNoteContent } from '@/note.ts';
|
||||
import { jsonMediaDataSchema } from '@/schemas/nostr.ts';
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import { NostrEvent } from '@nostrify/nostrify';
|
||||
import { Comlink, type VerifiedEvent, verifyEvent } from '@/deps.ts';
|
||||
import { VerifiedEvent, verifyEvent } from 'nostr-tools';
|
||||
|
||||
import { Comlink } from '@/deps.ts';
|
||||
import '@/nostr-wasm.ts';
|
||||
|
||||
export const VerifyWorker = {
|
||||
verifyEvent(event: NostrEvent): event is VerifiedEvent {
|
||||
|
|
Loading…
Reference in New Issue