Upgrade nostr-tools, fix BECH_32_REGEX imports
This commit is contained in:
parent
91bc0549c7
commit
9500ceee7c
|
@ -1,4 +1,4 @@
|
|||
import { lodash, nip19, nip21, z } from '@/deps.ts';
|
||||
import { lodash, nip19, z } from '@/deps.ts';
|
||||
import { AppController } from '@/app.ts';
|
||||
import { parseBody } from '@/utils.ts';
|
||||
|
||||
|
@ -96,7 +96,7 @@ function maybeDecodeUri(uri: string): string {
|
|||
|
||||
const oauthAuthorizeSchema = z.object({
|
||||
pubkey: z.string().regex(/^[0-9a-f]{64}$/).optional().catch(undefined),
|
||||
nip19: z.string().regex(new RegExp(`^${nip21.BECH32_REGEX.source}$`)).optional().catch(undefined),
|
||||
nip19: z.string().regex(new RegExp(`^${nip19.BECH32_REGEX.source}$`)).optional().catch(undefined),
|
||||
redirect_uri: z.string().url(),
|
||||
}).superRefine((data, ctx) => {
|
||||
if (!data.pubkey && !data.nip19) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { AppController } from '@/app.ts';
|
||||
import { nip21 } from '@/deps.ts';
|
||||
import { nip19 } from '@/deps.ts';
|
||||
import { signStreams } from '@/sign.ts';
|
||||
|
||||
const streamingController: AppController = (c) => {
|
||||
|
@ -17,7 +17,7 @@ const streamingController: AppController = (c) => {
|
|||
return c.json({ error: 'Missing access token' }, 401);
|
||||
}
|
||||
|
||||
if (!nip21.BECH32_REGEX.test(token)) {
|
||||
if (!nip19.BECH32_REGEX.test(token)) {
|
||||
return c.json({ error: 'Invalid access token' }, 401);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ export {
|
|||
nip19,
|
||||
nip21,
|
||||
signEvent as getSignature,
|
||||
} from 'npm:nostr-tools@^1.10.1';
|
||||
} from 'npm:nostr-tools@^1.11.1';
|
||||
export { findReplyTag } from 'https://gitlab.com/soapbox-pub/mostr/-/raw/c67064aee5ade5e01597c6d23e22e53c628ef0e2/src/nostr/tags.ts';
|
||||
export { parseFormData } from 'npm:formdata-helper@^0.3.0';
|
||||
// @deno-types="npm:@types/lodash@4.14.194"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { findReplyTag, lodash, nip19, nip21, TTLCache, unfurl, z } from '@/deps.ts';
|
||||
import { findReplyTag, lodash, nip19, TTLCache, unfurl, z } from '@/deps.ts';
|
||||
import { type Event } from '@/event.ts';
|
||||
import { emojiTagSchema, filteredArray, type MetaContent, parseMetaContent } from '@/schema.ts';
|
||||
|
||||
|
@ -151,7 +151,7 @@ function buildInlineRecipients(mentions: Mention[]): string {
|
|||
if (!mentions.length) return '';
|
||||
|
||||
const elements = mentions.reduce<string[]>((acc, { url, username }) => {
|
||||
const name = nip21.BECH32_REGEX.test(username) ? username.substring(0, 8) : username;
|
||||
const name = nip19.BECH32_REGEX.test(username) ? username.substring(0, 8) : username;
|
||||
acc.push(`<a href="${url}" class="u-url mention" rel="ugc">@<span>${name}</span></a>`);
|
||||
return acc;
|
||||
}, []);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { getAuthor } from '@/client.ts';
|
||||
import { Context, getPublicKey, nip19, nip21, parseFormData } from '@/deps.ts';
|
||||
import { Context, getPublicKey, nip19, parseFormData } from '@/deps.ts';
|
||||
import { type Event } from '@/event.ts';
|
||||
import { lookupNip05Cached } from '@/nip05.ts';
|
||||
|
||||
|
@ -25,7 +25,7 @@ function getKeys(c: Context) {
|
|||
|
||||
/** Return true if the value is a bech32 string, eg for use with NIP-19. */
|
||||
function isBech32(value: unknown): value is string {
|
||||
return typeof value === 'string' && nip21.BECH32_REGEX.test(value);
|
||||
return typeof value === 'string' && nip19.BECH32_REGEX.test(value);
|
||||
}
|
||||
|
||||
/** Return true if the value is a Nostr pubkey, private key, or event ID. */
|
||||
|
|
Loading…
Reference in New Issue