diff --git a/docs/requirements/037-corporate-design-overhaul.md b/docs/requirements/037-corporate-design-overhaul.md index cf45a4761b..0493056b0a 100644 --- a/docs/requirements/037-corporate-design-overhaul.md +++ b/docs/requirements/037-corporate-design-overhaul.md @@ -101,7 +101,7 @@ Two base commits changed many roles after their last run: `6c2de017f8` split ven - [x] web-app-openclaw - [x] web-app-opencloud - [x] web-app-openproject -- [ ] web-app-opentalk: the conference room is not covered; the native theme setting is half exercised; the title check cannot fail; logo lockup changed by `63f3631567`. +- [x] web-app-opentalk - [ ] web-app-openwebui: logo and title stay Open WebUI's own because clause 4 of its license allows replacing the branding only up to 50 users, with written permission or under an enterprise license (operator decision, see `roles/web-app-openwebui/TODO.md`). - [x] web-app-peertube - [x] web-app-penpot @@ -120,7 +120,7 @@ Two base commits changed many roles after their last run: `6c2de017f8` split ven - [x] web-app-socialhome - [x] web-app-sphinx - [ ] web-app-stalwart: under `sso` the web administration specs need the administrator group grant of `feature/store-i18n` (`199f2a6d41`); no green run on the merged state yet. -- [ ] web-app-suitecrm: visible title not asserted; literal SVG fills in `files/style.css`; the session rework from `main` never ran with the design. +- [x] web-app-suitecrm - [x] web-app-taiga - [x] web-app-wordpress - [x] web-app-xwiki diff --git a/roles/web-app-keycloak/tasks/03_manager_ops/update_routines.yml b/roles/web-app-keycloak/tasks/03_manager_ops/update_routines.yml index 1e902920ff..3483a7f08d 100644 --- a/roles/web-app-keycloak/tasks/03_manager_ops/update_routines.yml +++ b/roles/web-app-keycloak/tasks/03_manager_ops/update_routines.yml @@ -54,11 +54,11 @@ include_tasks: "{{ role_path }}/tasks/update/08_users/email_verified.yml" when: KEYCLOAK_USER_EMAILS_VERIFIED | bool -- name: "📂 Ensure application-declared clients (existing realms)" +- name: "📂 Ensure application-declared and SAML clients (existing realms)" include_tasks: "{{ role_path }}/tasks/update/10_declared_client.yml" vars: kc_declared_client_id: "{{ declared_client }}" - loop: "{{ KEYCLOAK_DECLARED_CLIENT_IDS }}" + loop: "{{ KEYCLOAK_DECLARED_CLIENT_IDS + KEYCLOAK_SAML_CLIENT_IDS }}" loop_control: loop_var: declared_client diff --git a/roles/web-app-keycloak/tasks/update/10_declared_client.yml b/roles/web-app-keycloak/tasks/update/10_declared_client.yml index 06a5934de8..bd44321fef 100644 --- a/roles/web-app-keycloak/tasks/update/10_declared_client.yml +++ b/roles/web-app-keycloak/tasks/update/10_declared_client.yml @@ -1,6 +1,6 @@ --- # Realm import only runs for a MISSING realm; this kcadm create-or-update brings -# application-declared clients to existing realms too. Desired state is the +# application-declared and SAML clients to existing realms too. Desired state is the # import's own client object, so the realm template stays the one SPOT. - name: "✅ Ensure the '{{ kc_declared_client_id }}' client" vars: diff --git a/roles/web-app-keycloak/vars/main.yml b/roles/web-app-keycloak/vars/main.yml index 20de24a6c8..5d531068ee 100644 --- a/roles/web-app-keycloak/vars/main.yml +++ b/roles/web-app-keycloak/vars/main.yml @@ -125,6 +125,7 @@ KEYCLOAK_MOODLE_ENABLED: "{{ 'web-app-moodle' in group_names }}" KEYCLOAK_DECLARED_CLIENT_APPS: "{{ lookup('applications') | kc_declared_client_apps(lookup('deployment').groups) }}" KEYCLOAK_DECLARED_CLIENT_IDS: "{{ lookup('applications') | kc_declared_client_ids(lookup('deployment').groups) }}" +KEYCLOAK_SAML_CLIENT_IDS: "{{ KEYCLOAK_DICTIONARY_REALM.clients | selectattr('protocol', 'equalto', 'saml') | map(attribute='clientId') | list }}" KEYCLOAK_RECAPTCHA_ENABLED: "{{ lookup('config', application_id, 'services.recaptcha.enabled') }}" KEYCLOAK_RECAPTCHA_KEY: "{{ lookup('config', application_id, 'secrets.credentials.recaptcha.key') }}" diff --git a/roles/web-app-opentalk/files/playwright/test-design.js b/roles/web-app-opentalk/files/playwright/test-design.js index d82b6bffd3..4ce7bfd14f 100644 --- a/roles/web-app-opentalk/files/playwright/test-design.js +++ b/roles/web-app-opentalk/files/playwright/test-design.js @@ -9,7 +9,7 @@ const { galleryEnabled, tokenValue, } = require("./design"); -const { decodeDotenvQuotedValue, gotoOnion } = require("./personas"); +const { apiGetOnion, decodeDotenvQuotedValue, gotoOnion } = require("./personas"); const { skipUnlessServiceEnabled } = require("./service-gating"); const { resolveTimeout } = require("./timeouts"); const { adminPassword, adminUsername, baseUrl, ssoLoginAndAssertDashboard } = require("./_shared"); @@ -18,7 +18,6 @@ test.use({ ignoreHTTPSErrors: true }); const logoUrl = decodeDotenvQuotedValue(process.env.DESIGN_LOGO_URL || ""); const faviconUrl = decodeDotenvQuotedValue(process.env.DESIGN_FAVICON_URL || ""); -const title = decodeDotenvQuotedValue(process.env.DESIGN_TITLE || ""); const MODES = ["light", "dark"]; const BASE = baseUrl.replace(/\/+$/, ""); @@ -37,6 +36,15 @@ const ERROR_TITLE = "#root .MuiTypography-h5"; const LOBBY = '[data-testid="selfTest"]'; const EMPTY_ENTRY = `${MAIN} [data-testid="empty-entry"]`; const SHOWCASE = ["Design Showcase Weekly", "Design Showcase Review"]; +const JOIN = 'button[form="join-form"][type="submit"]'; +const HANGUP = '[data-testid="toolbarEndCallButton"]'; +const MORE_BUTTON = '[data-testid="toolbarMenuButton"]'; +const MORE_MENU = '[data-testid="moreMenu"]:has(.MuiAvatar-root) .MuiPaper-root'; +const ROOM_SIDEBAR = `aside:has(> div > aside ${HANGUP})`; +const TOOLBAR_BUTTON = `aside:has(> div > ${HANGUP}) .MuiIconButton-root:not(${HANGUP})`; +const MODERATION_STRIP = "aside > .MuiTabs-vertical > .MuiTabs-scroller"; +const PANEL_TABS = 'aside [role="tabpanel"] .MuiTabs-root:not(.MuiTabs-vertical)'; +const HEADER_TILE = "header > div > * > .MuiStack-root"; /** * Args: @@ -134,6 +142,19 @@ async function seedShowcase(page) { return events; } +/** + * Args: + * page: signed-in Playwright page that joins the meeting room of `event` from its lobby. + * event: showcase event with its `room.id`. + */ +async function joinRoom(page, event) { + await gotoOnion(page, `${BASE}/room/${event.room.id}`); + await shown(LOBBY)(page); + await page.locator(JOIN).click(); + await expect(page.locator(HANGUP)).toBeVisible({ timeout: resolveTimeout(60_000) }); + await animationsSettled(page); +} + /** * Args: * page: Playwright page on a dashboard route; a navigation the viewport collapses gets opened. @@ -225,6 +246,28 @@ function signedInViews([first, second]) { await animationsSettled(page); }, }, + { + name: "room", + url: `${BASE}/room/${first.room.id}`, + prepare: async (page) => { + await shown(LOBBY)(page); + await page.locator(JOIN).click(); + await shown(HANGUP)(page); + await page.mouse.move(1, 1); + }, + }, + { + name: "room-more-menu", + url: `${BASE}/room/${first.room.id}`, + prepare: async (page) => { + await shown(LOBBY)(page); + await page.locator(JOIN).click(); + await shown(HANGUP)(page); + await page.locator(MORE_BUTTON).click(); + await shown(MORE_MENU)(page); + await page.mouse.move(1, 1); + }, + }, ]; } @@ -308,36 +351,98 @@ test("design: every focus stop inside the frame draws its indicator in the frame } }); -test("design: the native theme setting drives the palette", async ({ page }) => { +test("design: the dashboard and conference theme settings drive the palette", async ({ page }) => { skipUnlessServiceEnabled("design"); - test.setTimeout(resolveTimeout(180_000)); + test.setTimeout(resolveTimeout(300_000)); + const root = page.locator("html"); + const save = async (dashboard, conference) => { + await gotoOnion(page, `${BASE}/dashboard/settings/general`); + await shown(SETTINGS_FORM)(page); + for (const [label, field, value] of [ + ["Dashboard theme", "dashboard-theme", dashboard], + ["Conference theme", "conference-theme", conference], + ]) { + await page.getByRole("combobox", { name: new RegExp(`^${label}`) }).click(); + await page.locator(`${MENU} [role="option"][data-value="${value}"]`).click(); + await expect(page.locator(`${SETTINGS_FORM} input[name="${field}"]`)).toHaveValue(value); + } + const stored = page.waitForResponse( + (response) => new URL(response.url()).pathname === "/v1/users/me" && response.request().method() === "PATCH", + { timeout: resolveTimeout(30_000) }, + ); + await page.locator(`${SETTINGS_FORM} button[type="submit"]`).click(); + expect((await stored).status(), "the settings form stores both themes").toBeLessThan(300); + }; await page.emulateMedia({ colorScheme: "light" }); await signIn(page); - const root = page.locator("html"); - const light = await tokenValue(page, "--design-surface-1", "color"); + const [event] = await seedShowcase(page); try { - await api(page, "PATCH", "/users/me", { dashboard_theme: "dark" }); + await save("dark", "light"); await gotoOnion(page, `${BASE}/dashboard/settings/general`); await shown(SETTINGS_FORM)(page); - await expect(root).toHaveAttribute("data-design-theme", "dark"); - expect(await tokenValue(page, "--design-surface-1", "color"), "the dark palette must differ").not.toBe(light); - await assertToken(page, MAIN, "color", "--design-text", "switched to dark"); - await api(page, "PATCH", "/users/me", { dashboard_theme: "system" }); - await gotoOnion(page, `${BASE}/dashboard/settings/general`); - await shown(SETTINGS_FORM)(page); - await expect(root).not.toHaveAttribute("data-design-theme", /.+/); - expect(await tokenValue(page, "--design-surface-1", "color")).toBe(light); + await expect(root, "a dark dashboard theme pins the palette to dark").toHaveAttribute("data-design-theme", "dark"); + await assertToken(page, MAIN, "color", "--design-text", "dashboard on its dark theme"); + await page.emulateMedia({ colorScheme: "dark" }); + await gotoOnion(page, `${BASE}/room/${event.room.id}`); + await shown(LOBBY)(page); + await expect(root, "a light conference theme pins the lobby to light").toHaveAttribute("data-design-theme", "light"); + await assertToken(page, `${LOBBY} > div`, "background-color", "--design-surface-2", "lobby on its light theme"); + await save("system", "system"); + await gotoOnion(page, `${BASE}/room/${event.room.id}`); + await shown(LOBBY)(page); + await expect(root, "system leaves the palette to the browser").not.toHaveAttribute("data-design-theme", /.+/); } finally { + await page.emulateMedia({ colorScheme: null }); await api(page, "PATCH", "/users/me", { dashboard_theme: "system", conference_theme: "system" }); } }); +test("design: the lobby and the conference room take surfaces, text and the leave action from the palette", async ({ page }) => { + skipUnlessServiceEnabled("design"); + test.setTimeout(resolveTimeout(300_000)); + await page.setViewportSize({ width: 1440, height: 900 }); + await signIn(page); + const [event] = await seedShowcase(page); + for (const mode of MODES) { + await page.emulateMedia({ colorScheme: mode }); + await gotoOnion(page, `${BASE}/room/${event.room.id}`); + await shown(LOBBY)(page); + await assertToken(page, `${LOBBY} > div`, "background-color", "--design-surface-2", `lobby panel ${mode}`); + await assertToken(page, `${LOBBY} > div`, "color", "--design-text", `lobby panel ${mode}`); + } + await page.emulateMedia({ colorScheme: null }); + await assertReadable(page, [`${LOBBY} .MuiTypography-root`, JOIN], "opentalk lobby"); + await joinRoom(page, event); + for (const mode of MODES) { + await page.emulateMedia({ colorScheme: mode }); + await assertToken(page, ROOM_SIDEBAR, "background-color", "--design-surface-2", `room sidebar ${mode}`); + await assertToken(page, ROOM_SIDEBAR, "color", "--design-text", `room sidebar ${mode}`); + await assertToken(page, TOOLBAR_BUTTON, "background-color", "--design-surface-1", `toolbar button ${mode}`); + await assertToken(page, `${TOOLBAR_BUTTON} svg`, "fill", "--design-text", `toolbar icon ${mode}`); + await assertToken(page, HANGUP, "background-color", "--design-danger", `leave action ${mode}`); + await assertToken(page, `${HANGUP} svg`, "fill", "--design-on-danger", `leave action ${mode}`); + await assertToken(page, MODERATION_STRIP, "background-color", "--design-surface-3", `moderation strip ${mode}`); + await assertToken(page, PANEL_TABS, "background-color", "--design-surface-3", `panel tabs ${mode}`); + await assertToken(page, HEADER_TILE, "background-color", "--design-surface-2", `header tile ${mode}`); + await assertToken(page, HEADER_TILE, "color", "--design-text", `header tile ${mode}`); + } + await page.emulateMedia({ colorScheme: null }); + await assertLightAndDark(page, ROOM_SIDEBAR, "opentalk room"); + await assertReadable(page, ["header .MuiTypography-root", { selector: `${ROOM_SIDEBAR} .MuiTypography-root`, optional: true }], "opentalk room"); + await page.locator(MORE_BUTTON).click(); + await shown(MORE_MENU)(page); + await page.mouse.move(1, 1); + await assertToken(page, MORE_MENU, "background-color", "--design-surface-2", "more menu"); + await assertToken(page, MORE_BUTTON, "background-color", "--design-primary", "more button while its menu is open"); +}); + test("design: the dashboard shows the generated logo and the configured title", async ({ page }) => { skipUnlessServiceEnabled("design"); + const title = decodeDotenvQuotedValue(process.env.DESIGN_TITLE || ""); test.skip(!logoUrl && !title, "logo and title replacement are disabled for this role"); await signIn(page); if (title) { - await expect(page).toHaveTitle(new RegExp(title.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))); + await expect(page).toHaveTitle(new RegExp(` in ${title.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`)); } if (logoUrl) { expect(faviconUrl, "DESIGN_FAVICON_URL is written whenever the logo is").toBeTruthy(); @@ -345,6 +450,28 @@ test("design: the dashboard shows the generated logo and the configured title", await expect(page.locator("link[rel~='icon']").first()).toHaveAttribute("href", faviconUrl); const box = await page.locator(`${MAIN} ${LOGO}`).boundingBox(); expect(box.width, "the logo box of the dashboard is wider than high").toBeGreaterThan(box.height * 1.5); + const svg = await (await apiGetOnion(page.request, logoUrl)).text(); + const dark = svg.match(/@media \(prefers-color-scheme: dark\)\{text\{fill:(#[0-9a-fA-F]{3,8});/); + const light = svg.match(/]*\sfill="(#[0-9a-fA-F]{3,8})"/); + expect(dark, "the lockup carries a dark rule for its title").not.toBeNull(); + expect(light, "the lockup title has a light fill").not.toBeNull(); + const resolve = (hex) => + page.evaluate((color) => { + const probe = document.createElement("span"); + probe.style.color = color; + document.body.append(probe); + const value = getComputedStyle(probe).color; + probe.remove(); + return value; + }, hex); + for (const [mode, fill] of [ + ["light", light[1]], + ["dark", dark[1]], + ]) { + await page.emulateMedia({ colorScheme: mode }); + expect(await resolve(fill), `lockup title fill ${mode}`).toBe(await tokenValue(page, "--design-link", "color")); + } + await page.emulateMedia({ colorScheme: null }); } }); diff --git a/roles/web-app-opentalk/templates/nginx/extra.conf.j2 b/roles/web-app-opentalk/templates/nginx/extra.conf.j2 index 32188e311c..079cecf03d 100644 --- a/roles/web-app-opentalk/templates/nginx/extra.conf.j2 +++ b/roles/web-app-opentalk/templates/nginx/extra.conf.j2 @@ -11,7 +11,7 @@ location /v1/ { client_max_body_size 0; } -location /signaling { +location /v1/signaling/ { {{ opentalk_controller_backend }} proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/roles/web-app-opentalk/templates/style.css.j2 b/roles/web-app-opentalk/templates/style.css.j2 index 14aea01256..97444c2685 100644 --- a/roles/web-app-opentalk/templates/style.css.j2 +++ b/roles/web-app-opentalk/templates/style.css.j2 @@ -312,6 +312,68 @@ body, background-color: var(--design-surface-2); color: var(--design-text); } + +div:has(> div > aside aside [data-testid="toolbarEndCallButton"]) { + background-color: var(--design-surface-1); + color: var(--design-text); +} +aside:has(> div > aside [data-testid="toolbarEndCallButton"]) { + --design-focus: var(--design-link); + background-color: var(--design-surface-2); + color: var(--design-text); + box-shadow: var(--design-shadow-2); +} +aside:has(> div > [data-testid="toolbarEndCallButton"]) .MuiIconButton-root:not([data-testid="toolbarEndCallButton"]) { + background-color: var(--design-surface-1); + color: var(--design-text); +} +aside:has(> div > [data-testid="toolbarEndCallButton"]) .MuiIconButton-root:not([data-testid="toolbarEndCallButton"]) svg { + fill: var(--design-text); +} +aside:has(> div > [data-testid="toolbarEndCallButton"]) .MuiIconButton-root:not([data-testid="toolbarEndCallButton"]):hover, +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarAudioButton"]:has([data-testid="toolbarAudioButtonOn"]), +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarVideoButton"]:is([aria-label^="Turn Off Video"], [aria-label^="Kamera deaktivieren"]), +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarShareScreenButton"]:is([aria-label^="Turn Off Screen Share"], [aria-label^="Bildschirm nicht mehr teilen"]), +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarHandraiseButton"]:is([aria-label^="Lower Your Hand"], [aria-label^="Hand runternehmen"]), +body:has([data-testid="moreMenu"] .MuiAvatar-root) aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarMenuButton"] { + background-color: var(--design-primary); +} +aside:has(> div > [data-testid="toolbarEndCallButton"]) .MuiIconButton-root:not([data-testid="toolbarEndCallButton"]):hover svg, +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarAudioButton"]:has([data-testid="toolbarAudioButtonOn"]) svg, +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarVideoButton"]:is([aria-label^="Turn Off Video"], [aria-label^="Kamera deaktivieren"]) svg, +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarShareScreenButton"]:is([aria-label^="Turn Off Screen Share"], [aria-label^="Bildschirm nicht mehr teilen"]) svg, +aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarHandraiseButton"]:is([aria-label^="Lower Your Hand"], [aria-label^="Hand runternehmen"]) svg, +body:has([data-testid="moreMenu"] .MuiAvatar-root) aside:has(> div > [data-testid="toolbarEndCallButton"]) [data-testid="toolbarMenuButton"] svg { + fill: var(--design-on-primary); +} +[data-testid="toolbarEndCallButton"] { + background-color: var(--design-danger); +} +[data-testid="toolbarEndCallButton"] svg { + fill: var(--design-on-danger); +} +[data-testid="toolbarEndCallButton"]:hover { + background-color: var(--design-danger-hover); +} +aside:has(> .MuiTabs-vertical) { + background-color: var(--design-surface-2); + color: var(--design-text); +} +aside > .MuiTabs-vertical, +aside > .MuiTabs-vertical > .MuiTabs-scroller, +aside [role="tabpanel"] .MuiTabs-root:not(.MuiTabs-vertical) { + background-color: var(--design-surface-3); + color: var(--design-text); +} +body:has([data-testid="toolbarEndCallButton"]) header > div > * > .MuiStack-root, +body:has([data-testid="toolbarEndCallButton"]) header > div > .MuiStack-root:not(:has(> .MuiStack-root)) { + background-color: var(--design-surface-2); + color: var(--design-text); +} +body:has([data-testid="toolbarEndCallButton"]) header > div > * > .MuiStack-root svg, +body:has([data-testid="toolbarEndCallButton"]) header > div > .MuiStack-root:not(:has(> .MuiStack-root)) svg { + fill: var(--design-text); +} {% if design.logo is string %} svg[viewBox="0 0 206.392 45.061"] { diff --git a/roles/web-app-suitecrm/TODO.md b/roles/web-app-suitecrm/TODO.md index 72747422a4..23bf753885 100644 --- a/roles/web-app-suitecrm/TODO.md +++ b/roles/web-app-suitecrm/TODO.md @@ -1,3 +1,5 @@ # TODO - `logs/prod/prod.log` in the `suitecrm_data` volume still holds the Redis password from the `SessionHandler::read(): open(tcp://...)` warnings written before the session handler override in `files/session.yaml`. Options: truncate the file once after the password was rotated, or let a log rotation drop it. +- The biber logout spec (`files/playwright/saml.spec.js`, "the in-app logout ends the session") passes about three runs in five. A user created by the SAML login has no completed login wizard, so the shell's route guard redirects every navigation to `/users/Wizard`, and `inAppLogout` triggers one such navigation per attempt. When the logout click lands inside one of them, the shell reads no `logout` system config and falls back to `POST /logout`, which the SAML firewall does not intercept: the controller throws "This will be intercepted by the logout key" (HTTP 500) and the session stays. Options: complete the login wizard for users the SAML user factory creates, or let the spec finish the wizard before it logs out. +- The design spec "the shell takes frame, bars, rows, links and menus from the palette" fails on its first run after a fresh install or container start (the shell list or its rows are not visible yet) and passes on the retry. diff --git a/roles/web-app-suitecrm/files/php/design.php b/roles/web-app-suitecrm/files/php/design.php index 010699750f..6c8c472d1b 100644 --- a/roles/web-app-suitecrm/files/php/design.php +++ b/roles/web-app-suitecrm/files/php/design.php @@ -9,7 +9,7 @@ * app_dir: application root inside the container * enabled: bool, false removes what an earlier run wrote * css: legacy theme override for custom/themes/suite8/css/Dawn/style.css - * title: system name; empty leaves the setting alone + * title: system name of the legacy settings (config table) and of the shell tab ($sugar_config through the Configurator); empty leaves both alone * logo: Base64 PNG for custom/themes/default/images/company_logo.png; empty leaves the logo alone * favicon: Base64 ICO for the shell and the legacy favicon; empty leaves both alone * @@ -26,6 +26,7 @@ chdir($payload['app_dir'] . '/public/legacy'); $_SERVER['PHP_SELF'] = 'design.php'; define('sugarEntry', true); require_once 'include/entryPoint.php'; +require_once 'modules/Configurator/Configurator.php'; $changed = false; $markFile = 'custom/themes/.infinito-design.json'; @@ -130,10 +131,22 @@ $title = $enabled ? (string) ($payload['title'] ?? '') : ''; $administration = BeanFactory::newBean('Administration'); $administration->retrieveSettings('system'); $name = (string) ($administration->settings['system_name'] ?? ''); +$shellName = (string) ($sugar_config['system_name'] ?? ''); + +$saveShellName = static function (string $value) use (&$changed): void { + $configurator = new Configurator(); + $configurator->config['system_name'] = $value; + $configurator->handleOverride(); + $changed = true; +}; + if ($title !== '') { if (!array_key_exists('title_before', $mark)) { $mark['title_before'] = $name; } + if (!array_key_exists('shell_title_before', $mark)) { + $mark['shell_title_before'] = $shellName; + } if ($name === $mark['title_before'] || $name === ($mark['title'] ?? null)) { if ($name !== $title) { $administration->saveSetting('system', 'name', $title); @@ -141,12 +154,21 @@ if ($title !== '') { } $mark['title'] = $title; } + if ($shellName === $mark['shell_title_before'] || $shellName === ($mark['shell_title'] ?? null)) { + if ($shellName !== $title) { + $saveShellName($title); + } + $mark['shell_title'] = $title; + } } else { if (isset($mark['title']) && $name === $mark['title']) { $administration->saveSetting('system', 'name', (string) $mark['title_before']); $changed = true; } - unset($mark['title'], $mark['title_before']); + if (isset($mark['shell_title']) && $shellName === $mark['shell_title']) { + $saveShellName((string) $mark['shell_title_before']); + } + unset($mark['title'], $mark['title_before'], $mark['shell_title'], $mark['shell_title_before']); } if (isset($touched['css'])) { diff --git a/roles/web-app-suitecrm/files/playwright/test-design.js b/roles/web-app-suitecrm/files/playwright/test-design.js index 0a51045376..5694e292b2 100644 --- a/roles/web-app-suitecrm/files/playwright/test-design.js +++ b/roles/web-app-suitecrm/files/playwright/test-design.js @@ -57,6 +57,10 @@ const SHELL_NAV_LINK = `${SHELL_NAVBAR} li.top-nav .nav-link`; const SHELL_ROW_LINK = `${SHELL_TABLE} scrm-field a.field-link`; const SHELL_FOOTER = "scrm-footer-ui .footer"; const SHELL_LIST_LOADED = `${SHELL_TABLE} a.field-link, ${SHELL_TABLE} :text("No results found")`; +const ROLE_SHEET = "link[href*='/roles/web-app-suitecrm/'][href*='style.css']"; +const LEGACY_OVERRIDE = "legacy/custom/themes/suite8/css/Dawn/style.css"; +const COLOR_PROPERTY = + /^(?:--[\w-]+|(?:[a-z-]*-)?color|background(?:-image)?|fill|stroke|box-shadow|text-shadow|border(?:-(?:top|right|bottom|left))?|outline|column-rule|(?:-webkit-)?mask(?:-image)?)$/; exports.register = function () { const base = normalizeBaseUrl(requireDotenvValue(process.env.APP_BASE_URL, "APP_BASE_URL")); @@ -355,7 +359,9 @@ exports.register = function () { await signIn(page); if (title) { await open(page, "module=Configurator&action=EditView", "input[name='system_name']"); - await expect(page.locator("input[name='system_name']"), "the system name the shell shows as title").toHaveValue(title); + await expect(page.locator("input[name='system_name']"), "the system name of the legacy pages").toHaveValue(title); + await openShell(page, "/accounts", SHELL_TABLE); + await expect(page, "the shell tab shows the configured system name").toHaveTitle(title, { timeout: resolveTimeout(10_000) }); } if (logoUrl) { expect(faviconUrl, "DESIGN_FAVICON_URL is written whenever the logo is").toBeTruthy(); @@ -382,6 +388,53 @@ exports.register = function () { } }); + test("design: the role stylesheets set every color through a token, inside SVG images too", async ({ page }) => { + skipUnlessServiceEnabled("design"); + await signIn(page); + await openShell(page, "/accounts", SHELL_TABLE); + const sheets = [await page.locator(ROLE_SHEET).first().getAttribute("href"), `${base}/${LEGACY_OVERRIDE}`]; + for (const sheet of sheets) { + const response = await apiGetOnion(page.request, new URL(sheet, page.url()).toString()); + expect(response.status(), `${sheet} is served`).toBe(200); + const offenders = await page.evaluate( + ([source, property]) => { + const colorProperty = new RegExp(property); + const keyword = (word) => + /^[a-z]+$/i.test(word) && + !/^(?:transparent|currentcolor|inherit|initial|unset|revert|none)$/i.test(word) && + CSS.supports("color", word); + const paint = /(?:fill|stroke|stop-color|flood-color)\s*[=:]\s*["']?\s*(?!none\b|currentcolor\b|url\()[#\w(]/i; + const decode = (header, data) => { + if (/;base64$/i.test(header)) return atob(data); + try { + return decodeURIComponent(data); + } catch (error) { + return data; + } + }; + const found = []; + for (const [, , header, data] of source.matchAll(/url\(\s*(["'])data:image\/svg\+xml([^,]*),(.*?)\1\s*\)/gi)) { + const hit = decode(header, data).match(paint); + if (hit) found.push(`svg ${hit[0]}`); + } + for (const [, name, value] of source.matchAll(/(?:^|[{;])\s*(--[\w-]+|[a-z-]+)\s*:\s*([^;{}]+)/gm)) { + if (!colorProperty.test(name) || value.includes("url(")) continue; + if ( + /#[0-9a-f]{3,8}\b/i.test(value) || + /\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\(\s*[\d.]/i.test(value) || + value.split(/[\s,()]+/).some(keyword) + ) { + found.push(`${name}: ${value.trim()}`); + } + } + return found; + }, + [await response.text(), COLOR_PROPERTY.source], + ); + expect(offenders, `${sheet}: every color comes from a --design-* token`).toEqual([]); + } + }); + test("design: gallery of dashboard, lists, records, forms and administration", async ({ page }) => { skipUnlessServiceEnabled("design"); test.skip(!galleryEnabled(), "INFINITO_PLAYWRIGHT_KEEP is not true"); diff --git a/roles/web-app-suitecrm/files/style.css b/roles/web-app-suitecrm/files/style.css index 86c93f93e8..41e388a2fb 100644 --- a/roles/web-app-suitecrm/files/style.css +++ b/roles/web-app-suitecrm/files/style.css @@ -1694,13 +1694,17 @@ } :root:has(app-root) .carousel-control-next-icon, :root:has(app-root) .carousel-control-prev-icon { - background: no-repeat 50%/100% 100%; + background: currentcolor; + -webkit-mask: no-repeat 50%/100% 100%; + mask: no-repeat 50%/100% 100%; } :root:has(app-root) .carousel-control-prev-icon { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='M5.25 0l-4 4 4 4 1.5-1.5L4.25 4l2.5-2.5L5.25 0z'/%3e%3c/svg%3e"); + -webkit-mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='M5.25 0l-4 4 4 4 1.5-1.5L4.25 4l2.5-2.5L5.25 0z'/%3e%3c/svg%3e"); + mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='M5.25 0l-4 4 4 4 1.5-1.5L4.25 4l2.5-2.5L5.25 0z'/%3e%3c/svg%3e"); } :root:has(app-root) .carousel-control-next-icon { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='M2.75 0l-1.5 1.5L3.75 4l-2.5 2.5L2.75 8l4-4-4-4z'/%3e%3c/svg%3e"); + -webkit-mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='M2.75 0l-1.5 1.5L3.75 4l-2.5 2.5L2.75 8l4-4-4-4z'/%3e%3c/svg%3e"); + mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath d='M2.75 0l-1.5 1.5L3.75 4l-2.5 2.5L2.75 8l4-4-4-4z'/%3e%3c/svg%3e"); } :root:has(app-root) .carousel-indicators li { background-color: var(--design-surface-2); diff --git a/roles/web-app-suitecrm/templates/legacy.css.j2 b/roles/web-app-suitecrm/templates/legacy.css.j2 index 1b757d3026..43e8b213de 100644 --- a/roles/web-app-suitecrm/templates/legacy.css.j2 +++ b/roles/web-app-suitecrm/templates/legacy.css.j2 @@ -7336,7 +7336,8 @@ body.popupBody .list.view .pagination .button { background-color: var(--design-primary-hover); } .modal-edit-dashboard .modal-body .panel .panel-heading .edit-dashboard-tabs .panel-title .btn-danger { - background: lightslategrey; + background: var(--design-text-muted); + color: var(--design-surface-2); border-color: var(--design-surface-2); } .security-suite-settings select { diff --git a/roles/web-svc-seaweedfs/TODO.md b/roles/web-svc-seaweedfs/TODO.md index c26e5d1bc5..45f142252e 100644 --- a/roles/web-svc-seaweedfs/TODO.md +++ b/roles/web-svc-seaweedfs/TODO.md @@ -1,5 +1,9 @@ # TODO +## Filer page scripts under the CSP + +The filer page runs its own inline script (it defines `reportProgress` for the upload progress bar) and inline event handlers, but `meta/csp.yml` grants neither `script-src-elem` nor `script-src-attr`. They run only because `build_csp_header` (`plugins/filter/csp_filters.py`) adds `'unsafe-inline'` to both directives whenever the `logout` service is enabled. With `logout` disabled the browser refuses them ("Executing inline script violates ... script-src-elem", "Executing inline event handler violates ... script-src-attr"), the upload progress never renders, and the design spec "the upload progress bar is the primary fill and carries its on-color" fails. Options: grant the filer's script needs in `meta/csp.yml` (flags for both directives, or hashes of the upstream snippets per pinned version), or let the filer page carry its own policy. + ## Object-store (S3) consumer integration — roles not yet wired SeaweedFS is the shared S3 object store. A role becomes a consumer by declaring a diff --git a/scripts/tests/deploy/ci/dns53-sampler.sh b/scripts/tests/deploy/ci/dns53-sampler.sh index c565215836..3d5bec1a37 100755 --- a/scripts/tests/deploy/ci/dns53-sampler.sh +++ b/scripts/tests/deploy/ci/dns53-sampler.sh @@ -20,15 +20,20 @@ zone_probe_name() { printf 'rescue-probe.%s' "${zone}" } +uptime_ms() { + read -r up _ /dev/null 2>&1; then verdict=ok else verdict=fail fi - printf ' %s=%s/%sms' "${name}" "${verdict}" "$(($(date -u '+%s%3N') - start))" + printf ' %s=%s/%sms' "${name}" "${verdict}" "$(($(uptime_ms) - start))" } [ "${DNS53_SAMPLER_LIB:-}" = "1" ] && return 0 diff --git a/tests/unit/python/scripts/tests/deploy/ci/test_dns53_sampler.py b/tests/unit/python/scripts/tests/deploy/ci/test_dns53_sampler.py index d8ca33dc49..0c37be6f81 100644 --- a/tests/unit/python/scripts/tests/deploy/ci/test_dns53_sampler.py +++ b/tests/unit/python/scripts/tests/deploy/ci/test_dns53_sampler.py @@ -8,6 +8,7 @@ clients whose remote end is :53, other ports, or the embedded Docker DNS. from __future__ import annotations +import os import subprocess import tempfile import unittest @@ -59,7 +60,7 @@ class SamplerTickTests(unittest.TestCase): class AnswerProbeTests(unittest.TestCase): - def _answer(self, name: str) -> str: + def _answer(self, name: str, env: dict[str, str] | None = None) -> str: proc = subprocess.run( [ "sh", @@ -72,12 +73,23 @@ class AnswerProbeTests(unittest.TestCase): capture_output=True, text=True, check=True, + env=env, ) return proc.stdout def test_a_resolvable_name_is_reported_ok_with_its_latency(self): self.assertRegex(self._answer("localhost"), r"^ localhost=ok/\d+ms$") + def test_the_latency_does_not_depend_on_the_date_implementation(self): + with tempfile.TemporaryDirectory() as stub_dir: + stub = Path(stub_dir) / "date" + stub.write_text("#!/bin/sh\necho 1792150731%3N\n", encoding="utf-8") + stub.chmod(0o755) + env = {**os.environ, "PATH": f"{stub_dir}{os.pathsep}{os.environ['PATH']}"} + self.assertRegex( + self._answer("localhost", env=env), r"^ localhost=ok/\d+ms$" + ) + def test_an_unresolvable_name_is_reported_fail_not_skipped(self): self.assertRegex( self._answer("rescue-probe.invalid"),