summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-14 04:37:20 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-14 04:37:20 +0900
commit0fb52ea7eb7c5f760f3a13afd2cbe20023dfff37 (patch)
treed409c4dd48f0e75afd26e9865e6f9bdcb92b8bec /src
parent:v: (diff)
downloadsharkey-0fb52ea7eb7c5f760f3a13afd2cbe20023dfff37.tar.gz
sharkey-0fb52ea7eb7c5f760f3a13afd2cbe20023dfff37.tar.bz2
sharkey-0fb52ea7eb7c5f760f3a13afd2cbe20023dfff37.zip
:v:
Diffstat (limited to 'src')
-rw-r--r--src/api/stream/othello-game.ts2
-rw-r--r--src/api/streaming.ts6
-rw-r--r--src/web/app/common/scripts/streaming/othello-game.ts2
-rw-r--r--src/web/app/common/views/components/othello.game.vue1
4 files changed, 8 insertions, 3 deletions
diff --git a/src/api/stream/othello-game.ts b/src/api/stream/othello-game.ts
index ba0f11252f..1c846f27ae 100644
--- a/src/api/stream/othello-game.ts
+++ b/src/api/stream/othello-game.ts
@@ -6,7 +6,7 @@ import { publishOthelloGameStream } from '../event';
import Othello from '../../common/othello/core';
import * as maps from '../../common/othello/maps';
-export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void {
+export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user?: any): void {
const gameId = request.resourceURL.query.game;
// Subscribe game stream
diff --git a/src/api/streaming.ts b/src/api/streaming.ts
index 7d67ba9574..f56c08092c 100644
--- a/src/api/streaming.ts
+++ b/src/api/streaming.ts
@@ -53,6 +53,11 @@ module.exports = (server: http.Server) => {
const user = await authenticate(request.resourceURL.query.i);
+ if (request.resourceURL.pathname === '/othello-game') {
+ othelloGameStream(request, connection, subscriber, user);
+ return;
+ }
+
if (user == null) {
connection.send('authentication-failed');
connection.close();
@@ -64,7 +69,6 @@ module.exports = (server: http.Server) => {
request.resourceURL.pathname === '/drive' ? driveStream :
request.resourceURL.pathname === '/messaging' ? messagingStream :
request.resourceURL.pathname === '/messaging-index' ? messagingIndexStream :
- request.resourceURL.pathname === '/othello-game' ? othelloGameStream :
request.resourceURL.pathname === '/othello' ? othelloStream :
null;
diff --git a/src/web/app/common/scripts/streaming/othello-game.ts b/src/web/app/common/scripts/streaming/othello-game.ts
index 51a435541a..cdf46d5d8d 100644
--- a/src/web/app/common/scripts/streaming/othello-game.ts
+++ b/src/web/app/common/scripts/streaming/othello-game.ts
@@ -3,7 +3,7 @@ import Stream from './stream';
export class OthelloGameStream extends Stream {
constructor(me, game) {
super('othello-game', {
- i: me.token,
+ i: me ? me.token : null,
game: game.id
});
}
diff --git a/src/web/app/common/views/components/othello.game.vue b/src/web/app/common/views/components/othello.game.vue
index 907e317ce9..69b2127760 100644
--- a/src/web/app/common/views/components/othello.game.vue
+++ b/src/web/app/common/views/components/othello.game.vue
@@ -56,6 +56,7 @@ export default Vue.extend({
computed: {
iAmPlayer(): boolean {
+ if (!(this as any).os.isSignedIn) return false;
return this.game.user1_id == (this as any).os.i.id || this.game.user2_id == (this as any).os.i.id;
},
myColor(): Color {