diff --git a/src/mami.js/main.js b/src/mami.js/main.js index f07380a..a724dcc 100644 --- a/src/mami.js/main.js +++ b/src/mami.js/main.js @@ -597,6 +597,9 @@ window.Umi = { UI: {}, Protocol: { SockChat: { Protocol: {} } } }; if(dumpEvents) console.log('conn:ready', ready); getLoadingOverlay('spinner', 'Loading...', 'Authenticating...'); + + const authInfo = MamiMisuzuAuth.getInfo(); + Umi.Server.sendAuth(authInfo.method, authInfo.token); }); Umi.Server.watch('conn:lost', lost => { if(dumpEvents) console.log('conn:lost', lost); diff --git a/src/mami.js/sockchat_old.js b/src/mami.js/sockchat_old.js index a770b04..b4692c6 100644 --- a/src/mami.js/sockchat_old.js +++ b/src/mami.js/sockchat_old.js @@ -1,5 +1,4 @@ #include common.js -#include mszauth.js #include servers.js #include watcher.js #include websock.js @@ -88,7 +87,7 @@ Umi.Protocol.SockChat.Protocol = function() { lastPong = undefined; lastPing = Date.now(); }; - const sendAuth = args => { + const sendAuth = (...args) => { if(selfUserId === undefined) send('1', ...args); }; @@ -111,16 +110,11 @@ Umi.Protocol.SockChat.Protocol = function() { isRestarting = false; - watchers.call('conn:ready', { - wasConnected: wasConnected, - }); - // see if these are neccesary watchers.call('user:clear'); watchers.call('chan:clear'); - const authInfo = MamiMisuzuAuth.getInfo(); - sendAuth([authInfo.method, authInfo.token]); + watchers.call('conn:ready', { wasConnected: wasConnected }); }; const onClose = ev => { @@ -600,6 +594,7 @@ Umi.Protocol.SockChat.Protocol = function() { }; return { + sendAuth: sendAuth, sendMessage: sendMessage, open: () => { noReconnect = false;