diff --git a/README.md b/README.md index 5bd1b26f..12d01140 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ The icon is provided under [Creative Commons BY-NC-SA](https://creativecommons.o * [ico](https://dl.thedesk.top/press/TheDesk.ico) * [icns](https://dl.thedesk.top/press/TheDesk.icns) +The default sound of notifications is provided [Creative Commons BY](https://creativecommons.org/licenses/by/4.0/) + ## Terms of Use/利用規約 * [利用規約(Terms of Use(ja))](https://thedesk.top/tos.html) diff --git a/app/about.html b/app/about.html index 63f25012..ca455003 100644 --- a/app/about.html +++ b/app/about.html @@ -76,7 +76,7 @@ a,button{
TheDesk
-
External version
+
Display version
Internal version
@@ -87,13 +87,17 @@ a,button{
Node.js
-
Copyright © TheDesk 2018 All rights reserved.
Web site
+
Copyright © Cutls P 2018 All rights reserved.
+ Thanks:toneji/popn_ja/kPherox and all users + ❤️ +
Web site
- \ No newline at end of file +$(document).on('click', 'a', e => { + var url = $(e.target).attr('href'); + shell.openExternal(url); + return false; +}); + \ No newline at end of file diff --git a/app/css/master.css b/app/css/master.css index 74e7b81c..e4ece881 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -30,6 +30,8 @@ option { } #mainView { padding: 10px; + overflow:scroll; + height: auto; } #message { display: none; diff --git a/app/css/tl.css b/app/css/tl.css index 42df4407..754ea4cd 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -249,6 +249,29 @@ grid-area: toot; margin:2px; grid-area: side; } + +.quote-renote{ + display: grid; + grid-template-columns: 43px 2fr 1fr; + grid-template-areas: 'ricon ruser' 'ricon rtext'; + border: 1px solid; + margin-top: 3px; + padding: 1px; + border-radius: 3px; +} +.renote-icon{ + grid-area: ricon; +} +.renote-icon img{ + width:43px; +} +.renote-user{ + grid-area: ruser; +} +.renote-text{ + grid-area: rtext; +} + .btn-flat{ color:var(--color); } diff --git a/app/js/login/manager.js b/app/js/login/manager.js index 884b50eb..efaf09b2 100644 --- a/app/js/login/manager.js +++ b/app/js/login/manager.js @@ -364,6 +364,28 @@ function misskeyLogin(url) { "reaction-write", "vote-read", "vote-write" + /* + "read:account", + "write:account", + "read:drive", + "write:drive", + "read:blocks", + "write:blocks", + "read:favorites", + "write:favorites", + "read:following", + "write:following", + "read:messaging", + "write:messaging", + "read:mutes", + "write:mutes", + "write:notes", + "read:notifications", + "write:notifications", + "read:reactions", + "write:reactions", + "write:votes" + */ ] })); httpreq.onreadystatechange = function() { diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 4e9adaf2..7bb937c1 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -181,4 +181,21 @@ const { } = require('electron'); webviewDom.addEventListener('new-window', function(e) { shell.openExternal(e.url); -}); \ No newline at end of file +}); +function playSound() { + window.AudioContext = window.AudioContext || window.webkitAudioContext; + context = new AudioContext(); + context.createBufferSource().start(0); + context.decodeAudioData(request.response, function (buf) { + console.log(source) + source.buffer = buf; + source.loop = false; + }); + source = context.createBufferSource(); + volumeControl = context.createGain(); + source.connect(volumeControl); + volumeControl.connect(context.destination); + volumeControl.gain.value=0.8 + console.log(volumeControl) + source.start(0); +} \ No newline at end of file diff --git a/app/js/tl/misskeyparse.js b/app/js/tl/misskeyparse.js index 8164ab1a..761e4d96 100644 --- a/app/js/tl/misskeyparse.js +++ b/app/js/tl/misskeyparse.js @@ -296,7 +296,9 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { ")
"; var boostback = "shared"; var uniqueid=toot.id; - var toot = toot.renote; + if(!toot.text){ + var toot = toot.renote; + } var dis_name=escapeHTMLtemp(toot.user.name); var uniqueid=toot.id; var actemojick=false @@ -636,9 +638,11 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { }); poll='
'+poll+'
'; } - /* - - */ + //引用Renote + if(toot.renote){ + poll=poll+'
'+escapeHTML(toot.renote.user.name)+'
'+escapeHTML(toot.renote.text)+'
' + } if(localStorage.getItem("emojiReaction_" + acct_id)=="disabled"){ var freeReact="hide"; }else{ @@ -667,7 +671,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { var emoji = obj[i]; if (":"+emoji.shortcode+":"==keye) { if (emoji) { - addReact=addReact+ ''+thisReact+ ''; } diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index f8b1d195..93d7b1da 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -112,73 +112,6 @@ function notfColumn(acct_id, tlid, sys){ at; } - console.log(start); - var wsid = websocketNotf.length; - websocketNotf[acct_id] = new WebSocket(start); - console.log(websocketNotf); - websocketNotf[acct_id].onopen = function(mess) { - console.log("Connect Streaming API(Notf):"); - console.log(mess); - $("i[data-notf=" + acct_id +"]").removeClass("red-text"); - - } - websocketNotf[acct_id].onmessage = function(mess) { - console.log("Receive Streaming API(Notf):"+acct_id); - var popup = localStorage.getItem("popup"); - if (!popup) { - popup = 0; - } - console.log(domain) - if(misskey){ - console.log("misskey") - console.log(JSON.parse(mess.data)); - if (JSON.parse(mess.data).type == "notification") { - var obj = JSON.parse(mess.data).body; - console.log(obj); - if(obj.type!="follow"){ - - templete = misskeyParse([obj], 'notf', acct_id, 'notf', popup); - }else{ - templete = misskeyUserparse([obj], 'notf', acct_id, 'notf', popup); - } - if(obj.type=="reaction"){ - console.log("refresh") - reactRefresh(acct_id,obj.note.id) - } - if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){ - $("div[data-notf=" + acct_id +"]").prepend(templete); - } - jQuery("time.timeago").timeago(); - }else if(JSON.parse(mess.data).type == "note-updated"){ - var obj = JSON.parse(mess.data).body.note; - reactRefreshCore(obj) - } - }else{ - var obj = JSON.parse(JSON.parse(mess.data).payload); - console.log(obj); - var type = JSON.parse(mess.data).event; - if (type == "notification") { - var templete=""; - localStorage.setItem("lastnotf_" + acct_id,obj.id); - if(obj.type!="follow"){ - templete = parse([obj], 'notf', acct_id, 'notf', popup); - }else{ - templete = userparse([obj], 'notf', acct_id, 'notf', popup); - } - if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){ - $(".tl[data-notf=" + acct_id +"]").prepend(templete); - } - $(".notf-timeline[data-acct=" + acct_id +"]").prepend(templete); - jQuery("time.timeago").timeago(); - } else if (type == "delete") { - $("[toot-id=" + obj + "]").hide(); - $("[toot-id=" + obj + "]").remove(); - } - } - } - websocketNotf[acct_id].onerror = function(error) { - console.error('WebSocket Error ' + error); - }; } function notfCommon(acct_id, tlid, sys) { todo("Notifications Loading..."); @@ -318,6 +251,7 @@ function notfCommon(acct_id, tlid, sys) { } if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){ $("div[data-notf=" + acct_id +"]").prepend(templete); + $("div[data-const=notf_"+acct_id+"]").prepend(templete); } jQuery("time.timeago").timeago(); }else if(JSON.parse(mess.data).type == "note-updated"){ @@ -338,6 +272,7 @@ function notfCommon(acct_id, tlid, sys) { } if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){ $("div[data-notf=" + acct_id +"]").prepend(templete); + $("div[data-const=notf_"+acct_id+"]").prepend(templete); } jQuery("time.timeago").timeago(); } else if (type == "delete") { diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 54e73beb..8d42b599 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -251,16 +251,19 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { $(".notf-reply_" + acct_id).text(replyct*1-(-1)); localStorage.setItem("notf-reply_" + acct_id,replyct*1-(-1)) $(".notf-reply_" + acct_id).removeClass("hide") + var sound=localStorage.getItem("replySound"); }else if (toot.type == "reblog") { var btct=localStorage.getItem("notf-bt_" + acct_id) $(".notf-bt_" + acct_id).text(btct*1-(-1)); localStorage.setItem("notf-bt_" + acct_id,btct*1-(-1)) $(".notf-bt_" + acct_id).removeClass("hide") + var sound=localStorage.getItem("btSound"); }else if (toot.type == "favourite") { var favct=localStorage.getItem("notf-fav_" + acct_id) $(".notf-fav_" + acct_id).text(favct*1-(-1)); localStorage.setItem("notf-fav_" + acct_id,favct*1-(-1)) $(".notf-fav_" + acct_id).removeClass("hide") + var sound=localStorage.getItem("favSound"); } } @@ -268,6 +271,25 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { if(popup>0){ Materialize.toast("["+domain+"]"+escapeHTML(toot.account.display_name)+what, popup * 1000); } + //通知音 + if(sound=="default" || !sound){ + var file="../../source/notif.wav" + }else if(sound=="c1"){ + var file=localStorage.getItem("custom1"); + }else if(sound=="c2"){ + var file=localStorage.getItem("custom2"); + }else if(sound=="c3"){ + var file=localStorage.getItem("custom3"); + }else if(sound=="c4"){ + var file=localStorage.getItem("custom4"); + } + if(file){ + request = new XMLHttpRequest(); + request.open("GET", file, true); + request.responseType = "arraybuffer"; + request.onload = playSound; + request.send(); + } if(native=="yes"){ var electron = require("electron"); var ipc = electron.ipcRenderer; @@ -395,7 +417,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var via = ''; viashow="hide"; } else { - var via = toot.application.name; + var via = escapeHTML(toot.application.name); //強調チェック Object.keys(emp).forEach(function(key6) { var cli = emp[key6]; @@ -452,6 +474,40 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var viewer = ""; var hasmedia = ""; var youtube = ""; + //Poll + var poll=""; + if(toot.poll){ + var choices=toot.poll.options; + if(toot.poll.voted){ + var myvote=lang.lang_parse_voted; + var result_hide=""; + }else{ + myvote=''+lang.lang_parse_vote+'
'; + if(choices[0].votes_count===0 || choices[0].votes_count>0){ + myvote=myvote+''+lang.lang_parse_unvoted+""; + } + var result_hide="hide"; + } + if(toot.poll.expired){ + var ended=lang.lang_parse_endedvote; + }else{ + var ended=date(toot.poll.expires_at, datetype); + } + Object.keys(choices).forEach(function(keyc) { + var choice = choices[keyc]; + if(!toot.poll.voted && !toot.poll.expired){ + var votesel='voteSelMastodon(\''+acct_id+'\',\''+toot.poll.id+'\','+keyc+','+toot.poll.multiple+')'; + var voteclass="pointer waves-effect waves-light"; + }else{ + var votesel=""; + var voteclass=""; + } + poll=poll+'
'+escapeHTML(choice.title)+'('+choice.votes_count+')
'; + }); + poll='
'+poll+myvote+'' + + ended+ '
'; + } if(toot.emojis){ var emojick = toot.emojis[0]; }else{ @@ -467,6 +523,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var regExp = new RegExp(":" + shortcode + ":", "g"); content = content.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url); + poll = poll.replace(regExp, emoji_url); }); } //ニコフレ絵文字 @@ -485,6 +542,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { var regExp = new RegExp(":" + shortcode + ":", "g"); content = content.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url); + poll = poll.replace(regExp, emoji_url); }); } //デフォ絵文字 @@ -501,6 +559,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { if(notice){ notice=twemoji.parse(notice); } + if(poll){ + poll=twemoji.parse(poll); + } var mediack = toot.media_attachments[0]; //メディアがあれば var media_ids=""; @@ -704,39 +765,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { } } } - //Poll - var poll=""; - if(toot.poll){ - var choices=toot.poll.options; - if(toot.poll.voted){ - var myvote=lang.lang_parse_voted; - var result_hide=""; - }else{ - myvote=''+lang.lang_parse_vote+'
'; - if(choices[0].votes_count===0 || choices[0].votes_count>0){ - myvote=myvote+''+lang.lang_parse_unvoted+""; - } - var result_hide="hide"; - } - if(toot.poll.expired){ - var ended=lang.lang_parse_endedvote; - }else{ - var ended=date(toot.poll.expires_at, datetype); - } - Object.keys(choices).forEach(function(keyc) { - var choice = choices[keyc]; - if(!toot.poll.voted && !toot.poll.expired){ - var votesel='voteSelMastodon(\''+acct_id+'\',\''+toot.poll.id+'\','+keyc+','+toot.poll.multiple+')'; - var voteclass="pointer waves-effect waves-light"; - }else{ - var votesel=""; - var voteclass=""; - } - poll=poll+'
'+escapeHTML(choice.title)+'('+choice.votes_count+')
'; - }); - poll='
'+poll+myvote+'' + - ended+ '
'; + //Quote + if(toot.quote){ + poll=poll+'
'+escapeHTML(toot.quote.account.display_name)+'
'+toot.quote.content+'
' } templete = templete + '
'+choice.title+'('+choice.votes_count+')
'; + poll=poll+'
'+escapeHTML(choice.title)+'('+choice.votes_count+')
'; }); poll=poll+myvote+'' + diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index 59a0a1b0..b37f12ae 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -199,7 +199,7 @@ function parseColumn() { ')" class="setting nex">hearingOn'+lang.lang_layout_tts +'TL
low_priority'+lang.lang_layout_reconnect+'
'+lang.lang_layout_headercolor +'
'+lang.lang_layout_nodata +'
' + '" class="tl '+acct.type+'-timeline " tlid="' + key + '" data-type="' + acct.type + '" data-acct="'+acct.domain+'" data-const="' + acct.type + '_'+acct.domain+'">
'+lang.lang_layout_nodata +'
' $('#timeline_box_' + basekey + '_parentBox').append(html); localStorage.removeItem("pool_" + key); if (acct.data) { diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index baaf4589..62bc14fa 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -123,6 +123,10 @@ function load() { var font = ""; } $("#font").val(font); + $("#c1-file").text(localStorage.getItem("custom1")) + $("#c2-file").text(localStorage.getItem("custom2")); + $("#c3-file").text(localStorage.getItem("custom3")); + $("#c4-file").text(localStorage.getItem("custom4")); } function climute(){ @@ -636,6 +640,22 @@ ipc.on('theme-json-create-complete', function (event, args) { $("#custom_import").val(""); ctLoad() }); +function customSound(key){ + var electron = require("electron"); + var remote=electron.remote; + var dialog=remote.dialog; + dialog.showOpenDialog(null, { + title: 'Custom sound', + properties: ['openFile'], + filters: [ + {name: 'Audio', extensions: ['mp3','aac','wav','flac','m4a']}, + {name: 'All', extensions: ['*']}, + ] + }, (fileNames) => { + localStorage.setItem("custom"+key,fileNames[0]); + $("#c1-file").text(fileNames[0]) + }); +} window.onload = function() { //最初に読む load(); diff --git a/app/js/userdata/showOnTL.js b/app/js/userdata/showOnTL.js index b201b38b..8c72c2e3 100644 --- a/app/js/userdata/showOnTL.js +++ b/app/js/userdata/showOnTL.js @@ -157,8 +157,7 @@ function udg(user, acct_id) { var when=""; var color="inherit" } - fval=twemoji.parse(fval); - note=note+''+fname+''+fval+''; + note=note+''+twemoji.parse(escapeHTML(fname))+''+twemoji.parse(fval)+''; } note=note+'' $("#his-des").html(twemoji.parse(note)); diff --git a/app/package.json b/app/package.json index 55cbaef9..c1c8a382 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "thedesk", - "version": "18.2.3", + "version": "18.3.0", "description": "TheDesk is a Mastodon client for PC.", "repository": "https://github.com/cutls/TheDesk", "main": "main.js", @@ -35,7 +35,7 @@ }, { "name": "kPherox", - "url": "https://www.kr-kp.com/", + "url": "https://pawoo.net/@kPherox", "email": "admin@mail.kr-kp.com" } ], diff --git a/app/source/notif.wav b/app/source/notif.wav new file mode 100644 index 00000000..78700e70 Binary files /dev/null and b/app/source/notif.wav differ diff --git a/app/view/en/index.html b/app/view/en/index.html index 19746733..d5e8dceb 100644 --- a/app/view/en/index.html +++ b/app/view/en/index.html @@ -32,7 +32,7 @@