diff --git a/apps/git/index.tsx b/apps/git/index.tsx index 571ec03..962a4b0 100644 --- a/apps/git/index.tsx +++ b/apps/git/index.tsx @@ -13,7 +13,7 @@ const DATA_ROOT = process.env.DATA_ROOT! const TOES_URL = process.env.TOES_URL! const REPOS_DIR = resolve(DATA_ROOT, 'repos') -const VALID_NAME = /^[a-zA-Z0-9_-]+$/ +const VALID_NAME = /^[a-zA-Z0-9._-]+$/ const VISIBILITY_PATH = join(DATA_DIR, 'visibility.json') const TOGGLE_SCRIPT = ` diff --git a/src/client/modals/NewApp.tsx b/src/client/modals/NewApp.tsx index e48e654..f39ce5b 100644 --- a/src/client/modals/NewApp.tsx +++ b/src/client/modals/NewApp.tsx @@ -20,8 +20,8 @@ async function createNewApp() { return } - if (!/^[a-z][a-z0-9-]*$/.test(name)) { - newAppError = 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens' + if (!/^[a-z][a-z0-9.-]*$/.test(name)) { + newAppError = 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens' renderModal() return } diff --git a/src/client/modals/RenameApp.tsx b/src/client/modals/RenameApp.tsx index 3e8c2ca..001e0f2 100644 --- a/src/client/modals/RenameApp.tsx +++ b/src/client/modals/RenameApp.tsx @@ -19,8 +19,8 @@ async function doRenameApp(input: HTMLInputElement) { return } - if (!/^[a-z][a-z0-9-]*$/.test(newName)) { - renameAppError = 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens' + if (!/^[a-z][a-z0-9.-]*$/.test(newName)) { + renameAppError = 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens' renderModal() return } diff --git a/src/server/api/apps.ts b/src/server/api/apps.ts index 06d94a0..9b48081 100644 --- a/src/server/api/apps.ts +++ b/src/server/api/apps.ts @@ -120,8 +120,8 @@ router.post('/', async c => { const name = body.name?.trim().toLowerCase().replace(/\s+/g, '-') if (!name) return c.json({ ok: false, error: 'App name is required' }, 400) - if (!/^[a-z][a-z0-9-]*$/.test(name)) { - return c.json({ ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens' }, 400) + if (!/^[a-z][a-z0-9.-]*$/.test(name)) { + return c.json({ ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens' }, 400) } const appPath = join(APPS_DIR, name) diff --git a/src/server/apps.ts b/src/server/apps.ts index b8a4c8e..3751745 100644 --- a/src/server/apps.ts +++ b/src/server/apps.ts @@ -176,8 +176,8 @@ export async function renameApp(oldName: string, newName: string): Promise<{ ok: if (_apps.has(newName)) return { ok: false, error: 'An app with that name already exists' } - if (!/^[a-z][a-z0-9-]*$/.test(newName)) { - return { ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens' } + if (!/^[a-z][a-z0-9.-]*$/.test(newName)) { + return { ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens' } } const oldPath = join(APPS_DIR, oldName)