diff --git a/server/control-plane-store.mjs b/server/control-plane-store.mjs index bfa0d5e..f599dc5 100644 --- a/server/control-plane-store.mjs +++ b/server/control-plane-store.mjs @@ -73,6 +73,7 @@ const bimViewerService = { "Standalone BIM/CAD viewer NODE.DC для рабочих моделей, вложений Operational Core, персонального модельного хранилища и безопасного внешнего просмотра по share-ссылкам.", url: "https://bim.nodedc.tech", launchUrl: "https://bim.nodedc.tech", + logoutUrl: "https://bim.nodedc.tech/logout", accentColor: "#8FE3C8", fallbackGradient: "linear-gradient(132deg, rgba(143, 227, 200, 0.78), rgba(24, 70, 64, 0.9) 46%, #080B0F 84%)", status: "active", @@ -2351,6 +2352,7 @@ function applyBimViewerServiceInvariants(data) { service.fullDescription = service.fullDescription || bimViewerService.fullDescription; service.url = service.url || bimViewerService.url; service.launchUrl = service.launchUrl || service.url || bimViewerService.launchUrl; + service.logoutUrl = service.logoutUrl || bimViewerService.logoutUrl; service.accentColor = service.accentColor || bimViewerService.accentColor; service.fallbackGradient = service.fallbackGradient || bimViewerService.fallbackGradient; service.status = service.status || bimViewerService.status; @@ -2488,6 +2490,20 @@ function upsertSystemProtectedUserGrant(data, user, service, appRole, now) { function normalizeService(service) { if (typeof service !== "object" || service === null) return service; + if (service.id === "service_bim_viewer" || service.slug === "bim-viewer" || service.authentikApplicationSlug === "bim-viewer") { + const legacyLocalUrl = (value) => value === "http://localhost:8080" || value === "http://127.0.0.1:8080"; + return { + ...service, + url: !service.url || legacyLocalUrl(service.url) ? "https://bim.nodedc.tech" : service.url, + launchUrl: + !service.launchUrl || legacyLocalUrl(service.launchUrl) + ? "https://bim.nodedc.tech" + : service.launchUrl, + logoutUrl: service.logoutUrl || "https://bim.nodedc.tech/logout", + authentikApplicationSlug: service.authentikApplicationSlug || "bim-viewer", + authentikGroupName: service.authentikGroupName || "nodedc:bim:access", + }; + } if (service.id !== "service_nodedc" && service.slug !== "nodedc" && service.authentikApplicationSlug !== "nodedc") return service; return { diff --git a/server/dev-server.mjs b/server/dev-server.mjs index b03c031..001d9db 100644 --- a/server/dev-server.mjs +++ b/server/dev-server.mjs @@ -222,7 +222,7 @@ app.get("/auth/logged-out", (req, res) => { res.clearCookie(sessionCookieName, clearCookieOptions()); res.clearCookie(oidcStateCookieName, clearCookieOptions()); setNoStore(res); - res.redirect(buildLoginRedirectUrl(returnTo, { forceLogin: true })); + res.redirect(buildLoginRedirectUrl(returnTo, { includeReturnTo: returnTo !== "/" })); }); app.get("/auth/session-sync", (req, res) => { @@ -3110,7 +3110,7 @@ function getBimViewerBaseUrl(app = null) { app?.launchTargetUrl || app?.openUrl || app?.url || - "http://localhost:8080" + "https://bim.nodedc.tech" ).replace(/\/$/, ""); } diff --git a/src/app/LauncherApp.tsx b/src/app/LauncherApp.tsx index bed7128..2652e1e 100644 --- a/src/app/LauncherApp.tsx +++ b/src/app/LauncherApp.tsx @@ -339,7 +339,7 @@ export function LauncherApp() { if (isRedirecting) return; isRedirecting = true; - redirectToLogin("/auth/login?prompt=login"); + redirectToLogin("/auth/login"); }); }, []); diff --git a/src/shared/api/mockData.ts b/src/shared/api/mockData.ts index 6ed4fe7..6266742 100644 --- a/src/shared/api/mockData.ts +++ b/src/shared/api/mockData.ts @@ -123,6 +123,7 @@ export const mockServices: Service[] = [ "Standalone BIM/CAD viewer NODE.DC для рабочих моделей, вложений Operational Core, персонального модельного хранилища и безопасного внешнего просмотра по share-ссылкам.", url: "https://bim.nodedc.tech", launchUrl: "https://bim.nodedc.tech", + logoutUrl: "https://bim.nodedc.tech/logout", accentColor: "#8FE3C8", fallbackGradient: "linear-gradient(132deg, rgba(143, 227, 200, 0.78), rgba(24, 70, 64, 0.9) 46%, #080B0F 84%)", status: "active",