From e861fca0926baebc1fc088757f43e53ee4d39c41 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Fri, 10 Apr 2026 18:29:13 -0500 Subject: [PATCH] Enhancement: Enhanced Swagger UI authorization dialog: registered a custom `OpenApiAuthenticationExtension` for `ApiKeyAuthentication` so drf-spectacular now generates an `ApiKeyAuth (apiKey)` entry alongside `jwtAuth`. Both entries include descriptive text linking to the relevant endpoints (`/api/accounts/token/`, `/api/accounts/api-keys/generate/`, `/api/accounts/api-keys/revoke/`). --- CHANGELOG.md | 1 + apps/accounts/authentication.py | 37 +++++++++++++++++++++++++++++++++ dispatcharr/settings.py | 11 ---------- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f96b283..470fc135 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Enhanced Swagger UI authorization dialog: registered a custom `OpenApiAuthenticationExtension` for `ApiKeyAuthentication` so drf-spectacular now generates an `ApiKeyAuth (apiKey)` entry alongside `jwtAuth`. Both entries include descriptive text linking to the relevant endpoints (`/api/accounts/token/`, `/api/accounts/api-keys/generate/`, `/api/accounts/api-keys/revoke/`). - Refactored frontend form components (`AccountInfoModal`, `AssignChannelNumbers`, `Channel`, `ChannelBatch`, `ChannelGroup`, `Connection`, `CronBuilder`, `DummyEPG`, and `EPG`) to extract business logic into dedicated utility modules under `src/utils/forms/`. Each extracted module is covered by unit tests. Mantine compound component references (`Table.Tbody`, `Popover.Target`, `Accordion.Item`, etc.) have been updated to use flat named imports. — Thanks [@nick4810](https://github.com/nick4810) - Improved the EPG BOM fix from v0.22.1: replaced the `lstrip(b'\xef\xbb\xbf')` / `startswith` approach with `start.find(b'` or `X-API-Key: `. diff --git a/dispatcharr/settings.py b/dispatcharr/settings.py index 4bf4e8dc..b2b1909f 100644 --- a/dispatcharr/settings.py +++ b/dispatcharr/settings.py @@ -280,17 +280,6 @@ SPECTACULAR_SETTINGS = { "DESCRIPTION": "API documentation for Dispatcharr", "VERSION": "1.0.0", "SERVE_INCLUDE_SCHEMA": False, - "SECURITY": [{"BearerAuth": []}], - "COMPONENTS": { - "securitySchemes": { - "BearerAuth": { - "type": "http", - "scheme": "bearer", - "bearerFormat": "JWT", - "description": "Enter your JWT access token. The 'Bearer ' prefix is added automatically.", - } - } - }, } LANGUAGE_CODE = "en-us"