From 8493de194b3a7d506ba7eaa8333788b210f0bef5 Mon Sep 17 00:00:00 2001 From: Jaro Habiger Date: Sun, 8 Oct 2023 15:22:08 +0200 Subject: [PATCH] backend: add logged_out_redirect_url config set LOGGED_OUT_REDIRECT_URL to the url of the landing page of the instance --- backend/openapi-schema.yml | 3 +++ backend/transcribee_backend/config.py | 8 +++++++- frontend/src/openapi-schema.ts | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/openapi-schema.yml b/backend/openapi-schema.yml index ebefa040..3d1d0bb7 100644 --- a/backend/openapi-schema.yml +++ b/backend/openapi-schema.yml @@ -370,6 +370,9 @@ components: type: object PublicConfig: properties: + logged_out_redirect_url: + title: Logged Out Redirect Url + type: string models: additionalProperties: $ref: '#/components/schemas/ModelConfig' diff --git a/backend/transcribee_backend/config.py b/backend/transcribee_backend/config.py index 56824764..c83d2285 100644 --- a/backend/transcribee_backend/config.py +++ b/backend/transcribee_backend/config.py @@ -1,3 +1,4 @@ +from os import environ from pathlib import Path from typing import Dict, List, Optional @@ -15,6 +16,7 @@ class Settings(BaseSettings): task_attempt_limit = 5 media_url_base = "http://localhost:8000/" + logged_out_redirect_url: None | str = None model_config_path: Path = Path("data/models.json") pages_dir: Path = Path("data/pages/") @@ -28,6 +30,7 @@ class ModelConfig(BaseModel): class PublicConfig(BaseModel): models: Dict[str, ModelConfig] + logged_out_redirect_url: str | None class ShortPageConfig(BaseModel): @@ -69,7 +72,10 @@ def get_short_page_config() -> Dict[str, ShortPageConfig]: def get_public_config(): - return PublicConfig(models=get_model_config()) + return PublicConfig( + models=get_model_config(), + logged_out_redirect_url=settings.logged_out_redirect_url, + ) settings = Settings() diff --git a/frontend/src/openapi-schema.ts b/frontend/src/openapi-schema.ts index 437cda6e..6ab7a4fa 100644 --- a/frontend/src/openapi-schema.ts +++ b/frontend/src/openapi-schema.ts @@ -330,6 +330,8 @@ export interface components { }; /** PublicConfig */ PublicConfig: { + /** Logged Out Redirect Url */ + logged_out_redirect_url?: string; /** Models */ models: { [key: string]: components["schemas"]["ModelConfig"] | undefined;