fix(api/docs): Use Base in redoc template

This commit is contained in:
MidoriKurage 2026-04-10 10:39:28 +08:00 committed by kolaente
parent fb0d0cb32c
commit 3a5ba17ca0
2 changed files with 4 additions and 4 deletions

View File

@ -53,10 +53,10 @@ func DocsJSON(c *echo.Context) error {
// RedocUI serves everything needed to provide the redoc ui
func RedocUI(c *echo.Context) error {
publicURL := config.ServicePublicURL.GetString()
docsURL := strings.TrimRight(publicURL, "/") + "/api/v1/docs.json"
docsBase := strings.TrimRight(publicURL, "/") + "/"
var buf bytes.Buffer
data := map[string]string{"Url": docsURL}
data := map[string]string{"Base": docsBase}
if err := redocUITemplate.Execute(&buf, data); err != nil {
return err

View File

@ -8,7 +8,7 @@
<style>body{margin:0;padding:0;}</style>
</head>
<body>
<redoc spec-url='{{.Url}}'></redoc>
<script src="/api/v1/docs/redoc.standalone.js"></script>
<redoc spec-url='{{.Base}}api/v1/docs.json'></redoc>
<script src="{{.Base}}api/v1/docs/redoc.standalone.js"></script>
</body>
</html>