summaryrefslogtreecommitdiff
path: root/app/router.go
Commit message (Collapse)AuthorAgeFilesLines
* fix: serve media again by unsetting download-proxy and scoping Host per requestChristian Cleberg2026-07-151-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Two independent faults made every image fail while pages still rendered. config.example.json shipped download-proxy=http://127.0.0.1:8080. Only media fetches go through that proxy — pages reach DeviantArt via devianter on the default transport — so when nothing listens there, images 502 and the rest of the page looks fine. In a scratch container 127.0.0.1 is the container itself, so the default could never work under Docker. Unset it and document that it must stay empty unless an operator really runs a proxy. Host was a package global reassigned by every request, so a concurrent request could overwrite it mid-render and emit URLs on another origin's host and port. The instance's own default-src 'self' CSP then blocked those images. Thread the request's host through skunkyart instead, and take it as an explicit argument in URLBuilder, ParseMedia, ParseDescription, BuildUserPlate and ConvertDeviantArtURLToSkunkyArt. Feeds keep their absolute URLs. Also start RefreshInstances after ExecuteConfig rather than before it: the goroutine read CFG while json.Unmarshal was writing it (a race the detector flags), and its fetch escaped both the throttle and the configured User-Agent. Verified: 300 concurrent requests with distinct Host headers now round-trip their own host (was 1 leak per 300), go test -race is clean, and cache+proxy both enabled serves 200 image/jpeg cold and from cache.
* fix: harden HTTP transport, server timeouts and panic pathsChristian Cleberg2026-07-151-11/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | Correctness and security findings surfaced by golangci-lint, plus two latent panics found alongside them. - router: http.ListenAndServe has no timeouts at all (gosec G114), so a slow client could hold a connection and its handler open indefinitely. Replace it with an explicit http.Server carrying read/write/idle timeouts. - httpclient: InstallDAThrottle asserted http.DefaultTransport was a *http.Transport and would panic outright if anything had already wrapped it -- which is precisely what that function does. Check the assertion and fall back to a fresh transport. Expose ProxiedTransport so a configured download-proxy can inherit the same throttle and timeouts instead of silently bypassing them. - cache: the Sys() assertion to *syscall.Stat_t is only valid on unix and would panic elsewhere; skip rotation instead. Indexing Headers["Content-Type"][0] panics when the header is absent; use Headers.Get. Cache files are written 0600 rather than 0700, as they are never executed. - cli, api: check error returns, and exit rather than nil-dereference a file handle that failed to open. SHA-1 and math/rand keep //nolint:gosec with reasons: they are cache-key hashes and random-artwork picks, not security primitives.
* fix: remove russian language throughoutChristian Cleberg2026-07-151-1/+1
|
* Add da.opnxng.com + lost-skunk.cc is now in Finlandlost+skunk2025-04-071-0/+0
|
* офрцвагргшlost+skunk2024-11-151-2/+0
|
* ыlost+skunk2024-11-151-4/+5
|
* v1.3.2v1.3.2lost+skunk2024-09-231-11/+20
|
* отображение ошибокlost+skunk2024-09-041-4/+4
|
* фикс небольшого обосрамсаlost+skunk2024-09-031-1/+2
|
* Два API-эндпоинтаlost+skunk2024-09-031-27/+29
|
* instance list updatelost+skunk2024-09-021-1/+9
|
* темплейты в бинарнике и улучшенная ↵lost+skunk2024-08-131-6/+27
| | | | система кеша
* v1.3lost+skunk2024-08-011-3/+3
|
* Подготовка к релизу v1.3.1lost+skunk2024-07-301-4/+7
|
* Исправление некоторых обосрамсовv1.3lost+skunk2024-07-131-4/+3
|
* v1.3lost+skunk2024-07-131-16/+11
|
* Реализация конфигаlost+skunk2024-07-061-9/+21
|
* временная реализация RSSlost+skunk2024-07-051-0/+3
|
* Галерея, папки и группыlost+skunk2024-07-041-15/+26
|
* попытка реализовать галерею. так сыро ↵lost+skunk2024-06-301-2/+2
| | | | потому что мне скоро уезжать
* крымские наработкиlost+skunk2024-06-271-0/+3
|
* панель навигации, ответы и ежедневные артыlost+skunk2024-06-141-0/+2
|
* альфа: работают только посты и поискlost+skunk2024-06-131-0/+81