Commit Graph

42 Commits

Author SHA1 Message Date
Matthieu B
31005dcf87 Fix recent onboarding and media-server bugs (#1318)
* fix: resolve button widget context URLs

Fixes #1280

* fix: return relative invitation API URLs

Fixes #1262

* fix: use modern Jellyfin auth headers

Fixes #1309

* fix: use Emby library GUIDs for access policy

Fixes #1303
2026-07-05 18:14:39 +02:00
Matthieu B
6ebafbf328 fix: deduplicate wizard steps in multi-server setups and add bundle selection to API
Default wizard steps were duplicated once per server instance of the same
type (e.g., 2 Plex servers → 6 steps instead of 3). Deduplicate the
server type list before loading steps so each type's steps appear only once.

Also add the missing wizard_bundle_id parameter to the invitation creation
API, matching the existing web UI capability.

Closes #1219
2026-04-01 22:33:27 +02:00
Matthieu B
b642d9100b Merge pull request #1200 from wizarrrr/fix/1182-user-created-at
fix: add missing created_at column to User model
2026-03-29 16:25:40 +02:00
Matthieu B
73c29458fe fix: resolve all test failures, linting errors, and type errors
- Fix 55 test failures caused by missing request contexts and incorrect
  session_transaction() usage across 8 test files
- Fix ruff import sorting errors and unused imports
- Fix 122 type errors: rename method override parameters to match base
  classes, add None guards for fetchone()/datetime, widen dict type
  annotations, add type: ignore for SQLAlchemy stub limitations
- Add [tool.ty.rules] config to suppress unsupported-base warnings
- Fix _ variable shadowing gettext in wizard routes
- Add noqa: ARG002 for unused method arguments required by base class
2026-03-29 16:20:23 +02:00
Matthieu B
41ca8856f0 fix: add missing created_at column to User model (#1182)
Add created_at column to the User model, an Alembic migration to
backfill existing rows via server_default, and update the API
serialization and OpenAPI spec from the stale `created` field to
`created_at` so the joined/created date is no longer returned as null.
2026-03-29 16:11:05 +02:00
Matthieu B
89762d96dd feat: add bundle preview functionality and improve token generation tests
- Added a preview link for bundles in the wizard settings page. closes #1048
- Enhanced the wizard steps template to handle bundle preview mode.
- Updated JavaScript to generate URLs for bundle preview and runtime modes.
- Improved test coverage for password reset token generation by asserting token creation.
2025-12-09 14:37:39 +01:00
Matthieu B
ac36e793e1 refactor: improve code formatting and readability across multiple files 2025-12-09 14:12:17 +01:00
Matthieu B
9651cd0268 Update app/blueprints/api/api_routes.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-04 12:57:25 +01:00
Simon
930b1c1a2c feat: Implements password reset functionality.
- A new API endpoint for requesting a password reset token, which can be accessed either through an API key or an authenticated session.
- A public route for handling the password reset process using the generated token.
- Updates media client to allow password resets.
2025-11-21 00:15:09 +01:00
Matthieu B
9b5aa0972a refactor: remove slop from media and new linting rules 2025-10-23 18:33:50 +02:00
Mully
4996b1c8f3 fix: separate disable and enable
+ Much clearer separation of enable and disable (fixing the earlier terrible idea)

+ Audiobookshelf, jellyfin and romm now have enable user logic in the enable_user func
2025-10-10 10:45:40 -04:00
Mully
104c529fba fix: linting error regarding imports 2025-10-10 10:23:15 -04:00
Mully
2564e5b661 fix: import enable_user to API routes 2025-10-10 10:17:44 -04:00
Mully
73e1e12629 feat: enable user endpoint
+ POST /users/<user_id>/enable added

+ Most service's enable_user implementation informs the user that enabling is not supported

+ Audiobookshelf, Jellyfin and RomM can now both disable and enable users

+ Since the few platforms that natively support disabling/enabling users use the same endpoints, disable_user has been given an optional boolean param called enable which defaults to false. This reduces the need of any working enable_user funcs to have a nearly identical implementation.
2025-10-10 10:00:17 -04:00
Matthieu B
b54ea22ca3 fix: action running 2025-10-08 14:44:04 +02:00
Mully
adb9d8a026 fix: linting errors & unused import
- Removed now-unused admin_model import

- Removed some whitespace
2025-10-07 12:03:58 -04:00
Mully
97d3b67dc1 fix: add func import from sqlalchemy 2025-10-07 11:55:13 -04:00
Mully
2bf2a63065 fix: N+1 passkey query in /admins
+Replace individual passkey count queries with single JOIN query (now uses single optimized query regardless of admin count.)

- Previously executed 1+N database queries (1 for admins + 1 per admin
for passkey counts).

+ Also moved username filtering to database level for better performance.
2025-10-07 11:39:25 -04:00
Mully
3c0dd6e162 fix: import new models
+ Added admin_model and admin_list_model imports to api_routes
2025-10-06 11:34:52 -04:00
Mully
18715f3a6c feat: add GET /admins endpoint
+ Created admins namespace in api_routes for new /admins endpoint

+ GET /admins endpoint added to api_routes (similar to GET /users)

GET /admins returns:
- Admin account info (admins)
- Total # of admins (count)

For each admin in admins:
- ID (id)
- Username (username)
- # of Passkeys (passkeys)
- Creation date (created)

More detailed information can be found in the small models.py diff
2025-10-06 10:48:04 -04:00
Matthieu B
fc49da65f6 refactor: fix ruff linting and ty type errors
- Fix invalid parameter defaults: library_id: str | None = None
- Replace try-except-pass with contextlib.suppress()
- Remove unnecessary dict.keys() calls
- Remove unnecessary variable assignments before return
- Combine nested if statements
- Add type ignore comments for intentional shadowing
- Add type ignore comments for SQLAlchemy dynamic attributes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 22:06:15 +02:00
Matthieu B
27a570258f feat: add user disable functionality and integrate with media server service 2025-09-28 11:47:31 +02:00
Matthieu B
e95cb7f909 feat: enhance user listing endpoint with filtering by username and email 2025-09-19 22:24:37 +02:00
Matthieu B
cc4c0dad86 feat: add user expiry update endpoint and models 2025-09-19 22:11:44 +02:00
Matthieu B
c317e66fa8 fix: update API key hashing to use UTF-8 encoding and improve bundle name handling in export
fix: add requests.exceptions import in Audiobookrequest and Ombi clients
fix: ignore type errors in invitation unit tests for library and server associations
fix: use timezone-aware datetime for export dates in WizardExportImportService
2025-09-05 14:41:37 +02:00
Matthieu B
7466ce86c4 Enhance library migration and invitation linking logic for multi-server support 2025-08-14 10:47:26 +02:00
Matthieu B
1723e876b6 Refactor API models and invitation flow; add comprehensive tests
- Updated `InvitationCreateRequest` model to change `server_ids` from required to optional with improved description.
- Enhanced `library_model` to include `external_id`, `server_name`, and `enabled` fields.
- Modified `InvitationFlowManager` to prioritize new many-to-many relationship checks for invitations.
- Created a new migration file to merge branches related to API key and foreign key improvements.
- Added comprehensive tests for API endpoints, including status, users, invitations, libraries, servers, and API key management.
- Implemented error handling tests for malformed JSON and inactive API keys.
2025-08-13 20:58:11 +02:00
Matthieu B
d69feaf67f Complete Flask-RESTX migration for automatic API documentation
 Replaced manual API documentation with Flask-RESTX OpenAPI generation
 All endpoints now auto-generate Swagger UI at /api/docs/
 Maintained backward compatibility - all existing API functionality preserved
 Added comprehensive OpenAPI models for request/response validation

Changes:
- app/blueprints/api/api_routes.py: Migrated from Flask routes to Flask-RESTX Resource classes
- app/blueprints/api/models.py: Created OpenAPI schema definitions
- app/extensions.py: Added Flask-RESTX configuration with API key security
- pyproject.toml: Added flask-restx>=1.3.0 dependency
- README.md: Updated API documentation to point to interactive Swagger UI
- docs/API.md: Simplified to quick-start guide pointing to automatic docs
2025-08-13 20:16:07 +02:00
Matthieu B
b27167e4eb Merge latest changes from main
Resolved conflicts in:
- app/models.py: Combined ApiKey and ExpiredUser models
- app/logging_config.py: Combined API logger and alembic logger configurations
- app/blueprints/public/routes.py: Combined server resolution approaches with fallback
2025-08-13 20:15:05 +02:00
Tomat0r
a437181f87 Update app/blueprints/api/api_routes.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-11 21:45:54 +02:00
copilot-swe-agent[bot]
87de7c0679 Implement API server differentiation and ready-to-go links
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-08-11 16:50:44 +00:00
copilot-swe-agent[bot]
3532cd596f Fix SQLAlchemy legacy API warnings by replacing query.get() with session.get()
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-08-11 15:56:11 +00:00
copilot-swe-agent[bot]
10e8b4ae13 Implement server name fallback logic for invitations
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-07-29 14:48:36 +00:00
copilot-swe-agent[bot]
f59693396c Fix linting issues and finalize invitation server defaulting implementation
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-07-29 14:17:06 +00:00
copilot-swe-agent[bot]
6e761c9a05 Implement invitation server defaulting logic for API
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-07-29 14:14:56 +00:00
copilot-swe-agent[bot]
3cf6332b92 Fix library scanning and invitation server name display issues
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-07-28 21:45:00 +00:00
copilot-swe-agent[bot]
0613652129 Complete API testing, documentation and additional endpoints implementation
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-07-28 13:15:04 +00:00
copilot-swe-agent[bot]
1b1159e0f3 Fix API key deletion UI glitch and improve API endpoint functionality
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-07-28 13:06:36 +00:00
copilot-swe-agent[bot]
60cb5d8972 Implement comprehensive API system with key management
Co-authored-by: Tomat0r <68383702+Tomat0r@users.noreply.github.com>
2025-07-28 12:02:42 +00:00
Matthieu B
02126de7b8 Add ty dependency and pre-push hook for type checking
- Added `ty` version 0.0.1a14 to dependencies in `pyproject.toml`.
- Updated `.pre-commit-config.yaml` to include a pre-push hook for type checking using `ty`.
- Made minor adjustments in various files to ensure compatibility with type checking.
2025-07-15 21:32:43 +02:00
Matthieu B
7b8f64af7d Fix SQLAlchemy model constructors to accept keyword arguments
- Added __init__ constructors to all SQLAlchemy models
- Fixed pyright 'No parameter named' errors across the codebase
- Fixed various ruff linting issues (SIM108, E741, E402, SIM102, B904, SIM105)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-15 13:52:15 +02:00
Jandalslap
5c0f3616f6 Refactor api/status endpoint
Moved from app/blueprints/status/routes.py to app/blueprints/api/status.py and recreated using SQLAlchemy.
2025-05-31 09:36:31 +12:00