diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-04 12:58:35 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-04 12:58:35 +0900 |
| commit | dc1d7fa9d75dcf00a8e04b9f5ebe7c6262e0c597 (patch) | |
| tree | 755ab1431ef3dcd6c7ecba1b638332119119364b /src/server/api | |
| parent | :art: (diff) | |
| download | sharkey-dc1d7fa9d75dcf00a8e04b9f5ebe7c6262e0c597.tar.gz sharkey-dc1d7fa9d75dcf00a8e04b9f5ebe7c6262e0c597.tar.bz2 sharkey-dc1d7fa9d75dcf00a8e04b9f5ebe7c6262e0c597.zip | |
ローカルタイムラインストリームに認証不要で接続できるように
Diffstat (limited to 'src/server/api')
| -rw-r--r-- | src/server/api/stream/local-timeline.ts | 6 | ||||
| -rw-r--r-- | 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 : |