mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
Fix oEmbed CI: accept any host in URL parsing
This commit is contained in:
parent
7f6c083dce
commit
06e59f0615
2 changed files with 17 additions and 2 deletions
|
|
@ -34,6 +34,16 @@ proc parseTweetUrl*(url: string; cfg: Config): tuple[username, id: string] =
|
|||
if path.startsWith(nitterPrefix):
|
||||
return parseTweetPath(path[nitterPrefix.len..^1])
|
||||
|
||||
# Fall back: strip any hostname and try to parse as a tweet path.
|
||||
# Handles requests where the URL's host differs from cfg.hostname
|
||||
# (e.g. localhost in dev/CI, or a reverse proxy with a different domain).
|
||||
let slashPos = path.find('/')
|
||||
if slashPos > 0:
|
||||
let afterHost = path[slashPos + 1..^1]
|
||||
let parsed = parseTweetPath(afterHost)
|
||||
if parsed.username.len > 0:
|
||||
return parsed
|
||||
|
||||
return ("", "")
|
||||
|
||||
proc createEmbedRouter*(cfg: Config) =
|
||||
|
|
|
|||
Loading…
Reference in a new issue