mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-26 00:35:15 +00:00
Refactorijg
This commit is contained in:
parent
2cdcbcc80e
commit
865fd25af1
19 changed files with 46 additions and 44 deletions
|
@ -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({
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// MISSKEY REVERSI ENGINE
|
||||
|
||||
/**
|
||||
* true ... 黒
|
||||
* false ... 白
|
||||
|
@ -18,7 +20,7 @@ export type Undo = {
|
|||
/**
|
||||
* 色
|
||||
*/
|
||||
color: Color,
|
||||
color: Color;
|
||||
|
||||
/**
|
||||
* どこに打ったか
|
|
@ -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;
|
|
@ -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;
|
|
@ -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,
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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'
|
||||
},
|
||||
|
||||
{
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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({
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue