From a3101a435bae8bba7da77bba52d80e06b85593a4 Mon Sep 17 00:00:00 2001 From: Oneric Date: Thu, 20 Jun 2024 19:53:03 +0200 Subject: [PATCH] Fix swagger-ui Ever since the browser frontend switcher was introduced in de64c6c54aaacc4123031f2e3d5bfb9fc9c517fe /akkoma counts as an API prefix and thus gets skipped by frontend plugs breaking the old swagger ui path of /akkoma/swagger-ui. Do the simple thing and change the frontend path to /pleroma/swaggerui which isn't an API path and can't collide with frontend user paths given pleroma is areserved nickname. Reported in https://meta.akkoma.dev/t/view-all-endpoints/269/7 https://meta.akkoma.dev/t/swagger-ui-not-loading/728 --- CHANGELOG.md | 1 + docs/docs/configuration/cheatsheet.md | 2 +- docs/docs/configuration/frontend_management.md | 2 +- lib/pleroma/web/endpoint.ex | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d451dca8..d2fcd752c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## BREAKING - Minimum PostgreSQL version is raised to 12 +- Swagger UI moved from `/akkoma/swaggerui/` to `/pleroma/swaggerui/` ## Added - Implement [FEP-67ff](https://codeberg.org/fediverse/fep/src/branch/main/fep/67ff/fep-67ff.md) (federation documentation) diff --git a/docs/docs/configuration/cheatsheet.md b/docs/docs/configuration/cheatsheet.md index 80f5c3577..916e1cc0c 100644 --- a/docs/docs/configuration/cheatsheet.md +++ b/docs/docs/configuration/cheatsheet.md @@ -338,7 +338,7 @@ config :pleroma, :frontends, * `:primary` - The frontend that will be served at `/` * `:admin` - The frontend that will be served at `/pleroma/admin` -* `:swagger` - Config for developers to act as an API reference to be served at `/akkoma/swaggerui/` (trailing slash _needed_). Disabled by default. +* `:swagger` - Config for developers to act as an API reference to be served at `/pleroma/swaggerui/` (trailing slash _needed_). Disabled by default. * `:mastodon` - The mastodon-fe configuration. This shouldn't need to be changed. This is served at `/web` when installed. ### :static\_fe diff --git a/docs/docs/configuration/frontend_management.md b/docs/docs/configuration/frontend_management.md index bc5344826..8875ee279 100644 --- a/docs/docs/configuration/frontend_management.md +++ b/docs/docs/configuration/frontend_management.md @@ -60,4 +60,4 @@ config :pleroma, :frontends, Then run the [pleroma.frontend cli task](../../administration/CLI_tasks/frontend) with the name of `swagger-ui` to install the distribution files. -You will now be able to view documentation at `/akkoma/swaggerui` +You will now be able to view documentation at `/pleroma/swaggerui` diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 6628fcaf3..3c9fcb48c 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -66,10 +66,10 @@ defmodule Pleroma.Web.Endpoint do } ) - plug(Plug.Static.IndexHtml, at: "/akkoma/swaggerui") + plug(Plug.Static.IndexHtml, at: "/pleroma/swaggerui/") plug(Pleroma.Web.Plugs.FrontendStatic, - at: "/akkoma/swaggerui", + at: "/pleroma/swaggerui", frontend_type: :swagger, gzip: true, if: &Pleroma.Web.Swagger.ui_enabled?/0,