Skip to content

Commit

Permalink
Fetch google email to use as gpmdp_connect id
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Nov 13, 2016
1 parent dd8a2ce commit a74879b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/features/core/websocketAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,24 +192,27 @@ const handleWSMessage = (ws) =>

if (Settings.get('__gpmdp_connect__')) {
const reconnectConnectClient = () => {
const email = Settings.get('gpmdp_connect_email');
if (!email) return;
if (connectClient) {
connectClient.close();
connectClient = null;
}
connectClient = new WebSocket('wss://connect.gpmdp.xyz');
addWSPrototypes(connectClient);
connectClient.on('open', () => {
connectClient.json({
type: 'connect',
email: 'samuel.r.attard@gmail.com',
clientType: 'player',
});
connectClient.json({ type: 'connect', email, clientType: 'player' });
connectClient.on('message', handleWSMessage(connectClient));
});
connectClient.on('error', () => {});
connectClient.on('close', () => {
if (connectClientShouldReconnect) {
Logger.warn('Attempting to reconnect to connect.gpmdp.xyz');
Logger.warn('Attempting to reconnect to wss://connect.gpmdp.xyz');
setTimeout(() => reconnectConnectClient(), 500);
}
});
};
Settings.onChange('gpmdp_connect_email', reconnectConnectClient);
reconnectConnectClient();
}

Expand Down
1 change: 1 addition & 0 deletions src/renderer/windows/GPMWebView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ const waitForExternal = setInterval(() => {
Logger.error('Emitter fn() threw exception.', e.stack);
}
});
Settings.set('gpmdp_connect_email', window.gbar._CONFIG[0][10][5]);
}
}, 10);

0 comments on commit a74879b

Please sign in to comment.