Commit Graph

573 Commits

Author SHA1 Message Date
IRHM 7b65c8af0f tmdb: Strip TMDB prefix from all struct names
This prefix is a remnant from when the structs where in the "main" package (from before the server refactor).
2026-08-03 01:14:02 +00:00
IRHM cf3168d59c content: GetOrCacheContent: Use Movie/ShowDetails funcs instead of manually using APIRequest func
Because this makes more sense to reuse the logic and also because APIRequest is now only locally accessible in the tmdb package, to stop me from using anywhere else, should always use an exposed function from the package so it can be reused.
2026-08-03 01:14:02 +00:00
IRHM fb1017f551 tmdb: Make req local, Movie/Show details funcs now accept struct options 2026-08-03 01:14:02 +00:00
IRHM bff354fcc3 organize tmdb api request logic into tmdb package AND support inline search filters 2026-08-03 01:14:02 +00:00
IRHM 0be6fdb346 content: Improve search function formatting 2026-08-03 01:14:02 +00:00
IRHM 9da0913d48 Add Status & ReleaseDateLast to Media, show end year for tv shows 2026-08-01 03:48:44 +00:00
IRHM dbc8b74893 v4.1.1 2026-07-26 02:47:48 +01:00
IRHM 9d5e489675 plex: Stop after 10 redirects
Since the default CheckRedirect has been replaced with ours, we won't get the default protection of erroring after 10 redirects, so i've copied that back in from the std implementation
2026-07-26 01:27:30 +00:00
tonghuaroot 4e6e71687b fix(plex): strip X-Plex-Token on cross-host redirect
The Plex integration used bare http.Client values with no CheckRedirect
policy, so they followed redirects automatically. net/http strips the
standard sensitive headers on a cross-host redirect but not custom-named
headers, so the Plex token carried in X-Plex-Token was forwarded verbatim
to any host the configured PLEX_HOST redirected to, disclosing the
credential.

Route all Plex outbound calls through a shared client whose CheckRedirect
policy deletes X-Plex-Token when the redirect target host differs from the
original request host. Includes a regression test.

Signed-off-by: tonghuaroot <tonghuaroot@gmail.com>
2026-07-26 01:27:30 +00:00
IRHM 8c8d604bc6 v4.1.1-dev1 2026-07-26 01:34:45 +01:00
IRHM a16c769273 v4.1.0 2026-07-19 14:15:42 +01:00
IRHM f022dc702c v4.1.0-dev1 2026-07-18 13:05:20 +01:00
IRHM 9b64932af1 watched_refine: refineFilterStatus: Remove parenthesis around WHERE query.
It looks like GORM already adds the parenthesis around this for us in the final query, so ours was unnecessary
2026-07-18 09:50:53 +00:00
IRHM bf0594c1e8 Fix Include Previously Watched regression and update profile stats to not use the setting
Index also added to

Fixes https://github.com/sbondCo/Watcharr/issues/1027
2026-07-18 09:50:53 +00:00
IRHM 61382de4d2 v4.0.1 2026-07-16 10:07:58 +01:00
IRHM e65ba9d1d9 v4.0.1-dev1 2026-07-16 09:40:47 +01:00
IRHM 6654d85448 testing workflow - no longer testing workflow cuz it works now yippee 2026-07-16 08:36:22 +00:00
IRHM eabdb47cfa testing workflow - gofmt 2026-07-16 08:36:22 +00:00
IRHM 643ca0fd38 testing workflow - go test 2026-07-16 08:36:22 +00:00
IRHM 38fba0ac10 Watched: Also log the error on the "failed to restore existing watched entry" log. 2026-07-16 08:36:22 +00:00
IRHM 5bebb754ed v4.0.0 2026-07-11 03:28:19 +01:00
IRHM c8920c911d migrate: Change debug log to info
and add an info migration not been applied before log.
2026-07-11 03:27:31 +01:00
IRHM dd0bae137f migrations: Remove comment TODO
Should be okay with them there.
2026-07-10 22:08:04 +01:00
IRHM d5baee0df7 v4.0.0-dev1 2026-07-10 21:42:03 +01:00
IRHM 05f9813be8 image: validate: Don't log whole image config 2026-07-10 20:30:23 +00:00
IRHM f285d1a8f4 image: Move new download/save methods to a Saver struct 2026-07-10 20:30:23 +00:00
IRHM 4cc9bd3edb make image module way more robust
- Create a better (more) re-usable flow for downloading images to disk and inserting images into the db
- Validate images properly by reading them fully and using DecodeConfig
- Fix some security issues by re-encoding images
- Always outputs one format `jpeg`, which keeps everything "normalized" and adds compression to images (mainly user uploads which might be big).
2026-07-10 20:30:23 +00:00
IRHM 34f7f54e72 fix: Add headers to requests for files in img/ folder to prevent stored xss attacks
A modern browser will see these headers and protect the user by not allowing any code to run.
2026-07-10 20:30:23 +00:00
IRHM 3461a4ec74 db: Add duration to log for optimization queries 2026-07-05 17:39:42 +00:00
IRHM dbfc354353 GetWatchedPage: Put filter scope on one line 2026-07-05 17:39:42 +00:00
IRHM 28a6d85672 Update watched.go 2026-07-05 17:39:42 +00:00
IRHM b861cfcec3 separate watched_refine funcs 2026-07-05 17:39:42 +00:00
IRHM 08e0021535 refineSort: Filter by user_id AND use count_as_play instead of doing text search for LastFinished sort 2026-07-05 17:39:42 +00:00
IRHM b3bf111f82 Replace Fatal log with more direct Error and os.Exit 2026-07-05 17:39:42 +00:00
IRHM 23ed5ffca8 Add separator log for log files so a new server starting is easier to find/notice 2026-07-05 17:39:42 +00:00
IRHM cc9f246c9a update watched_util_test with new model name 2026-07-05 17:39:42 +00:00
IRHM 75d75248e1 Remove AddActivity endpoint
it isn't used and is only a way for others to potentially add activity to other peoples watched entries since user owning the watched entry is not validated on the endpoint.

Co-Authored-By: Dreddy <24421368+dredsen@users.noreply.github.com>
2026-07-05 17:39:42 +00:00
IRHM c34a0878b2 New Deref helper for using pointers safely with default values 2026-07-05 17:39:42 +00:00
IRHM 681212566b activity: Change AddRequest name to Props. Add CountAsPlay param to AddActivity()
and some formatting
2026-07-05 17:39:42 +00:00
IRHM df37de00e1 manually validate WatchedUpdateRequest struct and add plays count to watcheddto 2026-07-05 17:39:42 +00:00
IRHM fc900d8e93 db: Optimize when opening and new optimize task ran every 24hr server is running to keep it running best 2026-07-05 17:39:42 +00:00
IRHM 57ce143ebe migrate db to WAL journal_mode 2026-07-05 17:39:42 +00:00
IRHM 3eb2810a31 db: Configure sqlite connection when open. Currently set synchronous to FULL
(did this work a long time ago now so commits are in weird order)
2026-07-05 17:39:42 +00:00
IRHM b8598ba404 Remove deleted_at columns for watched episode/season tables
We don't use these columns and won't in the foreseeable future. Query speed seems be to be faster now that we aren't filtering for the extra deleted_at cols.
2026-07-05 17:39:42 +00:00
IRHM 579428d86b migrate: Backfill media plays data from existing activity 2026-07-05 17:39:42 +00:00
IRHM 4da8730b6f Activity: Add CountAsPlay property 2026-07-05 17:39:42 +00:00
IRHM e980a1f70e db: Create custom migrations support 2026-07-05 17:39:42 +00:00
IRHM f73105e9c7 v3.0.2-dev1 2026-03-19 01:30:26 +00:00
IRHM a12faf8e72 v3.0.1 2026-03-09 11:14:19 +00:00
IRHM eb1b8b86c7 v3.0.1-dev2 2026-03-09 10:48:51 +00:00