diff --git a/backend/app/api/v1/settings.py b/backend/app/api/v1/settings.py index f5913a2..33d64f6 100644 --- a/backend/app/api/v1/settings.py +++ b/backend/app/api/v1/settings.py @@ -1,3 +1,5 @@ +from dataclasses import replace + from datetime import datetime from fastapi import APIRouter, Depends, HTTPException @@ -582,6 +584,12 @@ class AgentUpdateSettingsUpdate(BaseModel): git_branch: str | None = None +class AgentGitTestRequest(BaseModel): + rdp_git_repo_url: str | None = None + ssh_git_repo_url: str | None = None + git_branch: str | None = None + + class AgentGitTestResponse(BaseModel): git_latest_rdp_version: str | None = None git_latest_ssh_version: str | None = None @@ -661,10 +669,18 @@ def update_agent_update_settings( @router.post("/agent-updates/test-git", response_model=AgentGitTestResponse) def test_agent_git_release( + body: AgentGitTestRequest | None = None, db: Session = Depends(get_db), _user=Depends(require_admin), ) -> AgentGitTestResponse: cfg = get_effective_agent_update_config(db) + if body is not None: + cfg = replace( + cfg, + rdp_git_repo_url=(body.rdp_git_repo_url or cfg.rdp_git_repo_url).strip(), + ssh_git_repo_url=(body.ssh_git_repo_url or cfg.ssh_git_repo_url).strip(), + git_branch=(body.git_branch or cfg.git_branch or "main").strip() or "main", + ) git_release = get_git_release_versions(cfg, db=db, force_refresh=True) from app.services.agent_update_settings import PRODUCT_RDP, PRODUCT_SSH diff --git a/backend/app/version.py b/backend/app/version.py index 46b1bc7..9f678d5 100644 --- a/backend/app/version.py +++ b/backend/app/version.py @@ -1,5 +1,5 @@ """Единый источник версии SAC (API, health, логи, OpenAPI).""" APP_NAME = "Security Alert Center" -APP_VERSION = "0.20.0" +APP_VERSION = "0.20.1" APP_VERSION_LABEL = f"{APP_NAME} v.{APP_VERSION}" diff --git a/backend/tests/test_health.py b/backend/tests/test_health.py index 1d967e2..4e011b5 100644 --- a/backend/tests/test_health.py +++ b/backend/tests/test_health.py @@ -4,6 +4,6 @@ from app.version import APP_NAME, APP_VERSION, APP_VERSION_LABEL def test_version_constants(): - assert APP_VERSION == "0.20.0" + assert APP_VERSION == "0.20.1" assert APP_NAME == "Security Alert Center" - assert APP_VERSION_LABEL == "Security Alert Center v.0.20.0" + assert APP_VERSION_LABEL == "Security Alert Center v.0.20.1" diff --git a/frontend/src/api.ts b/frontend/src/api.ts index 076de7e..11f0858 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -581,9 +581,16 @@ export function saveAgentUpdateSettings( }); } -export function testAgentGitRelease(): Promise { +export interface AgentGitTestPayload { + rdp_git_repo_url?: string | null; + ssh_git_repo_url?: string | null; + git_branch?: string | null; +} + +export function testAgentGitRelease(payload?: AgentGitTestPayload): Promise { return apiFetch("/api/v1/settings/agent-updates/test-git", { method: "POST", + body: JSON.stringify(payload ?? {}), }); } diff --git a/frontend/src/version.ts b/frontend/src/version.ts index af9e344..fde3c66 100644 --- a/frontend/src/version.ts +++ b/frontend/src/version.ts @@ -1,4 +1,4 @@ /** Fallback до загрузки /health; при релизе держите в sync с backend/app/version.py */ export const APP_NAME = "Security Alert Center"; -export const APP_VERSION = "0.20.0"; +export const APP_VERSION = "0.20.1"; export const APP_VERSION_LABEL = `${APP_NAME} v.${APP_VERSION}`; diff --git a/frontend/src/views/SettingsView.vue b/frontend/src/views/SettingsView.vue index 5e093dc..a52e1cb 100644 --- a/frontend/src/views/SettingsView.vue +++ b/frontend/src/views/SettingsView.vue @@ -165,15 +165,20 @@ Git-ветка -

- Latest из git: - RDP {{ agentUpdateLoaded?.git_latest_rdp_version ?? "—" }}, - SSH {{ agentUpdateLoaded?.git_latest_ssh_version ?? "—" }} - - · обновлено {{ formatDateTime(agentUpdateLoaded.git_fetched_at) }} - -

-

{{ agentGitTestErrors }}

+
+

+ {{ agentGitFeedback.text }} +

+

+ Latest из git: + RDP {{ agentUpdateLoaded?.git_latest_rdp_version ?? "—" }}, + SSH {{ agentUpdateLoaded?.git_latest_ssh_version ?? "—" }} + + · обновлено {{ formatDateTime(agentUpdateLoaded.git_fetched_at) }} + +

+

{{ agentGitTestErrors }}

+