Merge branch 'intent-userid'

This commit is contained in:
Zed
2021-12-30 01:45:41 +01:00
5 changed files with 48 additions and 3 deletions

View File

@@ -102,8 +102,22 @@ template respTimeline*(timeline: typed) =
resp Http404, showError("User \"" & @"name" & "\" not found", cfg)
resp t
template respUserId*() =
cond @"user_id".len > 0
let username = await getCachedProfileScreenName(@"user_id")
if username.len > 0:
redirect("/" & username)
else:
resp Http404, showError("User not found", cfg)
proc createTimelineRouter*(cfg: Config) =
router timeline:
get "/i/user/@user_id":
respUserId()
get "/intent/user":
respUserId()
get "/@name/?@tab?/?":
cond '.' notin @"name"
cond @"name" notin ["pic", "gif", "video"]

View File

@@ -11,10 +11,13 @@ proc createUnsupportedRouter*(cfg: Config) =
resp renderMain(renderFeature(), request, cfg, themePrefs())
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"]
get "/intent/?@i?":
cond @"i" notin ["user"]
feature()
get "/i/@i?/?@j?":
cond @"i" notin ["status", "lists" , "user"]
feature()