diff --git a/app/js/login/login.js b/app/js/login/login.js index 5cccef13..dd6018f8 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -398,6 +398,8 @@ function ckdb(acct_id) { } if (json["urls"]["streaming_api"]) { localStorage.setItem("streaming_" + acct_id, json["urls"]["streaming_api"]); + }else{ + localStorage.removeItem("streaming_" + acct_id); } } }); diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index f7e3d680..c59f93c4 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -264,7 +264,21 @@ function notfWS(misskey, acct_id, tlid, domain, at) { } websocketNotf[acct_id].onerror = function (error) { console.error('WebSocket Error ' + error); - notfWS(misskey, acct_id, tlid, domain, at) + errorct++; + console.log(errorct) + if (errorct < 3) { + notfWS(misskey, acct_id, tlid, domain, at) + } + + }; + websocketNotf[acct_id].onclose = function (error) { + console.error('WebSocket Close ' + error); + errorct++; + console.log(errorct) + if (errorct < 3) { + notfWS(misskey, acct_id, tlid, domain, at) + } + }; } } @@ -361,23 +375,23 @@ function notfToggle(acct, tlid) { $("#notf-box_" + tlid).animate({ 'height': '400px' }, { - 'duration': 300, - 'complete': function () { - $("#notf-box_" + tlid).css("overflow-y", "scroll") - $("#notf-box_" + tlid).removeClass("column-hide") - } - }); + 'duration': 300, + 'complete': function () { + $("#notf-box_" + tlid).css("overflow-y", "scroll") + $("#notf-box_" + tlid).removeClass("column-hide") + } + }); } else { $("#notf-box_" + tlid).css("overflow-y", "hidden") $("#notf-box_" + tlid).animate({ 'height': '0' }, { - 'duration': 300, - 'complete': function () { - $("#notf-box_" + tlid).addClass("column-hide") - $("#notf-box_" + tlid).css("display", "none") - } - }); + 'duration': 300, + 'complete': function () { + $("#notf-box_" + tlid).addClass("column-hide") + $("#notf-box_" + tlid).css("display", "none") + } + }); } notfCanceler(acct) } diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index de4a1f43..39c4bb19 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -1,5 +1,6 @@ //TL取得 moreloading = false; +var errorct=0; function tl(type, data, acct_id, tlid, delc, voice, mode) { scrollevent(); $("#unread_" + tlid + " .material-icons").removeClass("teal-text") @@ -230,6 +231,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { websocket[wsid] = new WebSocket(start); websocket[wsid].onopen = function (mess) { console.table({ "tlid": tlid, "type": "Connect Streaming API" + type, "domain": domain, "message": [mess] }) + errorct=0 $("#notice_icon_" + tlid).removeClass("red-text") } websocket[wsid].onmessage = function (mess) { @@ -317,8 +319,8 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { $("#notice_icon_" + tlid).addClass("red-text") todo('WebSocket Error ' + error); } else { - var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1; - localStorage.setItem("wserror_" + tlid, errorct); + errorct++; + console.log(errorct) if (errorct < 3) { reconnector(tlid, type, acct_id, data, "error"); } @@ -331,8 +333,8 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { $("#notice_icon_" + tlid).addClass("red-text") todo('WebSocket Closed'); } else { - var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1; - localStorage.setItem("wserror_" + tlid, errorct); + errorct++; + console.log(errorct) if (errorct < 3) { reconnector(tlid, type, acct_id, data, "error"); } @@ -791,7 +793,6 @@ function strAlive() { var type = obj[key].type; var acct_id = obj[key].domain; var data = obj[key].data; - localStorage.removeItem("wserror_" + tlid) reconnector(key, type, acct_id, data, "error"); } });