From cf33e483f7e6f40e8cbbbc0118a7df70bdaf651f Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 29 Mar 2018 20:32:18 +0900 Subject: 整理した MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/stream/channel.ts | 4 +++- src/server/api/stream/home.ts | 6 +++--- src/server/api/stream/messaging.ts | 4 +++- src/server/api/stream/othello-game.ts | 10 ++++++---- src/server/api/stream/othello.ts | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src/server/api/stream') 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 { -- cgit v1.2.3-freya