Ignore trailing slashes for list routes

This commit is contained in:
Zed 2020-06-01 05:31:11 +02:00
parent 92883cbd73
commit 1cb57401b6
2 changed files with 8 additions and 9 deletions

View file

@ -19,7 +19,7 @@ template respList*(list, timeline, vnode: typed) =
proc createListRouter*(cfg: Config) =
router list:
get "/@name/lists/@list":
get "/@name/lists/@list/?":
cond '.' notin @"name"
cond @"name" != "i"
let
@ -36,7 +36,7 @@ proc createListRouter*(cfg: Config) =
members = await getListMembers(list)
respList(list, members, renderTimelineUsers(members, cookiePrefs(), request.path))
get "/i/lists/@id":
get "/i/lists/@id/?":
cond '.' notin @"id"
let list = await getCachedList(id=(@"id"))
if list.id.len == 0:

View file

@ -6,15 +6,14 @@ import ../views/[general, about]
proc createUnsupportedRouter*(cfg: Config) =
router unsupported:
get "/about/feature":
template feature {.dirty.} =
resp renderMain(renderFeature(), request, cfg)
get "/intent/?@i?":
resp renderMain(renderFeature(), request, cfg)
get "/login/?@i?":
resp renderMain(renderFeature(), request, cfg)
get "/about/feature": feature()
get "/intent/?@i?": feature()
get "/login/?@i?": feature()
get "/@name/lists/?": feature()
get "/i/@i?/?@j?":
cond @"i" notin ["status", "lists"]
resp renderMain(renderFeature(), request, cfg)
feature()