diff --git a/src/client/app/common/views/components/reversi.game.vue b/src/client/app/common/views/components/reversi.game.vue index a2a6fd0dc1..c4dd42dc63 100644 --- a/src/client/app/common/views/components/reversi.game.vue +++ b/src/client/app/common/views/components/reversi.game.vue @@ -58,7 +58,7 @@ <script lang="ts"> import Vue from 'vue'; import * as CRC32 from 'crc-32'; -import Reversi, { Color } from '../../../../../reversi/core'; +import Reversi, { Color } from '../../../../../games/reversi/core'; import { url } from '../../../config'; export default Vue.extend({ diff --git a/src/client/app/common/views/components/reversi.room.vue b/src/client/app/common/views/components/reversi.room.vue index 5074845758..7bbeca96d6 100644 --- a/src/client/app/common/views/components/reversi.room.vue +++ b/src/client/app/common/views/components/reversi.room.vue @@ -94,7 +94,7 @@ <script lang="ts"> import Vue from 'vue'; -import * as maps from '../../../../../reversi/maps'; +import * as maps from '../../../../../games/reversi/maps'; export default Vue.extend({ props: ['game', 'connection'], diff --git a/src/client/app/common/views/components/reversi.vue b/src/client/app/common/views/components/reversi.vue index 61705163ac..6e64710823 100644 --- a/src/client/app/common/views/components/reversi.vue +++ b/src/client/app/common/views/components/reversi.vue @@ -99,18 +99,18 @@ export default Vue.extend({ this.connection.on('matched', this.onMatched); this.connection.on('invited', this.onInvited); - (this as any).api('reversi/games', { + (this as any).api('games/reversi/games', { my: true }).then(games => { this.myGames = games; }); - (this as any).api('reversi/games').then(games => { + (this as any).api('games/reversi/games').then(games => { this.games = games; this.gamesFetching = false; }); - (this as any).api('reversi/invitations').then(invitations => { + (this as any).api('games/reversi/invitations').then(invitations => { this.invitations = this.invitations.concat(invitations); }); @@ -132,7 +132,7 @@ export default Vue.extend({ }, methods: { go(game) { - (this as any).api('reversi/games/show', { + (this as any).api('games/reversi/games/show', { gameId: game.id }).then(game => { this.matching = null; @@ -146,7 +146,7 @@ export default Vue.extend({ (this as any).api('users/show', { username }).then(user => { - (this as any).api('reversi/match', { + (this as any).api('games/reversi/match', { userId: user.id }).then(res => { if (res == null) { @@ -160,10 +160,10 @@ export default Vue.extend({ }, cancel() { this.matching = null; - (this as any).api('reversi/match/cancel'); + (this as any).api('games/reversi/match/cancel'); }, accept(invitation) { - (this as any).api('reversi/match', { + (this as any).api('games/reversi/match', { userId: invitation.parent.id }).then(game => { if (game) { diff --git a/src/client/app/desktop/views/pages/reversi.vue b/src/client/app/desktop/views/pages/reversi.vue index 098fc41f1c..b484b81b5d 100644 --- a/src/client/app/desktop/views/pages/reversi.vue +++ b/src/client/app/desktop/views/pages/reversi.vue @@ -33,7 +33,7 @@ export default Vue.extend({ Progress.start(); this.fetching = true; - (this as any).api('reversi/games/show', { + (this as any).api('games/reversi/games/show', { gameId: this.$route.params.game }).then(game => { this.game = game; diff --git a/src/client/app/mobile/views/pages/reversi.vue b/src/client/app/mobile/views/pages/reversi.vue index e2f0db6d87..0cff1317aa 100644 --- a/src/client/app/mobile/views/pages/reversi.vue +++ b/src/client/app/mobile/views/pages/reversi.vue @@ -33,7 +33,7 @@ export default Vue.extend({ Progress.start(); this.fetching = true; - (this as any).api('reversi/games/show', { + (this as any).api('games/reversi/games/show', { gameId: this.$route.params.game }).then(game => { this.game = game; diff --git a/src/reversi/core.ts b/src/games/reversi/core.ts similarity index 99% rename from src/reversi/core.ts rename to src/games/reversi/core.ts index 37f62a43d5..92b7c3799c 100644 --- a/src/reversi/core.ts +++ b/src/games/reversi/core.ts @@ -1,3 +1,5 @@ +// MISSKEY REVERSI ENGINE + /** * true ... 黒 * false ... 白 @@ -18,7 +20,7 @@ export type Undo = { /** * 色 */ - color: Color, + color: Color; /** * どこに打ったか diff --git a/src/reversi/maps.ts b/src/games/reversi/maps.ts similarity index 100% rename from src/reversi/maps.ts rename to src/games/reversi/maps.ts diff --git a/src/models/reversi-game.ts b/src/models/games/reversi/game.ts similarity index 96% rename from src/models/reversi-game.ts rename to src/models/games/reversi/game.ts index cf497f0568..8255db0584 100644 --- a/src/models/reversi-game.ts +++ b/src/models/games/reversi/game.ts @@ -1,7 +1,7 @@ import * as mongo from 'mongodb'; const deepcopy = require('deepcopy'); -import db from '../db/mongodb'; -import { IUser, pack as packUser } from './user'; +import db from '../../../db/mongodb'; +import { IUser, pack as packUser } from '../../user'; const ReversiGame = db.get<IReversiGame>('reversiGames'); export default ReversiGame; diff --git a/src/models/reversi-matching.ts b/src/models/games/reversi/matching.ts similarity index 91% rename from src/models/reversi-matching.ts rename to src/models/games/reversi/matching.ts index 90227bd121..e94b832cb0 100644 --- a/src/models/reversi-matching.ts +++ b/src/models/games/reversi/matching.ts @@ -1,7 +1,7 @@ import * as mongo from 'mongodb'; const deepcopy = require('deepcopy'); -import db from '../db/mongodb'; -import { IUser, pack as packUser } from './user'; +import db from '../../../db/mongodb'; +import { IUser, pack as packUser } from '../../user'; const Matching = db.get<IMatching>('reversiMatchings'); export default Matching; diff --git a/src/publishers/notify.ts b/src/publishers/notify.ts index 5b25fbf8aa..760d467393 100644 --- a/src/publishers/notify.ts +++ b/src/publishers/notify.ts @@ -4,7 +4,7 @@ import Mute from '../models/mute'; import { pack } from '../models/notification'; import stream from './stream'; import User from '../models/user'; -import pushSw from '../publishers/push-sw'; +import pushSw from './push-sw export default ( notifiee: mongo.ObjectID, diff --git a/src/renderers/get-notification-summary.ts b/src/renderers/get-notification-summary.ts index f9c5a55879..67c9654769 100644 --- a/src/renderers/get-notification-summary.ts +++ b/src/renderers/get-notification-summary.ts @@ -1,4 +1,4 @@ -import getUserName from '../renderers/get-user-name'; +import getUserName from './get-user-name import getNoteSummary from './get-note-summary'; import getReactionEmoji from './get-reaction-emoji'; diff --git a/src/server/api/endpoints.ts b/src/server/api/endpoints.ts index 146de67253..16237583bf 100644 --- a/src/server/api/endpoints.ts +++ b/src/server/api/endpoints.ts @@ -245,27 +245,27 @@ const endpoints: Endpoint[] = [ }, { - name: 'reversi/match', + name: 'games/reversi/match', withCredential: true }, { - name: 'reversi/match/cancel', + name: 'games/reversi/match/cancel', withCredential: true }, { - name: 'reversi/invitations', + name: 'games/reversi/invitations', withCredential: true }, { - name: 'reversi/games', + name: 'games/reversi/games', withCredential: true }, { - name: 'reversi/games/show' + name: 'games/reversi/games/show' }, { diff --git a/src/server/api/endpoints/reversi/games.ts b/src/server/api/endpoints/games/reversi/games.ts similarity index 86% rename from src/server/api/endpoints/reversi/games.ts rename to src/server/api/endpoints/games/reversi/games.ts index 11da7b3c0c..585e833ef1 100644 --- a/src/server/api/endpoints/reversi/games.ts +++ b/src/server/api/endpoints/games/reversi/games.ts @@ -1,6 +1,6 @@ -import $ from 'cafy'; import ID from '../../../../cafy-id'; -import ReversiGame, { pack } from '../../../../models/reversi-game'; -import { ILocalUser } from '../../../../models/user'; +import $ from 'cafy'; import ID from '../../../../../cafy-id'; +import ReversiGame, { pack } from '../../../../../models/games/reversi/game'; +import { ILocalUser } from '../../../../../models/user'; export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'my' parameter diff --git a/src/server/api/endpoints/reversi/games/show.ts b/src/server/api/endpoints/games/reversi/games/show.ts similarity index 72% rename from src/server/api/endpoints/reversi/games/show.ts rename to src/server/api/endpoints/games/reversi/games/show.ts index ba52066040..62c37f8e0a 100644 --- a/src/server/api/endpoints/reversi/games/show.ts +++ b/src/server/api/endpoints/games/reversi/games/show.ts @@ -1,7 +1,7 @@ -import $ from 'cafy'; import ID from '../../../../../cafy-id'; -import ReversiGame, { pack } from '../../../../../models/reversi-game'; -import Reversi from '../../../../../reversi/core'; -import { ILocalUser } from '../../../../../models/user'; +import $ from 'cafy'; import ID from '../../../../../../cafy-id'; +import ReversiGame, { pack } from '../../../../../../models/games/reversi/game'; +import Reversi from '../../../../../../games/reversi/core'; +import { ILocalUser } from '../../../../../../models/user'; export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'gameId' parameter diff --git a/src/server/api/endpoints/reversi/invitations.ts b/src/server/api/endpoints/games/reversi/invitations.ts similarity index 66% rename from src/server/api/endpoints/reversi/invitations.ts rename to src/server/api/endpoints/games/reversi/invitations.ts index 179abe8cd9..c6d0ecfa73 100644 --- a/src/server/api/endpoints/reversi/invitations.ts +++ b/src/server/api/endpoints/games/reversi/invitations.ts @@ -1,5 +1,5 @@ -import Matching, { pack as packMatching } from '../../../../models/reversi-matching'; -import { ILocalUser } from '../../../../models/user'; +import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching'; +import { ILocalUser } from '../../../../../models/user'; export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Find session diff --git a/src/server/api/endpoints/reversi/match.ts b/src/server/api/endpoints/games/reversi/match.ts similarity index 82% rename from src/server/api/endpoints/reversi/match.ts rename to src/server/api/endpoints/games/reversi/match.ts index 20473d9a4b..77c014143a 100644 --- a/src/server/api/endpoints/reversi/match.ts +++ b/src/server/api/endpoints/games/reversi/match.ts @@ -1,9 +1,9 @@ -import $ from 'cafy'; import ID from '../../../../cafy-id'; -import Matching, { pack as packMatching } from '../../../../models/reversi-matching'; -import ReversiGame, { pack as packGame } from '../../../../models/reversi-game'; -import User, { ILocalUser } from '../../../../models/user'; -import publishUserStream, { publishReversiStream } from '../../../../publishers/stream'; -import { eighteight } from '../../../../reversi/maps'; +import $ from 'cafy'; import ID from '../../../../../cafy-id'; +import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching'; +import ReversiGame, { pack as packGame } from '../../../../../models/games/reversi/game'; +import User, { ILocalUser } from '../../../../../models/user'; +import publishUserStream, { publishReversiStream } from '../../../../../publishers/stream'; +import { eighteight } from '../../../../../games/reversi/maps'; export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { // Get 'userId' parameter diff --git a/src/server/api/endpoints/reversi/match/cancel.ts b/src/server/api/endpoints/games/reversi/match/cancel.ts similarity index 53% rename from src/server/api/endpoints/reversi/match/cancel.ts rename to src/server/api/endpoints/games/reversi/match/cancel.ts index 470d848b53..84cd1ff119 100644 --- a/src/server/api/endpoints/reversi/match/cancel.ts +++ b/src/server/api/endpoints/games/reversi/match/cancel.ts @@ -1,5 +1,5 @@ -import Matching from '../../../../../models/reversi-matching'; -import { ILocalUser } from '../../../../../models/user'; +import Matching from '../../../../../../models/games/reversi/matching'; +import { ILocalUser } from '../../../../../../models/user'; export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => { await Matching.remove({ diff --git a/src/server/api/stream/reversi-game.ts b/src/server/api/stream/reversi-game.ts index ea8a9741d2..7a09e55ecd 100644 --- a/src/server/api/stream/reversi-game.ts +++ b/src/server/api/stream/reversi-game.ts @@ -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/reversi-game'; +import ReversiGame, { pack } from '../../../models/games/reversi/game'; import { publishReversiGameStream } from '../../../publishers/stream'; -import Reversi from '../../../reversi/core'; -import * as maps from '../../../reversi/maps'; +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 { diff --git a/src/server/api/stream/reversi.ts b/src/server/api/stream/reversi.ts index 35c6167364..4e450297ff 100644 --- a/src/server/api/stream/reversi.ts +++ b/src/server/api/stream/reversi.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/reversi-matching'; +import Matching, { pack } from '../../../models/games/reversi/matching'; import publishUserStream from '../../../publishers/stream'; export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void {