Skip to content

Node.js based forum software built for the modern web

fix: closes #13298, catch exceptions in webfinger and nodeinfo

Barış Soner Uşaklıbbfd64457d2f
diff --git a/src/routes/well-known.js b/src/routes/well-known.js
index 399668b679..5ea46c41f6 100644
--- a/src/routes/well-known.js
+++ b/src/routes/well-known.js
@@ -3,6 +3,7 @@
const nconf = require('nconf');
const meta = require('../meta');
const db = require('../database');
+const helpers = require('./helpers');
module.exports = function (app, middleware, controllers) {
const url = nconf.get('url');
@@ -12,7 +13,7 @@ module.exports = function (app, middleware, controllers) {
res.redirect('/me/edit/password');
});
- app.get('/.well-known/webfinger', controllers['well-known'].webfinger);
+ app.get('/.well-known/webfinger', helpers.tryRoute(controllers['well-known'].webfinger));
app.get('/.well-known/nodeinfo', (req, res) => {
res.json({
@@ -25,7 +26,7 @@ module.exports = function (app, middleware, controllers) {
});
});
- app.get('/nodeinfo/2.0(.json)?', async (req, res) => {
+ app.get('/nodeinfo/2.0(.json)?', helpers.tryRoute(async (req, res) => {
const getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
function addMonths(input, months) {
@@ -73,5 +74,5 @@ module.exports = function (app, middleware, controllers) {
nodeDescription: meta.config.description || '',
},
});
- });
+ }));
};