about summary refs log tree commit diff
path: root/src/lib/routes
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-03-09 10:35:23 -0600
committerGitHub <noreply@github.com>2024-03-09 10:35:23 -0600
commit594958c6dc2a69155c19bcd108f19fe9c64f98be (patch)
tree72180011d9d227f24c3eb47df79bd5567357c718 /src/lib/routes
parentaad8c080eda81ad96875c817420d719a8c80874f (diff)
downloadvoidsky-594958c6dc2a69155c19bcd108f19fe9c64f98be.tar.zst
Fix RSS URLs treated as internal (#3156)
* Fix RSS URLs treated as internal

* Add utils to patch relative RSS external links

* modify router to support multiple paths

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/lib/routes')
-rw-r--r--src/lib/routes/router.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/routes/router.ts b/src/lib/routes/router.ts
index 00defaeda..8c8be3739 100644
--- a/src/lib/routes/router.ts
+++ b/src/lib/routes/router.ts
@@ -2,9 +2,15 @@ import {RouteParams, Route} from './types'
 
 export class Router {
   routes: [string, Route][] = []
-  constructor(description: Record<string, string>) {
+  constructor(description: Record<string, string | string[]>) {
     for (const [screen, pattern] of Object.entries(description)) {
-      this.routes.push([screen, createRoute(pattern)])
+      if (typeof pattern === 'string') {
+        this.routes.push([screen, createRoute(pattern)])
+      } else {
+        pattern.forEach(subPattern => {
+          this.routes.push([screen, createRoute(subPattern)])
+        })
+      }
     }
   }