feat: error page, admin-only DNS page, navbar active styling (v1.33.0)
Pull Request Tests / Run Tests (18.x) (push) Successful in 30s
Pull Request Tests / Run Tests (20.x) (push) Successful in 26s
Pull Request Tests / Run Tests (22.x) (push) Successful in 33s
Pull Request Tests / Test Summary (push) Successful in 4s

- Add SSO-style error page (views/error.ejs) and render it for browser
  navigation in the error handler (API still returns JSON).
- DNS page admin-only: forceLogin(['admin']) + nav groups ['admin'].
- Navbar: username not underlined; only the active nav link is bold+underlined.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-04 13:26:36 -04:00
parent 8107755307
commit 1bbf593232
7 changed files with 55 additions and 4 deletions
+15
View File
@@ -21,6 +21,8 @@ module.exports = app;
// Hold onto the auth middleware
const middleware = require('./middleware/auth');
const conf = require('@simpleworkjs/conf');
const buildInfo = require('./utils/build_info');
// Grab the projects PubSub
app.contoller = require('./controller');
@@ -115,6 +117,19 @@ app.use(async function(err, req, res, next) {
res.status(status);
// Only expose safe, non-internal fields to the client.
const body = { name: err.name, message: err.message };
// Browser navigation gets the HTML error page (shared with SSO); API
// clients get JSON.
if (req.accepts('html') && !req.originalUrl.startsWith('/api/')) {
res.render('error', {
title: conf.environment !== 'production' ? 'dev' : '',
titleIcon: conf.environment !== 'production' ? '<i class="fa-brands fa-dev"></i>' : '',
name: conf.name,
logo: conf.logo,
...buildInfo,
error: err,
});
return;
}
res.json(body);
}catch(error){
console.error('error in the catch-all error handler', error);