1
0
mirror of https://github.com/zedeus/nitter.git synced 2026-04-15 10:12:09 -04:00

Add full support for tweet edit history

Fixes #700
This commit is contained in:
Zed
2026-02-16 00:52:17 +01:00
parent f257ce53ae
commit a15d1ce16b
13 changed files with 194 additions and 60 deletions

View File

@@ -64,9 +64,29 @@ proc createStatusRouter*(cfg: Config) =
resp renderMain(html, request, cfg, prefs, title, desc, ogTitle,
images=images, video=video)
get "/@name/status/@id/history/?":
cond '.' notin @"name"
let id = @"id"
if id.len > 19 or id.any(c => not c.isDigit):
resp Http404, showError("Invalid tweet ID", cfg)
let edits = await getGraphEditHistory(id)
if edits.latest == nil or edits.latest.id == 0:
resp Http404, showError("Tweet history not found", cfg)
let
prefs = requestPrefs()
title = "History for " & pageTitle(edits.latest)
ogTitle = "Edit History for " & pageTitle(edits.latest.user)
desc = edits.latest.text
let html = renderEditHistory(edits, prefs, getPath())
resp renderMain(html, request, cfg, prefs, title, desc, ogTitle)
get "/@name/@s/@id/@m/?@i?":
cond @"s" in ["status", "statuses"]
cond @"m" in ["video", "photo", "history"]
cond @"m" in ["video", "photo"]
redirect("/$1/status/$2" % [@"name", @"id"])
get "/@name/statuses/@id/?":