mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-05-05 23:50:21 +00:00
feat(listenbrainz): Use end-of-string token and wildcard route to better log malformed LZ endpoint routes
This commit is contained in:
parent
4ee503655c
commit
a5f6aaa7c0
1 changed files with 5 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ export const setupLZEndpointRoutes = (app: ExpressWithAsync, parentLogger: Logge
|
|||
const nonEmptyCheck = nonEmptyBody(logger, 'LZ Endpoint');
|
||||
|
||||
const webhookIngress = new LZEndpointNotifier(logger);
|
||||
app.useAsync(/(\/api\/listenbrainz.*)|(\/1\/submit-listens)/,
|
||||
app.useAsync(/(\/api\/listenbrainz.*)|(\/1\/submit-listens\/?$)/,
|
||||
async function (req, res, next) {
|
||||
// track request before parsing body to ensure we at least log that something is happening
|
||||
// (in the event body parsing does not work or request is not POST/PATCH)
|
||||
|
|
@ -59,5 +59,9 @@ export const setupLZEndpointRoutes = (app: ExpressWithAsync, parentLogger: Logge
|
|||
user_name: "Multi-Scrobbler"
|
||||
})
|
||||
});
|
||||
app.useAsync(/\/1\/.*/, async function (req, res) {
|
||||
logger.warn(`Received what looks like a Listenbrainz Endpoint request but it was to an invalid URL route: ${req.originalUrl}\nMake sure base URL path to MS endpoint is correct.`);
|
||||
res.status(404);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue