From f87ece15354b874dd662a4d35298ba822dd33f1f Mon Sep 17 00:00:00 2001 From: cutls Date: Mon, 17 Sep 2018 20:55:00 +0900 Subject: [PATCH] TheDesk Akane (16.1.3) --- app/css/post.css | 10 +- app/css/tl.css | 21 + app/css/userdata.css | 1 + app/js/common/keyshortcut.js | 18 +- app/js/lang/setting.lang.js | 4 + app/js/login/login.js | 8 +- app/js/login/manager.js | 4 +- app/js/post/post.js | 18 +- app/js/tl/mix.js | 9 +- app/js/tl/notification.js | 7 +- app/js/tl/speech.js | 7 +- app/js/tl/tl.js | 23 +- app/js/ui/layout.js | 26 + app/js/ui/settings.js | 13 + app/package.json | 2 +- app/view/en/acct.html | 1 + app/view/en/index.html | 32 +- app/view/en/setting.html | 14 + app/view/ja/acct.html | 1 + app/view/ja/index.html | 32 +- app/view/ja/setting.html | 14 + app/view/make/acct.sample.html | 1 + app/view/make/index.sample.html | 32 +- app/view/make/language/index.en.json | 4 +- app/view/make/language/index.ja.json | 4 +- app/view/make/language/setting.en.json | 4 + app/view/make/language/setting.ja.json | 4 + app/view/make/setting.sample.html | 14 + package-lock.json | 1394 ------------------------ 29 files changed, 252 insertions(+), 1470 deletions(-) delete mode 100644 package-lock.json diff --git a/app/css/post.css b/app/css/post.css index 85e5515c..00595d2f 100644 --- a/app/css/post.css +++ b/app/css/post.css @@ -69,7 +69,15 @@ overflow-y:scroll; max-height:100px; } - +#toot-btn-field{ + display:flex; +} +#toot-post-btn{ + width:calc(100% - 10px); padding:0; margin-top:10px; +} +#toot-sec-btn{ + width:30px; padding:0; margin-top:10px; +} /*mini*/ diff --git a/app/css/tl.css b/app/css/tl.css index 4c15a3f3..25e3209b 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -425,4 +425,25 @@ p:not(:last-child){ margin-top: 3px; padding: 1px; border-radius: 3px; +} +.fa-2x>.emoji-img { + width: 36px!important; + height: 36px!important +} +.fa-3x>.emoji-img { + width: 54px!important; + height: 54px!important +} +.fa-4x>.emoji-img { + width: 72px!important; + height: 72px!important +} +.fa-5x>.emoji-img { + width: 90px!important; + height: 90px!important +} +#lists-user{ + overflow-y: scroll; + overflow-x: hidden; + max-height: 200px; } \ No newline at end of file diff --git a/app/css/userdata.css b/app/css/userdata.css index 919821ce..29eebe46 100644 --- a/app/css/userdata.css +++ b/app/css/userdata.css @@ -19,6 +19,7 @@ } #his-float-data{ width: 400px; + height: 100%; } #his-float-timeline{ width: calc(100% - 400px); diff --git a/app/js/common/keyshortcut.js b/app/js/common/keyshortcut.js index 38146aea..2198026d 100644 --- a/app/js/common/keyshortcut.js +++ b/app/js/common/keyshortcut.js @@ -12,6 +12,16 @@ $(function($) { }else{ var wv=true; } + //Ctrl+Shift+Enter:Lgen + if (event.metaKey || event.ctrlKey && wv) { + if (event.shiftKey) { + if (e.keyCode === 13) { + post('local'); + return false; + } + } + + } //Ctrl+Enter:投稿 if (event.metaKey || event.ctrlKey && wv) { if (e.keyCode === 13) { @@ -19,13 +29,7 @@ $(function($) { return false; } } - //Shift+Enter:Markdown - if (event.shiftKey) { - if (e.keyCode === 13) { - brInsert(" \n"); - return false; - } - } + //Shift+Space:Markdownゼロ幅スペース if (event.shiftKey) { if (e.keyCode === 32) { diff --git a/app/js/lang/setting.lang.js b/app/js/lang/setting.lang.js index 4a469f53..4dd4d902 100644 --- a/app/js/lang/setting.lang.js +++ b/app/js/lang/setting.lang.js @@ -118,6 +118,10 @@ var lang_setting_main={ "ja":"起動時・投稿時のアカウントを{{set}}に設定しました。", "en":"Default account:{{set}}" } +var lang_setting_sec={ + "ja":"セカンダリートゥートボタン:{{set}}", + "en":"Secondary toot button:{{set}}" +} var lang_setting_ksref={ "ja":"キーボードショートカットが更新されました。", "en":"Keyboard shortcuts are refreshed." diff --git a/app/js/login/login.js b/app/js/login/login.js index 7b1c5684..d32c6f1c 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -399,8 +399,12 @@ function ckdb(acct_id) { return; } if(json){ - localStorage.setItem("letters_" + acct_id, json["max_toot_chars"]); - //localStorage.setItem("statuses_" + acct_id, json["statuses"]); + if(json["max_toot_chars"]){ + localStorage.setItem("letters_" + acct_id, json["max_toot_chars"]); + } + if(json["urls"]["streaming_api"]){ + localStorage.setItem("streaming_" + acct_id, json["urls"]["streaming_api"]); + } } }); diff --git a/app/js/login/manager.js b/app/js/login/manager.js index 987ce69e..59a12b62 100644 --- a/app/js/login/manager.js +++ b/app/js/login/manager.js @@ -269,7 +269,8 @@ function support() { function login(url) { var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); - if($('#misskey:checked').val()=="on"){ + if($('#misskey:checked').val()=="on" || url=="misskey.xyz"){ + $("#misskey").prop("checked", true); misskeyLogin(url); return; } @@ -369,6 +370,7 @@ function misskeyLogin(url) { $("#auth").show(); $("#code").val(token); $("#add").hide(); + $("#misskey").prop("checked", false); localStorage.setItem("domain_tmp",url); shell.openExternal(json.url); var electron = require("electron"); diff --git a/app/js/post/post.js b/app/js/post/post.js index 32eae3cf..366c83a7 100644 --- a/app/js/post/post.js +++ b/app/js/post/post.js @@ -1,6 +1,15 @@ /*投稿系*/ //投稿 -function post(mode) { +function sec(){ + var mode=localStorage.getItem("sec"); + var acct_id = $("#post-acct-sel").val(); + var domain = localStorage.getItem("domain_" + acct_id); + if(~domain.indexOf("kirishima.cloud")>=0 && mode=="local"){ + mode="unlisted"; + } + post(null,mode); +} +function post(mode,postvis) { if($("#toot-post-btn").prop("disabled")){ return } @@ -85,7 +94,12 @@ function post(mode) { } else { var nsfw = "false"; } - var vis = $("#vis").text(); + if(postvis){ + var vis = postvis; + }else{ + var vis = $("#vis").text(); + } + if(vis!="inherit" && vis!="local"){ toot.visibility=vis; }else if(vis=="local"){ diff --git a/app/js/tl/mix.js b/app/js/tl/mix.js index 980d092d..9c48966d 100644 --- a/app/js/tl/mix.js +++ b/app/js/tl/mix.js @@ -80,10 +80,15 @@ function mixtl(acct_id, tlid, type,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 + + if(localStorage.getItem("streaming_" + acct_id)){ + var wss=localStorage.getItem("streaming_" + acct_id) + }else{ + var wss="wss://"+domain + } + var startHome = wss "/api/v1/streaming/?stream=user&access_token=" + at; - var startLocal = "wss://" + domain + + var startLocal = wss "/api/v1/streaming/?stream=public:local&access_token=" + at; var wshid = websocketHome.length; var wslid = websocketLocal.length; diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index cf479af9..016b91df 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -95,7 +95,12 @@ function notf(acct_id, tlid, sys) { todc(); }); if(!misskey){ - var start = "wss://" + domain + "/api/v1/streaming/?stream=user&access_token=" + + if(localStorage.getItem("streaming_" + acct_id)){ + var wss=localStorage.getItem("streaming_" + acct_id) + }else{ + var wss="wss://"+domain + } + var start = wss + "/api/v1/streaming/?stream=user&access_token=" + at; }else{ var start = "wss://" + domain + "/?i=" + diff --git a/app/js/tl/speech.js b/app/js/tl/speech.js index 2213dfb7..543f9494 100644 --- a/app/js/tl/speech.js +++ b/app/js/tl/speech.js @@ -12,8 +12,8 @@ $voise = null; $synthes.rate=localStorage.getItem("voice_speed"); $synthes.pitch=localStorage.getItem("voice_pitch"); $synthes.volume=localStorage.getItem("voice_vol"); -function say(msg){ - msg=voiceParse(msg); +function say(msgr){ + msg=voiceParse(msgr); var voice=localStorage.getItem("voicebank"); var obj = JSON.parse(voice); if(!obj){ @@ -43,10 +43,11 @@ $repeat = setInterval(function() { } }, 300); function voiceParse(msg){ + msg = $.strip_tags(msg); msg = msg.replace(/#/g, ""); msg = msg.replace(/'/g, ""); msg = msg.replace(/"/g, ""); - msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?&]+/g, ""); + msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?%&-]+/g, ""); return msg; } function voiceToggle(tlid) { diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index ff111f3d..3326c5c5 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -179,20 +179,25 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { } }else{ var misskey=false; + if(localStorage.getItem("streaming_" + acct_id)){ + var wss=localStorage.getItem("streaming_" + acct_id) + }else{ + var wss="wss://"+domain + } if (type == "home") { - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=user&access_token=" + at; } else if (type == "pub") { - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=public&access_token=" + at; } else if (type == "pub-media") { - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=public:media&access_token=" + at; } else if (type == "local") { - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=public:local&access_token=" + at; } else if (type == "local-media") { - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=public:local:media&only_media=true&access_token=" + at; } else if (type == "tag") { if(type=="tag"){ @@ -201,16 +206,16 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { data=data+"&local=true"; } } - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=hashtag&tag=" + data +"&access_token=" + at; } else if (type == "noauth") { - var start = "wss://" + acct_id + + var start = wss + "/api/v1/streaming/?stream=public:local"; } else if (type=="list"){ - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=list&list=" + data +"&access_token=" + at; } else if (type=="dm"){ - var start = "wss://" + domain + + var start = wss + "/api/v1/streaming/?stream=direct&access_token=" + at; } } diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index 91ace987..d26be06f 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -179,6 +179,9 @@ function parseColumn() { $("#bottom").removeClass("reverse"); $(".leftside").removeClass("reverse"); } + if(localStorage.getItem("sec") && localStorage.getItem("sec")!="nothing"){ + secvis(localStorage.getItem("sec")); + } favTag(); var cw = localStorage.getItem("always-cw"); if (cw == "yes") { @@ -193,6 +196,29 @@ function parseColumn() { } } } +//セカンダリートゥートボタン +function secvis(set){ + if(set=="public"){ + $("#toot-sec-icon").text("public"); + $("#toot-sec-btn").addClass("purple"); + }else if(set=="unlisted"){ + $("#toot-sec-icon").text("lock_open"); + $("#toot-sec-btn").addClass("blue"); + }else if(set=="private"){ + $("#toot-sec-icon").text("lock"); + $("#toot-sec-btn").addClass("orange"); + }else if(set=="direct"){ + $("#toot-sec-icon").text("mail"); + $("#toot-sec-btn").addClass("red"); + }else if(set=="limited"){ + $("#toot-sec-icon").text("group"); + $("#toot-sec-btn").addClass("teal"); + }else if(set=="local"){ + $("#toot-sec-icon").text("visibility"); + $("#toot-sec-btn").addClass("light-blue"); + } + $("#toot-sec-btn").removeClass("hide"); +} //カラム追加 function addColumn() { var acct = $("#add-acct-sel").val(); diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index d4b6b287..00731952 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -192,6 +192,13 @@ function settings() { Materialize.toast(lang_setting_main[lang].replace("{{set}}" ,maint), 3000); } localStorage.setItem("mainuse", maind); + + var secd = $("[name=sec]:checked").val(); + var sect = $("[for=sec-"+secd+"]").text(); + if (secd != localStorage.getItem("sec")) { + Materialize.toast(lang_setting_sec[lang].replace("{{set}}" ,sect), 3000); + } + localStorage.setItem("sec", secd); } //読み込み時の設定ロード @@ -384,6 +391,12 @@ function load() { var maint = "remain"; } $("#mn_" + maint).prop("checked", true); + + var sect = localStorage.getItem("sec"); + if (!sect) { + var sect = "nothing"; + } + $("#sec-" + sect).prop("checked", true); } //最初に読む load(); diff --git a/app/package.json b/app/package.json index e1ac240c..fcd176cc 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "thedesk", - "version": "16.1.2", + "version": "16.1.3", "description": "TheDesk is a Mastodon client for PC.", "main": "main.js", "scripts": { diff --git a/app/view/en/acct.html b/app/view/en/acct.html index 995342af..8ffdb88d 100644 --- a/app/view/en/acct.html +++ b/app/view/en/acct.html @@ -88,6 +88,7 @@ Mastodon version:@
+ \ No newline at end of file diff --git a/app/view/en/index.html b/app/view/en/index.html index 02d84e1c..e479ec31 100644 --- a/app/view/en/index.html +++ b/app/view/en/index.html @@ -26,7 +26,7 @@ + \ No newline at end of file diff --git a/app/view/ja/index.html b/app/view/ja/index.html index 7db64efa..e790717c 100644 --- a/app/view/ja/index.html +++ b/app/view/ja/index.html @@ -26,7 +26,7 @@ + \ No newline at end of file diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index 6e65b3f8..56cab57e 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -26,7 +26,7 @@