From 296ceb3fd46df51737372b671361273cb247f2ad Mon Sep 17 00:00:00 2001 From: murdle Date: Mon, 5 Jan 2026 16:19:19 +0200 Subject: [PATCH] add no region support in feed --- package-lock.json | 2 -- src/api/feed.ts | 5 +++-- src/models/FeedGetSchema.ts | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index f5332a6..eaaeb48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -586,7 +586,6 @@ "resolved": "https://registry.npmjs.org/hono/-/hono-4.11.1.tgz", "integrity": "sha512-KsFcH0xxHes0J4zaQgWbYwmz3UPOOskdqZmItstUG93+Wk1ePBLkLGwbP9zlmh1BFUiL8Qp+Xfu9P7feJWpGNg==", "license": "MIT", - "peer": true, "engines": { "node": ">=16.9.0" } @@ -669,7 +668,6 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-4.2.1.tgz", "integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==", "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/src/api/feed.ts b/src/api/feed.ts index 1bb3f69..a032544 100644 --- a/src/api/feed.ts +++ b/src/api/feed.ts @@ -8,8 +8,9 @@ import type { YT } from "youtubei.js"; const feed = new Hono(); -feed.get( - "/standardfeeds/:region/:type", +feed.on( + "GET", + ["/standardfeeds/:region/:type", "/standardfeeds/:type"], zValidator("param", FeedGetSchema), async (c) => { const { type } = c.req.valid("param"); diff --git a/src/models/FeedGetSchema.ts b/src/models/FeedGetSchema.ts index b098bf0..ab2da39 100644 --- a/src/models/FeedGetSchema.ts +++ b/src/models/FeedGetSchema.ts @@ -1,6 +1,6 @@ import z from "zod"; export const FeedGetSchema = z.object({ - region: z.string().length(2), + region: z.string().length(2).optional(), type: z.enum(["most_popular", "most_popular_Film", "most_popular_Games", "most_popular_Music"]) }); \ No newline at end of file