Merge branch 'master' into dependabot/npm_and_yarn/app/electron-22.0.0

This commit is contained in:
Cutls 2022-12-06 00:18:45 +09:00 committed by GitHub
commit 8d4784da82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 122 additions and 97 deletions

View File

@ -297,7 +297,7 @@ iframe,
.area-display_name {
user-select: text;
height: 1.5em;
height: 1.5rem;
margin: 0.15rem;
margin-left: 0.4rem;
overflow: hidden;

View File

@ -49,6 +49,7 @@ async function details(id, acct_id, tlid, mode) {
const json = await response.json()
console.log(['Toot data:', json])
if (!$('#timeline_' + tlid + ' #pub_' + id).length) {
var mute = getFilterTypeByAcct(acct_id, 'thread')
var html = parse([json], '', acct_id, '', '', mute)
$('#toot-this').html(html)
jQuery('time.timeago').timeago()
@ -126,7 +127,7 @@ async function details(id, acct_id, tlid, mode) {
if (!$('#activator').hasClass('active')) {
$('#det-col').collapsible('open', 4)
}
} catch (e) {
} catch (error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
@ -599,28 +600,21 @@ function staCopy(id) {
}
//翻訳
function trans(tar, to, elem) {
var html = elem.parents('.cvo').find('.toot').html()
if (html.match(/^<p>(.+)<\/p>$/)) {
html = html.match(/^<p>(.+)<\/p>$/)[1]
}
html = html.replace(/<br\s?\/?>/g, '\n')
html = html.replace(/<p>/g, '\n')
html = html.replace(/<\/p>/g, '\n')
html = $.strip_tags(html)
if (~tar.indexOf('zh')) {
tar = 'zh'
}
var id = elem.parents('.cvo').attr('toot-id')
alert(id)
$('#toot-this .additional').text('Loading...(Powered by Google Translate)')
var exec =
'https://script.google.com/macros/s/AKfycbxhwW5tjjop9Irg-y1zr_WsXlCKEzwWG6KuoOt_vVRDfEbRv0c/exec?format=json&text=' +
encodeURIComponent(html) +
'&source=' +
tar +
'&target=' +
to
console.log('Try to translate from ' + tar + ' to ' + to + ' at ' + exec)
var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem('mode_' + domain) == 'misskey') {
return false
}
var at = localStorage.getItem('acct_' + acct_id + '_at')
var exec = `https://${domain}/api/v1/statuses/${id}/translate`
fetch(exec, {
method: 'GET'
method: 'POST',
headers: {
'content-type': 'application/json',
Authorization: 'Bearer ' + at
}
})
.then(function (response) {
if (!response.ok) {
@ -636,7 +630,8 @@ function trans(tar, to, elem) {
console.error(error)
})
.then(function (text) {
elem.parents('.cvo').find('.toot').append('<span class="gray translate">' + text.text + '</span>')
console.log(text)
elem.parents('.cvo').find('.toot').append('<span class="gray translate">' + text.content + '</span>')
})
}
//ブラウザで開く

View File

@ -41,7 +41,7 @@ function notfColumn(acct_id, tlid, sys) {
httpreq.responseType = 'json'
httpreq.send(body)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -56,7 +56,7 @@ function notfColumn(acct_id, tlid, sys) {
var templete = ''
var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) {
Object.keys(json).forEach(function (key) {
var obj = json[key]
if (lastnotf == obj.id && key > 0 && native == 'yes') {
var ct = key
@ -72,7 +72,7 @@ function notfColumn(acct_id, tlid, sys) {
}
var mute = getFilterTypeByAcct(acct_id, 'notif')
//Pleromaにはmoveというtypeがあるらしい。何が互換APIじゃ
if (obj.type != 'follow' && obj.type != 'move' && obj.type != 'follow_request') {
if (obj.type !== 'follow' && obj.type !== 'move' && obj.type !== 'request' && obj.type !== 'admin.sign_up') {
if (misskey) {
templete = templete + misskeyParse([obj], 'notf', acct_id, tlid, -1, mute)
} else {
@ -155,10 +155,10 @@ function notfCommon(acct_id, tlid, sys, stream) {
return false
}
fetch(start, i)
.then(function(response) {
.then(function (response) {
console.log('header to get param:' + response.headers.get('link'))
if (!response.ok) {
response.text().then(function(text) {
response.text().then(function (text) {
console.log('notf error', 'div[data-notf=' + acct_id + '] .landing')
$('div[data-notf=' + acct_id + '] .landing').append(`<div>${response.status}</div><div>${escapeHTML(text)}`)
setLog(response.url, response.status, text)
@ -166,17 +166,17 @@ function notfCommon(acct_id, tlid, sys, stream) {
}
return response.json()
})
.catch(function(error) {
.catch(function (error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function(json) {
.then(function (json) {
if (json[0]) {
var templete = ''
var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) {
Object.keys(json).forEach(function (key) {
var obj = json[key]
if (lastnotf == obj.id && key > 0 && native == 'yes') {
var ct = key
@ -192,7 +192,7 @@ function notfCommon(acct_id, tlid, sys, stream) {
}
var mute = getFilterTypeByAcct(acct_id, 'notif')
//Pleromaにはmoveというtypeがあるらしい。何が互換APIじゃ
if (obj.type != 'follow' && obj.type != 'move') {
if (obj.type !== 'follow' && obj.type !== 'move' && obj.type !== 'request' && obj.type !== 'admin.sign_up') {
if (misskey) {
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
} else {
@ -228,7 +228,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
var wsid = websocketNotf.length
websocketNotf[acct_id] = new WebSocket(start)
websocketNotf[acct_id].onopen = function(mess) {
websocketNotf[acct_id].onopen = function (mess) {
console.table({
acct_id: acct_id,
type: 'Connect Streaming API(Notf)',
@ -237,7 +237,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
})
$('i[data-notf=' + acct_id + ']').removeClass('red-text')
}
websocketNotf[acct_id].onmessage = function(mess) {
websocketNotf[acct_id].onmessage = function (mess) {
$('#landing_' + tlid).hide()
//console.log(["Receive Streaming API(Notf):" + acct_id + "(" + domain + ")", JSON.parse(JSON.parse(mess.data).payload)]);
var popup = localStorage.getItem('popup')
@ -251,7 +251,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
localStorage.setItem('lastnotf_' + acct_id, obj.id)
if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
//markers show中はダメ
if (obj.type != 'follow' && obj.type != 'follow_request') {
if (obj.type !== 'follow' && obj.type !== 'move' && obj.type !== 'request' && obj.type !== 'admin.sign_up') {
templete = parse([obj], 'notf', acct_id, 'notf', popup)
} else if (obj.type == 'follow_request') {
templete = userparse([obj.account], 'request', acct_id, 'notf', -1)
@ -269,7 +269,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
$('[toot-id=' + obj + ']').remove()
}
}
websocketNotf[acct_id].onerror = function(error) {
websocketNotf[acct_id].onerror = function (error) {
console.error('WebSocket Error ', error)
errorct++
console.log(errorct)
@ -277,7 +277,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
notfWS(misskey, acct_id, tlid, domain, at)
}
}
websocketNotf[acct_id].onclose = function(error) {
websocketNotf[acct_id].onclose = function (error) {
console.error('WebSocket Close ', error)
errorct++
console.log(errorct)
@ -331,7 +331,7 @@ function notfmore(tlid) {
httpreq.responseType = 'json'
httpreq.send(body)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -343,10 +343,10 @@ function notfmore(tlid) {
var templete = ''
var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) {
Object.keys(json).forEach(function (key) {
var obj = json[key]
var mute = getFilterTypeByAcct(acct_id, 'notif')
if (obj.type != 'follow') {
if (obj.type !== 'follow' && obj.type !== 'move' && obj.type !== 'request' && obj.type !== 'admin.sign_up') {
if (misskey) {
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
} else {
@ -381,7 +381,7 @@ function notfToggle(acct, tlid) {
height: '400px',
}, {
duration: 300,
complete: function() {
complete: function () {
$('#notf-box_' + tlid).css('overflow-y', 'scroll')
$('#notf-box_' + tlid).removeClass('column-hide')
},
@ -392,7 +392,7 @@ function notfToggle(acct, tlid) {
height: '0',
}, {
duration: 300,
complete: function() {
complete: function () {
$('#notf-box_' + tlid).addClass('column-hide')
$('#notf-box_' + tlid).css('display', 'none')
},
@ -429,7 +429,7 @@ function allNotfRead() {
var multi = localStorage.getItem('multi')
if (multi) {
var obj = JSON.parse(multi)
Object.keys(obj).forEach(function(key) {
Object.keys(obj).forEach(function (key) {
notfCanceler(key)
})
}

View File

@ -821,23 +821,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
}
//絵文字があれば
if (emojick) {
Object.keys(toot.emojis).forEach(function (key5) {
var emoji = toot.emojis[key5]
var shortcode = emoji.shortcode
if (gif == 'yes') {
var emoSource = emoji.url
} else {
var emoSource = emoji.static_url
}
var emoji_url = `
<img draggable="false" src="${emoSource}" class="emoji-img" data-emoji="${shortcode}"
alt=" :${shortcode}: " title="${shortcode}" onclick="this.classList.toggle('bigemoji');" loading="lazy">
`
var regExp = new RegExp(':' + shortcode + ':', 'g')
content = content.replace(regExp, emoji_url)
spoil = spoil.replace(regExp, emoji_url)
poll = poll.replace(regExp, emoji_url)
})
content = this.customEmojiReplace(content, toot, gif);
spoil = this.customEmojiReplace(spoil, toot, gif);
poll = this.customEmojiReplace(poll, toot, gif);
}
//ニコフレ絵文字
if (toot.profile_emojis) {
@ -1217,6 +1203,8 @@ function userparse(obj, auth, acct_id, tlid, popup) {
var ftxt = lang.lang_parse_moved
} else if (auth == 'request') {
var ftxt = lang.lang_parse_request
} else if (auth == 'admin.sign_up') {
var ftxt = lang.lang_parse_signup
}
if (popup > 0 || popup == -1 || notf) {
var notftext = ftxt + '<br>'
@ -1529,7 +1517,51 @@ function pollParse(poll, acct_id, emojis) {
</div>`
return pollHtml
}
function customEmojiReplace(content, toot, gif) {
var contentDiv = document.createElement('div');
contentDiv.style.display = 'none';
contentDiv.innerHTML = content;
var replace = false;
Object.keys(toot.emojis).forEach(function(key5) {
var emoji = toot.emojis[key5]
var shortcode = emoji.shortcode
if (gif == 'yes') {
var emoSource = emoji.url
} else {
var emoSource = emoji.static_url
}
var nodes = document.evaluate('//text()', contentDiv, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
if ( nodes.snapshotLength == 0 ) return;
var shortcodeBracket = (':' + shortcode + ':');
var img = document.createElement('img');
img.setAttribute('draggable', 'false');
img.setAttribute('src', emoSource);
img.setAttribute('class', 'emoji-img');
img.setAttribute('data-emoji', shortcode);
img.setAttribute('alt', shortcodeBracket);
img.setAttribute('title', shortcodeBracket);
img.setAttribute('onclick', "this.classList.toggle('bigemoji');");
for ( var i=0; i < nodes.snapshotLength; i++ ) {
var node = nodes.snapshotItem(i);
var txt = node.textContent;
var spos = txt.indexOf(shortcodeBracket);
if (spos == -1) continue;
var txtBefore = document.createTextNode(txt.substr(0, spos));
var txtAfter = document.createTextNode(txt.substr(spos + shortcodeBracket.length));
node.parentNode.insertBefore(txtBefore, node);
node.parentNode.insertBefore(img, node);
node.parentNode.insertBefore(txtAfter, node);
node.textContent = '';
replace = true;
}
})
if (replace) contentDiv.innerHTML = this.customEmojiReplace(contentDiv.innerHTML, toot, gif);
return contentDiv.innerHTML;
}
//MastodonBaseStreaming
var mastodonBaseWs = {}
var mastodonBaseWsStatus = {}
@ -1585,7 +1617,7 @@ function mastodonBaseStreaming(acct_id) {
if (!popup) {
popup = 0
}
if (obj.type != 'follow' && obj.type != 'follow_request') {
if (obj.type !== 'follow' && obj.type !== 'move' && obj.type !== 'request' && obj.type !== 'admin.sign_up') {
template = parse([obj], 'notf', acct_id, 'notf', popup)
} else if (obj.type == 'follow_request') {
template = userparse([obj.account], 'request', acct_id, 'notf', -1)

View File

@ -1,6 +1,6 @@
{
"name": "thedesk",
"version": "23.0.1",
"version": "23.0.2",
"codename": "Chieri",
"description": "TheDesk is a Mastodon client for PC.",
"repository": "https://github.com/cutls/TheDesk",
@ -69,7 +69,7 @@
"lodash": "^4.17.21",
"sanitize-html": "^2.7.2",
"sumchecker": "^3.0.1",
"sweetalert2": "^11.4.38",
"sweetalert2": "^11.6.15",
"system-font-families": "^0.6.0",
"textarea-caret": "^3.1.0",
"uuid": "^8.3.2",

View File

@ -138,9 +138,6 @@
<li class="mac">
<a onclick="nowplaying('itunes');">NowPlaying (iTunes macOS)</a>
</li>
<li class="mac hide" id="ccnp">
<a onclick="nowplaying('anynp');">NowPlaying (コントロールセンター)</a>
</li>
<li>
<a onclick="nowplaying('lastFm');">NowPlaying (Last.fm)</a>
</li>

View File

@ -22,7 +22,6 @@
</div>
<div id="support-btm-right">
<h5>@@once@@</h5>
<a class="btn-share btn waves-effect waves-light blue" href="https://www.amazon.co.jp/registry/wishlist/2TV35ZHHJPDSB" target="_blank"> @@AWLSupport@@ </a>
<br /> @@SendAmazonGift1@@ <a href="mailto:web-pro@cutls.com" target="_blank">web-pro@cutls.com</a>@@SendAmazonGift2@@<br /> Kyash
<br />
<img src="../../img/kyash.png" width="100" /><br />

View File

@ -176,6 +176,7 @@
"lang_showontl_botacct": "[bot]",
"lang_showontl_followed": "Following you",
"lang_parse_request": "Follow request",
"lang_parse_signup": "Newface",
"lang_showontl_notf": "Notification ",
"lang_showontl_domain": "Domain ",
"lang_showontl_listwarn": "Follow to add this user to lists.",

View File

@ -178,6 +178,8 @@
"lang_showontl_domain": "ドメイン",
"lang_showontl_listwarn": "リストに追加すんにはまずフォローしてな。",
"lang_showontl_verified": "このサイトはこの人のやつやってわかってる。",
"lang_parse_request": "フォローリクエスト",
"lang_parse_signup": "新規登録",
"lang_parse_mentioned": "が返信したで",
"lang_parse_faved": "がお気に入り登録したで",
"lang_parse_bted": "がブーストしたで",

View File

@ -177,6 +177,7 @@
"lang_showontl_botacct": "botアカウント",
"lang_showontl_followed": "フォローされています",
"lang_parse_request": "フォローリクエスト",
"lang_parse_signup": "新規登録",
"lang_showontl_notf": "通知",
"lang_showontl_domain": "ドメイン",
"lang_showontl_listwarn": "リストに追加するためにはフォローが必要です。",

View File

@ -576,13 +576,6 @@
dependencies:
"@types/yargs-parser" "*"
"@types/yauzl@^2.9.1":
version "2.10.0"
resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.0.tgz#b3248295276cf8c6f153ebe6a9aba0c988cb2599"
integrity sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==
dependencies:
"@types/node" "*"
JSONStream@^1.0.3:
version "1.3.5"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0"
@ -1443,7 +1436,7 @@ concat-map@0.0.1:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
concat-stream@^1.6.0, concat-stream@^1.6.1, concat-stream@~1.6.0:
concat-stream@^1.6.0, concat-stream@^1.6.1, concat-stream@^1.6.2, concat-stream@~1.6.0:
version "1.6.2"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34"
integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==
@ -1570,7 +1563,7 @@ debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, d
dependencies:
ms "2.1.2"
debug@^2.6.8:
debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
@ -1879,7 +1872,6 @@ electron-rebuild@^3.2.9:
semver "^7.3.5"
tar "^6.0.5"
yargs "^17.0.1"
electron@^22.0.0:
version "22.0.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-22.0.0.tgz#ef84ab9cf23aa3f8c2f42a1e8e000ad7fd941058"
@ -1887,7 +1879,7 @@ electron@^22.0.0:
dependencies:
"@electron/get" "^2.0.0"
"@types/node" "^16.11.26"
extract-zip "^2.0.1"
extract-zip "^1.0.3"
elliptic@^6.5.3:
version "6.5.4"
@ -2172,16 +2164,15 @@ ext-name@^5.0.0:
ext-list "^2.0.0"
sort-keys-length "^1.0.0"
extract-zip@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a"
integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==
extract-zip@^1.0.3:
version "1.7.0"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.7.0.tgz#556cc3ae9df7f452c493a0cfb51cc30277940927"
integrity sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==
dependencies:
debug "^4.1.1"
get-stream "^5.1.0"
concat-stream "^1.6.2"
debug "^2.6.9"
mkdirp "^0.5.4"
yauzl "^2.10.0"
optionalDependencies:
"@types/yauzl" "^2.9.1"
extsprintf@^1.2.0:
version "1.4.0"
@ -3427,6 +3418,13 @@ mkdirp@^0.5.1:
dependencies:
minimist "0.0.8"
mkdirp@^0.5.4:
version "0.5.6"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==
dependencies:
minimist "^1.2.6"
mkdirp@^1.0.3, mkdirp@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
@ -4696,10 +4694,10 @@ supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"
sweetalert2@^11.4.38:
version "11.4.38"
resolved "https://registry.yarnpkg.com/sweetalert2/-/sweetalert2-11.4.38.tgz#f8cec3a87b99d7f3edd9756676d11d3c86e46b4a"
integrity sha512-H8FDIiL7hLe7uUEdTO6xwk2Vexvr05IL7FGZAIHEFmjjnZRWtRrSUYm//r+4bL8d6XhjWFRHXBs32ZCwH+ir8g==
sweetalert2@^11.6.15:
version "11.6.15"
resolved "https://registry.yarnpkg.com/sweetalert2/-/sweetalert2-11.6.15.tgz#0459e97100810b0734c62d2cce4d3d41c8f30b0a"
integrity sha512-FqMy1gRGHEI5G145NE5XSP059TziCJu9Xf9/mkki/aKu5pLNcYzjggOzKO5Ex10EBgAGDXQ99jyGfYYzGCYXRQ==
syntax-error@^1.1.1:
version "1.4.0"