diff options
| author | こぴなたみぽ <Syuilotan@yahoo.co.jp> | 2017-11-01 04:18:32 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-01 04:18:32 +0900 |
| commit | 2a00930150207c983a2f6e111d03f2db33b897b9 (patch) | |
| tree | f41dc9bcc5498ac89839057e07910b9c2d81fed3 /src/api/streaming.ts | |
| parent | v2752 (diff) | |
| parent | v2769 (diff) | |
| download | sharkey-2a00930150207c983a2f6e111d03f2db33b897b9.tar.gz sharkey-2a00930150207c983a2f6e111d03f2db33b897b9.tar.bz2 sharkey-2a00930150207c983a2f6e111d03f2db33b897b9.zip | |
Merge pull request #854 from syuilo/bbs
Bbs
Diffstat (limited to 'src/api/streaming.ts')
| -rw-r--r-- | src/api/streaming.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/api/streaming.ts b/src/api/streaming.ts index db600013b9..0e512fb210 100644 --- a/src/api/streaming.ts +++ b/src/api/streaming.ts @@ -9,6 +9,7 @@ import isNativeToken from './common/is-native-token'; import homeStream from './stream/home'; import messagingStream from './stream/messaging'; import serverStream from './stream/server'; +import channelStream from './stream/channel'; module.exports = (server: http.Server) => { /** @@ -26,14 +27,6 @@ module.exports = (server: http.Server) => { return; } - const user = await authenticate(request.resourceURL.query.i); - - if (user == null) { - connection.send('authentication-failed'); - connection.close(); - return; - } - // Connect to Redis const subscriber = redis.createClient( config.redis.port, config.redis.host); @@ -43,6 +36,19 @@ module.exports = (server: http.Server) => { subscriber.quit(); }); + if (request.resourceURL.pathname === '/channel') { + channelStream(request, connection, subscriber); + return; + } + + const user = await authenticate(request.resourceURL.query.i); + + if (user == null) { + connection.send('authentication-failed'); + connection.close(); + return; + } + const channel = request.resourceURL.pathname === '/' ? homeStream : request.resourceURL.pathname === '/messaging' ? messagingStream : |