feat: replace static Swagger UI server selector with dynamic client-side detection
Build and Push Docker Image / build (push) Successful in 56s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m18s
CI / Security audit (push) Successful in 2m9s
CI / Swagger Validation & Coverage (push) Successful in 2m25s
CI / Tests & coverage (push) Successful in 2m44s
Build and Push Docker Image / build (push) Successful in 56s
Licence Check / Licence compatibility and copyright header verification (push) Successful in 1m18s
CI / Security audit (push) Successful in 2m9s
CI / Swagger Validation & Coverage (push) Successful in 2m25s
CI / Tests & coverage (push) Successful in 2m44s
- Update openapi.yaml to use single placeholder server URL - Add swagger-server-detection.js to auto-detect current server URL from window.location - Configure protocol, host, and port detection based on browser connection - Fallback to placeholder URL if detection fails - Include detection script in both app.js and index.js Swagger UI configurations - /api/swagger.json endpoint returns static placeholder for external consumers
This commit is contained in:
+2
-1
@@ -185,7 +185,8 @@ function createApp({ skipRateLimits = false } = {}) {
|
||||
customSiteTitle: 'sofarr API Documentation',
|
||||
customCss: '.swagger-ui .topbar { display: none }',
|
||||
customJs: [
|
||||
'/swagger-auth-banner.js'
|
||||
'/swagger-auth-banner.js',
|
||||
'/swagger-server-detection.js'
|
||||
]
|
||||
}));
|
||||
|
||||
|
||||
+2
-1
@@ -300,7 +300,8 @@ app.use('/api/swagger', swaggerUi.serve, swaggerUi.setup(swaggerSpec, {
|
||||
customSiteTitle: 'sofarr API Documentation',
|
||||
customCss: '.swagger-ui .topbar { display: none }',
|
||||
customJs: [
|
||||
'/swagger-auth-banner.js'
|
||||
'/swagger-auth-banner.js',
|
||||
'/swagger-server-detection.js'
|
||||
]
|
||||
}));
|
||||
|
||||
|
||||
+1
-3
@@ -25,10 +25,8 @@ info:
|
||||
name: MIT
|
||||
|
||||
servers:
|
||||
- url: http://localhost:3001
|
||||
description: Local development server
|
||||
- url: https://sofarr.example.com
|
||||
description: Production server
|
||||
description: sofarr API (auto-detected from current URL)
|
||||
|
||||
tags:
|
||||
- name: Health
|
||||
|
||||
Reference in New Issue
Block a user