Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ app.use(express.static(path.join(__dirname, 'public')))
app.all('*', (req, res, next) => {
if(process.env.DOWN === "true"){
res.status(503).json({"message":"RERUM v1 is down for updates or maintenance at this time. We apologize for the inconvenience. Try again later."})
return
}
else{
next() //pass on to the next app.use
}
next() //pass on to the next app.use
Comment on lines 72 to +77
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The maintenance-mode guard is registered on app.all('*_', ...), but '*_' is not a catch-all route in Express (the usual catch-all is '*' or '/*'). As written, this handler likely won’t run for most requests, so DOWN=true may not actually block traffic. Consider changing the route to a real catch-all (and keep the early return after res.status(503).json(...)).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wrong. new express who dis

})

app.use('/', indexRouter)
Expand Down
7 changes: 3 additions & 4 deletions routes/patchSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import rest from '../rest.js'
router.route('/')
.patch(auth.checkJwt, controller.patchSet)
.post(auth.checkJwt, (req, res, next) => {
if (rest.checkPatchOverrideSupport(req, res)) {
controller.patchSet(req, res, next)
}
else {
if (!rest.checkPatchOverrideSupport(req, res)) {
res.statusMessage = 'Improper request method for updating, please use PATCH to add new keys to this object.'
res.status(405)
next(res)
return
}
controller.patchSet(req, res, next)
})
.all((req, res, next) => {
res.statusMessage = 'Improper request method for updating, please use PATCH to add new keys to this object.'
Expand Down
7 changes: 3 additions & 4 deletions routes/patchUnset.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import rest from '../rest.js'
router.route('/')
.patch(auth.checkJwt, controller.patchUnset)
.post(auth.checkJwt, (req, res, next) => {
if (rest.checkPatchOverrideSupport(req, res)) {
controller.patchUnset(req, res, next)
}
else {
if (!rest.checkPatchOverrideSupport(req, res)) {
res.statusMessage = 'Improper request method for updating, please use PATCH to remove keys from this object.'
res.status(405)
next(res)
return
}
controller.patchUnset(req, res, next)
})
.all((req, res, next) => {
res.statusMessage = 'Improper request method for updating, please use PATCH to remove keys from this object.'
Expand Down
7 changes: 3 additions & 4 deletions routes/patchUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import auth from '../auth/index.js'
router.route('/')
.patch(auth.checkJwt, controller.patchUpdate)
.post(auth.checkJwt, (req, res, next) => {
if (rest.checkPatchOverrideSupport(req, res)) {
controller.patchUpdate(req, res, next)
}
else {
if (!rest.checkPatchOverrideSupport(req, res)) {
res.statusMessage = 'Improper request method for updating, please use PATCH to alter the existing keys this object.'
res.status(405)
next(res)
return
}
controller.patchUpdate(req, res, next)
})
.all((req, res, next) => {
res.statusMessage = 'Improper request method for updating, please use PATCH to alter existing keys on this object.'
Expand Down