Commit Graph

257 Commits

Author SHA1 Message Date
Estrella Pan
d2bf733a3e feat(database): auto-fill NULL values with model defaults during migration
When migrating from older versions, new columns may have NULL values.
This adds a generic mechanism that scans all table models and fills
NULL values based on field defaults defined in SQLModel, improving
data consistency for upgraded databases.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:13:17 +01:00
Estrella Pan
683e272b4d fix(core): add max retry for downloader connection check
Prevents startup from hanging indefinitely when downloader is
unreachable (e.g., due to proxy configuration). After 10 retries
(~5 min), program continues with an error log instead of blocking.

Fixes #955 (comment)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:58:55 +01:00
Estrella Pan
5064d42d59 chore: bump version to 3.2.0-beta.6
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:48:29 +01:00
Estrella Pan
ecd7914f22 fix(db): prevent duplicate bangumi rules in add_all method
- Add _is_duplicate() helper to check by (title_raw, group_name)
- Fix add_all() to skip existing records and deduplicate within batch
- Improve add() to use same deduplication logic

feat(ui): calendar page grouping and accessibility improvements

- Calendar page now groups bangumi by title+season (same as main page)
- Add rule selection popup for grouped bangumi with multiple rules
- Add skeleton loading animation on bangumi list page
- Fix popup z-index layering with CSS variable system
- Improve accessibility: 44px touch targets, focus-visible states, aria-labels
- Add i18n translations for rule selection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:38:16 +01:00
Estrella Pan
55b15ea8fe feat: add bangumi archive and episode offset features (#958)
* feat: add bangumi archive and episode offset features

Archive Feature:
- Add archived field to Bangumi model with database migration (v4)
- Add archive/unarchive API endpoints (PATCH /bangumi/archive/{id})
- Add auto-archive for ended series via TMDB metadata refresh
- Add collapsible archived section in UI with visual styling
- Add archive/unarchive button in edit rule popup

Episode Offset Feature:
- Extract series_status and season_episode_counts from TMDB API
- Add suggest-offset API endpoint with auto-detection logic
- Apply offset in renamer gen_path() for episode numbering
- Add offset field with "Auto Detect" button in rule editor
- Look up offset from database when renaming files

The offset auto-detection calculates the sum of episodes from all
previous seasons (e.g., if S01 has 13 episodes, S02E18 → S02E05
with offset=-13).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add changelog for bangumi archive and episode offset features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:13:49 +01:00
Estrella Pan
ce5b23ea03 fix(db): resolve DetachedInstanceError and missing passkey table (#956)
- Fix DetachedInstanceError in bangumi cache by expunging objects from
  session before caching, preventing lazy loading errors when cached
  objects are accessed from different request contexts

- Add database migration v3 to create passkey table for WebAuthn support,
  fixing "no such table: passkey" error for users upgrading from older
  versions

Closes #956

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-01-25 07:52:00 +01:00
Estrella Pan
c5f4919e15 feat(rss): add connection status tracking and display
Track RSS feed reachability during refresh cycles. Each feed now stores
connection_status (healthy/error), last_checked_at, and last_error.
The RSS management page shows a green "Connected" tag for healthy feeds
and a red "Error" tag with tooltip for failed feeds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:45:04 +01:00
Estrella Pan
cba4988e52 perf: comprehensive performance optimization for backend and frontend
Backend: shared HTTP connection pool, concurrent RSS/torrent/notification
operations, TMDB/Mikan result caching, database indexes, pre-compiled
regex, __slots__ on dataclasses, O(1) set-based dedup, frozenset lookups,
batch RSS enable/disable, asyncio.to_thread for blocking calls.

Frontend: shallowRef for large arrays, computed table columns, watch
instead of watchEffect, scoped style fix, typed emits, noImplicitAny,
useIntervalFn lifecycle management, shared useClipboard instance,
shallow clone for shared template objects.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:46:45 +01:00
Estrella Pan
929a88c343 test: add comprehensive test suite for core business logic
Cover RSS engine, downloader, renamer, auth, notifications, search,
config, API endpoints, and end-to-end integration flows. When all
210 tests pass, the program's key behavioral contracts are verified.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-01-24 18:59:18 +01:00
Estrella Pan
9ebf469539 chore: bump version to 3.2.0-beta.4
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-01-24 18:29:08 +01:00
Estrella Pan
dcc60ce9a5 fix(db,downloader): fix server error on upgrade from 3.1.x to 3.2.x (#956)
- Fix 'dict' object has no attribute 'files' in renamer by using dict
  access for qBittorrent API responses and fetching file lists via
  separate torrents/files endpoint
- Replace version-file-based migration with schema_version table to
  reliably track and apply database migrations on every startup
- Add air_weekday column migration as versioned migration entry
- Add torrents_files method to QbDownloader and Aria2Downloader

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-01-24 18:26:57 +01:00
Estrella Pan
5382aec8dc feat: add first-run setup wizard with guided configuration
Add a multi-step setup wizard that guides new users through initial
configuration on first run. The wizard covers account credentials,
download client connection (with test), RSS source, media paths,
and optional notification setup.

Backend: new /api/v1/setup/ endpoints with sentinel file mechanism.
Frontend: 7-step wizard with validation and i18n (en/zh-CN).

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-01-24 08:16:41 +01:00
Estrella Pan
9235b07b41 fix: resolve config conflicts when upgrading from 3.1.x to 3.2
Old 3.1.x config files used different field names (sleep_time/times)
that were silently dropped during loading, causing user settings to
be lost on upgrade. Also fixes version migration dispatch that was
incorrectly calling 3.0→3.1 migration for all upgrades.

- Migrate old config fields: sleep_time→rss_time, times→rename_time
- Remove deprecated rss_parser fields (type, custom_url, token, enable_tmdb)
- Fix ENV_TO_ATTR mapping to use correct model field names
- Sync DEFAULT_SETTINGS with current Config model
- Add version-aware migration dispatch (from_31_to_32)
- Add comprehensive migration tests (config + database)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-01-24 07:49:23 +01:00
Estrella Pan
b1018d41fe fix(test): use sync sessions in database tests to match production code
The database classes (BangumiDatabase, TorrentDatabase, RSSDatabase) use
synchronous Session, but tests were incorrectly using AsyncSession with
await calls, causing AttributeError on coroutine objects.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-01-24 06:10:20 +01:00
Estrella Pan
a98a162500 feat: fix search, poster serving, and add hover overlay UI for cards
- Fix search store exports to match component expectations (inputValue,
  bangumiList, onSearch) and transform data to SearchResult format
- Fix poster endpoint path check that incorrectly blocked all requests
- Add resolvePosterUrl utility to handle both external URLs and local paths
- Move tags into hover overlay on homepage cards and calendar cards
- Show title and tags on poster hover with dark semi-transparent styling
- Add downloader API, store, and page
- Update backend to async patterns and uv migration changes
- Remove .claude/settings.local.json from tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:20:12 +01:00
EstrellaXD
0408ecdd61 fix(backend): use background task for startup to avoid blocking server
Change program.startup() to run via asyncio.create_task() so uvicorn
accepts connections immediately while downloader check runs in background.
Also add .claude/ project settings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 18:00:06 +01:00
EstrellaXD
3edddfec09 Merge branch 'feature/uv-migration' into 3.2-dev
# Conflicts:
#	backend/pyproject.toml
#	backend/requirements.txt
#	backend/src/module/api/passkey.py
#	backend/src/module/database/combine.py
#	backend/src/module/database/engine.py
#	backend/src/module/security/auth_strategy.py
#	backend/src/module/security/webauthn.py
#	webui/src/components/setting/config-passkey.vue
#	webui/src/hooks/usePasskey.ts
#	webui/src/pages/index/config.vue
#	webui/src/pages/login.vue
#	webui/src/services/webauthn.ts
2026-01-23 17:58:37 +01:00
EstrellaXD
2a757e8f2c feat: add calendar view with Bangumi.tv schedule integration
Add weekly broadcast schedule page showing subscribed anime grouped by
day-of-week. Backend fetches air_weekday from Bangumi.tv calendar API
and matches titles. Frontend displays responsive grid (desktop) and
vertical list (mobile). Edit popup moved to parent layout to fix
KeepAlive conflicts, and restyled with purple theme.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 17:51:19 +01:00
EstrellaXD
b3be217e4f chore: add passkey test server and v3.2 changelog
- Add minimal test server for passkey development (no downloader check)
- Add changelog for version 3.2 features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 16:15:37 +01:00
EstrellaXD
cd233881bd fix(backend): restore sync Database interface, isolate async for passkey
The previous refactoring broke backward compatibility by converting
Database from Session-extending sync class to a standalone async class.
This broke RSSEngine, startup code, and auth flows.

- Restore Database(Session) with sync interface for legacy code
- Restore UserDatabase to sync methods
- Restore security/api.py and auth.py to sync calls
- Passkey API now uses async_session_factory directly
- PasskeyAuthStrategy uses async sessions independently
- Remove unused db_session from engine.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:59:26 +01:00
EstrellaXD
027222a24d fix: resolve WebAuthn passkey compatibility with py_webauthn 2.7.0
- Fix aaguid type (str not bytes) in registration verification
- Fix missing credential_backup_eligible field (use credential_device_type)
- Remove invalid credential_id param from verify_authentication_response
- Fix origin detection to use browser Origin header for WebAuthn verification
- Add async database engine support (aiosqlite) for passkey operations
- Convert UserDatabase to async-compatible with sync/async session detection
- Update Database class to support both sync and async context managers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:07:18 +01:00
EstrellaXD
d2cfd9b150 feat: add WebAuthn passkey authentication support
- Add passkey login as alternative authentication method
- Support multiple passkeys per user with custom names
- Backend: WebAuthn service, auth strategy pattern, API endpoints
- Frontend: passkey management UI in settings, login option
- Fix: convert downloader check from sync requests to async httpx
  to prevent blocking the event loop when downloader unavailable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 14:57:00 +01:00
EstrellaXD
0c69498089 fix: requirements problem 2026-01-23 14:57:00 +01:00
EstrellaXD
c7f793a9f6 fix: secure problem, openai.py 2026-01-23 14:57:00 +01:00
EstrellaXD
9c5474d8e9 feat: migrate backend to uv package manager
Replace pip + requirements.txt with uv for dependency management.

- Multi-stage Dockerfile using ghcr.io/astral-sh/uv builder image
- CI updated to use astral-sh/setup-uv@v4
- Ruff config moved to [tool.ruff.lint] (fixes deprecation)
- Transitive deps removed, missing direct deps added (requests, PySocks, urllib3)
- Database layer migrated to async (AsyncSession + aiosqlite)
- Tests updated to match async database interface

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 12:56:23 +01:00
EstrellaXD
bfba010471 feat: add WebAuthn passkey authentication support
- Add passkey login as alternative authentication method
- Support multiple passkeys per user with custom names
- Backend: WebAuthn service, auth strategy pattern, API endpoints
- Frontend: passkey management UI in settings, login option
- Fix: convert downloader check from sync requests to async httpx
  to prevent blocking the event loop when downloader unavailable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 11:50:55 +01:00
EstrellaXD
b4d90e2a11 fix: requirements problem 2025-04-29 15:11:10 +02:00
EstrellaXD
1ed87b3dfd fix: secure problem, openai.py 2025-04-29 15:05:25 +02:00
Rewrite0
c7dc25f2f3 fix: program start error 2024-09-26 11:41:09 +08:00
Rewrite0
22dfed741e fix: program restart error 2024-09-26 09:15:54 +08:00
EstrellaXD
d5b84b9085 fix: test openai problem. 2024-09-23 18:09:16 +08:00
EstrellaXD
cbc3f1f91e fix: temp fix ab cannot startup without qb live.
Close #839
2024-09-15 11:22:01 +08:00
Estrella Pan
073e809bae Merge pull request #784 from KotaHv/fix-filter
Fix: changed the global RSS parser filter requires program restart to take effect
2024-09-15 11:00:40 +08:00
Estrella Pan
0f3479c236 Merge pull request #816 from KotaHv/fix-805
fix: #805 and support episode as int or float
2024-09-15 10:56:30 +08:00
KotaHv
2b6fa65a9f test: add new cases for test_torrent_parser 2024-07-24 15:11:05 +08:00
KotaHv
ee36b05f95 fix: support episode as int or float 2024-07-24 14:03:20 +08:00
KotaHv
6f43949585 fix: Resolve issue #805 2024-07-24 13:53:34 +08:00
Jeremy-Hibiki
89f0754d69 fix: fix multi-line title post-processing in raw_parser
close #679, #794
related pr #685
2024-07-14 17:47:41 +08:00
KotaHv
29f5617e78 fix: changed the global RSS parser filter requires program restart to take effect 2024-06-11 01:15:12 +08:00
EstrellaXD
66518fdbfc fix: model test failed. 2024-05-31 15:48:16 +08:00
Estrella Pan
ca676f9082 Merge pull request #623 from 100gle/bugfix-openai-baseurl
bugfix(experimental): add api version for openai api base automatically
2024-04-12 12:13:15 +08:00
Estrella Pan
5c1c5e2ebe Merge pull request #676 from KotaHv/fix-subtitles
fix: subtitle file rename failure in collection
2024-04-12 12:10:41 +08:00
EstrellaXD
459bc4f749 fix: temp fix third part webui cannot let ab start problem 2024-04-10 15:34:25 +08:00
Estrella Pan
6bd18fbe8b Merge pull request #675 from KotaHv/fix-2
fix: rss.parser set to default value when subscribe Bangumi
2024-04-10 15:26:46 +08:00
KotaHv
690335c4ef fix: Resolve issue #679 2024-02-01 10:33:19 +08:00
KotaHv
3fb6cf6a2e fix: subtitle file rename failure in collection 2024-01-24 22:26:31 +08:00
KotaHv
2149182a54 fix: rss.parser set to default value when subscribe Bangumi 2024-01-24 21:09:25 +08:00
2huo
0c2b1b1c3b fix: incorrect password format 2024-01-14 21:37:01 +08:00
EstrellaXD
df0292672c fix: mikan poster problem. 2024-01-09 15:25:16 +08:00
Geeksun2018
f96aa03449 setting qbittorrent doesn't create sub folders 2023-11-22 14:27:21 +08:00