mirror of
https://github.com/markbeep/AudioBookRequest.git
synced 2025-12-30 18:19:34 -06:00
add version to settings pages
This commit is contained in:
5
.github/workflows/build.yaml
vendored
5
.github/workflows/build.yaml
vendored
@@ -70,8 +70,11 @@ jobs:
|
||||
MINOR=$(echo $VERSION | cut -d. -f2)
|
||||
PATCH=$(echo $VERSION | cut -d. -f3)
|
||||
echo "::set-output name=tags::${{ secrets.DOCKER_HUB_USERNAME }}/audiobookrequest:$VERSION,${{ secrets.DOCKER_HUB_USERNAME }}/audiobookrequest:$MAJOR.$MINOR,${{ secrets.DOCKER_HUB_USERNAME }}/audiobookrequest:$MAJOR,${{ secrets.DOCKER_HUB_USERNAME }}/audiobookrequest:latest"
|
||||
echo "::set-output name=version::$VERSION"
|
||||
else
|
||||
echo "::set-output name=tags::${{ secrets.DOCKER_HUB_USERNAME }}/audiobookrequest:nightly"
|
||||
github_sha_hash=${{ github.sha }}
|
||||
echo "::set-output name=version::${github_sha_hash:0:7}"
|
||||
fi
|
||||
|
||||
- name: Build and push
|
||||
@@ -80,3 +83,5 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.vars.outputs.tags }}
|
||||
build-args: |
|
||||
VERSION=${{ steps.vars.outputs.version }}
|
||||
|
||||
@@ -37,6 +37,8 @@ COPY app/ app/
|
||||
RUN /bin/tailwindcss -i styles/globals.css -o static/globals.css -m
|
||||
|
||||
ENV ABR_APP__PORT=8000
|
||||
ARG VERSION
|
||||
ENV ABR_APP__VERSION=$VERSION
|
||||
|
||||
CMD alembic upgrade heads && fastapi run --port $ABR_APP__PORT
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class oidcConfig(StringConfigCache[oidcConfigKey]):
|
||||
return "Failed to fetch OIDC configuration"
|
||||
data = await response.json()
|
||||
|
||||
config_scope = (self.get(session, "oidc_scope") or "").split(" ")
|
||||
config_scope = self.get(session, "oidc_scope", "").split(" ")
|
||||
provider_scope = data.get("scopes_supported")
|
||||
if not provider_scope or not all(
|
||||
scope in provider_scope for scope in config_scope
|
||||
|
||||
@@ -13,6 +13,7 @@ class ApplicationSettings(BaseModel):
|
||||
openapi_enabled: bool = False
|
||||
config_dir: str = "/config"
|
||||
port: int = 8000
|
||||
version: str = "local"
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
|
||||
@@ -6,7 +6,6 @@ from aiohttp import ClientResponseError, ClientSession
|
||||
from fastapi import APIRouter, Depends, Form, HTTPException, Request, Response
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from app.internal.auth.config import LoginTypeEnum, auth_config
|
||||
from app.internal.auth.authentication import (
|
||||
DetailedUser,
|
||||
create_user,
|
||||
@@ -14,7 +13,9 @@ from app.internal.auth.authentication import (
|
||||
is_correct_password,
|
||||
raise_for_invalid_password,
|
||||
)
|
||||
from app.internal.auth.config import LoginTypeEnum, auth_config
|
||||
from app.internal.auth.oidc_config import oidc_config
|
||||
from app.internal.env_settings import Settings
|
||||
from app.internal.models import EventEnum, GroupEnum, Notification, User
|
||||
from app.internal.notifications import send_notification
|
||||
from app.internal.prowlarr.indexer_categories import indexer_categories
|
||||
@@ -35,7 +36,10 @@ def read_account(
|
||||
user: Annotated[DetailedUser, Depends(get_authenticated_user())],
|
||||
):
|
||||
return template_response(
|
||||
"settings_page/account.html", request, user, {"page": "account"}
|
||||
"settings_page/account.html",
|
||||
request,
|
||||
user,
|
||||
{"page": "account", "version": Settings().app.version},
|
||||
)
|
||||
|
||||
|
||||
@@ -84,7 +88,12 @@ def read_users(
|
||||
"settings_page/users.html",
|
||||
request,
|
||||
admin_user,
|
||||
{"page": "users", "users": users, "is_oidc": is_oidc},
|
||||
{
|
||||
"page": "users",
|
||||
"users": users,
|
||||
"is_oidc": is_oidc,
|
||||
"version": Settings().app.version,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -215,6 +224,7 @@ def read_prowlarr(
|
||||
"indexer_categories": indexer_categories,
|
||||
"selected_categories": selected,
|
||||
"prowlarr_misconfigured": True if prowlarr_misconfigured else False,
|
||||
"version": Settings().app.version,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -304,6 +314,7 @@ def read_download(
|
||||
"name_ratio": name_ratio,
|
||||
"title_ratio": title_ratio,
|
||||
"indexer_flags": flags,
|
||||
"version": Settings().app.version,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -443,6 +454,7 @@ def read_notifications(
|
||||
"page": "notifications",
|
||||
"notifications": notifications,
|
||||
"event_types": event_types,
|
||||
"version": Settings().app.version,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -579,13 +591,13 @@ def read_security(
|
||||
"login_type": auth_config.get_login_type(session),
|
||||
"access_token_expiry": auth_config.get_access_token_expiry_minutes(session),
|
||||
"min_password_length": auth_config.get_min_password_length(session),
|
||||
"oidc_endpoint": oidc_config.get(session, "oidc_endpoint") or "",
|
||||
"oidc_client_secret": oidc_config.get(session, "oidc_client_secret") or "",
|
||||
"oidc_client_id": oidc_config.get(session, "oidc_client_id") or "",
|
||||
"oidc_scope": oidc_config.get(session, "oidc_scope") or "",
|
||||
"oidc_username_claim": oidc_config.get(session, "oidc_username_claim")
|
||||
or "",
|
||||
"oidc_group_claim": oidc_config.get(session, "oidc_group_claim") or "",
|
||||
"oidc_endpoint": oidc_config.get(session, "oidc_endpoint", ""),
|
||||
"oidc_client_secret": oidc_config.get(session, "oidc_client_secret", ""),
|
||||
"oidc_client_id": oidc_config.get(session, "oidc_client_id", ""),
|
||||
"oidc_scope": oidc_config.get(session, "oidc_scope", ""),
|
||||
"oidc_username_claim": oidc_config.get(session, "oidc_username_claim", ""),
|
||||
"oidc_group_claim": oidc_config.get(session, "oidc_group_claim", ""),
|
||||
"version": Settings().app.version,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- VERSION=local
|
||||
volumes:
|
||||
- ./config:/config
|
||||
ports:
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
{% extends "base.html" %} {% block head %}
|
||||
<title>Settings</title>
|
||||
{% endblock %} {% block body %}
|
||||
{% endblock %} {% block body %} {% if version %}
|
||||
<p
|
||||
class="fixed bottom-1 right-1 font-mono text-xs font-semibold text-neutral/60"
|
||||
>
|
||||
version: {{ version }}
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="flex items-start justify-center p-2 md:p-4 relative">
|
||||
<main
|
||||
class="flex flex-col w-[90%] md:w-3/4 max-w-[40rem] gap-4 gap-y-8 pb-[10rem]"
|
||||
|
||||
Reference in New Issue
Block a user