diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-29 20:32:18 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-29 20:32:18 +0900 |
| commit | cf33e483f7e6f40e8cbbbc0118a7df70bdaf651f (patch) | |
| tree | 318279530d3392ee40d91968477fc0e78d5cf0f7 /src/server/api/stream | |
| parent | Update .travis.yml (diff) | |
| download | sharkey-cf33e483f7e6f40e8cbbbc0118a7df70bdaf651f.tar.gz sharkey-cf33e483f7e6f40e8cbbbc0118a7df70bdaf651f.tar.bz2 sharkey-cf33e483f7e6f40e8cbbbc0118a7df70bdaf651f.zip | |
整理した
Diffstat (limited to 'src/server/api/stream')
| -rw-r--r-- | src/server/api/stream/channel.ts | 4 | ||||
| -rw-r--r-- | src/server/api/stream/home.ts | 6 | ||||
| -rw-r--r-- | src/server/api/stream/messaging.ts | 4 | ||||
| -rw-r--r-- | src/server/api/stream/othello-game.ts | 10 | ||||
| -rw-r--r-- | src/server/api/stream/othello.ts | 2 |
5 files changed, 16 insertions, 10 deletions
diff --git a/src/server/api/stream/channel.ts b/src/server/api/stream/channel.ts index d67d77cbf4..cb04278237 100644 --- a/src/server/api/stream/channel.ts +++ b/src/server/api/stream/channel.ts @@ -1,8 +1,10 @@ import * as websocket from 'websocket'; import * as redis from 'redis'; +import { ParsedUrlQuery } from 'querystring'; export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient): void { - const channel = request.resourceURL.query.channel; + const q = request.resourceURL.query as ParsedUrlQuery; + const channel = q.channel; // Subscribe channel stream subscriber.subscribe(`misskey:channel-stream:${channel}`); diff --git a/src/server/api/stream/home.ts b/src/server/api/stream/home.ts index 291be0824d..648bd7c3c2 100644 --- a/src/server/api/stream/home.ts +++ b/src/server/api/stream/home.ts @@ -2,9 +2,9 @@ import * as websocket from 'websocket'; import * as redis from 'redis'; import * as debug from 'debug'; -import User from '../models/user'; -import Mute from '../models/mute'; -import { pack as packPost } from '../models/post'; +import User from '../../../models/user'; +import Mute from '../../../models/mute'; +import { pack as packPost } from '../../../models/post'; import readNotification from '../common/read-notification'; const log = debug('misskey'); diff --git a/src/server/api/stream/messaging.ts b/src/server/api/stream/messaging.ts index a4a12426a3..3e6c2cd509 100644 --- a/src/server/api/stream/messaging.ts +++ b/src/server/api/stream/messaging.ts @@ -1,9 +1,11 @@ import * as websocket from 'websocket'; import * as redis from 'redis'; import read from '../common/read-messaging-message'; +import { ParsedUrlQuery } from 'querystring'; export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void { - const otherparty = request.resourceURL.query.otherparty; + const q = request.resourceURL.query as ParsedUrlQuery; + const otherparty = q.otherparty as string; // Subscribe messaging stream subscriber.subscribe(`misskey:messaging-stream:${user._id}-${otherparty}`); diff --git a/src/server/api/stream/othello-game.ts b/src/server/api/stream/othello-game.ts index e48d93cddc..b6a251c4c8 100644 --- a/src/server/api/stream/othello-game.ts +++ b/src/server/api/stream/othello-game.ts @@ -1,13 +1,15 @@ import * as websocket from 'websocket'; import * as redis from 'redis'; import * as CRC32 from 'crc-32'; -import OthelloGame, { pack } from '../models/othello-game'; +import OthelloGame, { pack } from '../../../models/othello-game'; import { publishOthelloGameStream } from '../event'; -import Othello from '../../common/othello/core'; -import * as maps from '../../common/othello/maps'; +import Othello from '../../../common/othello/core'; +import * as maps from '../../../common/othello/maps'; +import { ParsedUrlQuery } from 'querystring'; export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user?: any): void { - const gameId = request.resourceURL.query.game; + const q = request.resourceURL.query as ParsedUrlQuery; + const gameId = q.game; // Subscribe game stream subscriber.subscribe(`misskey:othello-game-stream:${gameId}`); diff --git a/src/server/api/stream/othello.ts b/src/server/api/stream/othello.ts index 55c993ec85..4205afae7c 100644 --- a/src/server/api/stream/othello.ts +++ b/src/server/api/stream/othello.ts @@ -1,7 +1,7 @@ import * as mongo from 'mongodb'; import * as websocket from 'websocket'; import * as redis from 'redis'; -import Matching, { pack } from '../models/othello-matching'; +import Matching, { pack } from '../../../models/othello-matching'; import publishUserStream from '../event'; export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void { |