[mastodon-client] Improve streaming api isMastodon check

This commit is contained in:
Laura Hausmann 2023-10-09 22:15:10 +02:00
parent 878970d318
commit a0adea70f5
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605

View File

@ -53,10 +53,7 @@ export const initializeStreamingServer = (server: http.Server) => {
const host = `https://${request.host}`;
const prepareStream = q.stream?.toString();
const isMastodon = request.resourceURL.pathname?.endsWith('/api/v1/streaming');
if (isMastodon && !request.resourceURL.pathname?.startsWith('/mastodon')) {
streamingLogger.warn(`Received connect from mastodon on incorrect path: ${request.resourceURL.pathname}`);
}
const isMastodon = request.resourceURL.pathname?.startsWith('/api/v1/streaming');
const main = isMastodon
? new MastodonStreamingConnection(connection, ev, user, app, q)