From 8dff6af7ac48059d0d67f7194b443433d28d7ca9 Mon Sep 17 00:00:00 2001 From: Padreug Date: Sat, 2 May 2026 16:23:21 +0200 Subject: [PATCH] feat: add hub URL options for chakra-tile linking The webapp's chakra hub page (src/pages/Hub.vue) reads VITE_HUB__URL at runtime to decide where each module tile points. Without these env vars set, hubLink() returns null and every chakra tile renders ghosted (non-link), which makes the hub look broken on first visit. Adds 7 new options on services.webapp: hubActivitiesUrl, hubCastleUrl, hubWalletUrl, hubChatUrl, hubForumUrl, hubMarketUrl, hubTasksUrl Each maps 1:1 to VITE_HUB__URL during the buildNpmPackage build phase. All default to "" which preserves the ghosted-when-unset behaviour for hosts that don't deploy a given module. Per-host usage: services.webapp = { enable = true; hubMarketUrl = "https://demo.${domain}/market/"; hubChatUrl = "https://demo.${domain}/chat/"; hubWalletUrl = "https://demo.${domain}/wallet/"; hubForumUrl = "https://demo.${domain}/forum/"; hubTasksUrl = "https://demo.${domain}/tasks/"; hubActivitiesUrl = "https://demo.${domain}/sortir/"; hubCastleUrl = "https://demo.${domain}/castle/"; ... }; Trailing-slash convention is recommended under path-mode deployment to avoid an asset-resolution round-trip; see the webapp repo's .env.example for the rationale. Co-Authored-By: Claude Opus 4.7 (1M context) --- webapp.nix | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/webapp.nix b/webapp.nix index 1e09d1c..87e220c 100644 --- a/webapp.nix +++ b/webapp.nix @@ -60,6 +60,22 @@ let # Demo Mode VITE_DEMO_MODE = if cfg.demoMode then "true" else "false"; + # Hub → standalone navigation URLs. + # The chakra tiles in src/pages/Hub.vue build from these. With + # path-mode deployment, set these to canonical trailing-slash URLs: + # hubMarketUrl = "https://demo.example.com/market/"; + # With subdomain deployment: + # hubMarketUrl = "https://market.example.com"; + # When unset (empty string), the corresponding chakra renders ghosted + # (non-link) — useful for hosts that don't deploy a given module. + VITE_HUB_ACTIVITIES_URL = cfg.hubActivitiesUrl; + VITE_HUB_CASTLE_URL = cfg.hubCastleUrl; + VITE_HUB_WALLET_URL = cfg.hubWalletUrl; + VITE_HUB_CHAT_URL = cfg.hubChatUrl; + VITE_HUB_FORUM_URL = cfg.hubForumUrl; + VITE_HUB_MARKET_URL = cfg.hubMarketUrl; + VITE_HUB_TASKS_URL = cfg.hubTasksUrl; + # Additional env vars NODE_ENV = "production"; @@ -217,6 +233,53 @@ in { description = "Enable demo mode with auto-generated demo accounts on the login page"; }; + # Hub → standalone navigation URLs (one per chakra tile). + # Empty string = tile rendered ghosted (no link). Set per-host based on + # whether each standalone is deployed and on the deployment shape + # (path-mode → trailing slash recommended; subdomain-mode → no path). + hubActivitiesUrl = lib.mkOption { + type = lib.types.str; + default = ""; + example = "https://demo.example.com/sortir/"; + description = "URL the chakra hub's Activities tile links to"; + }; + hubCastleUrl = lib.mkOption { + type = lib.types.str; + default = ""; + example = "https://demo.example.com/castle/"; + description = "URL the chakra hub's Castle tile links to"; + }; + hubWalletUrl = lib.mkOption { + type = lib.types.str; + default = ""; + example = "https://demo.example.com/wallet/"; + description = "URL the chakra hub's Wallet tile links to"; + }; + hubChatUrl = lib.mkOption { + type = lib.types.str; + default = ""; + example = "https://demo.example.com/chat/"; + description = "URL the chakra hub's Chat tile links to"; + }; + hubForumUrl = lib.mkOption { + type = lib.types.str; + default = ""; + example = "https://demo.example.com/forum/"; + description = "URL the chakra hub's Forum tile links to"; + }; + hubMarketUrl = lib.mkOption { + type = lib.types.str; + default = ""; + example = "https://demo.example.com/market/"; + description = "URL the chakra hub's Market tile links to"; + }; + hubTasksUrl = lib.mkOption { + type = lib.types.str; + default = ""; + example = "https://demo.example.com/tasks/"; + description = "URL the chakra hub's Tasks tile links to"; + }; + enableSSL = lib.mkOption { type = lib.types.bool; default = true;