This commit is contained in:
syuilo
2021-12-09 23:58:30 +09:00
parent 0abe2dfee0
commit c69b72e199
573 changed files with 3318 additions and 3318 deletions

View File

@@ -32,13 +32,13 @@ export default class extends Channel {
// リプライなら再pack
if (note.replyId != null) {
note.reply = await Notes.pack(note.replyId, this.user, {
detail: true
detail: true,
});
}
// Renoteなら再pack
if (note.renoteId != null) {
note.renote = await Notes.pack(note.renoteId, this.user, {
detail: true
detail: true,
});
}

View File

@@ -95,12 +95,12 @@ export default class extends Channel {
if (!['map', 'bw', 'isLlotheo', 'canPutEverywhere', 'loopedBoard'].includes(key)) return;
await ReversiGames.update(this.gameId!, {
[key]: value
[key]: value,
});
publishReversiGameStream(this.gameId!, 'updateSettings', {
key: key,
value: value
value: value,
});
}
@@ -115,16 +115,16 @@ export default class extends Channel {
if ((game.user1Id !== this.user.id) && (game.user2Id !== this.user.id)) return;
const set = game.user1Id === this.user.id ? {
form1: form
form1: form,
} : {
form2: form
form2: form,
};
await ReversiGames.update(this.gameId!, set);
publishReversiGameStream(this.gameId!, 'initForm', {
userId: this.user.id,
form
form,
});
}
@@ -147,9 +147,9 @@ export default class extends Channel {
item.value = value;
const set = game.user1Id === this.user.id ? {
form2: form
form2: form,
} : {
form1: form
form1: form,
};
await ReversiGames.update(this.gameId!, set);
@@ -157,7 +157,7 @@ export default class extends Channel {
publishReversiGameStream(this.gameId!, 'updateForm', {
userId: this.user.id,
id,
value
value,
});
}
@@ -168,7 +168,7 @@ export default class extends Channel {
message.id = Math.random();
publishReversiGameStream(this.gameId!, 'message', {
userId: this.user.id,
message
message,
});
}
@@ -185,23 +185,23 @@ export default class extends Channel {
if (game.user1Id === this.user.id) {
await ReversiGames.update(this.gameId!, {
user1Accepted: accept
user1Accepted: accept,
});
publishReversiGameStream(this.gameId!, 'changeAccepts', {
user1: accept,
user2: game.user2Accepted
user2: game.user2Accepted,
});
if (accept && game.user2Accepted) bothAccepted = true;
} else if (game.user2Id === this.user.id) {
await ReversiGames.update(this.gameId!, {
user2Accepted: accept
user2Accepted: accept,
});
publishReversiGameStream(this.gameId!, 'changeAccepts', {
user1: game.user1Accepted,
user2: accept
user2: accept,
});
if (accept && game.user1Accepted) bothAccepted = true;
@@ -235,14 +235,14 @@ export default class extends Channel {
startedAt: new Date(),
isStarted: true,
black: bw,
map: map
map: map,
});
//#region 盤面に最初から石がないなどして始まった瞬間に勝敗が決定する場合があるのでその処理
const o = new Reversi(map, {
isLlotheo: freshGame.isLlotheo,
canPutEverywhere: freshGame.canPutEverywhere,
loopedBoard: freshGame.loopedBoard
loopedBoard: freshGame.loopedBoard,
});
if (o.isEnded) {
@@ -257,12 +257,12 @@ export default class extends Channel {
await ReversiGames.update(this.gameId!, {
isEnded: true,
winnerId: winner
winnerId: winner,
});
publishReversiGameStream(this.gameId!, 'ended', {
winnerId: winner,
game: await ReversiGames.pack(this.gameId!, this.user)
game: await ReversiGames.pack(this.gameId!, this.user),
});
}
//#endregion
@@ -293,7 +293,7 @@ export default class extends Channel {
const o = new Reversi(game.map, {
isLlotheo: game.isLlotheo,
canPutEverywhere: game.canPutEverywhere,
loopedBoard: game.loopedBoard
loopedBoard: game.loopedBoard,
});
// 盤面の状態を再生
@@ -320,7 +320,7 @@ export default class extends Channel {
const log = {
at: new Date(),
color: myColor,
pos
pos,
};
const crc32 = CRC32.str(game.logs.map(x => x.pos.toString()).join('') + pos.toString()).toString();
@@ -331,17 +331,17 @@ export default class extends Channel {
crc32,
isEnded: o.isEnded,
winnerId: winner,
logs: game.logs
logs: game.logs,
});
publishReversiGameStream(this.gameId!, 'set', Object.assign(log, {
next: o.turn
next: o.turn,
}));
if (o.isEnded) {
publishReversiGameStream(this.gameId!, 'ended', {
winnerId: winner,
game: await ReversiGames.pack(this.gameId!, this.user)
game: await ReversiGames.pack(this.gameId!, this.user),
});
}
}

View File

@@ -23,7 +23,7 @@ export default class extends Channel {
if (body.id == null) return;
const matching = await ReversiMatchings.findOne({
parentId: this.user!.id,
childId: body.id
childId: body.id,
});
if (matching == null) return;
publishMainStream(matching.childId, 'reversiInvited', await ReversiMatchings.pack(matching, { id: matching.childId }));

View File

@@ -32,13 +32,13 @@ export default class extends Channel {
// リプライなら再pack
if (note.replyId != null) {
note.reply = await Notes.pack(note.replyId, this.user, {
detail: true
detail: true,
});
}
// Renoteなら再pack
if (note.renoteId != null) {
note.renote = await Notes.pack(note.renoteId, this.user, {
detail: true
detail: true,
});
}

View File

@@ -31,7 +31,7 @@ export default class extends Channel {
// Renoteなら再pack
if (note.renoteId != null) {
note.renote = await Notes.pack(note.renoteId, this.user, {
detail: true
detail: true,
});
}

View File

@@ -32,7 +32,7 @@ export default class extends Channel {
if (['followers', 'specified'].includes(note.visibility)) {
note = await Notes.pack(note.id, this.user!, {
detail: true
detail: true,
});
if (note.isHidden) {
@@ -42,13 +42,13 @@ export default class extends Channel {
// リプライなら再pack
if (note.replyId != null) {
note.reply = await Notes.pack(note.replyId, this.user!, {
detail: true
detail: true,
});
}
// Renoteなら再pack
if (note.renoteId != null) {
note.renote = await Notes.pack(note.renoteId, this.user!, {
detail: true
detail: true,
});
}
}

View File

@@ -37,7 +37,7 @@ export default class extends Channel {
if (['followers', 'specified'].includes(note.visibility)) {
note = await Notes.pack(note.id, this.user!, {
detail: true
detail: true,
});
if (note.isHidden) {
@@ -47,13 +47,13 @@ export default class extends Channel {
// リプライなら再pack
if (note.replyId != null) {
note.reply = await Notes.pack(note.replyId, this.user!, {
detail: true
detail: true,
});
}
// Renoteなら再pack
if (note.renoteId != null) {
note.renote = await Notes.pack(note.renoteId, this.user!, {
detail: true
detail: true,
});
}
}

View File

@@ -33,5 +33,5 @@ export default {
channel,
admin,
gamesReversi,
gamesReversiGame
gamesReversiGame,
};

View File

@@ -32,13 +32,13 @@ export default class extends Channel {
// リプライなら再pack
if (note.replyId != null) {
note.reply = await Notes.pack(note.replyId, this.user, {
detail: true
detail: true,
});
}
// Renoteなら再pack
if (note.renoteId != null) {
note.renote = await Notes.pack(note.renoteId, this.user, {
detail: true
detail: true,
});
}

View File

@@ -20,7 +20,7 @@ export default class extends Channel {
if (data.body.note && data.body.note.isHidden) {
const note = await Notes.pack(data.body.note.id, this.user, {
detail: true
detail: true,
});
this.connection.cacheNote(note);
data.body.note = note;
@@ -33,7 +33,7 @@ export default class extends Channel {
if (this.muting.has(data.body.userId)) return;
if (data.body.isHidden) {
const note = await Notes.pack(data.body.id, this.user, {
detail: true
detail: true,
});
this.connection.cacheNote(note);
data.body = note;

View File

@@ -28,7 +28,7 @@ export default class extends Channel {
if (this.groupId) {
const joining = await UserGroupJoinings.findOne({
userId: this.user!.id,
userGroupId: this.groupId
userGroupId: this.groupId,
});
if (joining == null) {

View File

@@ -28,7 +28,7 @@ export default class extends Channel {
});
ev.emit('requestQueueStatsLog', {
id: body.id,
length: body.length
length: body.length,
});
break;
}

View File

@@ -28,7 +28,7 @@ export default class extends Channel {
});
ev.emit('requestServerStatsLog', {
id: body.id,
length: body.length
length: body.length,
});
break;
}

View File

@@ -21,7 +21,7 @@ export default class extends Channel {
// Check existence and owner
const list = await UserLists.findOne({
id: this.listId,
userId: this.user!.id
userId: this.user!.id,
});
if (!list) return;
@@ -40,7 +40,7 @@ export default class extends Channel {
where: {
userListId: this.listId,
},
select: ['userId']
select: ['userId'],
});
this.listUsers = users.map(x => x.userId);
@@ -52,7 +52,7 @@ export default class extends Channel {
if (['followers', 'specified'].includes(note.visibility)) {
note = await Notes.pack(note.id, this.user, {
detail: true
detail: true,
});
if (note.isHidden) {
@@ -62,13 +62,13 @@ export default class extends Channel {
// リプライなら再pack
if (note.replyId != null) {
note.reply = await Notes.pack(note.replyId, this.user, {
detail: true
detail: true,
});
}
// Renoteなら再pack
if (note.renoteId != null) {
note.renote = await Notes.pack(note.renoteId, this.user, {
detail: true
detail: true,
});
}
}