TheDesk 20.0.6 (Kawaii)

This commit is contained in:
cutls 2019-12-01 20:28:20 +09:00
parent 8844320fc5
commit f46b05dca8
6 changed files with 294 additions and 215 deletions

View File

@ -1,346 +1,375 @@
//バージョンチェッカー //バージョンチェッカー
function verck(ver, jp) { function verck(ver, jp) {
console.log("%c Welcome😊", "color: red;font-size:200%;"); console.log('%c Welcome😊', 'color: red;font-size:200%;')
var date = new Date(); var date = new Date()
var show = false; var show = false
if (localStorage.getItem("ver") != ver && localStorage.getItem("winstore")) { if (localStorage.getItem('ver') != ver && localStorage.getItem('winstore')) {
//ちょっと削除とリンク解析の都合上アレ(s) //ちょっと削除とリンク解析の都合上アレ(s)
//対象外のアプデ:storageが20の最初まで"Usamin (18.6.5)" //対象外のアプデ:storageが20の最初まで"Usamin (18.6.5)"
if (!localStorage.getItem("usamin_18_6_5_flag")) { if (!localStorage.getItem('usamin_18_6_5_flag')) {
localStorage.setItem("usamin_18_6_5_flag", true); localStorage.setItem('usamin_18_6_5_flag', true)
var multi = localStorage.getItem("column"); var multi = localStorage.getItem('column')
var obj = JSON.parse(multi); var obj = JSON.parse(multi)
for (var i = 0; i < obj.length; i++) { for (var i = 0; i < obj.length; i++) {
localStorage.removeItem("card_" + i); localStorage.removeItem('card_' + i)
} }
} }
//ちょっと削除とリンク解析の都合上アレ(e) //ちょっと削除とリンク解析の都合上アレ(e)
show = true; show = true
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;"); console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
$(document).ready(function() { $(document).ready(function() {
if (localStorage.getItem("winstore")) { if (localStorage.getItem('winstore')) {
$("#releasenote").modal("open"); $('#releasenote').modal('open')
} }
verp = ver.replace("(", ""); verp = ver.replace('(', '')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace("[", "-"); verp = verp.replace('[', '-')
verp = verp.replace("]", ""); verp = verp.replace(']', '')
verp = verp.replace(")", ""); verp = verp.replace(')', '')
verp = verp.replace(" ", "_"); verp = verp.replace(' ', '_')
console.log("%c " + verp, "color: red;font-size:200%;"); console.log('%c ' + verp, 'color: red;font-size:200%;')
if (lang.language == "ja") { if (lang.language == 'ja') {
$("#release-" + verp).show(); $('#release-' + verp).show()
} else { } else {
$("#release-en").show(); $('#release-en').show()
} }
}); })
} }
localStorage.setItem("ver", ver); localStorage.setItem('ver', ver)
if (!show) { if (!show) {
console.log(show); console.log(show)
if (date.getMonth() + 1 >= localStorage.getItem("showSupportMe") || !localStorage.getItem("showSupportMe")) { if (
date.getFullYear() * 100 + date.getMonth() + 1 >= localStorage.getItem('showSupportMe') ||
!localStorage.getItem('showSupportMe')
) {
if (date.getMonth() == 11) { if (date.getMonth() == 11) {
var nextmonth = 1; var yrs = date.getFullYear() + 1
var nextmonth = yrs * 100 + 1
} else { } else {
var nextmonth = date.getMonth() + 2; var yrs = date.getFullYear()
var nextmonth = yrs * 100 + date.getMonth() + 2
} }
if (lang.language != "ja") { if (lang.language != 'ja') {
$("#support-btm-ja").addClass("hide"); $('#support-btm-ja').addClass('hide')
$("#support-btm-en").removeClass("hide"); $('#support-btm-en').removeClass('hide')
} }
localStorage.setItem("showSupportMe", nextmonth); localStorage.setItem('showSupportMe', nextmonth)
$("#support-btm").removeClass("hide"); $('#support-btm').removeClass('hide')
$("#support-btm").animate( $('#support-btm').animate(
{ {
bottom: "0" bottom: '0'
}, },
{ {
duration: 300 duration: 300
} }
); )
} }
} }
var platform = localStorage.getItem("platform"); var platform = localStorage.getItem('platform')
console.log("Your platform:" + platform); console.log('Your platform:' + platform)
if (!localStorage.getItem("winstore")) { if (!localStorage.getItem('winstore')) {
$("#start").css("display", "flex"); $('#start').css('display', 'flex')
} }
if (localStorage.getItem("winstore") == "brewcask" || localStorage.getItem("winstore") == "snapcraft" || localStorage.getItem("winstore") == "winstore") { if (
var winstore = true; localStorage.getItem('winstore') == 'brewcask' ||
localStorage.getItem('winstore') == 'snapcraft' ||
localStorage.getItem('winstore') == 'winstore'
) {
var winstore = true
} else { } else {
var winstore = false; var winstore = false
} }
var l = 5; var l = 5
// 生成する文字列に含める文字セット // 生成する文字列に含める文字セット
var c = "abcdefghijklmnopqrstuvwxyz0123456789"; var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
var cl = c.length; var cl = c.length
var r = ""; var r = ''
for (var i = 0; i < l; i++) { for (var i = 0; i < l; i++) {
r += c[Math.floor(Math.random() * cl)]; r += c[Math.floor(Math.random() * cl)]
} }
var start = "https://thedesk.top/ver.json"; var start = 'https://thedesk.top/ver.json'
fetch(start, { fetch(start, {
method: "GET" method: 'GET'
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
response.text().then(function(text) { response.text().then(function(text) {
setLog(response.url, response.status, text); setLog(response.url, response.status, text)
}); })
} }
return response.json(); return response.json()
}) })
.catch(function(error) { .catch(function(error) {
todo(error);setLog(start, "JSON", error); todo(error)
setLog(start, "JSON", error); setLog(start, 'JSON', error)
console.error(error); setLog(start, 'JSON', error)
console.error(error)
}) })
.then(function(mess) { .then(function(mess) {
console.table(mess); console.table(mess)
if (mess) { if (mess) {
//askjp_jp_ua: 2019年10月24日、mstdn.jpによるユーザーエージェントアクセス制限 //askjp_jp_ua: 2019年10月24日、mstdn.jpによるユーザーエージェントアクセス制限
if (jp && mess.jp_ua && !localStorage.getItem("askjp_jp_ua")) { if (jp && mess.jp_ua && !localStorage.getItem('askjp_jp_ua')) {
localStorage.setItem("askjp_jp_ua", true); localStorage.setItem('askjp_jp_ua', true)
$("#askjp_jp_ua").removeClass("hide"); $('#askjp_jp_ua').removeClass('hide')
} }
var platform = localStorage.getItem("platform"); var platform = localStorage.getItem('platform')
if (platform == "darwin") { if (platform == 'darwin') {
var newest = mess.desk_mac; var newest = mess.desk_mac
} else { } else {
var newest = mess.desk; var newest = mess.desk
} }
if (newest == ver) { if (newest == ver) {
todo(lang.lang_version_usever.replace("{{ver}}", mess.desk)); todo(lang.lang_version_usever.replace('{{ver}}', mess.desk))
//betaかWinstoreならアプデチェックしない //betaかWinstoreならアプデチェックしない
} else if (ver.indexOf("beta") != -1 || winstore) { } else if (ver.indexOf('beta') != -1 || winstore) {
} else { } else {
localStorage.removeItem("instance"); localStorage.removeItem('instance')
if (localStorage.getItem("new-ver-skip")) { if (localStorage.getItem('new-ver-skip')) {
if (localStorage.getItem("next-ver") != newest) { if (localStorage.getItem('next-ver') != newest) {
postMessage(["sendSinmpleIpc", "update"], "*"); postMessage(['sendSinmpleIpc', 'update'], '*')
} else { } else {
console.warn(lang.lang_version_skipver); console.warn(lang.lang_version_skipver)
todo(lang.lang_version_skipver); todo(lang.lang_version_skipver)
} }
} else { } else {
postMessage(["sendSinmpleIpc", "update"], "*"); postMessage(['sendSinmpleIpc', 'update'], '*')
} }
} }
} }
}); })
if (!localStorage.getItem("last-notice-id")) { if (!localStorage.getItem('last-notice-id')) {
localStorage.setItem("last-notice-id", 0); localStorage.setItem('last-notice-id', 0)
} }
var start = "https://thedesk.top/notice?since_id=" + localStorage.getItem("last-notice-id"); var start = 'https://thedesk.top/notice?since_id=' + localStorage.getItem('last-notice-id')
fetch(start, { fetch(start, {
method: "GET" method: 'GET'
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
response.text().then(function(text) { response.text().then(function(text) {
setLog(response.url, response.status, text); setLog(response.url, response.status, text)
}); })
} }
return response.json(); return response.json()
}) })
.catch(function(error) { .catch(function(error) {
todo(error);setLog(start, "JSON", error); todo(error)
console.error(error); setLog(start, 'JSON', error)
console.error(error)
}) })
.then(function(mess) { .then(function(mess) {
if (mess.length < 1) { if (mess.length < 1) {
return false; return false
} else { } else {
var last = localStorage.getItem("last-notice-id"); var last = localStorage.getItem('last-notice-id')
localStorage.setItem("last-notice-id", mess[0].ID); localStorage.setItem('last-notice-id', mess[0].ID)
for (i = 0; i < mess.length; i++) { for (i = 0; i < mess.length; i++) {
var obj = mess[i]; var obj = mess[i]
if (obj.ID * 1 <= last) { if (obj.ID * 1 <= last) {
break; break
} else { } else {
if (obj.type == "textv2") { if (obj.type == 'textv2') {
if (~obj.languages.indexOf(lang.language)) { if (~obj.languages.indexOf(lang.language)) {
var show = true; var show = true
if (obj.toot != "") { if (obj.toot != '') {
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + "','main')\">Show</button>"; var toot =
'<button class="btn-flat toast-action" onclick="detEx(\'' +
obj.toot +
"','main')\">Show</button>"
} else { } else {
var toot = ""; var toot = ''
} }
if (obj.ver != "") { if (obj.ver != '') {
if (obj.ver == ver) { if (obj.ver == ver) {
show = true; show = true
} else { } else {
show = false; show = false
} }
} }
if (obj.domain != "") { if (obj.domain != '') {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem('multi')
if (multi) { if (multi) {
show = false; show = false
var accts = JSON.parse(multi); var accts = JSON.parse(multi)
Object.keys(accts).forEach(function(key) { Object.keys(accts).forEach(function(key) {
var acct = accts[key]; var acct = accts[key]
if (acct.domain == obj.domain) { if (acct.domain == obj.domain) {
show = true; show = true
} }
}); })
} }
} }
if (show) { if (show) {
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 }); M.toast({
html:
escapeHTML(obj.text) +
toot +
'<span class="sml grey-text">(スライドして消去)</span>',
displayLength: 86400
})
} }
} }
} }
} }
} }
} }
}); })
} }
var infostreaming = false; var infostreaming = false
function infowebsocket() { function infowebsocket() {
infows = new WebSocket("wss://thedesk.top/ws/"); infows = new WebSocket('wss://thedesk.top/ws/')
infows.onopen = function(mess) { infows.onopen = function(mess) {
console.log([tlid, ":Connect Streaming Info:", mess]); console.log([tlid, ':Connect Streaming Info:', mess])
infostreaming = true; infostreaming = true
}; }
infows.onmessage = function(mess) { infows.onmessage = function(mess) {
console.log([tlid, ":Receive Streaming:", JSON.parse(mess.data)]); console.log([tlid, ':Receive Streaming:', JSON.parse(mess.data)])
var obj = JSON.parse(mess.data); var obj = JSON.parse(mess.data)
if (obj.type != "counter") { if (obj.type != 'counter') {
if (obj.type == "textv2") { if (obj.type == 'textv2') {
if (~obj.languages.indexOf(lang.language)) { if (~obj.languages.indexOf(lang.language)) {
localStorage.setItem("last-notice-id", obj.id); localStorage.setItem('last-notice-id', obj.id)
var show = true; var show = true
if (obj.toot != "") { if (obj.toot != '') {
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + "','main')\">Show</button>"; var toot =
'<button class="btn-flat toast-action" onclick="detEx(\'' +
obj.toot +
"','main')\">Show</button>"
} else { } else {
var toot = ""; var toot = ''
} }
if (obj.ver != "") { if (obj.ver != '') {
if (obj.ver == ver) { if (obj.ver == ver) {
show = true; show = true
} else { } else {
show = false; show = false
} }
} }
if (obj.domain != "") { if (obj.domain != '') {
var multi = localStorage.getItem("multi"); var multi = localStorage.getItem('multi')
if (multi) { if (multi) {
show = false; show = false
var accts = JSON.parse(multi); var accts = JSON.parse(multi)
Object.keys(accts).forEach(function(key) { Object.keys(accts).forEach(function(key) {
var acct = accts[key]; var acct = accts[key]
if (acct.domain == obj.domain) { if (acct.domain == obj.domain) {
show = true; show = true
} }
}); })
} }
} }
if (show) { if (show) {
console.log(obj.text); console.log(obj.text)
console.log(escapeHTML(obj.text)); console.log(escapeHTML(obj.text))
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 }); M.toast({
html:
escapeHTML(obj.text) +
toot +
'<span class="sml grey-text">(スライドして消去)</span>',
displayLength: 86400
})
} }
} }
} }
} else { } else {
$("#persons").text(obj.text); $('#persons').text(obj.text)
}
} }
};
infows.onerror = function(error) { infows.onerror = function(error) {
infostreaming = false; infostreaming = false
console.error("Error closing:info"); console.error('Error closing:info')
console.error(error); console.error(error)
return false; return false
}; }
infows.onclose = function() { infows.onclose = function() {
infostreaming = false; infostreaming = false
console.error("Closing:info"); console.error('Closing:info')
}; }
} }
setInterval(function() { setInterval(function() {
if (!infostreaming) { if (!infostreaming) {
console.log("try to connect to base-streaming"); console.log('try to connect to base-streaming')
infowebsocket(); infowebsocket()
} }
}, 10000); }, 10000)
function openRN() { function openRN() {
$("#releasenote").modal("open"); $('#releasenote').modal('open')
if (lang.language == "ja") { if (lang.language == 'ja') {
verp = ver.replace("(", ""); verp = ver.replace('(', '')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace("[", "-"); verp = verp.replace('[', '-')
verp = verp.replace("]", ""); verp = verp.replace(']', '')
verp = verp.replace(")", ""); verp = verp.replace(')', '')
verp = verp.replace(" ", "_"); verp = verp.replace(' ', '_')
$("#release-" + verp).show(); $('#release-' + verp).show()
} else { } else {
$("#release-en").show(); $('#release-en').show()
} }
} }
function closeSupport() { function closeSupport() {
$("#support-btm").animate( $('#support-btm').animate(
{ {
bottom: "-300px" bottom: '-300px'
}, },
{ {
duration: 300, duration: 300,
complete: function() { complete: function() {
$("#support-btm").addClass("hide"); $('#support-btm').addClass('hide')
} }
} }
); )
} }
function storeDialog(platform, ver) { function storeDialog(platform, ver) {
if (platform == "win32") { if (platform == 'win32') {
var mes = lang.lang_version_platform; var mes = lang.lang_version_platform
} else if (platform == "linux") { } else if (platform == 'linux') {
var mes = lang.lang_version_platform_linux; var mes = lang.lang_version_platform_linux
} else if (platform == "darwin") { } else if (platform == 'darwin') {
var mes = lang.lang_version_platform_mac; var mes = lang.lang_version_platform_mac
} }
Swal.fire({ Swal.fire({
title: "Select your platform", title: 'Select your platform',
text: mes, text: mes,
type: "info", type: 'info',
showCancelButton: true, showCancelButton: true,
confirmButtonColor: "#3085d6", confirmButtonColor: '#3085d6',
cancelButtonColor: "#3085d6", cancelButtonColor: '#3085d6',
confirmButtonText: lang.lang_no, confirmButtonText: lang.lang_no,
cancelButtonText: lang.lang_yesno cancelButtonText: lang.lang_yesno
}).then(result => { }).then(result => {
//逆にしてる //逆にしてる
if (!result.value) { if (!result.value) {
localStorage.setItem("winstore", "winstore"); localStorage.setItem('winstore', 'winstore')
} else { } else {
localStorage.setItem("winstore", "localinstall"); localStorage.setItem('winstore', 'localinstall')
} }
localStorage.setItem("ver", ver); localStorage.setItem('ver', ver)
show = true; show = true
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;"); console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
$(document).ready(function() { $(document).ready(function() {
$("#releasenote").modal("open"); $('#releasenote').modal('open')
verp = ver.replace("(", ""); verp = ver.replace('(', '')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace(".", "-"); verp = verp.replace('.', '-')
verp = verp.replace("[", "-"); verp = verp.replace('[', '-')
verp = verp.replace("]", ""); verp = verp.replace(']', '')
verp = verp.replace(")", ""); verp = verp.replace(')', '')
verp = verp.replace(" ", "_"); verp = verp.replace(' ', '_')
console.log("%c " + verp, "color: red;font-size:200%;"); console.log('%c ' + verp, 'color: red;font-size:200%;')
if (lang.language == "ja") { if (lang.language == 'ja') {
$("#release-" + verp).show(); $('#release-' + verp).show()
} else { } else {
$("#release-en").show(); $('#release-en').show()
} }
}); })
}); })
} }
function closeStart() { function closeStart() {
$("#start").css("display", "none"); $('#start').css('display', 'none')
var platform = localStorage.getItem("platform"); var platform = localStorage.getItem('platform')
var ver = localStorage.getItem("ver"); var ver = localStorage.getItem('ver')
storeDialog(platform, ver); storeDialog(platform, ver)
} }

View File

@ -211,3 +211,62 @@ function escapeCsv(str) {
} }
return result return result
} }
function statusModel(now) {
if(!now){
var now = new Date().toString()
}
return {
id: '',
created_at: now,
in_reply_to_id: null,
in_reply_to_account_id: null,
sensitive: false,
spoiler_text: '',
visibility: 'public',
language: 'en',
uri: '',
url: '',
replies_count: 0,
reblogs_count: 0,
favourites_count: 0,
favourited: false,
reblogged: false,
muted: false,
bookmarked: false,
pinned: false,
content: '<p><i>No status here</i></p>',
reblog: null,
application: {
name: null,
website: null
},
account: {
id: '',
username: '',
acct: '',
display_name: '',
locked: false,
bot: false,
created_at: now,
note:
'',
url: '',
avatar: '',
avatar_static:
'',
header: '',
header_static: '',
followers_count: 0,
following_count: 0,
statuses_count: 0,
last_status_at: now,
emojis: [],
fields: []
},
media_attachments: [],
mentions: [],
tags: [],
card: null,
poll: null
}
}

View File

@ -227,6 +227,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
} }
var noticeavatar = '' var noticeavatar = ''
if (mix == 'notf') { if (mix == 'notf') {
if(!toot.status) {
toot.status = statusModel(toot.created_at)
}
if (gif == 'yes') { if (gif == 'yes') {
noticeavatar = toot.account.avatar noticeavatar = toot.account.avatar
} else { } else {

View File

@ -1,6 +1,6 @@
{ {
"name": "thedesk", "name": "thedesk",
"version": "20.0.5", "version": "20.0.6",
"description": "TheDesk is a Mastodon client for PC.", "description": "TheDesk is a Mastodon client for PC.",
"repository": "https://github.com/cutls/TheDesk", "repository": "https://github.com/cutls/TheDesk",
"main": "main.js", "main": "main.js",

View File

@ -762,28 +762,16 @@
<a href="https://thedesk.top" target="_blank">HP</a><br> <a href="https://thedesk.top" target="_blank">HP</a><br>
<a href="https://github.com/cutls/TheDesk" target="_blank">GitHub</a><br> <a href="https://github.com/cutls/TheDesk" target="_blank">GitHub</a><br>
<br> <br>
<div id="release-20-0-5_Kawaii" class="release-do" style="display:none; ">><br> <div id="release-20-0-6_Kawaii" class="release-do" style="display:none; ">><br>
<a href="https://ja.mstdn.wiki/TheDesk" target="_blank">機能一覧</a><br> <a href="https://ja.mstdn.wiki/TheDesk" target="_blank">機能一覧</a><br>
Pixiv FanboxやPatreonでは支援者様限定で様々なTheDeskに関する記事をご覧いただけます。最低月一更新。<br> Pixiv FanboxやPatreonでは支援者様限定で様々なTheDeskに関する記事をご覧いただけます。最低月一更新。<br>
困ったときは、<a href="https://docs.thedesk.top">TheDesk Docs</a>をご覧ください。 困ったときは、<a href="https://docs.thedesk.top">TheDesk Docs</a>をご覧ください。
<h5>Release Note 20.0.5 (Kawaii)</h5> <h5>Release Note 20.0.6 (Kawaii)</h5>
バグ匿名報告ボタンを付けた 支援ダイアログが消えない
<a onclick="udgEx('Cutls@cutls.com','main')" class="contributor"> <a onclick="udgEx('Cutls@cutls.com','main')" class="contributor">
<img src="https://media.thedesk.top/accounts/avatars/000/000/001/original/d34ef8bb49d5e011.png">Cutls <img src="https://media.thedesk.top/accounts/avatars/000/000/001/original/d34ef8bb49d5e011.png">Cutls
</a><br> </a><br>
・削除して再編集でリプライとNSFWの情報を継承するように ・ステータスが虚無なことがある
<a onclick="udgEx('Cutls@cutls.com','main')" class="contributor">
<img src="https://media.thedesk.top/accounts/avatars/000/000/001/original/d34ef8bb49d5e011.png">Cutls
</a><br>
・冪等性の確保(これにより1秒以内の同一アカウントからの連投は禁止されます。)
<a onclick="udgEx('Cutls@cutls.com','main')" class="contributor">
<img src="https://media.thedesk.top/accounts/avatars/000/000/001/original/d34ef8bb49d5e011.png">Cutls
</a><br>
・トレンドタグのデザイン改善
<a onclick="udgEx('Cutls@cutls.com','main')" class="contributor">
<img src="https://media.thedesk.top/accounts/avatars/000/000/001/original/d34ef8bb49d5e011.png">Cutls
</a><br>
・アンケートのデザイン改善
<a onclick="udgEx('Cutls@cutls.com','main')" class="contributor"> <a onclick="udgEx('Cutls@cutls.com','main')" class="contributor">
<img src="https://media.thedesk.top/accounts/avatars/000/000/001/original/d34ef8bb49d5e011.png">Cutls <img src="https://media.thedesk.top/accounts/avatars/000/000/001/original/d34ef8bb49d5e011.png">Cutls
</a><br> </a><br>

View File

@ -1,4 +1,4 @@
let ver = '20.0.5 (Kawaii)' let ver = '20.0.6 (Kawaii)'
if (process.argv.indexOf('--automatic') === -1) { if (process.argv.indexOf('--automatic') === -1) {
let input = require('readline-sync').question('version string [empty: ' + ver + ' (default)]? ') let input = require('readline-sync').question('version string [empty: ' + ver + ' (default)]? ')
if (input) { if (input) {