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

This commit is contained in:
Barış Soner Uşaklı
2025-04-03 12:57:49 -04:00
parent a6839b6149
commit bbfd64457d

View File

@@ -3,6 +3,7 @@
const nconf = require('nconf'); const nconf = require('nconf');
const meta = require('../meta'); const meta = require('../meta');
const db = require('../database'); const db = require('../database');
const helpers = require('./helpers');
module.exports = function (app, middleware, controllers) { module.exports = function (app, middleware, controllers) {
const url = nconf.get('url'); const url = nconf.get('url');
@@ -12,7 +13,7 @@ module.exports = function (app, middleware, controllers) {
res.redirect('/me/edit/password'); 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) => { app.get('/.well-known/nodeinfo', (req, res) => {
res.json({ 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(); const getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
function addMonths(input, months) { function addMonths(input, months) {
@@ -73,5 +74,5 @@ module.exports = function (app, middleware, controllers) {
nodeDescription: meta.config.description || '', nodeDescription: meta.config.description || '',
}, },
}); });
}); }));
}; };