diff --git a/internal/api/openapi_test.go b/internal/api/openapi_test.go index 453903a..2c8f621 100644 --- a/internal/api/openapi_test.go +++ b/internal/api/openapi_test.go @@ -115,4 +115,13 @@ func TestAPIDocsServed(t *testing.T) { if st, _, page := e.browser(t).page("/api/docs"); st != http.StatusOK || !strings.Contains(page, "swagger-ui-bundle.js") { t.Errorf("/api/docs = %d", st) } + // Linked from every console page and where tokens are created. + if _, _, login := e.browser(t).page("/login"); !strings.Contains(login, `href="/api/docs"`) { + t.Error("the footer does not link the API documentation") + } + b := e.browser(t) + b.signup("d@"+uniq("ad")+".test", uniq("ad-")) + if _, _, tokens := b.page("/settings/tokens"); !strings.Contains(tokens, `href="/api/docs"`) || !strings.Contains(tokens, "Authorization: Bearer") { + t.Error("the token page does not explain usage with a link to the API documentation") + } } diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json index a0a6ee4..66e87b7 100644 --- a/internal/i18n/locales/de.json +++ b/internal/i18n/locales/de.json @@ -10,6 +10,7 @@ "agents.region": "Region", "agents.revoke_confirm": "Diesen Agent widerrufen? Seine Instanzen hören sofort auf zu arbeiten.", "agents.token_now": "Kopiere den Token jetzt und setze ihn als UPTIME_AGENT_TOKEN. Er wird nicht erneut angezeigt. Beliebig viele Instanzen können ihn teilen.", + "apidocs.footer": "API", "apidocs.hint": "„Try it out“ nutzt deine aktuelle Sitzung.", "apidocs.title": "API-Dokumentation", "app.network_error": "Verbindung fehlgeschlagen.", @@ -772,6 +773,7 @@ }, "tokens.revoke_confirm": "Diesen Token widerrufen? Anfragen damit schlagen sofort fehl.", "tokens.title": "API-Tokens", + "tokens.usage": "Sende den Token bei jeder Anfrage mit:", "weekday.0": "So", "weekday.1": "Mo", "weekday.2": "Di", diff --git a/internal/i18n/locales/en.json b/internal/i18n/locales/en.json index 2a7ad48..62f173a 100644 --- a/internal/i18n/locales/en.json +++ b/internal/i18n/locales/en.json @@ -10,6 +10,7 @@ "agents.region": "Region", "agents.revoke_confirm": "Revoke this agent? Its instances stop working immediately.", "agents.token_now": "Copy the token now and set it as UPTIME_AGENT_TOKEN. It will not be shown again. Any number of instances may share it.", + "apidocs.footer": "API", "apidocs.hint": "\"Try it out\" uses your current session.", "apidocs.title": "API documentation", "app.network_error": "Connection failed.", @@ -772,6 +773,7 @@ }, "tokens.revoke_confirm": "Revoke this token? Requests using it fail immediately.", "tokens.title": "API tokens", + "tokens.usage": "Send the token with every request:", "weekday.0": "Sun", "weekday.1": "Mon", "weekday.2": "Tue", diff --git a/internal/web/layout.templ b/internal/web/layout.templ index bd0a458..24b0635 100644 --- a/internal/web/layout.templ +++ b/internal/web/layout.templ @@ -42,7 +42,7 @@ templ Layout(p Page) {