mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 07:35:05 -04:00
fix(frontend): permit static resources for access
This commit is contained in:
parent
9276a001d8
commit
b6b6eb528e
1 changed files with 12 additions and 0 deletions
|
@ -49,8 +49,20 @@ exports.userCanModify = (padId: string, req: SocketClientRequest) => {
|
||||||
// Exported so that tests can set this to 0 to avoid unnecessary test slowness.
|
// Exported so that tests can set this to 0 to avoid unnecessary test slowness.
|
||||||
exports.authnFailureDelayMs = 1000;
|
exports.authnFailureDelayMs = 1000;
|
||||||
|
|
||||||
|
const staticResources = [
|
||||||
|
/^\/padbootstrap-[a-zA-Z0-9]+\.min\.js$/,
|
||||||
|
/^\/manifest.json$/
|
||||||
|
]
|
||||||
|
|
||||||
const checkAccess = async (req:any, res:any, next: Function) => {
|
const checkAccess = async (req:any, res:any, next: Function) => {
|
||||||
const requireAdmin = req.path.toLowerCase().startsWith('/admin-auth');
|
const requireAdmin = req.path.toLowerCase().startsWith('/admin-auth');
|
||||||
|
for (const staticResource of staticResources) {
|
||||||
|
if (req.path.match(staticResource)) {
|
||||||
|
console.log(`Loading [${staticResource}] ${req.path}`);
|
||||||
|
return next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Step 1: Check the preAuthorize hook for early permit/deny (permit is only allowed for non-admin
|
// Step 1: Check the preAuthorize hook for early permit/deny (permit is only allowed for non-admin
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue