From 7162dd94f5e61cb63e670e3f09944c0c948b39a8 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Tue, 3 Nov 2026 10:41:59 +0100 Subject: [PATCH 1/3] VSB-TUO/filter config.json before exposing it Port of dtq-dev PR 1059 (commit 1fa478b376). Co-Authored-By: Claude Opus 5.5 --- src/config/config.server.ts | 57 ++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/config/config.server.ts b/src/config/config.server.ts index 488c1c7a4c6..13d3f7297e3 100644 --- a/src/config/config.server.ts +++ b/src/config/config.server.ts @@ -237,7 +237,62 @@ export const buildAppConfig = (destConfigPath?: string): AppConfig => { buildBaseUrl(appConfig.rest); if (isNotEmpty(destConfigPath)) { - writeFileSync(destConfigPath, JSON.stringify(appConfig, null, 2)); + // Create sanitized public config - only expose what frontend actually needs + const publicConfig = { + production: appConfig.production, + // REST API configuration - only public endpoint + ...(appConfig.rest && { + rest: { + baseUrl: appConfig.rest.baseUrl, + nameSpace: appConfig.rest.nameSpace, + }, + }), + // UI namespace for routing + ...(appConfig.ui ? { ui: { nameSpace: appConfig.ui.nameSpace } } : {}), + // Auth configuration - only expose client-side settings (idle timeout, token refresh) + auth: { + ui: { + timeUntilIdle: appConfig.auth?.ui?.timeUntilIdle, + idleGracePeriod: appConfig.auth?.ui?.idleGracePeriod, + }, + rest: { + timeLeftBeforeTokenRefresh: appConfig.auth?.rest?.timeLeftBeforeTokenRefresh, + }, + }, + // Frontend feature configurations + languages: appConfig.languages, + defaultLanguage: appConfig.defaultLanguage, + themes: appConfig.themes, + form: appConfig.form, + notifications: appConfig.notifications, + submission: appConfig.submission, + browseBy: appConfig.browseBy, + communityList: appConfig.communityList, + homePage: appConfig.homePage, + item: appConfig.item, + collection: appConfig.collection, + mediaViewer: appConfig.mediaViewer, + bundle: appConfig.bundle, + info: appConfig.info, + markdown: appConfig.markdown, + vocabularies: appConfig.vocabularies, + comcolSelectionSort: appConfig.comcolSelectionSort, + liveRegion: appConfig.liveRegion, + search: appConfig.search, + accessibility: appConfig.accessibility, + signpostingEnabled: appConfig.signpostingEnabled, + // Matomo analytics - only expose client-side tracking properties + ...(appConfig.matomo && { + matomo: { + hostUrl: appConfig.matomo.hostUrl, + siteId: appConfig.matomo.siteId, + dimensionId: appConfig.matomo.dimensionId, + }, + }), + debug: appConfig.debug, + }; + + writeFileSync(destConfigPath, JSON.stringify(publicConfig, null, 2)); console.log(`Angular ${bold('config.json')} file generated correctly at ${bold(destConfigPath)} \n`); } From 5f5e2bbddb04312687311b4583a938d3a74cc19b Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Tue, 3 Nov 2026 10:42:00 +0100 Subject: [PATCH 2/3] VSB-TUO/Add cache config to public config Port of dtq-dev PR 1069 (commit 8de5005558). Co-Authored-By: Claude Opus 5.5 --- cypress/e2e/homepage-statistics.cy.ts | 68 +++++++++++++-------------- src/config/config.server.ts | 6 +++ 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/cypress/e2e/homepage-statistics.cy.ts b/cypress/e2e/homepage-statistics.cy.ts index 86c2805557e..e3f0c0cb41b 100644 --- a/cypress/e2e/homepage-statistics.cy.ts +++ b/cypress/e2e/homepage-statistics.cy.ts @@ -1,36 +1,34 @@ -import { REGEX_MATCH_NON_EMPTY_TEXT } from 'cypress/support/e2e'; -import { testA11y } from 'cypress/support/utils'; -import '../support/commands'; +// Commented out because exposing of the config.json was changed and the `generateViewEvent` cannot be used. -describe('Site Statistics Page', () => { - // CLARIN - // NOTE: statistics were removed from the navbar - // it('should load if you click on "Statistics" from homepage', () => { - // cy.visit('/'); - // cy.get('a[data-test="link-menu-item.menu.section.statistics"]').click(); - // cy.location('pathname').should('eq', '/statistics'); - // }); - - it('should pass accessibility tests', () => { - // generate 2 view events on an Item's page - cy.generateViewEvent(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION'), 'item'); - cy.generateViewEvent(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION'), 'item'); - - cy.visit('/statistics'); - - // tag must be visable - cy.get('ds-site-statistics-page').should('be.visible'); - - // Verify / wait until "Total Visits" table's *last* label is non-empty - // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) - cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').last().contains(REGEX_MATCH_NON_EMPTY_TEXT); - // Wait an extra 500ms, just so all entries in Total Visits have loaded. - cy.wait(500); - - // Analyze for accessibility issues - // CLARIN - // NOTE: accessibility tests are failing because the UI has been changed - // testA11y('ds-site-statistics-page'); - // CLARIN - }); -}); +// describe('Site Statistics Page', () => { +// // CLARIN +// // NOTE: statistics were removed from the navbar +// // it('should load if you click on "Statistics" from homepage', () => { +// // cy.visit('/'); +// // cy.get('a[data-test="link-menu-item.menu.section.statistics"]').click(); +// // cy.location('pathname').should('eq', '/statistics'); +// // }); +// +// it('should pass accessibility tests', () => { +// // generate 2 view events on an Item's page +// cy.generateViewEvent(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION'), 'item'); +// cy.generateViewEvent(Cypress.env('DSPACE_TEST_ENTITY_PUBLICATION'), 'item'); +// +// cy.visit('/statistics'); +// +// // tag must be visable +// cy.get('ds-site-statistics-page').should('be.visible'); +// +// // Verify / wait until "Total Visits" table's *last* label is non-empty +// // (This table loads these labels asynchronously, so we want to wait for them before analyzing page) +// cy.get('table[data-test="TotalVisits"] th[data-test="statistics-label"]').last().contains(REGEX_MATCH_NON_EMPTY_TEXT); +// // Wait an extra 500ms, just so all entries in Total Visits have loaded. +// cy.wait(500); +// +// // Analyze for accessibility issues +// // CLARIN +// // NOTE: accessibility tests are failing because the UI has been changed +// // testA11y('ds-site-statistics-page'); +// // CLARIN +// }); +// }); diff --git a/src/config/config.server.ts b/src/config/config.server.ts index 13d3f7297e3..848f5fa4622 100644 --- a/src/config/config.server.ts +++ b/src/config/config.server.ts @@ -245,6 +245,7 @@ export const buildAppConfig = (destConfigPath?: string): AppConfig => { rest: { baseUrl: appConfig.rest.baseUrl, nameSpace: appConfig.rest.nameSpace, + ssrBaseUrl: appConfig.rest.ssrBaseUrl, }, }), // UI namespace for routing @@ -259,6 +260,11 @@ export const buildAppConfig = (destConfigPath?: string): AppConfig => { timeLeftBeforeTokenRefresh: appConfig.auth?.rest?.timeLeftBeforeTokenRefresh, }, }, + // Cache configuration - frontend needs msToLive, control, and autoSync settings + cache: { + msToLive: appConfig.cache?.msToLive, + control: appConfig.cache?.control, + }, // Frontend feature configurations languages: appConfig.languages, defaultLanguage: appConfig.defaultLanguage, From aa81739bb58598c185ce0c93f992f35124f7a3fc Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Tue, 3 Nov 2026 11:36:39 +0100 Subject: [PATCH 3/3] VSB-TUO/Keep matomo.enabled in the public config.json customer/vsb-tuo turns Matomo on in main.browser.ts by reading matomo.enabled from assets/config.json. Without the key the browser never loads the tracker. Co-Authored-By: Claude Opus 5.5 --- src/config/config.server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/config.server.ts b/src/config/config.server.ts index 848f5fa4622..d73462c0c8e 100644 --- a/src/config/config.server.ts +++ b/src/config/config.server.ts @@ -290,6 +290,7 @@ export const buildAppConfig = (destConfigPath?: string): AppConfig => { // Matomo analytics - only expose client-side tracking properties ...(appConfig.matomo && { matomo: { + enabled: appConfig.matomo.enabled, hostUrl: appConfig.matomo.hostUrl, siteId: appConfig.matomo.siteId, dimensionId: appConfig.matomo.dimensionId,