},
created: function() {
window.doClick = (elemId) => { document.getElementById(elemId).click() };
- store.initialize(this.$route.path);
+ // TODO: why is this wrong?
+ //store.initialize(this.$route.path);
+ store.initialize(window.location.href.split("#")[1]);
// NOTE: at this point, variants and tr(anslations) might be uninitialized
},
}).$mount("#app");
};
this.socketCloseListener = () => {
// Next line may fail at first, but should retry and eventually success (TODO?)
- this.state.conn = new WebSocket(params.socketUrl + "/?sid=" + mysid);
+ this.state.conn = new WebSocket(params.socketUrl + "/?sid=" + mysid +
+ "&page=" + encodeURIComponent(page));
};
this.state.conn.onclose = this.socketCloseListener;
const supportedLangs = ["en","es","fr"];
// Node version in Ubuntu 16.04 does not know about URL class
function getJsonFromUrl(url)
{
- // url: /game/XYZ/?sid=XYZ
- const queryParts = url.split("?");
- let result = {page: queryParts[0]};
- queryParts[1].split("&").forEach((part) => {
+ const query = url.substr(2); //starts with "/?"
+ let result = {};
+ query.split("&").forEach((part) => {
const item = part.split("=");
result[item[0]] = decodeURIComponent(item[1]);
});
if (!!obj.target)
{
clients[obj.target].sock.send(JSON.stringify(
- {code:"game", game:data.game, from:sid}));
+ {code:"game", game:obj.game, from:sid}));
}
else
{
// Notify all room except opponent and me:
- notifyRoom("/", "game", {game:data.game}, [data.oppsid]);
+ notifyRoom("/", "game", {game:obj.game}, [obj.oppsid]);
}
break;
case "newchat":