Commit Graph

1850 Commits

Author SHA1 Message Date
Estrella Pan
758cc986bb fix(downloader): build qB rule filter as regex alternation, not char-join
build_rss_rule joined the comma-separated filter string with '|' via
str.join, which splits it into characters ('720,480' -> '7|2|0|,|4|8|0')
instead of alternating whole terms ('720|480') the way every other filter
site does with .replace(',', '|'). Latent since the rule dict was first
written; low real-world impact (the download path uses add_torrent, not
qB-native RSS rules) but the extracted helper is now correct.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 14:47:22 +02:00
Estrella Pan
939ba5b6ab refactor(database): drop the now-unused sync engine
No production code imports the sync `engine` after the async flip. Remove it
and its foreign_keys connect listener; the migration tests build their own
throwaway sync engine via create_engine and the sync create_tables/
run_migrations helpers in migrations.py, which are kept for that purpose.
DATA_PATH stays only to derive ASYNC_DATA_PATH.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 14:35:31 +02:00
Estrella Pan
1cd740657a refactor(database): flip repositories, Database, and all consumers to async
Convert the whole DB stack from a sync Session to AsyncSession in one atomic
change. The async boundary cannot be split into individually-green commits:
async repositories and sync consumers cannot coexist, and the API service-mock
tests break the moment the consumers flip, so the planned repos/consumers/test
commits land together here.

- Repositories (bangumi/rss/torrent/user) take an AsyncSession; every method is
  async. user.py drops sqlmodel session.exec for session.execute().scalars().
- Database is an async context manager over async_session_factory (with an
  optional engine= DI seam for tests); add stays sync, commit/rollback/refresh/
  close and create_table/run_migrations/migrate are async. get_db is async.
- migrations.py gains create_tables_async / run_migrations_async wrappers that
  drive the existing sync-Connection bodies via async_engine.begin() + run_sync.
- Delete the module-level bangumi TTL cache entirely. Its real job — matching
  every torrent in an RSS refresh without re-querying per call — is now done by
  loading the active bangumi list ONCE per refresh cycle in RSSEngine.refresh_rss
  and matching in memory via match_bangumi_in_list().
- Flip every consumer to `async with Database()` + awaits: rss engine/analyser,
  managers (torrent/renamer/collector), core loops/context/offset_scanner,
  notification manager (dropping the asyncio.to_thread poster shim for a direct
  async query), security/api auth helpers, all api routes, mcp tools/resources,
  and the update/* startup chain.
- Fix two pre-existing latent bugs: update/rss.py::update_main_rss and
  update/data_migration.py::data_migration called the async engine.add_rss(...)
  WITHOUT await, so the calls were silently never executed. Both are now awaited
  and their enclosing functions made async up to AppContext.startup.
- RSSEngine/TorrentManager lose their transitional __enter__/__exit__; routes
  construct them plainly. Test fixtures go async (in-memory StaticPool engine;
  bare Database() rebound to a per-test temp-file DB; get_db overridden).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 14:34:17 +02:00
Estrella Pan
6c73226826 refactor(database): enable WAL + busy_timeout on the async engine
Concurrent aiosqlite connections replace the single serialized sync Session,
so add PRAGMA journal_mode=WAL and PRAGMA busy_timeout=5000 to the async
engine's connect listener (keeping foreign_keys=ON). Extract the listener as
_set_sqlite_pragmas_async so tests can attach it to a throwaway engine.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 13:50:10 +02:00
Estrella Pan
efdfacfbae refactor(core): replace Program god-object with lifespan composition root
AppContext is built in create_app and owned by the lifespan: startup() is
awaited before serving (errors abort boot), and start_tasks() runs as a
supervised background task. A generic PeriodicTask/Scheduler replaces the four
Thread mixins, with per-tick bodies moved to plain functions in loops.py. The
MCP app now takes the context instead of importing the api.program global.
Config updates go through reload_settings(), restoring the RSS re-application
that was previously commented out. SessionStore adds session expiry and
constant-time token comparison, and downloader shutdown() is wired into app
shutdown.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 13:39:24 +02:00
Estrella Pan
5c73aa0013 feat(downloader): reuse qBittorrent session across operations (#1039, #900)
Cache one concrete client per connection-settings key at module level and reuse
it across `async with DownloadClient()` blocks instead of logging in on enter and
out on exit every operation (~1/min from the rename loop). QbDownloader.auth is
now idempotent — a live, authenticated client short-circuits without re-posting
login — and data operations go through a _request wrapper that re-authenticates
once and retries on a 403 (expired session). __aexit__ no longer logs out; a new
shutdown() module function tears the cached client down (wired up by the Phase 5
composition root). MockDownloader/Aria2Downloader gain the same auth idempotency.
When connection settings change, the stale client is retired and closed lazily on
the next enter. A failed fresh login still closes the pool and drops the cache
entry before raising (leak fix, #1043).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 13:08:19 +02:00
Estrella Pan
f363fcb9ef refactor(downloader): protocol + capabilities, module-level path helpers, composed services
Introduce a DownloaderClient Protocol with per-backend DownloaderCapabilities;
the DownloadClient facade now consults capabilities and skips-and-logs
unsupported operations instead of relying on NotImplementedError stubs. Aria2
advertises only its core surface (auth/logout/add_torrents) and its ~20
NotImplementedError bodies are deleted; qB and Mock advertise the full surface
(Mock gains get_torrents_by_tag).

Extract the qB RSS rule dict into rules.build_rss_rule and route both the
facade set_rule and manager.update_rule through a new DownloadClient.set_rss_rule
guarded by can_rss_rules. Convert TorrentPath methods into module-level
functions in downloader.path and update all callers.

Recompose Renamer, SeasonCollector, and SearchTorrent to take/hold their
collaborators instead of inheriting DownloadClient / RequestContent / RSSAnalyser,
and update their call sites (sub_thread, api.rss, api.search, mcp.tools).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 13:07:38 +02:00
Estrella Pan
731830cf86 refactor(database): composition over inheritance for Database, RSSEngine, TorrentManager, RSSAnalyser
Break the DB-side inheritance chains so no service IS-A Session:

- Database no longer subclasses sqlmodel.Session; it now owns a Session
  (self.session) and constructs the repos from it. It keeps its
  context-manager role plus thin add/commit/rollback/refresh/close delegates
  for the call sites that relied on Database being a Session, and retains
  create_table/run_migrations/drop_table/migrate.
- RSSEngine and TorrentManager are plain services that take a Database in
  __init__ and reach the repos through self.db. They expose rss/torrent/bangumi
  as read-only properties over self.db and keep a trivial __enter__/__exit__ so
  the existing `with Service(db) as x:` call sites and their black-box tests
  stay valid.
- RSSAnalyser no longer subclasses TitleParser; it calls TitleParser.raw_parser /
  mikan_parser / tmdb_parser statically. SearchTorrent keeps composing
  RSSAnalyser and works unchanged because those methods are now static calls.
- API routes obtain a request-scoped Database through a new get_db FastAPI
  dependency (module/database/__init__.py) and build the service from it.
- Lifecycle-only call sites that previously went through an RSSEngine (create
  table / run migrations / migrate / default user) now use Database directly.

No behavior change; the REST API contract is frozen. Added minimal black-box
tests for the previously-uncovered routes (/rss/analysis, /rss/collect,
/rss/subscribe, PATCH /bangumi/{id}/weekday) before refactoring. Full suite:
741 passed / 71 skipped / 2 xfailed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 12:32:18 +02:00
Estrella Pan
0b4cbf4744 refactor(database): extract table-driven schema migrations
Move the migration machinery out of the Database session class into
module/database/migrations.py. Each Migration entry now carries a
declarative already_applied guard (column_exists / table_exists),
replacing the hardcoded per-version if-ladder in run_migrations().

Version numbers 1-9 and their SQL are unchanged — existing databases
upgrade identically. CURRENT_SCHEMA_VERSION is derived from the list, so
adding a migration is one tuple entry with its guard. The runner works on
a single sync Connection (each migration in a SAVEPOINT, stop on first
failure), which the async flip can later drive via conn.run_sync().

Database.create_table()/run_migrations() stay as thin delegates for
existing callers; they will move to the composition root in a later phase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:58:46 +02:00
Estrella Pan
1b3216fe1b Merge branch 'fix/batch-3.2.8-issues' into 3.3-dev 2026-07-02 11:57:49 +02:00
Estrella Pan
fe7298689a fix(review): tighten qB login check, propagate delete failures end-to-end, close cache race
Post-review fixes for the batch-3.2.8 branch:

- auth() and the setup wizard again require a positive success marker on
  200 responses ('Ok.' body) so a proxy or non-qB service answering
  200 + HTML is not mistaken for a login; 204 stays the qB >= 5.2 success.
- delete_rule no longer wraps a failed torrent deletion into a 200 reply,
  and the WebUI torrents-delete endpoint reports the failure instead of
  answering 'Torrents deleted' unconditionally.
- The close-on-failed-auth teardown now lives once in
  DownloadClient.__aenter__ (client.logout() before raising) instead of
  being copy-pasted into each concrete client.
- search_all() records a cache generation before querying and skips the
  cache write if an invalidation landed in between, so a stale snapshot
  can no longer overwrite a newer invalidation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:57:35 +02:00
Estrella Pan
f3634baaee refactor: remove dead code before the 3.3 architecture work
Delete the legacy notification stack (notification.py + plugin/, five
providers duplicated by the active providers/ registry, including a broken
copy-pasted slack plugin), the unused SIGALRM timeout decorator, the unused
ConflictError, the unused bgm_parser, the 0-byte transmission client stub,
unused Lock/Event state in ProgramStatus, the fully-skipped legacy RSS
engine test module, and the dev_server/test_passkey_server scratch entry
points that duplicated app assembly.

The zh notification message template now exists in exactly one place
(NotificationProvider._format_message) — the other seven copies lived in
the deleted legacy plugins.

No behavior change; full suite stays green (726 passed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:48:45 +02:00
Estrella Pan
fa24ec4e2a fix(core): stop blocking the event loop in OpenAI parsing and static routing
OpenAIParser now uses AsyncOpenAI — the previous sync SDK call ran directly
on the event loop (submitting to a ThreadPoolExecutor and immediately
blocking on .result() serialized it anyway). TitleParser.raw_parser and its
callers become async accordingly.

The SPA catch-all route listed dist/ on every request; snapshot it once at
startup. The module-level bangumi TTL cache is now lock-guarded — it is
written from asyncio.to_thread workers in notification paths while the event
loop reads it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:39:10 +02:00
Estrella Pan
6c39227aed fix(rss): throttle concurrent fetches per host to avoid HTTP 429 (#1026)
refresh_rss fired every feed at once, so sites with many subscribed feeds
(e.g. nyaa.si) rate-limited the whole batch. Feeds are now grouped by host:
serial with a 2s delay within a host, still parallel across hosts, with the
existing global concurrency cap kept.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:39:10 +02:00
Estrella Pan
487bdfec54 fix(api): harden pre-auth setup endpoints (#1041, #1044)
/setup/test-downloader now validates the URL scheme (http/https only) like
test-rss already did, and accepts qBittorrent 5.2's 204 login response.
Raw exception and response detail is no longer echoed back from the
pre-authentication setup endpoints; it goes to the server log only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:39:10 +02:00
Estrella Pan
e6aac59954 fix(downloader): make torrent deletion actually delete and report failures (#1046)
torrents_delete received a Python list, which httpx form-encodes as repeated
'hashes' fields that qBittorrent ignores — pipe-join it as the API expects.
Check the response status instead of logging success unconditionally, and
propagate the failure up through delete_torrent to the API ResponseModel.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:39:10 +02:00
Estrella Pan
930dd01220 fix(downloader): accept qBittorrent 5.2 login response and close leaked client (#1044, #1034, #1043)
qBittorrent >= 5.2 answers a successful login with HTTP 204 and an empty
body instead of 200 + 'Ok.', so every login was treated as bad credentials.
Accept both variants and keep 200 + 'Fails.' as a failure.

Also close the httpx.AsyncClient when auth() fails: DownloadClient.__aenter__
raises before __aexit__ can run, so each failed connect leaked a client and
its connection pool (qb and aria2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014w1Z6Nxy6XTRgkFXqPr9Zh
2026-07-02 11:39:10 +02:00
Estrella Pan
8169a2cc13 fix(downloader): cap qB httpx keepalive to prevent stale-socket storms (#1028)
Closes #984

Apply httpx.Limits(keepalive_expiry=30, max_connections=10, max_keepalive_connections=5) to the qBittorrent AsyncClient — same recipe as #1018 for the RSS side. Prevents the "Server disconnected" cascade when a proxy / NAS silently reaps idle sockets between renamer cycles.
2026-04-19 13:10:30 +02:00
Estrella Pan
1fbc0e3543 Merge pull request #1027 from EstrellaXD/fix/batch-3.2.7-followup
fix: batch bug fixes for 3.2.7 (#1016, #983, #1025, #994, #1015)
2026-04-19 13:04:17 +02:00
Estrella Pan
07522ae284 ci(release): include pyproject.toml / uv.lock / requirements.txt (#994, #1015)
The release artifact only zipped backend/src, omitting pyproject.toml and
uv.lock, so local deployments couldn't install dependencies. #994 also
reported the missing requirements.txt after the uv migration in 3.2.0.

Install uv in the release job and generate a production-only
requirements.txt via `uv export --no-dev`, then bundle all three alongside
src in the app zip.

Closes #994
Closes #1015
2026-04-19 13:01:27 +02:00
Estrella Pan
90239b0843 fix(parser): stop destroying titles without a [group] prefix (#1025)
prefix_process called re.sub(f".{group}.", "", raw) unconditionally. When
group was empty (torrents that don't start with [group]), the pattern
degenerated to ".." and every pair of characters in the title was deleted,
leaving a stub the downstream splitter couldn't turn into title_en/zh/jp.

Guarded the substitution with `if group:`. Titles like
"冰之城墙「氷の城壁」The Ramparts of Ice S01E02 1080p 日英双语-多国字幕"
and "Girls Band Cry S01E05 ..." now parse correctly. Updated #764's test
which had been pinned to the broken behavior.

Closes #1025
2026-04-19 13:00:35 +02:00
Estrella Pan
813078913a fix(network): follow 302 redirects in shared httpx client (#983)
Mikanime's mirror (and some CDN-fronted sources) respond with 302 to the
canonical host. httpx AsyncClient defaults to follow_redirects=False, so
raise_for_status surfaced the 302 as an HTTPStatusError and the RSS pull
failed in a retry loop.

Enable follow_redirects=True for every construction of the shared client
(proxy, socks5, and direct branches) via a shared kwargs dict.

Closes #983
2026-04-19 12:57:40 +02:00
Estrella Pan
4e9d8b34ab fix(downloader): parse Windows qB save_path on Linux hosts (#1016)
When AB runs in a Linux container and qBittorrent runs on a Windows host,
qB returns save_path strings with backslash separators. PurePosixPath
treats those as a single unsplittable segment, so _path_to_bangumi never
matched "Season N" and every non-S1 bangumi collapsed to Season 1.

PureWindowsPath accepts both "\\" and "/" as separators, so using it for
the parsing side handles both layouts. Path generation (_gen_save_path /
_join_path) still uses the platform-conditional Path alias, so AB keeps
emitting native paths for the host it runs on.

Diagnosis and fix credited to the reporter in #1016.

Closes #1016
2026-04-19 12:56:46 +02:00
ZzzzSsssWwww
d849edf89f fix(network): harden shared httpx client against stale connections (#1018)
RSS loop runs every 900s but reuses the same httpx.AsyncClient connection pool, well past server keep-alive expiry (60-120s). Reusing dead sockets produced ConnectTimeout errors over time.

- Configure httpx.Limits with keepalive_expiry=60s so idle connections are dropped proactively
- reset_shared_client() called on retry paths to force a fresh pool after ConnectError
- asyncio.Semaphore(5) in refresh_rss() caps concurrent RSS fetches to avoid tripping site rate limits

Closes #1008
Related #1010, #742, #701
2026-04-19 12:50:18 +02:00
ZzzzSsssWwww
6235892de2 fix(rss): cascade-delete torrents when deleting RSSItem (#1019)
Deleting an RSSItem failed with sqlite3.IntegrityError: FOREIGN KEY constraint failed when child torrents still referenced it, leaving the sidebar entry stuck in the UI.

- delete() now removes referencing torrents in the same transaction before removing the RSSItem
- Adds missing session.rollback() in the exception path
- rss_loop wraps each iteration to skip stale RSSItems deleted mid-loop via API
- Tests enable PRAGMA foreign_keys=ON to match production and gain 5 cascade-delete regression tests

Closes #1010
Closes #1017
2026-04-19 12:50:09 +02:00
Alex Tazman
117c24ce77 fix(checker): respect SSL setting when probing qBittorrent (#1014)
Startup probe hardcoded http:// ignoring settings.downloader.ssl, causing 5-minute startup delay when qBittorrent is HTTPS-only or redirects http→https.

Now derives the scheme from settings.downloader.ssl.
2026-04-19 12:49:59 +02:00
stonebeta
e819a77656 perf(entrypoint): narrow chown scope to skip .venv (#1011)
Reduces container startup time on low-spec devices (TrueNAS etc.) by limiting recursive chown to /app/data, /app/config, /home/ab instead of /app.

Closes #969 (related performance).
2026-04-19 12:49:48 +02:00
Estrella Pan
0dd8ce99ad test: add regression tests for issues #992 and #1005
- #992: title_parser returns None for non-episodic resources instead of crashing
- #1005: BangumiDatabase.search_official_title method exists and works correctly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 08:14:06 +01:00
Estrella Pan
d980c3c714 fix(parser): handle None return from raw_parser to avoid AttributeError (#992)
When raw_parser fails to parse non-episodic resources (movies, collections),
it returns None. Add guard clause in title_parser to skip these gracefully
instead of crashing on attribute access. Downgrade log level from error to
info since this is expected behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 08:12:18 +01:00
Estrella Pan
66a2b45f57 Merge remote-tracking branch 'origin/3.2-dev' into 3.2-dev 2026-03-01 08:07:26 +01:00
Estrella Pan
1d35b654e7 Merge pull request #998 from HuajunGao/fix/bangumi-search-official-title 2026-03-01 08:02:40 +01:00
Estrella Pan
ccafd04432 Merge pull request #1003 from EstrellaXD/3.2-dev
Release 3.2.5
3.2.5
2026-02-28 22:52:18 +01:00
Estrella Pan
61ff20fef6 fix(api): preserve masked passwords on config save and allow private IPs in setup (#995, #1001)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:48:38 +01:00
Estrella Pan
17de8fa8fe Merge pull request #1000 from HuajunGao/fix/mcp-sse-none-response
Thanks for catching this! Clean fix for the SSE disconnect issue.
2026-02-28 22:46:44 +01:00
Estrella Pan
903ecaf84a Merge pull request #999 from HuajunGao/fix/default-filter-regex
Thanks for the fix! The regex alignment makes sense.
2026-02-28 22:46:42 +01:00
Estrella Pan
62ee9f02ec Merge pull request #997 from HuajunGao/fix/config-sensitive-field-overwrite 2026-02-28 22:32:00 +01:00
HuajunGao
ab64186a38 fix(mcp): return Response() from handle_sse to prevent NoneType error
When an MCP client disconnects, Starlette tries to call the return value
of the handle_sse endpoint as an ASGI response. Since the function had
no return statement it returned None, causing:

  TypeError: 'NoneType' object is not callable

The mcp library's own SseServerTransport docstring explicitly documents
this requirement. Fix by adding 'return Response()' and importing
starlette.responses.Response.
2026-02-28 14:54:43 +11:00
HuajunGao
a263c0821e fix(config): align default filter regex from \d+-\d to \d+-\d+
The per-bangumi default in Bangumi model already uses \d+-\d+ to filter
batch/collection torrents (e.g. '01-13'). The global RSSParser default
was inconsistently using \d+-\d (one fewer +), which has subtly different
matching behaviour.

Align both defaults to \d+-\d+ for consistency.
2026-02-28 14:32:59 +11:00
HuajunGao
d4e50509dd fix(database): add missing search_official_title method to BangumiDatabase
BangumiDatabase.search_official_title() was called in
notification/manager.py (_get_poster) but never implemented,
causing a RenameThread crash:

  'BangumiDatabase' object has no attribute 'search_official_title'

Add the method as a simple exact-match lookup on Bangumi.official_title,
consistent with the existing search_id / search_rss pattern.
2026-02-28 12:14:50 +11:00
HuajunGao
6fb8421000 fix(config): restore sensitive fields before saving to prevent credential overwrite
When GET /config/get returns config to the frontend, sensitive fields
(password, token, api_key, secret) are masked as '********'.  If the
user changes any non-sensitive setting (e.g. ssl: true → false) and
saves, the frontend sends back the masked placeholder verbatim.  The
backend was saving it directly, overwriting the real credential with
the literal string '********', breaking authentication silently.

Add _restore_sensitive() to substitute any '********' placeholder with
the current in-memory value before writing to disk.  Non-sensitive
fields and genuinely new values are unaffected.

Fixes #995
2026-02-28 11:40:25 +11:00
Estrella Pan
e1b90c9eec 3.2.4
3.2.4
3.2.4
2026-02-24 19:56:57 +01:00
Estrella Pan
ded24b10da fix(downloader): fix qBittorrent SSL connection and rename verification (#923)
- Decouple HTTPS scheme selection from TLS certificate verification:
  `verify=False` always, since self-signed certs are the norm for
  home-server/NAS/Docker qBittorrent setups
- Bump connect timeout from 3.1s to 5.0s for slow TLS handshakes
- Add actionable error messages when HTTPS connection fails
- Fix `continue` → `break` bug in torrents_rename_file verification loop
- Consolidate json imports to top-level
- Add 31 unit tests for QbDownloader constructor, auth, and error handling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 19:52:50 +01:00
Estrella Pan
fe1858f0e6 fix(webui): close EventSource and clear timers on component unmount
Prevent memory leaks by ensuring the search EventSource connection is
closed when the modal unmounts and setTimeout handles are cleared in
copy-to-clipboard flows across modal components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 19:44:49 +01:00
Estrella Pan
ead16ba4cf feat(parser): add fallback episode parser for TITLE_RE failures (#876, #910, #773)
Add _fallback_parse() tried when TITLE_RE.match() returns None, using two
regex patterns to extract episode numbers from formats the main regex misses:
- digits before [ bracket (issues #876, #910)
- compound [02(57)] format (issue #773)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:12:24 +01:00
Estrella Pan
c261caa022 test(parser): add regression tests for issue #990
10 tests covering the full bug chain:
- raw_parser misparses leading number as episode
- TitleParser.raw_parser returns None for unparseable titles
- add_title_alias rejects None and empty string
- _get_aliases_list filters null values from JSON
- get_all_title_patterns skips None title_raw
- match_torrent and match_list handle corrupted data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:44:18 +01:00
Estrella Pan
c7206a351f fix(parser): prevent crash on titles starting with numbers (#990)
Titles like "29 岁单身冒险家的日常" cause the regex to match the leading
number as episode, leaving title_raw as None. This cascades into storing
null aliases and crashing match_torrent with TypeError.

- Fall back to title_jp when title_en and title_zh are both None
- Return None from raw_parser when no title can be extracted
- Reject None/empty aliases in add_title_alias
- Filter null values from parsed title_aliases JSON
- Skip None title_raw in get_all_title_patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:36:25 +01:00
Estrella Pan
b57d3c49ae feat(security): add security config UI and improve auth/MCP security
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 17:19:14 +01:00
Estrella Pan
a0bf878b7e feat(calendar): add drag-and-drop to assign unknown bangumi to weekdays
Allow users to drag bangumi cards from the "Unknown" section into weekday
columns in the calendar view. Manual assignments are locked so calendar
refresh from Bangumi.tv doesn't overwrite them. A reset button lets users
unlock and send cards back to Unknown.

Backend:
- Add weekday_locked field to Bangumi model (migration v9)
- Add PATCH /api/v1/bangumi/{id}/weekday endpoint
- Skip locked items in refresh_calendar()

Frontend:
- Add vuedraggable for smooth drag-and-drop
- Pin indicator and unpin button on manually-assigned cards
- Drop zone highlighting during drag
- i18n strings for drag/pin/unpin

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:21:00 +01:00
Estrella Pan
ba61194d3d Merge pull request #972 from EstrellaXD/3.2-dev
3.2.3
3.2.3
2026-02-23 12:57:06 +01:00
Estrella Pan
326d31dd0f Merge origin/main into 3.2-dev (resolve version conflict)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:55:18 +01:00