From a3323a26187f4d196ff630dd6feb5d40a01a9163 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 9 Jul 2023 14:22:18 -0500 Subject: [PATCH] Simplify \w+ regex usage --- src/controllers/well-known/nostr.ts | 2 +- src/db.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/well-known/nostr.ts b/src/controllers/well-known/nostr.ts index b1b8433..ae24895 100644 --- a/src/controllers/well-known/nostr.ts +++ b/src/controllers/well-known/nostr.ts @@ -4,7 +4,7 @@ import { z } from '@/deps.ts'; import type { AppController } from '@/app.ts'; import { Conf } from '../../config.ts'; -const nameSchema = z.string().min(1).regex(/^[\w_]+$/); +const nameSchema = z.string().min(1).regex(/^\w+$/); /** * Serves NIP-05's nostr.json. diff --git a/src/db.ts b/src/db.ts index bff1190..5f13af7 100644 --- a/src/db.ts +++ b/src/db.ts @@ -4,7 +4,7 @@ const kv = await Deno.openKv(); const userSchema = z.object({ pubkey: z.string().regex(/^[0-9a-f]{64}$/).describe('primary'), - username: z.string().regex(/^[\w_]{1,30}$/).describe('unique'), + username: z.string().regex(/^\w{1,30}$/).describe('unique'), createdAt: z.date(), });