-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website,kubernetes): make it possible to disable login and submi…
…t flow on website (#3223) * chore(website): delete unused function * fix(website): delete duplicate "to" in sentence It would show "Please select the organism for which you want to to browse data:" * feat(website,kubernetes): make it possible to disable login and submit flow on website resolves #3211 * chore(website): delete unused types * docs: add missing spec for `website.runtimeConfig`
- Loading branch information
1 parent
c0959b7
commit a6b3bb7
Showing
9 changed files
with
151 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
import { sequence } from 'astro:middleware'; | ||
|
||
import { getWebsiteConfig } from './config.ts'; | ||
import { authMiddleware } from './middleware/authMiddleware.ts'; | ||
import { catchErrorMiddleware } from './middleware/catchErrorMiddleware.ts'; | ||
import { organismValidatorMiddleware } from './middleware/organismValidatorMiddleware.ts'; | ||
import { submissionPagesDisablingMiddleware } from './middleware/submissionPagesDisablingMiddleware.ts'; | ||
|
||
const middlewares = [catchErrorMiddleware, organismValidatorMiddleware, authMiddleware]; | ||
if (!getWebsiteConfig().enableSubmissionPages) { | ||
middlewares.push(submissionPagesDisablingMiddleware); | ||
} | ||
|
||
// Astro middleware | ||
export const onRequest = sequence(catchErrorMiddleware, organismValidatorMiddleware, authMiddleware); | ||
export const onRequest = sequence(...middlewares); |
11 changes: 11 additions & 0 deletions
11
website/src/middleware/submissionPagesDisablingMiddleware.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineMiddleware } from 'astro/middleware'; | ||
|
||
export const submissionPagesDisablingMiddleware = defineMiddleware(async (context, next) => { | ||
const organism = context.params.organism; | ||
|
||
if (organism !== undefined && context.url.pathname.includes(`${organism}/submission`)) { | ||
return context.rewrite('/404'); | ||
} | ||
|
||
return next(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters