added starts of rss feeds... ha

This commit is contained in:
Paul Wilde 2024-12-18 17:47:41 +00:00
parent 13ae6c3fbd
commit af60ae5781
2 changed files with 4 additions and 3 deletions

View file

@ -38,7 +38,7 @@ proc staticFileHandler(request: Request) =
proc rssHandler(request: Request) = proc rssHandler(request: Request) =
echo request.uri echo request.uri
var headers: HttpHeaders var headers: HttpHeaders
let content = genRSS(path=request.uri) let content = genRSS(feedpath=request.uri)
headers["content-type"] = "application/rss+xml" headers["content-type"] = "application/rss+xml"
request.respond(200, headers, content) request.respond(200, headers, content)
@ -53,7 +53,7 @@ proc createRouter(): Router =
router.get("/favicon.ico", staticFileHandler) router.get("/favicon.ico", staticFileHandler)
router.get("/favicon.png", staticFileHandler) router.get("/favicon.png", staticFileHandler)
router.get("/css.css", staticFileHandler) router.get("/css.css", staticFileHandler)
router.get("/*.rss", rssHandler) router.get("/feed.xml", rssHandler)
return router return router

View file

@ -156,7 +156,8 @@ proc genpage*(path: string, video_uri: string = ""): string =
else: else:
return compilePage(content, video_uri) return compilePage(content, video_uri)
proc genRSS*(path: string): string = proc genRSS*(feedpath: string): string =
let path = feedpath.replace("feed.xml","")
let content = request(XV & path) let content = request(XV & path)
let search_query = findSearchQuery(path) let search_query = findSearchQuery(path)
return compileRSSPage(content, search_query = search_query) return compileRSSPage(content, search_query = search_query)