Skip to content

Commit e9b8b25

Browse files
committed
Merge remote-tracking branch 'dspace/main' into accessibility-settings-main
# Conflicts: # cypress/support/e2e.ts # src/app/core/auth/auth.service.ts # src/app/footer/footer.component.html
2 parents 25d6809 + 5cdc72d commit e9b8b25

File tree

154 files changed

+4499
-3227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+4499
-3227
lines changed

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@
160160
]
161161
}
162162
],
163+
"@angular-eslint/prefer-standalone": [
164+
"error"
165+
],
163166
"@angular-eslint/no-attribute-decorator": "error",
164167
"@angular-eslint/no-output-native": "warn",
165168
"@angular-eslint/no-output-on-prefix": "warn",

.github/workflows/build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX: 0
3030
# Tell Cypress to run e2e tests using the same UI URL
3131
CYPRESS_BASE_URL: http://127.0.0.1:4000
32+
# Disable the cookie consent banner in e2e tests to avoid errors because of elements hidden by it
33+
DSPACE_INFO_ENABLECOOKIECONSENTPOPUP: false
3234
# When Chrome version is specified, we pin to a specific version of Chrome
3335
# Comment this out to use the latest release
3436
#CHROME_VERSION: "90.0.4430.212-1"
@@ -268,6 +270,37 @@ jobs:
268270
echo "$result"
269271
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology Vol. 28, No. 1"
270272
273+
# Verify 301 Handle redirect behavior
274+
# Note: /handle/123456789/260 is the same test Publication used by our e2e tests
275+
- name: Verify 301 redirect from '/handle' URLs
276+
run: |
277+
result=$(wget --server-response --quiet http://127.0.0.1:4000/handle/123456789/260 2>&1 | head -1 | awk '{print $2}')
278+
echo "$result"
279+
[[ "$result" -eq "301" ]]
280+
281+
# Verify 403 error code behavior
282+
- name: Verify 403 error code from '/403'
283+
run: |
284+
result=$(wget --server-response --quiet http://127.0.0.1:4000/403 2>&1 | head -1 | awk '{print $2}')
285+
echo "$result"
286+
[[ "$result" -eq "403" ]]
287+
288+
# Verify 404 error code behavior
289+
- name: Verify 404 error code from '/404' and on invalid pages
290+
run: |
291+
result=$(wget --server-response --quiet http://127.0.0.1:4000/404 2>&1 | head -1 | awk '{print $2}')
292+
echo "$result"
293+
result2=$(wget --server-response --quiet http://127.0.0.1:4000/invalidurl 2>&1 | head -1 | awk '{print $2}')
294+
echo "$result2"
295+
[[ "$result" -eq "404" && "$result2" -eq "404" ]]
296+
297+
# Verify 500 error code behavior
298+
- name: Verify 500 error code from '/500'
299+
run: |
300+
result=$(wget --server-response --quiet http://127.0.0.1:4000/500 2>&1 | head -1 | awk '{print $2}')
301+
echo "$result"
302+
[[ "$result" -eq "500" ]]
303+
271304
- name: Stop running app
272305
run: kill -9 $(lsof -t -i:4000)
273306

config/config.example.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,24 @@ ssr:
2323
# Determining which styles are critical is a relatively expensive operation; this option is
2424
# disabled (false) by default to boost server performance at the expense of loading smoothness.
2525
inlineCriticalCss: false
26-
# Path prefixes to enable SSR for. By default these are limited to paths of primary DSpace objects.
27-
# NOTE: The "/handle/" path ensures Handle redirects work via SSR. The "/reload/" path ensures
28-
# hard refreshes (e.g. after login) trigger SSR while fully reloading the page.
29-
paths: [ '/home', '/items/', '/entities/', '/collections/', '/communities/', '/bitstream/', '/bitstreams/', '/handle/', '/reload/' ]
26+
# Patterns to be run as regexes against the path of the page to check if SSR is allowed.
27+
# If the path match any of the regexes it will be served directly in CSR.
28+
# By default, excludes community and collection browse, global browse, global search, community list, statistics and various administrative tools.
29+
excludePathPatterns:
30+
- pattern: "^/communities/[a-f0-9-]{36}/browse(/.*)?$",
31+
flag: "i"
32+
- pattern: "^/collections/[a-f0-9-]{36}/browse(/.*)?$"
33+
flag: "i"
34+
- pattern: "^/browse/"
35+
- pattern: "^/search$"
36+
- pattern: "^/community-list$"
37+
- pattern: "^/admin/"
38+
- pattern: "^/processes/?"
39+
- pattern: "^/notifications/"
40+
- pattern: "^/statistics/?"
41+
- pattern: "^/access-control/"
42+
- pattern: "^/health$"
43+
3044
# Whether to enable rendering of Search component on SSR.
3145
# If set to true the component will be included in the HTML returned from the server side rendering.
3246
# If set to false the component will not be included in the HTML returned from the server side rendering.
@@ -453,6 +467,8 @@ info:
453467
enableEndUserAgreement: true
454468
enablePrivacyStatement: true
455469
enableCOARNotifySupport: true
470+
# Whether to show the cookie consent popup and the cookie settings footer link or not.
471+
enableCookieConsentPopup: true
456472

457473
# Whether to enable Markdown (https://commonmark.org/) and MathJax (https://www.mathjax.org/)
458474
# display in supported metadata fields. By default, only dc.description.abstract is supported.

cypress/e2e/header.cy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ describe('Header', () => {
1515
cy.visit('/');
1616

1717
// Click the language switcher (globe) in header
18-
cy.get('a[data-test="lang-switch"]').click();
18+
cy.get('button[data-test="lang-switch"]').click();
1919
// Click on the "Deusch" language in dropdown
20-
cy.get('#language-menu-list li').contains('Deutsch').click();
20+
cy.get('#language-menu-list div[role="option"]').contains('Deutsch').click();
2121

2222
// HTML "lang" attribute should switch to "de"
2323
cy.get('html').invoke('attr', 'lang').should('eq', 'de');
2424

2525
// Login menu should now be in German
26-
cy.get('a[data-test="login-menu"]').contains('Anmelden');
26+
cy.get('[data-test="login-menu"]').contains('Anmelden');
2727

2828
// Change back to English from language switcher
29-
cy.get('a[data-test="lang-switch"]').click();
30-
cy.get('#language-menu-list li').contains('English').click();
29+
cy.get('button[data-test="lang-switch"]').click();
30+
cy.get('#language-menu-list div[role="option"]').contains('English').click();
3131

3232
// HTML "lang" attribute should switch to "en"
3333
cy.get('html').invoke('attr', 'lang').should('eq', 'en');
3434

3535
// Login menu should now be in English
36-
cy.get('a[data-test="login-menu"]').contains('Log In');
36+
cy.get('[data-test="login-menu"]').contains('Log In');
3737
});
3838
});

cypress/e2e/homepage.cy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ describe('Homepage', () => {
2626
// Wait for homepage tag to appear
2727
cy.get('ds-home-page').should('be.visible');
2828

29+
// Wait for at least one loading component to show up
30+
cy.get('ds-loading').should('exist');
31+
32+
// Wait until all loading components have disappeared
33+
cy.get('ds-loading').should('not.exist');
34+
2935
// Analyze <ds-home-page> for accessibility issues
3036
testA11y('ds-home-page');
3137
});

cypress/support/e2e.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@ before(() => {
5454

5555
// Runs once before the first test in each "block"
5656
beforeEach(() => {
57-
// Pre-agree to all Orejime cookies by setting the orejime-* cookies
57+
// Pre-agree to all Orejime cookies by setting the orejime-anonymous cookie
5858
// This just ensures it doesn't get in the way of matching other objects in the page.
59-
const cookieContent = '{"authentication":true,"preferences":true,"acknowledgement":true,"google-analytics":true,"matomo":true,"google-recaptcha":true,"accessibility":true}';
60-
cy.setCookie('orejime-anonymous', cookieContent);
61-
cy.setCookie(`orejime-${Cypress.env('DSPACE_TEST_ADMIN_USER_UUID')}`, cookieContent);
62-
cy.setCookie(`orejime-${Cypress.env('DSPACE_TEST_SUBMIT_USER_UUID')}`, cookieContent);
59+
cy.setCookie('orejime-anonymous', '{"authentication":true,"preferences":true,"acknowledgement":true,"google-analytics":true,"correlation-id":true,"accessibility":true}');
6360

6461
// Remove any CSRF cookies saved from prior tests
6562
cy.clearCookie(DSPACE_XSRF_COOKIE);

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"colors": "^1.4.0",
125125
"compression": "^1.7.5",
126126
"cookie-parser": "1.4.7",
127-
"core-js": "^3.41.0",
127+
"core-js": "^3.42.0",
128128
"date-fns": "^2.29.3",
129129
"date-fns-tz": "^1.3.7",
130130
"deepmerge": "^4.3.1",
@@ -232,12 +232,12 @@
232232
"postcss-loader": "^4.0.3",
233233
"postcss-preset-env": "^7.4.2",
234234
"rimraf": "^3.0.2",
235-
"sass": "~1.87.0",
235+
"sass": "~1.88.0",
236236
"sass-loader": "^12.6.0",
237237
"sass-resources-loader": "^2.2.5",
238238
"ts-node": "^8.10.2",
239239
"typescript": "~5.4.5",
240-
"webpack": "5.99.7",
240+
"webpack": "5.99.8",
241241
"webpack-cli": "^5.1.4",
242242
"webpack-dev-server": "^4.15.1"
243243
}

server.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
REQUEST,
5959
RESPONSE,
6060
} from './src/express.tokens';
61+
import { SsrExcludePatterns } from "./src/config/ssr-config.interface";
6162

6263
/*
6364
* Set path for the browser application's dist folder
@@ -221,7 +222,7 @@ export function app() {
221222
* The callback function to serve server side angular
222223
*/
223224
function ngApp(req, res, next) {
224-
if (environment.ssr.enabled && req.method === 'GET' && (req.path === '/' || environment.ssr.paths.some(pathPrefix => req.path.startsWith(pathPrefix)))) {
225+
if (environment.ssr.enabled && req.method === 'GET' && (req.path === '/' || !isExcludedFromSsr(req.path, environment.ssr.excludePathPatterns))) {
225226
// Render the page to user via SSR (server side rendering)
226227
serverSideRender(req, res, next);
227228
} else {
@@ -627,6 +628,21 @@ function start() {
627628
}
628629
}
629630

631+
/**
632+
* Check if SSR should be skipped for path
633+
*
634+
* @param path
635+
* @param excludePathPattern
636+
*/
637+
function isExcludedFromSsr(path: string, excludePathPattern: SsrExcludePatterns[]): boolean {
638+
const patterns = excludePathPattern.map(p =>
639+
new RegExp(p.pattern, p.flag || '')
640+
);
641+
return patterns.some((regex) => {
642+
return regex.test(path)
643+
});
644+
}
645+
630646
/*
631647
* The callback function to serve health check requests
632648
*/

src/app/browse-by/browse-by-page/browse-by-page.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { BrowseByPageComponent } from './browse-by-page.component';
2020
@Component({
2121
// eslint-disable-next-line @angular-eslint/component-selector
2222
selector: '',
23+
standalone: true,
2324
template: '<span id="BrowseByTestComponent"></span>',
2425
})
2526
class BrowseByTestComponent {

0 commit comments

Comments
 (0)