mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
Server (routes.rs): POST /api/util/resolve-tco — unauthenticated, accepts JSON array of https://t.co/<alphanumeric> URLs only (strict regex validation, no SSRF via input), capped at 50 per batch, 3 s timeout, redirect(Policy::none) so the server only ever touches t.co itself. HEAD first, GET fallback if HEAD returns no Location. Location sanitized to http/https only — javascript:/data:/etc. fall back to the original t.co. api.js: resolveTcoUrls(urls) — project-convention wrapper for the new endpoint. Returns {} on failure (callers degrade gracefully to bare t.co links). TweetPreview.jsx: After tweet data loads, per-tweet range-based coverage detection: builds covered [start,end) from existing entity fromIndex/toIndex or indices fallback, then finds regex matches whose span is NOT covered. Resolves unique uncovered t.co URLs via resolveTcoUrls(), synthesises one entity per occurrence (with exact fromIndex/toIndex so normalizeUrlAnn gets correct bounds even for duplicate t.co URLs in the same tweet). Augments entities.urls before setTweets() so all rendering paths see expanded URLs.
28 lines
631 B
TOML
28 lines
631 B
TOML
[package]
|
|
name = "archivr-server"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
archivr-core = { path = "../archivr-core" }
|
|
axum.workspace = true
|
|
serde.workspace = true
|
|
tokio.workspace = true
|
|
toml.workspace = true
|
|
tower.workspace = true
|
|
tower-http.workspace = true
|
|
argon2.workspace = true
|
|
rand.workspace = true
|
|
axum-extra.workspace = true
|
|
chrono.workspace = true
|
|
base64.workspace = true
|
|
serde_json.workspace = true
|
|
rusqlite.workspace = true
|
|
parking_lot.workspace = true
|
|
regex.workspace = true
|
|
reqwest.workspace = true
|
|
|
|
[dev-dependencies]
|
|
tempfile.workspace = true
|
|
tower.workspace = true
|