Refactoring

This commit is contained in:
syuilo 2018-07-09 21:15:49 +09:00
parent 8b3cb850a5
commit 9201b5318b
6 changed files with 19 additions and 19 deletions

View file

@ -1,9 +1,9 @@
import Stream from './stream';
import MiOS from '../../../mios';
import Stream from '../stream';
import MiOS from '../../../../mios';
export class ReversiGameStream extends Stream {
constructor(os: MiOS, me, game) {
super(os, 'reversi-game', {
super(os, 'games/reversi-game', {
i: me ? me.token : null,
game: game.id
});

View file

@ -1,10 +1,10 @@
import StreamManager from './stream-manager';
import Stream from './stream';
import MiOS from '../../../mios';
import StreamManager from '../stream-manager';
import Stream from '../stream';
import MiOS from '../../../../mios';
export class ReversiStream extends Stream {
constructor(os: MiOS, me) {
super(os, 'reversi', {
super(os, 'games/reversi', {
i: me.token
});
}

View file

@ -11,7 +11,7 @@ import { DriveStreamManager } from './common/scripts/streaming/drive';
import { ServerStatsStreamManager } from './common/scripts/streaming/server-stats';
import { NotesStatsStreamManager } from './common/scripts/streaming/notes-stats';
import { MessagingIndexStreamManager } from './common/scripts/streaming/messaging-index';
import { ReversiStreamManager } from './common/scripts/streaming/reversi';
import { ReversiStreamManager } from './common/scripts/streaming/games/reversi';
import Err from './common/views/components/connect-failed.vue';
import { LocalTimelineStreamManager } from './common/scripts/streaming/local-timeline';

View file

@ -1,10 +1,10 @@
import * as websocket from 'websocket';
import * as redis from 'redis';
import * as CRC32 from 'crc-32';
import ReversiGame, { pack } from '../../../models/games/reversi/game';
import { publishReversiGameStream } from '../../../stream';
import Reversi from '../../../games/reversi/core';
import * as maps from '../../../games/reversi/maps';
import * as CRC32 from 'crc-32/types';
import ReversiGame, { pack } from '../../../../models/games/reversi/game';
import { publishReversiGameStream } from '../../../../stream';
import Reversi from '../../../../games/reversi/core';
import * as maps from '../../../../games/reversi/maps';
import { ParsedUrlQuery } from 'querystring';
export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user?: any): void {

View file

@ -1,8 +1,8 @@
import * as mongo from 'mongodb';
import * as websocket from 'websocket';
import * as redis from 'redis';
import Matching, { pack } from '../../../models/games/reversi/matching';
import publishUserStream from '../../../stream';
import Matching, { pack } from '../../../../models/games/reversi/matching';
import publishUserStream from '../../../../stream';
export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void {
// Subscribe reversi stream

View file

@ -10,8 +10,8 @@ import userListStream from './stream/user-list';
import driveStream from './stream/drive';
import messagingStream from './stream/messaging';
import messagingIndexStream from './stream/messaging-index';
import reversiGameStream from './stream/reversi-game';
import reversiStream from './stream/reversi';
import reversiGameStream from './stream/games/reversi-game';
import reversiStream from './stream/games/reversi';
import serverStatsStream from './stream/server-stats';
import notesStatsStream from './stream/notes-stats';
import { ParsedUrlQuery } from 'querystring';
@ -50,7 +50,7 @@ module.exports = (server: http.Server) => {
const q = request.resourceURL.query as ParsedUrlQuery;
const [user, app] = await authenticate(q.i as string);
if (request.resourceURL.pathname === '/reversi-game') {
if (request.resourceURL.pathname === '/games/reversi-game') {
reversiGameStream(request, connection, subscriber, user);
return;
}
@ -69,7 +69,7 @@ module.exports = (server: http.Server) => {
request.resourceURL.pathname === '/drive' ? driveStream :
request.resourceURL.pathname === '/messaging' ? messagingStream :
request.resourceURL.pathname === '/messaging-index' ? messagingIndexStream :
request.resourceURL.pathname === '/reversi' ? reversiStream :
request.resourceURL.pathname === '/games/reversi' ? reversiStream :
null;
if (channel !== null) {