Moved authentication out of protocol handler.
This commit is contained in:
parent
4bc23eabc4
commit
caee3ace32
2 changed files with 6 additions and 8 deletions
|
@ -597,6 +597,9 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } };
|
||||||
if(dumpEvents) console.log('conn:ready', ready);
|
if(dumpEvents) console.log('conn:ready', ready);
|
||||||
|
|
||||||
getLoadingOverlay('spinner', 'Loading...', 'Authenticating...');
|
getLoadingOverlay('spinner', 'Loading...', 'Authenticating...');
|
||||||
|
|
||||||
|
const authInfo = MamiMisuzuAuth.getInfo();
|
||||||
|
Umi.Server.sendAuth(authInfo.method, authInfo.token);
|
||||||
});
|
});
|
||||||
Umi.Server.watch('conn:lost', lost => {
|
Umi.Server.watch('conn:lost', lost => {
|
||||||
if(dumpEvents) console.log('conn:lost', lost);
|
if(dumpEvents) console.log('conn:lost', lost);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include common.js
|
#include common.js
|
||||||
#include mszauth.js
|
|
||||||
#include servers.js
|
#include servers.js
|
||||||
#include watcher.js
|
#include watcher.js
|
||||||
#include websock.js
|
#include websock.js
|
||||||
|
@ -88,7 +87,7 @@ Umi.Protocol.SockChat.Protocol = function() {
|
||||||
lastPong = undefined;
|
lastPong = undefined;
|
||||||
lastPing = Date.now();
|
lastPing = Date.now();
|
||||||
};
|
};
|
||||||
const sendAuth = args => {
|
const sendAuth = (...args) => {
|
||||||
if(selfUserId === undefined)
|
if(selfUserId === undefined)
|
||||||
send('1', ...args);
|
send('1', ...args);
|
||||||
};
|
};
|
||||||
|
@ -111,16 +110,11 @@ Umi.Protocol.SockChat.Protocol = function() {
|
||||||
|
|
||||||
isRestarting = false;
|
isRestarting = false;
|
||||||
|
|
||||||
watchers.call('conn:ready', {
|
|
||||||
wasConnected: wasConnected,
|
|
||||||
});
|
|
||||||
|
|
||||||
// see if these are neccesary
|
// see if these are neccesary
|
||||||
watchers.call('user:clear');
|
watchers.call('user:clear');
|
||||||
watchers.call('chan:clear');
|
watchers.call('chan:clear');
|
||||||
|
|
||||||
const authInfo = MamiMisuzuAuth.getInfo();
|
watchers.call('conn:ready', { wasConnected: wasConnected });
|
||||||
sendAuth([authInfo.method, authInfo.token]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClose = ev => {
|
const onClose = ev => {
|
||||||
|
@ -600,6 +594,7 @@ Umi.Protocol.SockChat.Protocol = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
sendAuth: sendAuth,
|
||||||
sendMessage: sendMessage,
|
sendMessage: sendMessage,
|
||||||
open: () => {
|
open: () => {
|
||||||
noReconnect = false;
|
noReconnect = false;
|
||||||
|
|
Loading…
Reference in a new issue