Commit Graph

39 Commits

Author SHA1 Message Date
wmantly ce0e0bdd4f Point Ollama to local host 192.168.1.148:11434
Signed-off-by: William Mantly <wmantly@gmail.com>
2026-07-20 12:49:37 -04:00
wmantly bd9f058f26 Use official ollama npm client for all LLM calls
Replaces hand-rolled fetch to /api/chat with the ollama@0.6.3 package.

The package supplies proper Accept/Content-Type/User-Agent headers and

auto-handles the Ollama protocol, fixing the CDN 403s Node's bare fetch

gets against ollama.com during filing.

Both organize and search LLM ranking now route through controller/ollama.js.

Signed-off-by: William Mantly <wmantly@gmail.com>
2026-07-20 12:43:25 -04:00
wmantly 47a930eddb Add explicit User-Agent to Ollama API calls
Node's default fetch sends a bare User-Agent that Google's CDN

fronting ollama.com rejects with 403. curl worked because it

sends curl/. Fixes organize (and search LLM ranking).

Signed-off-by: William Mantly <wmantly@gmail.com>
2026-07-20 12:29:09 -04:00
wmantly 40a39b2d14 Add Ollama/organize logging to debug 403 filing failures
- Log raw Ollama HTTP body on non-2xx responses

- Log JSON extraction failures with raw content

- Log organizeWatcher tick errors instead of swallowing them

Signed-off-by: William Mantly <wmantly@gmail.com>
2026-07-20 11:55:41 -04:00
wmantly e9a376925d jq-repeat update 2026-07-19 00:25:04 -04:00
wmantly b166403309 Remember unavailable movies and auto-grab them later (wishlist)
When Smart Search finds no good copy of a movie (unreleased / only CAMs), we
now record it instead of dropping it:
- New Wanted model + migration (dedup by tmdbId, status wanted|fulfilled).
- POST /__api/search/releases remembers a movie when it returns no options,
  and the UI confirms it was added to the wishlist.
- controller/wantedWatcher re-runs Smart Search for wishlisted items every 6h
  (and on boot); when a good copy appears it queues the recommended release,
  which then flows through the normal download + organize pipeline, and marks
  the item fulfilled.
- GET/DELETE /__api/search/wanted to view/remove the wishlist.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 00:51:48 -04:00
wmantly 2046e5080b Stop Smart Search recommending the wrong movie / CAMs
TPB search is fuzzy: querying "Toy Story 5" returns Toy Story 4/3/… plus the
only real 2026 copies, which are CAM/Telesync. The LLM rejected them all, then
fallbackReleases picked the most-seeded (Toy Story 4), ignoring title/year.

Two deterministic guards:
- prefilter now drops low-quality source tags (CAM/TS/TELESYNC/SCR/…) via a
  token match, so neither the LLM nor the fallback can surface them.
- findReleases requires the confirmed TMDB year in a movie's release name, so a
  fuzzy match can't cross to a different film. If nothing survives, return no
  options and tell the user it may be unreleased / only CAMs exist.

Verified: "Toy Story 5" now returns 0 options (was Toy Story 4); Night of the
Living Dead (1990) still recommends its 1080p x265 pack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 22:34:24 -04:00
wmantly 27a6656ac5 Make Smart Search library-aware (Emby dedup + TV gap-fill)
New controller/library.js queries Emby by TMDB provider id (resilient: an
unreachable Emby degrades to "unknown" so search still works).

Movies — quality-aware dedup:
- findReleases checks movieInLibrary(tmdbId) and flags each option alreadyOwned
  when its resolution is <= what you already own, so only genuine upgrades are
  offered; the release picker greys owned qualities and shows a library banner.

TV — library-driven "fill the gaps":
- GET /__api/search/seasons compares Emby's episode inventory against TMDB's
  per-season episode counts to mark each season complete/partial/missing.
- POST /__api/search/fill picks the best complete-season pack (LLM) for every
  missing/incomplete season and queues them. Front-end routes TV titles to a
  season plan + "Fill all gaps" instead of the movie release list.

Adds tmdb.tmdbSeasons; shared tmdb module import in search.js.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 19:11:30 -04:00
wmantly fd5ef14999 Harden auth, add AI smart-search and post-download organization
Security & correctness hardening:
- Gate /__api/token/auth behind auth and self-scope every handler to the
  caller (was fully unauthenticated — account-takeover hole).
- Escape LDAP filter values (injection) and reject empty-password binds.
- Enforce per-torrent ownership so private torrents aren't exposed via IDOR.
- Assorted cleanup: fix 'use static' typos, drop dead Torrent.migrate + the
  getTorrentData noUpdate flag, Buffer.alloc, __dirname-relative reads,
  res.statusCode in the error handler, const-scope pubsub.

Login-gated proxy + anti-indexing:
- Block all proxying for logged-out users via an auth-token cookie the front
  end mirrors from its token; serve a local login page instead of hitting TPB.
- robots.txt disallow-all + X-Robots-Tag noindex.

Torrent category:
- Store a normalized category (TV/Movie/Music/Adult/App/Game/Other) mapped
  from the TPB category id; captured at add time (migration).

Smart Search (movies/TV):
- New /__api/search: TMDB title confirm -> scrape piratebay.party HTML ->
  Ollama ranks releases against quality prefs (x265/1080p/~1.5GB/subs,
  prefer uncut) returning a recommended pick, optional warned 4K, and other
  editions. Front-end Smart Search box + dialog feeding the existing add flow.

Post-download organization -> Emby (public Movie/TV only):
- Completion watcher files finished torrents: Ollama parses the release name,
  TMDB canonicalizes title/year, files main video (+subs) into the library
  with edition/quality-aware names (movies + TV SxxExx), stops seeding, and
  triggers an Emby library scan. Low-confidence matches are flagged, not
  mis-filed; correctable via "Fix match". Adds organizedAt/metadata columns.

Shared helpers: controller/tmdb.js, controller/ollama.js. Config blocks for
tmdb/ollama/search/emby/library/organize (secrets stay in gitignored secrets.js).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 14:19:13 -04:00
wmantly b30fe748b2 Merge pull request 'private' (#10) from private into master
Reviewed-on: http://git.theta42.com/718itbiz/tpbproxy/pulls/10
2025-11-17 18:35:56 +00:00
wmantly 331298825e Merge branch 'master' of ssh://git.theta42.com:2222/718itbiz/tpbproxy into private 2025-11-17 13:34:58 -05:00
wmantly 4719117504 Private session 2025-11-17 13:34:35 -05:00
wmantly c0c33b8859 Merge pull request 'Private download' (#9) from private into master
Reviewed-on: http://git.theta42.com/718itbiz/tpbproxy/pulls/9
2025-11-16 22:44:13 +00:00
wmantly 1922cf5b87 Private download 2025-11-16 17:43:35 -05:00
wmantly fa5b7a3249 Merge pull request 'proxy fixes' (#8) from cache-fix into master
Reviewed-on: #8
2025-02-22 21:50:33 +00:00
wmantly 60f65152cb proxy fixes 2025-02-22 16:49:26 -05:00
wmantly d34b74e505 Merge pull request 'bind issue fixed' (#7) from cache-fix into master
Reviewed-on: #7
2025-02-22 21:47:31 +00:00
wmantly 600173c959 bind issue fixed 2025-02-22 16:46:48 -05:00
wmantly 49fd73aaf9 Merge pull request 'Stopped completed torrents for doing GET for updated data' (#5) from sql into master
Reviewed-on: #5
2024-01-07 06:47:20 +00:00
wmantly ffa0f07daf Stopped completed torrents for doing GET for updated data 2024-01-07 01:46:28 -05:00
wmantly dc9f73961e Merge pull request 'sql' (#4) from sql into master
Reviewed-on: #4
2024-01-07 06:39:14 +00:00
wmantly bbcd955f28 Fixed issue where migrate deletes auth token 2024-01-07 01:37:43 -05:00
wmantly c6cc529d54 completed torrents no longer ask transmission for update 2024-01-07 01:37:19 -05:00
wmantly a4094cb795 Merge pull request 'SSO login' (#3) from sql into master
Reviewed-on: #3
2024-01-07 05:35:35 +00:00
wmantly 1c7e2e794e works 2024-01-07 00:30:53 -05:00
wmantly 7fad640cca more... 2024-01-06 15:10:39 -05:00
wmantly abc547c642 lots... 2024-01-05 22:06:34 -05:00
wmantly c8f00cdeaf merged 2022-01-01 17:07:30 -05:00
root 2c520e3c3c stuff 2022-01-01 21:53:32 +00:00
root fb08554aa7 ? 2020-05-15 22:42:38 +00:00
wmantly edcc7f6e62 transmission added 2020-03-23 14:07:50 -04:00
wmantly d80073d715 fixed #1 2020-02-16 22:40:20 -05:00
wmantly af13200158 mvp1 2020-02-16 13:05:52 -05:00
wmantly 789a51c6e2 mvp 2020-02-16 12:17:20 -05:00
wmantly 249c9cb1f3 basic project 2020-02-16 03:01:30 -05:00
wmantly a5165478b9 test1 2020-02-15 15:15:51 -05:00
wmantly 6e42c2a819 test1 2020-02-15 15:06:38 -05:00
wmantly e7a8c9a11d started 2020-02-15 14:58:52 -05:00
git-hosting 55f473bd2c Initial commit 2020-02-15 19:47:05 +00:00