diff --git a/app/acct.html b/app/acct.html index 0885b91b..e254b30c 100644 --- a/app/acct.html +++ b/app/acct.html @@ -45,25 +45,33 @@ body,html{overflow-y: scroll;} Check if TheDesk is not working on Windows, you want to login Pleroma instance.

+ +

Supports
- + + +
Main an account
Select an account
- - Instance data by instances.social API

@
diff --git a/app/acct.sample.html b/app/acct.sample.html index 7d22352c..229ae4d7 100644 --- a/app/acct.sample.html +++ b/app/acct.sample.html @@ -45,25 +45,33 @@ body,html{overflow-y: scroll;} {{codesetupwarn}}

+ +

Supports
- + + +
{{mainacct}}
{{selacct}}
- - Instance data by instances.social API

@
diff --git a/app/css/master.css b/app/css/master.css index ee5c24b0..fa19b1cf 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -1,5 +1,6 @@ /*共通CSS*/ html,body{ + /*transform: translate3d(0,0,0);*/ overflow:hidden; user-select: none; cursor:default; diff --git a/app/css/tl.css b/app/css/tl.css index bebcd069..49aaa5e0 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -353,6 +353,15 @@ p:not(:last-child){ overflow:hidden; height:0; } +.prof-img{ + border-radius: 3px; +} +.notf-icon{ + position: relative; + top: -20px; + width: 20px; + left: 20px; +} .notf-indv-box { width:100%; max-height: 400px; diff --git a/app/index.html b/app/index.html index 65e7a91e..4b2eecdd 100644 --- a/app/index.html +++ b/app/index.html @@ -1,5 +1,834 @@ - - \ No newline at end of file + TheDesk + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
Drag here to upload +
+ +
+
+
+
+ +
+ +
+ + + +
+
+ +
+ + cancel + + +
+
+
+format_bold +format_italic +format_underlined +strikethrough_s +format_quote +short_text +code +format_list_bulleted +format_list_numbered + + +autorenew +flare +swap_vert +swap_horiz + +Markdownエディタを隠す + +
+format_size +px +color_lens + +
+link +  + +
+image +  + +
+
+
+
+
+ +Edit + +
+
+ + + +
+ +Preview + + +Markdownエディタを表示 + + +
+
+ visibility_off + public + CW + photo_library + format_shapes + tag_faces + music_note + clear +
+
+
+ +Reply: +No/Attaching files: +None/Adjust status privacy: +public + +
+ +
+
+ + + + + + +
+
+ +
+
+ +
+ + Refresh emojis list + cancel +
+
+ +
+
+
+ + / + + +
+
+ are shown.
Some emojis are not able to be inserted. +
+ + add + + + people + + + local_florist + + + restaurant + + + directions_run + + + directions_car + + + attach_file + + + gesture + + + flag + + + + +
+
+ + + + + + + + + + + +
+ chevron_right  + expand_less  + close +
+
+
+ +
+
Select an account +
+ + +
+
+
+ + +
+
Show this TL: + +
+
+ +
+
+
+ +
+
+ +
+search + + + +
+
+
+ +
+ +
+ +
+ + +
+
+ +
+
+ + +
+
+ +
+

+
+
+ + +
+ +
+
+ + +
+
+ +
+
+ +
+ Filter contexts
+ + + + + + + +
+ Options
+ +
+ Nice for Latin language
+ +
+ Filtered toots will disappear irreversibly, even if filter is later removed
+ Expire afterUnset or "0" means "Never"This value may contain some error

+ days + hours + minutes +
+ Integrated TL/Plus TL will hide both Home-filtering words and Local-filtering words. +
+
+ +
+

Welcome to TheDesk


Add an account or click add to add a column. +
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/index.sample.html b/app/index.sample.html index 4363bb45..9fdbc430 100644 --- a/app/index.sample.html +++ b/app/index.sample.html @@ -741,7 +741,7 @@ var lang="{{lang}}"; filter_list -
Preferances: +
Preferences: settings diff --git a/app/js/lang/lang.js b/app/js/lang/lang.js index 1e739cb1..b5c61e9c 100644 --- a/app/js/lang/lang.js +++ b/app/js/lang/lang.js @@ -112,6 +112,10 @@ var lang_manager_none={ "ja":"なし", "en":"None" } +var lang_manager_godev={ + "ja":"MisskeyのDevセンターに移動します。同時に開かれるドキュメントを参考にログインしてください。", + "en":"Open DevCenter of Misskey. We show also an official documents to refer." +} //post/bb-md.js var lang_bbmd_misskey={ "ja":"TheDeskにおけるMisskeyでは、@を返信として扱いますが、全ての@は消去され別パラメータに入力されます。また、「未収載」を「ホーム」として扱います。", diff --git a/app/js/login/login.js b/app/js/login/login.js index 3a1fb934..62c996d8 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -263,7 +263,7 @@ function getdataAdv(domain, at) { function refresh(target) { var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); - if(obj[target].domain=="misskey.xyz"){ + if(obj[target].mode=="misskey"){ return } var start = "https://" + obj[target].domain + @@ -320,6 +320,7 @@ function refresh(target) { //絶対ストリーミングを閉じさせないマン function ckdb(acct_id) { var domain = localStorage.getItem("domain_" + acct_id); + if(domain=="kirishima.cloud"){ localStorage.setItem("kirishima", "true"); $("#ranking-btn").show(); @@ -380,7 +381,7 @@ function ckdb(acct_id) { localStorage.setItem("follow_" + acct_id, json[domain + "_follow"]); } } - if(domain!="misskey.xyz"){ + if(domain.indexOf("misskey::")==-1 || domain!="misskey.xyz"){ var start = "https://" + domain + "/api/v1/instance/activity"; fetch(start, { method: 'GET', @@ -402,6 +403,10 @@ function ckdb(acct_id) { } }); + }else{ + if(domain=="misskey.xyz"){ + localStorage.setItem("domain_" + acct_id,"misskey::misskey.xyz"); + } } @@ -420,29 +425,30 @@ function multiSelector() { var templete; if(localStorage.getItem("mainuse")=="main"){ var last = localStorage.getItem("main"); - }else{ + }else if(localStorage.getItem("last-use")){ var last = localStorage.getItem("last-use"); + }else{ + var last=0; } var sel; - console.log(obj.length) if(obj.length<1){ $("#src-acct-sel").html(''); $("#add-acct-sel").html(''); }else{ Object.keys(obj).forEach(function(key) { var acct = obj[key]; - var list = key * 1 + 1; if (key == last) { sel = "selected"; var domain = localStorage.getItem("domain_" + key); + var domain=domain.replace( "misskey::", "" ); if(idata[domain+"_letters"]){ $("#textarea").attr("data-length", idata[domain+"_letters"]) }else{ $("#textarea").attr("data-length", 500) } var profimg=localStorage.getItem("prof_"+key); - var domain=localStorage.getItem("domain_"+key); + console.log(profimg); if(!profimg){ profimg="./img/missing.svg"; } diff --git a/app/js/login/manager.js b/app/js/login/manager.js index d2d06f5c..ffcef936 100644 --- a/app/js/login/manager.js +++ b/app/js/login/manager.js @@ -244,8 +244,8 @@ function support() { function login(url) { var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); - if(url=="misskey.xyz"){ - misskeyLogin(); + if($('#misskey:checked').val()=="on"){ + misskeyLogin(url); return; } if($('#linux:checked').val()=="on"){ @@ -270,6 +270,7 @@ function login(url) { if (httpreq.readyState == 4) { var json = httpreq.response; console.log(json); + localStorage.setItem("msky","false"); var auth = "https://" + url + "/oauth/authorize?client_id=" + json[ "client_id"] + "&client_secret=" + json["client_secret"] + "&response_type=code&scope=read+write+follow&redirect_uri=" + encodeURIComponent(red); @@ -281,7 +282,7 @@ function login(url) { const { shell } = require('electron'); - + shell.openExternal(auth); var electron = require("electron"); var ipc = electron.ipcRenderer; @@ -294,16 +295,42 @@ function login(url) { } //これが後のMisskeyである。 -function misskeyLogin() { +function misskeyLogin(url) { + if(!url){ + var url=$("#misskey-url").val(); + } var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); - var start = "https://misskey.xyz/api/auth/session/generate"; + var start = "https://"+url+"/api/auth/session/generate"; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.responseType = 'json'; + localStorage.setItem("msky","ture"); + if(url=="misskey.xyz"){ + var mkc=localStorage.getItem("mkc"); + }else{ + var mkc=$("#misskey-key").val(); + if(!mkc){ + $("#misskeylogin").show(); + $("#misskey-url").val(url); + if(confirm(lang_manager_godev[lang])){ + const { + shell + } = require('electron'); + console.log("https://"+url+"/dev") + shell.openExternal("https://"+url+"/dev"); + shell.openExternal("https://thedesk.top/how-to-login-misskey.html"); + } + + return false; + }else{ + $("#misskeylogin").hide(); + $("#misskey-url").val(""); + } + } httpreq.send(JSON.stringify({ - appSecret: localStorage.getItem("mkc") + appSecret: mkc })); httpreq.onreadystatechange = function() { if (httpreq.readyState == 4) { @@ -316,7 +343,7 @@ function misskeyLogin() { $("#auth").show(); $("#code").val(token); $("#add").hide(); - localStorage.setItem("domain_tmp","misskey.xyz"); + localStorage.setItem("domain_tmp",url); shell.openExternal(json.url); var electron = require("electron"); } @@ -328,6 +355,10 @@ function misskeyLogin() { //テキストボックスにURL入れた function instance() { var url = $("#url").val(); + if(url.indexOf("@")!=-1 || url.indexOf("https")!=-1){ + alert("入力形式が違います。(Cutls@mstdn.jpにログインする場合、入力するのは\"mstdn.jp\"です。)") + return false; + } login(url); } @@ -336,12 +367,13 @@ function code(code) { localStorage.removeItem("redirect") if(!code){ var code = $("#code").val(); + $("#code").val(""); } var url = localStorage.getItem("domain_tmp"); localStorage.removeItem("domain_tmp"); console.log(url); - if(url=="misskey.xyz"){ - var start = "https://misskey.xyz/api/auth/session/userkey"; + if(localStorage.getItem("msky")=="true"){ + var start = "https://"+url+"/api/auth/session/userkey"; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); @@ -360,11 +392,12 @@ function code(code) { var add = { at: i, name: json["user"]["name"], - domain: "misskey.xyz", + domain: url, user: json["user"]["username"], prof: avatar, id: json["user"]["id"], - vis: priv + vis: priv, + mode: "misskey" }; var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); @@ -398,13 +431,6 @@ function code(code) { client_secret: secret, code: code })); - console.log({ - grant_type: "authorization_code", - redirect_uri: "urn:ietf:wg:oauth:2.0:oob", - client_id: id, - client_secret: secret, - code: code - }) httpreq.onreadystatechange = function() { if (httpreq.readyState == 4) { var json = httpreq.response; @@ -458,7 +484,8 @@ function getdata(domain, at) { user: json["acct"], prof: avatar, id: json["id"], - vis: priv + vis: priv, + mode: "mastodon" }; var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); @@ -479,8 +506,8 @@ function getdata(domain, at) { function refresh(target) { var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); - if(obj[target].domain=="misskey.xyz"){ - misskeyRefresh(obj,target); + if(obj[target].mode=="misskey"){ + misskeyRefresh(obj,target,obj[target].domain); return } var start = "https://" + obj[target].domain + @@ -532,8 +559,9 @@ function refresh(target) { load(); }); } -function misskeyRefresh(obj,target){ - var start = "https://misskey.xyz/api/users/show"; +function misskeyRefresh(obj,target,url){ + + var start = "https://"+url+"/api/users/show"; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); @@ -552,7 +580,7 @@ function misskeyRefresh(obj,target){ var add = { at: json.accessToken, name: json["user"]["name"], - domain: "misskey.xyz", + domain: url, user: json["user"]["username"], prof: avatar, id: json["user"]["id"], @@ -722,4 +750,4 @@ input.addEventListener("focus", function() { input.addEventListener("blur", function() { window.clearInterval(timer); -}, false); +}, false); \ No newline at end of file diff --git a/app/js/post/bb-md.js b/app/js/post/bb-md.js index 823622db..84c24955 100644 --- a/app/js/post/bb-md.js +++ b/app/js/post/bb-md.js @@ -3,11 +3,14 @@ function mdCheck(){ var acct_id = $("#post-acct-sel").val(); var profimg=localStorage.getItem("prof_"+acct_id); - $("#acct-sel-prof").attr("src",profimg); + if(!profimg){ + profimg="./img/missing.svg"; + } + $("#acct-sel-prof").attr("src",profimg); if(localStorage.getItem("post_" + acct_id)){ $("#toot-post-btn").text(localStorage.getItem("post_" + acct_id)+"("+localStorage.getItem("domain_"+acct_id)+")"); }else{ - $("#toot-post-btn").text(lang_toot[lang]+"("+localStorage.getItem("domain_"+acct_id)+")"); + $("#toot-post-btn").text(lang_toot[lang]+"("+localStorage.getItem("domain_"+acct_id).replace( "misskey::", "" )+")"); } if(!localStorage.getItem("bb_"+acct_id) && !localStorage.getItem("md_"+acct_id)){ $(".markdown").addClass("hide"); @@ -36,7 +39,7 @@ function mdCheck(){ }else{ $("#trendtag").html(""); } - if(domain=="misskey.xyz"){ + if(~domain.indexOf("misskey::")){ Materialize.toast(lang_bbmd_misskey[lang], 5000); } if(idata[domain+"_letters"]){ diff --git a/app/js/post/img.js b/app/js/post/img.js index a49577e6..399d4527 100644 --- a/app/js/post/img.js +++ b/app/js/post/img.js @@ -102,8 +102,9 @@ function media(b64, type, no) { var domain = localStorage.getItem("domain_" + acct_id); var at = localStorage.getItem("acct_"+ acct_id + "_at"); var httpreq = new XMLHttpRequest(); - if(domain=="misskey.xyz"){ - var start = "https://" + domain + "/api/drive/files/create"; + if(~domain.indexOf("misskey::")){ + + var start = "https://" + domain.replace( "misskey::", "" ) + "/api/drive/files/create"; httpreq.open('POST', start, true); httpreq.upload.addEventListener("progress", progshow, false); httpreq.responseType = 'json'; diff --git a/app/js/post/use-txtbox.js b/app/js/post/use-txtbox.js index 61610533..e2d71325 100644 --- a/app/js/post/use-txtbox.js +++ b/app/js/post/use-txtbox.js @@ -11,6 +11,11 @@ function re(id,at,acct_id,mode){ $('select').material_select(); $("#textarea").attr("placeholder",lang_usetxtbox_reply[lang]); $("#textarea").focus(); + var profimg=localStorage.getItem("prof_"+acct_id); + if(!profimg){ + profimg="./img/missing.svg"; + } + $("#acct-sel-prof").attr("src",profimg); vis(mode); } function reEx(id){ diff --git a/app/js/tl/card.js b/app/js/tl/card.js index 219d48c1..f870162a 100644 --- a/app/js/tl/card.js +++ b/app/js/tl/card.js @@ -29,9 +29,11 @@ function additional(acct_id, tlid) { var card = localStorage.getItem("card_" + tlid); var text = $(this).attr('href'); if(text){ - var urls = text.match( - /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/ - ); + if(text.indexOf("twimg.com")=== -1){ + var urls = text.match( + /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/ + ); + } }else{ var urls =[] } @@ -297,6 +299,7 @@ function mov(id,tlid,type){ } if(mouseover=="hide"){ $(tlide+" [toot-id="+id+"] .area-actions").toggleClass("hide") + $(tlide+" [toot-id="+id+"] .area-side").toggleClass("hide") } } @@ -313,6 +316,7 @@ function resetmv(type){ } if(mouseover=="hide"){ $(".area-actions").addClass("hide"); + $(".area-side").addClass("hide"); } } \ No newline at end of file diff --git a/app/js/tl/mix.js b/app/js/tl/mix.js index 87eedcc5..980d092d 100644 --- a/app/js/tl/mix.js +++ b/app/js/tl/mix.js @@ -77,7 +77,7 @@ function mixtl(acct_id, tlid, type,delc,voice) { //Streamingに接続 -function mixre(acct_id, tlid, TLtype, mute,delc,voice) { +function mixre(acct_id, tlid, TLtype, mute,delc,voice,mode) { var domain = localStorage.getItem("domain_" + acct_id); var at = localStorage.getItem("acct_"+ acct_id + "_at"); var startHome = "wss://" + domain + @@ -146,6 +146,11 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice) { console.log(obj); var type = JSON.parse(mess.data).event; if (type == "delete") { + if(del>10){ + reconnector(tlid,type,acct_id,data) + }else{ + localStorage.setItem("delete",del*1+1) + } if(delc=="true"){ $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized"); $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch"); @@ -154,6 +159,7 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice) { $("[toot-id=" + JSON.parse(mess.data).payload + "]").remove(); } } else if (type == "update") { + localStorage.removeItem("delete"); if(TLtype=="integrated"){ var templete = parse([obj], '', acct_id, tlid); }else if(TLtype=="plus"){ @@ -187,10 +193,42 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice) { } websocketLocal[wslid].onerror = function(error) { console.error('WebSocket Error ' + error); + if(mode=="error"){ + $("#notice_icon_" + tlid).addClass("red-text"); + todo('WebSocket Error ' + error); + }else{ + reconnector(tlid,TLtype,acct_id,"","error"); + } + }; + websocketLocal[wslid].onclose = function() { + console.error('WebSocketLocal Closing by error:' + tlid); + if(mode=="error"){ + $("#notice_icon_" + tlid).addClass("red-text"); + todo('WebSocket Closed'); + }else{ + reconnector(tlid,TLtype,acct_id,"","error"); + } }; websocketHome[wshid].onerror = function(error) { console.error('WebSocket Error ' + error); + if(mode=="error"){ + $("#notice_icon_" + tlid).addClass("red-text"); + todo('WebSocket Error ' + error); + }else{ + reconnector(tlid,TLtype,acct_id,"","error"); + } }; + websocketHome[wshid].onclose = function() { + console.error('WebSocketHome Closing by error:' + tlid); + if(mode=="error"){ + $("#notice_icon_" + tlid).addClass("red-text"); + todo('WebSocket Closed'); + }else{ + reconnector(tlid,TLtype,acct_id,"","error"); + } + + }; + } //ある程度のスクロールで発火 diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 8eb5d409..26e7a2c4 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -157,7 +157,18 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { }); } + var noticeavatar=""; if (mix == "notf") { + if (gif == "yes") { + noticeavatar = toot.account.avatar; + } else { + noticeavatar = toot.account.avatar_static; + } + noticeavatar='' + + ''; if (toot.type == "mention") { var what = lang_parse_mentioned[lang]; var icon = "fa-share teal-text"; @@ -249,6 +260,16 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { }else{ var if_notf=""; if (toot.reblog) { + if (gif == "yes") { + noticeavatar = toot.account.avatar; + } else { + noticeavatar = toot.account.avatar_static; + } + noticeavatar='' + + ''; var rebtxt = lang_parse_btedsimple[lang]; var rticon = "fa-retweet light-blue-text"; if(localStorage.getItem("domain_" + acct_id)=="imastodon.net" && !locale){ @@ -387,7 +408,24 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { spoil = spoil.replace(regExp, emoji_url); }); } - + //ニコフレ絵文字 + if(toot.profile_emojis){ + var nicoemojick = toot.profile_emojis[0]; + }else{ + var nicoemojick=false; + } + //絵文字があれば + if (nicoemojick) { + Object.keys(toot.profile_emojis).forEach(function(keynico) { + var emoji = toot.profile_emojis[keynico]; + var shortcode = emoji.shortcode; + var emoji_url = ' :'+shortcode+': '; + var regExp = new RegExp(":" + shortcode + ":", "g"); + content = content.replace(regExp, emoji_url); + spoil = spoil.replace(regExp, emoji_url); + }); + } //デフォ絵文字 content=twemoji.parse(content); if(dis_name){ @@ -551,7 +589,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { '\',' + acct_id + ');" user="' + toot.account.acct + '" class="udg">' + '
' + + '">'+noticeavatar+'
' + '
' + dis_name + ' @' + diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index bb8820d4..a3a2b90c 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -1,5 +1,5 @@ //TL取得 -function tl(type, data, acct_id, tlid, delc, voice) { +function tl(type, data, acct_id, tlid, delc, voice, mode) { scrollevent(); localStorage.removeItem("morelock"); localStorage.removeItem("pool"); @@ -140,7 +140,7 @@ function tl(type, data, acct_id, tlid, delc, voice) { } //Streaming接続 -function reload(type, cc, acct_id, tlid, data, mute, delc, voice) { +function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { if (!type) { var type = localStorage.getItem("now"); } @@ -247,6 +247,12 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) { }else{ var typeA = JSON.parse(mess.data).event; if (typeA == "delete") { + var del=localStorage.getItem("delete"); + if(del>10){ + reconnector(tlid,type,acct_id,data) + }else{ + localStorage.setItem("delete",del*1+1) + } var obj = JSON.parse(mess.data).payload; if(delc=="true"){ $("#timeline_"+tlid+" [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized"); @@ -257,6 +263,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) { } } else if (typeA == "update") { + localStorage.removeItem("delete"); var obj = JSON.parse(JSON.parse(mess.data).payload); console.log(obj); if($("#timeline_" + tlid +" [toot-id=" + obj.id + "]").length < 1){ @@ -264,16 +271,18 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) { say(obj.content) } var templete = parse([obj], type, acct_id, tlid,"",mute); - var pool = localStorage.getItem("pool_" + tlid); - if (pool) { - pool = templete + pool; - } else { - pool = templete + if ($("timeline_box_"+tlid+"_box .tl-box").scrollTop() == 0) { + $("#timeline_" + tlid).prepend(templete); + }else{ + var pool = localStorage.getItem("pool_" + tlid); + if (pool) { + pool = templete + pool; + } else { + pool = templete + } + localStorage.setItem("pool_" + tlid, pool); } - localStorage.setItem("pool_" + tlid, pool); - scrollck(); - additional(acct_id, tlid); jQuery("time.timeago").timeago(); }else{ @@ -290,7 +299,23 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) { } websocket[wsid].onerror = function(error) { console.error('WebSocket Error ' + error); + if(mode=="error"){ + $("#notice_icon_" + tlid).addClass("red-text"); + todo('WebSocket Error ' + error); + }else{ + reconnector(tlid,type,acct_id,data,"error"); + } }; + websocket[wsid].onclose = function() { + console.error('WebSocket Closing by error:' + tlid); + if(mode=="error"){ + $("#notice_icon_" + tlid).addClass("red-text"); + todo('WebSocket Closed'); + }else{ + reconnector(tlid,type,acct_id,data,"error"); + } + }; + } //一定のスクロールで発火 @@ -571,58 +596,11 @@ function strAlive(){ if(col){ var obj = JSON.parse(col); Object.keys(obj).forEach(function(key) { - var type=obj[key].type; - var lastunix=localStorage.getItem("lastunix_"+ key); - if(obj[key].type=="pub" || obj[key].type=="pub-media"){ - //連合[連合数100超 or not] - if(localStorage.getItem("connects_" + obj[key].domain)>100){ - var should=30; - }else{ - var should=120; - } - }else if(obj[key].type=="local" || obj[key].type=="local-media"){ - //連合[週間トゥ数10000超 or not] - if(localStorage.getItem("statuses_" + obj[key].domain)>10000){ - var should=10; - }else if(localStorage.getItem("statuses_" + obj[key].domain)>1000){ - var should=120; - }else{ - var should=600; - } - }else{ - if(type=="local" || type=="local-media" || type=="mix" || type=="plus"){ - //ローカル[週間トゥ数10000超 or not] - if(localStorage.getItem("statuses_" + obj[key].domain)>10000){ - var should=10; - }else if(localStorage.getItem("statuses_" + obj[key].domain)>1000){ - var should=120; - }else{ - var should=600; - } - } - if(type=="home" || type=="mix"){ - //ホーム[フォロー数] - var flw=localStorage.getItem("follow_" + obj[key].domain) - if(flw>1000){ - var should=10; - }else if(flw>500){ - var should=20; - }else if(flw>100){ - var should=30; - }else if(flw>50){ - var should=45; - }else{ - var should=60; - } - } - } - if (obj[key].data) { - var data = obj[key].data; - } else { - var data = ""; - } - if(unix*1>lastunix*1+should*1 && should){ - reconnector(tlid,type,obj[key].domain,data); + if($("#notice_icon_" + key).hasClass("red-text")){ + var type=obj[key].type; + var acct_id=obj[key].domain; + var data=obj[key].data; + reconnector(key,type,acct_id,data,"error"); } }); } @@ -631,8 +609,8 @@ function strAlive(){ function strAliveInt(){ setTimeout(strAlive, 10000); } -function reconnector(tlid,type,acct_id,data){ - console.log("Reconnector") +function reconnector(tlid,type,acct_id,data,mode){ + console.log("Reconnector:"+mode) if(type=="mix" || type=="plus"){ if(localStorage.getItem("voice_" + tlid)){ var voice=true; @@ -648,7 +626,7 @@ function reconnector(tlid,type,acct_id,data){ websocketHome[wssh].close(); var wssh=localStorage.getItem("wssL_" + tlid); websocketLocal[wssl].close(); - mixre(acct_id, tlid, type, mute,"",voice); + mixre(acct_id, tlid, type, mute,"",voice,mode); }else if(type=="notf"){ }else{ var wss=localStorage.getItem("wss_" + tlid); @@ -663,7 +641,7 @@ function reconnector(tlid,type,acct_id,data){ }else{ var mute=[]; } - reload(type, '', acct_id, tlid, data, mute, "",voice); + reload(type, '', acct_id, tlid, data, mute, "",voice,mode); } Materialize.toast(lang_tl_reconnect[lang], 2000); } diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index ea0c0111..487b44c8 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -156,7 +156,7 @@ function parseColumn() { }else{ var voice=false; } - tl(acct.type, data, acct.domain, key, delc,voice); + tl(acct.type, data, acct.domain, key, delc,voice,""); cardCheck(key); mediaCheck(key); catchCheck(key); diff --git a/app/language/acct.en.json b/app/language/acct.en.json index 0144a755..67abeccf 100644 --- a/app/language/acct.en.json +++ b/app/language/acct.en.json @@ -15,5 +15,7 @@ "users2":"users", "safety":"Connection", "ver":"Mastodon version", - "ko":"" + "ko":"", + "thisismisskey":"Login as Misskey", + "misskeylogin":"Read Docs(ja) to login Misskey." } \ No newline at end of file diff --git a/app/language/acct.ja.json b/app/language/acct.ja.json index eafc80b8..521a3046 100644 --- a/app/language/acct.ja.json +++ b/app/language/acct.ja.json @@ -15,5 +15,7 @@ "users2":"人", "safety":"コネクション", "ver":"Mastodonバージョン", - "ko":"個" + "ko":"個", + "thisismisskey":"Misskeyとしてログイン", + "misskeylogin":"ドキュメントを参照して正しいコードを入れてください。" } \ No newline at end of file