From dc1d7fa9d75dcf00a8e04b9f5ebe7c6262e0c597 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 4 Sep 2018 12:58:35 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB=E3=82=BF?= =?UTF-8?q?=E3=82=A4=E3=83=A0=E3=83=A9=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=83=BC=E3=83=A0=E3=81=AB=E8=AA=8D=E8=A8=BC=E4=B8=8D?= =?UTF-8?q?=E8=A6=81=E3=81=A7=E6=8E=A5=E7=B6=9A=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/stream/local-timeline.ts | 6 +++--- src/server/api/streaming.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/api/stream/local-timeline.ts b/src/server/api/stream/local-timeline.ts index 82060a7aaa..25e0e00c9f 100644 --- a/src/server/api/stream/local-timeline.ts +++ b/src/server/api/stream/local-timeline.ts @@ -9,10 +9,10 @@ export default async function( request: websocket.request, connection: websocket.connection, subscriber: Xev, - user: IUser + user?: IUser ) { - const mute = await Mute.find({ muterId: user._id }); - const mutedUserIds = mute.map(m => m.muteeId.toString()); + const mute = user ? await Mute.find({ muterId: user._id }) : null; + const mutedUserIds = mute ? mute.map(m => m.muteeId.toString()) : []; // Subscribe stream subscriber.on('local-timeline', async note => { diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index c8b2d4e0b9..e6094a40b2 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -52,6 +52,11 @@ module.exports = (server: http.Server) => { return; } + if (request.resourceURL.pathname === '/local-timeline') { + localTimelineStream(request, connection, ev, user); + return; + } + if (user == null) { connection.send('authentication-failed'); connection.close(); @@ -60,7 +65,6 @@ module.exports = (server: http.Server) => { const channel: any = request.resourceURL.pathname === '/' ? homeStream : - request.resourceURL.pathname === '/local-timeline' ? localTimelineStream : request.resourceURL.pathname === '/hybrid-timeline' ? hybridTimelineStream : request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream : request.resourceURL.pathname === '/user-list' ? userListStream :