introduce uuid yeah

This commit is contained in:
cutls 2021-06-19 19:16:08 +09:00
parent 679151e8ea
commit ab460d1401
11 changed files with 1897 additions and 1890 deletions

2
.gitignore vendored
View File

@ -26,7 +26,7 @@ app/git
*.code-workspace *.code-workspace
releasenote.md releasenote.md
app/yarn-error.log app/yarn-error.log
app/js/platform/aiscript.js app/js/platform/native.js
app/view/es-ES app/view/es-ES
app/view/fr-FR app/view/fr-FR
app/view/no-NO app/view/no-NO

View File

@ -1,21 +1,22 @@
window.onload = function () { window.onload = function() {
console.log('loaded') console.log('loaded')
initPostbox() initPostbox()
connection() connection()
initPlugin(plugins) initPlugin(plugins)
if (localStorage.getItem('control-center-np')) $('#ccnp').removeClass('hide') if (localStorage.getItem('control-center-np')) $('#ccnp').removeClass('hide')
} }
$.strip_tags = function (str, allowed) { $.strip_tags = function(str, allowed) {
if (!str) { if (!str) {
return '' return ''
} }
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('') allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('')
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi, var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi
return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { return str.replace(commentsAndPhpTags, '').replace(tags, function($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '' return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
}) })
} }
function escapeHTML(str) { function escapeHTML(str) {
if (!str) { if (!str) {
return '' return ''
@ -36,6 +37,7 @@ function nl2br(str) {
str = str.replace(/(\n|\r)/g, '<br />') str = str.replace(/(\n|\r)/g, '<br />')
return str return str
} }
function br2nl(str) { function br2nl(str) {
if (!str) { if (!str) {
return '' return ''
@ -43,6 +45,7 @@ function br2nl(str) {
str = str.replace(/<br \/>/g, '\r\n') str = str.replace(/<br \/>/g, '\r\n')
return str return str
} }
function formattime(date) { function formattime(date) {
var str = date.getFullYear() + '-' var str = date.getFullYear() + '-'
if (date.getMonth() + 1 < 10) { if (date.getMonth() + 1 < 10) {
@ -68,6 +71,7 @@ function formattime(date) {
} }
return escapeHTML(str) return escapeHTML(str)
} }
function formattimeutc(date) { function formattimeutc(date) {
var str = date.getUTCFullYear() + '-' var str = date.getUTCFullYear() + '-'
if (date.getUTCMonth() + 1 < 10) { if (date.getUTCMonth() + 1 < 10) {
@ -94,30 +98,11 @@ function formattimeutc(date) {
return escapeHTML(str) return escapeHTML(str)
} }
postMessage(['sendSinmpleIpc', 'custom-css-request'], '*') postMessage(['sendSinmpleIpc', 'custom-css-request'], '*')
function makeCID() { function makeCID() {
let chars = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("") return uuid()
for (let i = 0, len = chars.length; i < len; i++) {
switch (chars[i]) {
case "x":
chars[i] = Math.floor(Math.random() * 16).toString(16)
break
case "y":
chars[i] = (Math.floor(Math.random() * 4) + 8).toString(16)
break
}
}
return chars.join("")
}
function randomStr(l) {
// 生成する文字列に含める文字セット
var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
var cl = c.length
var r = ''
for (var i = 0; i < l; i++) {
r += c[Math.floor(Math.random() * cl)]
}
return r
} }
function rgbToHex(color) { function rgbToHex(color) {
// HEXに変換したものを代入する変数 // HEXに変換したものを代入する変数
var hex = '' var hex = ''
@ -155,15 +140,15 @@ function rgbToHex(color) {
console.error(color + ':第1引数はRGB形式で入力') console.error(color + ':第1引数はRGB形式で入力')
} }
/*マルチバイト用切り出し*/ /*マルチバイト用切り出し*/
$.isSurrogatePear = function (upper, lower) { $.isSurrogatePear = function(upper, lower) {
return 0xd800 <= upper && upper <= 0xdbff && 0xdc00 <= lower && lower <= 0xdfff return 0xd800 <= upper && upper <= 0xdbff && 0xdc00 <= lower && lower <= 0xdfff
} }
$.mb_strlen = function (str) { $.mb_strlen = function(str) {
var splitter = new GraphemeSplitter() var splitter = new GraphemeSplitter()
var arr = splitter.splitGraphemes(str) var arr = splitter.splitGraphemes(str)
return arr.length return arr.length
} }
$.mb_substr = function (str, begin, end) { $.mb_substr = function(str, begin, end) {
//配列にする //配列にする
var splitter = new GraphemeSplitter() var splitter = new GraphemeSplitter()
var arr = splitter.splitGraphemes(str) var arr = splitter.splitGraphemes(str)
@ -174,8 +159,8 @@ $.mb_substr = function (str, begin, end) {
} }
} }
return newarr.join('') return newarr.join('')
} }
//ソートするやつ //ソートするやつ
function object_array_sort(data, key, order, fn) { function object_array_sort(data, key, order, fn) {
var num_a = -1 var num_a = -1
var num_b = 1 var num_b = 1
@ -183,7 +168,7 @@ function object_array_sort(data, key, order, fn) {
num_a = 1 num_a = 1
num_b = -1 num_b = -1
} }
data = data.sort(function (a, b) { data = data.sort(function(a, b) {
var x = a[key] var x = a[key]
var y = b[key] var y = b[key]
if (x > y) return num_a if (x > y) return num_a
@ -200,6 +185,7 @@ function object_array_sort(data, key, order, fn) {
} }
fn(data) fn(data)
} }
function setLog(txt1, txt2, txt3) { function setLog(txt1, txt2, txt3) {
//url,statuscode,responsetext //url,statuscode,responsetext
var text = new Date().toUTCString() var text = new Date().toUTCString()
@ -207,6 +193,7 @@ function setLog(txt1, txt2, txt3) {
console.error(text) console.error(text)
postMessage(['log', text], '*') postMessage(['log', text], '*')
} }
function escapeCsv(str) { function escapeCsv(str) {
if (!str) { if (!str) {
return str return str
@ -218,6 +205,7 @@ function escapeCsv(str) {
} }
return result return result
} }
function evalAttr(json, attr, lenCk) { function evalAttr(json, attr, lenCk) {
if (json[attr]) { if (json[attr]) {
if (lenCk) { if (lenCk) {
@ -233,6 +221,7 @@ function evalAttr(json, attr, lenCk) {
return false return false
} }
} }
function statusModel(now) { function statusModel(now) {
if (!now) { if (!now) {
var now = new Date().toString() var now = new Date().toString()
@ -290,6 +279,7 @@ function statusModel(now) {
poll: null poll: null
} }
} }
function webviewFinder() { function webviewFinder() {
const webview = document.querySelector('webview') const webview = document.querySelector('webview')
webview.addEventListener('did-navigate', (e) => { webview.addEventListener('did-navigate', (e) => {
@ -301,12 +291,13 @@ function webviewFinder() {
} }
}) })
} }
function initWebviewEvent() { function initWebviewEvent() {
if (document.querySelector('webview')) { webviewFinder() } else { if (document.querySelector('webview')) { webviewFinder() } else {
const timerWV = setInterval(function () { const timerWV = setInterval(function() {
document.querySelector('webview') document.querySelector('webview') ?
? (webviewFinder(), clearInterval(timerWV)) (webviewFinder(), clearInterval(timerWV)) :
: console.log('まだロード中') console.log('まだロード中')
}, 500) }, 500)
} }
} }

View File

@ -8,7 +8,7 @@ function escapeHTMLtemp(str) {
.replace(/"/g, '&quot;') .replace(/"/g, '&quot;')
.replace(/'/g, '&#039;') .replace(/'/g, '&#039;')
} }
$.strip_tagstemp = function (str, allowed) { $.strip_tagstemp = function(str, allowed) {
if (!str) { if (!str) {
return "" return ""
} }
@ -16,11 +16,11 @@ $.strip_tagstemp = function (str, allowed) {
.join('') .join('')
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi, var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi
return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { return str.replace(commentsAndPhpTags, '').replace(tags, function($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '' return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
}) })
} }
//オブジェクトパーサー(トゥート) //オブジェクトパーサー(トゥート)
function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) { function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var templete = '' var templete = ''
localStorage.setItem("lastunix_" + tlid, date(obj[0].createdAt, 'unix')) localStorage.setItem("lastunix_" + tlid, date(obj[0].createdAt, 'unix'))
@ -158,7 +158,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} }
var local = [] var local = []
var times = [] var times = []
Object.keys(obj).forEach(function (key) { Object.keys(obj).forEach(function(key) {
var toot = obj[key] var toot = obj[key]
var dis_name = toot.user.name var dis_name = toot.user.name
if (dis_name) { if (dis_name) {
@ -168,7 +168,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} }
//絵文字があれば //絵文字があれば
if (toot.user.emojis) { if (toot.user.emojis) {
Object.keys(toot.user.emojis).forEach(function (key5) { Object.keys(toot.user.emojis).forEach(function(key5) {
var emoji = toot.user.emojis[key5] var emoji = toot.user.emojis[key5]
var shortcode = emoji.name var shortcode = emoji.name
var emoji_url = '<img draggable="false" src="' + emoji.url + var emoji_url = '<img draggable="false" src="' + emoji.url +
@ -306,7 +306,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var fullname = toot.user.username + "@" + domain var fullname = toot.user.username + "@" + domain
} }
if (useremp) { if (useremp) {
Object.keys(useremp).forEach(function (key10) { Object.keys(useremp).forEach(function(key10) {
var user = useremp[key10] var user = useremp[key10]
if (user == fullname) { if (user == fullname) {
boostback = "emphasized" boostback = "emphasized"
@ -343,14 +343,14 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
viashow = "via-hide" viashow = "via-hide"
} }
//強調チェック //強調チェック
Object.keys(empCli).forEach(function (key6) { Object.keys(empCli).forEach(function(key6) {
var empCliList = empCli[key6] var empCliList = empCli[key6]
if (empCliList == via) { if (empCliList == via) {
boostback = "emphasized" boostback = "emphasized"
} }
}) })
//ミュートチェック //ミュートチェック
Object.keys(muteCli).forEach(function (key7) { Object.keys(muteCli).forEach(function(key7) {
var muteCliList = muteCli[key7] var muteCliList = muteCli[key7]
if (muteCliList == via) { if (muteCliList == via) {
boostback = "hide" boostback = "hide"
@ -430,7 +430,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} }
//絵文字があれば //絵文字があれば
if (emojick) { if (emojick) {
Object.keys(toot.emojis).forEach(function (key5) { Object.keys(toot.emojis).forEach(function(key5) {
var emoji = toot.emojis[key5] var emoji = toot.emojis[key5]
var shortcode = emoji.name var shortcode = emoji.name
var emoji_url = '<img draggable="false" src="' + emoji.url + var emoji_url = '<img draggable="false" src="' + emoji.url +
@ -471,7 +471,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
if (mediack) { if (mediack) {
hasmedia = "hasmedia" hasmedia = "hasmedia"
var cwdt = 100 / toot[useparam].length var cwdt = 100 / toot[useparam].length
Object.keys(toot[useparam]).forEach(function (key2) { Object.keys(toot[useparam]).forEach(function(key2) {
var media = toot[useparam][key2] var media = toot[useparam][key2]
var purl = media.url var purl = media.url
media_ids = media_ids + media.id + "," media_ids = media_ids + media.id + ","
@ -516,9 +516,9 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var tags = "" var tags = ""
//タグであれば //タグであれば
if (tagck) { if (tagck) {
Object.keys(toot.tags).forEach(function (key4) { Object.keys(toot.tags).forEach(function(key4) {
var tag = toot.tags[key4] var tag = toot.tags[key4]
var tags = '<a onclick="tagShow(\'' + tag + '\', this)" class="pointer parsed">#' + tag + '</a><span class="hide" data-tag="' + tag + '" data-regTag="'+tag.toLowerCase()+'">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id + var tags = '<a onclick="tagShow(\'' + tag + '\', this)" class="pointer parsed">#' + tag + '</a><span class="hide" data-tag="' + tag + '" data-regTag="' + tag.toLowerCase() + '">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id +
',\'add\')" class="pointer parsed" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag) + '">TL</a> <a onclick="brInsert(\'#' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag) + '">Toot</a> ' + ',\'add\')" class="pointer parsed" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag) + '">TL</a> <a onclick="brInsert(\'#' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag) + '">Toot</a> ' +
'<a onclick="tagPin(\'' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag) + '">Pin</a></span> ' '<a onclick="tagPin(\'' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag) + '">Pin</a></span> '
content = content.replace("#" + tag, tags) content = content.replace("#" + tag, tags)
@ -578,7 +578,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var avatar = toot.user.avatarUrl var avatar = toot.user.avatarUrl
//ワードミュート //ワードミュート
if (wordmuteList) { if (wordmuteList) {
Object.keys(wordmuteList).forEach(function (key8) { Object.keys(wordmuteList).forEach(function(key8) {
var worde = wordmuteList[key8] var worde = wordmuteList[key8]
if (worde) { if (worde) {
if (worde.tag) { if (worde.tag) {
@ -595,7 +595,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} }
//ワード強調 //ワード強調
if (wordempList) { if (wordempList) {
Object.keys(wordempList).forEach(function (key9) { Object.keys(wordempList).forEach(function(key9) {
var wordList = wordempList[key9] var wordList = wordempList[key9]
if (wordList) { if (wordList) {
var wordList = wordList.tag var wordList = wordList.tag
@ -625,7 +625,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var poll = "" var poll = ""
if (toot.poll) { if (toot.poll) {
var choices = toot.poll.choices var choices = toot.poll.choices
Object.keys(choices).forEach(function (keyc) { Object.keys(choices).forEach(function(keyc) {
var choice = choices[keyc] var choice = choices[keyc]
if (choice.isVoted) { if (choice.isVoted) {
var myvote = twemoji.parse("✅") var myvote = twemoji.parse("✅")
@ -649,18 +649,9 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
//Reactions //Reactions
var addReact = "" var addReact = ""
if (toot.reactions) { if (toot.reactions) {
Object.keys(toot.reactions).forEach(function (keye) { Object.keys(toot.reactions).forEach(function(keye) {
var thisReact = toot.reactions[keye] var thisReact = toot.reactions[keye]
if (keye == "like") { var defaultEmoji = true } if (keye == "like") { var defaultEmoji = true } else if (keye == "love") { var defaultEmoji = true } else if (keye == "laugh") { var defaultEmoji = true } else if (keye == "hmm") { var defaultEmoji = true } else if (keye == "surprise") { var defaultEmoji = true } else if (keye == "congrats") { var defaultEmoji = true } else if (keye == "angry") { var defaultEmoji = true } else if (keye == "confused") { var defaultEmoji = true } else if (keye == "star") { var defaultEmoji = true } else {
else if (keye == "love") { var defaultEmoji = true }
else if (keye == "laugh") { var defaultEmoji = true }
else if (keye == "hmm") { var defaultEmoji = true }
else if (keye == "surprise") { var defaultEmoji = true }
else if (keye == "congrats") { var defaultEmoji = true }
else if (keye == "angry") { var defaultEmoji = true }
else if (keye == "confused") { var defaultEmoji = true }
else if (keye == "star") { var defaultEmoji = true }
else {
var obj = JSON.parse(localStorage.getItem("emoji_" + acct_id)) var obj = JSON.parse(localStorage.getItem("emoji_" + acct_id))
if (obj) { if (obj) {
var num = obj.length var num = obj.length
@ -743,8 +734,24 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} }
var fullhide = "" var fullhide = ""
} else { } else {
var like = 0; var love = 0; var laugh = 0; var hmm = 0; var surprise = 0; var congrats = 0; var angry = 0; var confused = 0; var pudding = 0 var like = 0;
var likehide = "hide"; var lovehide = "hide"; var laughhide = "hide"; var hmmhide = "hide"; var suphide = "hide"; var conghide = "hide"; var anghide = "hide"; var confhide = "hide"; var riphide = "hide" var love = 0;
var laugh = 0;
var hmm = 0;
var surprise = 0;
var congrats = 0;
var angry = 0;
var confused = 0;
var pudding = 0
var likehide = "hide";
var lovehide = "hide";
var laughhide = "hide";
var hmmhide = "hide";
var suphide = "hide";
var conghide = "hide";
var anghide = "hide";
var confhide = "hide";
var riphide = "hide"
var fullhide = "hide" var fullhide = "hide"
} }
if (!addReact && likehide == "hide" && lovehide == "hide" && laughhide == "hide" && hmmhide == "hide" && suphide == "hide" && conghide == "hide" && anghide == "hide" && confhide == "hide" && riphide == "hide") { if (!addReact && likehide == "hide" && lovehide == "hide" && laughhide == "hide" && hmmhide == "hide" && suphide == "hide" && conghide == "hide" && anghide == "hide" && confhide == "hide" && riphide == "hide") {
@ -765,10 +772,10 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} else { } else {
var actemojick = false var actemojick = false
} }
var rand = randomStr(8) var rand = uuid()
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' + templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
boostback + ' ' + fav_app + ' ' + rt_app + ' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[ boostback + ' ' + fav_app + ' ' + rt_app + ' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[
key].created_at, 'unix') + '" ' + if_notf + ' onmouseover="mov(\'' + toot.id + '\',\'' + tlid + '\',\'mv\', \''+rand+'\')" onclick="mov(\'' + toot.id + '\',\'' + tlid + '\',\'cl\', \''+rand+'\')" onmouseout="resetmv(\'mv\')" reacted="' + reacted + '">' + key].created_at, 'unix') + '" ' + if_notf + ' onmouseover="mov(\'' + toot.id + '\',\'' + tlid + '\',\'mv\', \'' + rand + '\')" onclick="mov(\'' + toot.id + '\',\'' + tlid + '\',\'cl\', \'' + rand + '\')" onmouseout="resetmv(\'mv\')" reacted="' + reacted + '">' +
'<div class="area-notice"><span class="gray sharesta">' + notice + home + '<div class="area-notice"><span class="gray sharesta">' + notice + home +
'</span></div>' + '</span></div>' +
'<div class="area-icon"><a onclick="udg(\'' + toot.user.id + '<div class="area-icon"><a onclick="udg(\'' + toot.user.id +
@ -810,8 +817,8 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
'</span></span><span class="' + riphide + ' reaction re-confused"><a onclick="reaction(\'confused\',\'' + toot.id + '\',' + acct_id + '</span></span><span class="' + riphide + ' reaction re-confused"><a onclick="reaction(\'confused\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid + '\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0;margin-left:3px;">' + twemoji.parse("😇") + '</a><span class="re-confusedct">' + rip + ',\'' + tlid + '\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0;margin-left:3px;">' + twemoji.parse("😇") + '</a><span class="re-confusedct">' + rip +
'</span></span>' + addReact + '</span></span>' + addReact +
'<i class="material-icons pointer hide freeReact ' + freeReact + '" style="font-size:1.0rem; padding-left:5px;position: relative;top: 3px;" onclick="reactioncustom(\'' + acct_id + '\',\'' + id + '\')">add_box</i></div>' '<i class="material-icons pointer hide freeReact ' + freeReact + '" style="font-size:1.0rem; padding-left:5px;position: relative;top: 3px;" onclick="reactioncustom(\'' + acct_id + '\',\'' + id + '\')">add_box</i></div>' +
+ poll + mentions + tags + '</div>' + poll + mentions + tags + '</div>' +
'<div class="area-vis"></div>' + '<div class="area-vis"></div>' +
'<div class="area-actions ' + mouseover + '">' + '<div class="area-actions ' + mouseover + '">' +
'<div class="action">' + vis + '</div>' + '<div class="action">' + vis + '</div>' +
@ -835,8 +842,8 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_del + '"><i class="fas fa-trash"></i></a></div>' + ')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_del + '"><i class="fas fa-trash"></i></a></div>' +
'<div class="' + if_mine + ' action pin ' + disp["pin"] + ' ' + noauth + '"><a onclick="pin(\'' + toot.id + '\',' + '<div class="' + if_mine + ' action pin ' + disp["pin"] + ' ' + noauth + '"><a onclick="pin(\'' + toot.id + '\',' +
acct_id + acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_pin + '"><i class="fas fa-map-pin pin_' + toot.id + '"></i></a></div>' ')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_pin + '"><i class="fas fa-map-pin pin_' + toot.id + '"></i></a></div>' +
+ '<div class="' + if_mine + ' action ' + disp["red"] + ' ' + noauth + '"><a onclick="redraft(\'' + toot.id + '\',' + '<div class="' + if_mine + ' action ' + disp["red"] + ' ' + noauth + '"><a onclick="redraft(\'' + toot.id + '\',' +
acct_id + acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_redraft + '"><i class="material-icons">redo</i></a></div>' + trans + ')" class="waves-effect waves-dark btn-flat" style="padding:0" title="' + lang.lang_parse_redraft + '"><i class="material-icons">redo</i></a></div>' + trans +
'<span class="cbadge viabadge waves-effect ' + viashow + ' ' + mine_via + '" onclick="client(\'' + $.strip_tagstemp(via) + '\')" title="via ' + $.strip_tagstemp(via) + '">via ' + '<span class="cbadge viabadge waves-effect ' + viashow + ' ' + mine_via + '" onclick="client(\'' + $.strip_tagstemp(via) + '\')" title="via ' + $.strip_tagstemp(via) + '">via ' +
@ -863,7 +870,7 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) {
} }
var templete = '' var templete = ''
var datetype = localStorage.getItem("datetype") var datetype = localStorage.getItem("datetype")
Object.keys(obj).forEach(function (key) { Object.keys(obj).forEach(function(key) {
var toot = obj[key] var toot = obj[key]
if (toot.followee) { if (toot.followee) {
toot = toot.followee toot = toot.followee
@ -947,6 +954,7 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) {
}) })
return templete return templete
} }
function goGoogle(id) { function goGoogle(id) {
var val = $("#srcbox_" + id).val() var val = $("#srcbox_" + id).val()
var url = "https://google.com/search?q=" + val var url = "https://google.com/search?q=" + val
@ -954,6 +962,7 @@ function goGoogle(id) {
} }
var misskeyws = [] var misskeyws = []
var misskeywsstate = [] var misskeywsstate = []
function connectMisskey(acct_id, re) { function connectMisskey(acct_id, re) {
var domain = localStorage.getItem("domain_" + acct_id) var domain = localStorage.getItem("domain_" + acct_id)
var at = localStorage.getItem("acct_" + acct_id + "_at") var at = localStorage.getItem("acct_" + acct_id + "_at")
@ -962,14 +971,14 @@ function connectMisskey(acct_id, re) {
var wsid = misskeyws.length var wsid = misskeyws.length
localStorage.setItem("misskey_wss_" + acct_id, wsid) localStorage.setItem("misskey_wss_" + acct_id, wsid)
misskeyws[wsid] = new WebSocket(start) misskeyws[wsid] = new WebSocket(start)
misskeyws[wsid].onopen = function (mess) { misskeyws[wsid].onopen = function(mess) {
console.table({ "tlid": tlid, "type": "Connect Streaming API", "domain": domain, "message": [mess] }) console.table({ "tlid": tlid, "type": "Connect Streaming API", "domain": domain, "message": [mess] })
misskeywsstate[wsid] = true misskeywsstate[wsid] = true
//$("#notice_icon_" + tlid).removeClass("red-text"); //$("#notice_icon_" + tlid).removeClass("red-text");
var send = '{"type":"connect","body":{"channel":"main","id":"notf:' + acct_id + '"}}' var send = '{"type":"connect","body":{"channel":"main","id":"notf:' + acct_id + '"}}'
misskeyws[wsid].send(send) misskeyws[wsid].send(send)
} }
misskeyws[wsid].onmessage = function (mess) { misskeyws[wsid].onmessage = function(mess) {
console.log([domain + ":Receive Streaming API:", data]) console.log([domain + ":Receive Streaming API:", data])
var data = JSON.parse(mess.data) var data = JSON.parse(mess.data)
var obj = data.body.body var obj = data.body.body
@ -1033,19 +1042,19 @@ function connectMisskey(acct_id, re) {
} }
} }
misskeyws[wsid].onerror = function (error) { misskeyws[wsid].onerror = function(error) {
console.error("Error closing " + tlid) console.error("Error closing " + tlid)
console.error(error) console.error(error)
misskeywsstate[wsid] = false misskeywsstate[wsid] = false
if(!re){ if (!re) {
connectMisskey(acct_id, true) connectMisskey(acct_id, true)
} }
return false return false
} }
misskeyws[wsid].onclose = function () { misskeyws[wsid].onclose = function() {
console.warn("Closing " + tlid) console.warn("Closing " + tlid)
misskeywsstate[wsid] = false misskeywsstate[wsid] = false
if(!re){ if (!re) {
connectMisskey(acct_id, true) connectMisskey(acct_id, true)
} }
return false return false

View File

@ -3,8 +3,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
var splitter = new GraphemeSplitter() var splitter = new GraphemeSplitter()
var templete = '' var templete = ''
if (obj[0]) { if (obj[0]) {
if (tlid === 1) { if (tlid === 1) {}
}
localStorage.setItem('lastunix_' + tlid, date(obj[0].created_at, 'unix')) localStorage.setItem('lastunix_' + tlid, date(obj[0].created_at, 'unix'))
} }
@ -215,7 +214,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
} }
//絵文字があれば //絵文字があれば
if (actemojick) { if (actemojick) {
Object.keys(toot.account.emojis).forEach(function (key5) { Object.keys(toot.account.emojis).forEach(function(key5) {
var emoji = toot.account.emojis[key5] var emoji = toot.account.emojis[key5]
var shortcode = emoji.shortcode var shortcode = emoji.shortcode
if (gif == 'yes') { if (gif == 'yes') {
@ -343,8 +342,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
if (native == 'yes') { if (native == 'yes') {
var os = localStorage.getItem('platform') var os = localStorage.getItem('platform')
var options = { var options = {
body: body: toot.account.display_name +
toot.account.display_name +
'(' + '(' +
toot.account.acct + toot.account.acct +
')' + ')' +
@ -372,7 +370,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
} }
//絵文字があれば //絵文字があれば
if (actemojick) { if (actemojick) {
Object.keys(toot.account.emojis).forEach(function (key5) { Object.keys(toot.account.emojis).forEach(function(key5) {
var emoji = toot.account.emojis[key5] var emoji = toot.account.emojis[key5]
var shortcode = emoji.shortcode var shortcode = emoji.shortcode
if (gif == 'yes') { if (gif == 'yes') {
@ -429,7 +427,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
} }
//絵文字があれば //絵文字があれば
if (actemojick) { if (actemojick) {
Object.keys(toot.account.emojis).forEach(function (key5) { Object.keys(toot.account.emojis).forEach(function(key5) {
var emoji = toot.account.emojis[key5] var emoji = toot.account.emojis[key5]
var shortcode = emoji.shortcode var shortcode = emoji.shortcode
if (gif == 'yes') { if (gif == 'yes') {
@ -457,7 +455,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
var fullname = toot.account.acct + '@' + domain var fullname = toot.account.acct + '@' + domain
} }
if (useremp) { if (useremp) {
Object.keys(useremp).forEach(function (key10) { Object.keys(useremp).forEach(function(key10) {
var user = useremp[key10] var user = useremp[key10]
if (user == fullname) { if (user == fullname) {
boostback = 'emphasized' boostback = 'emphasized'
@ -497,7 +495,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
var via = escapeHTML(toot.application.name) var via = escapeHTML(toot.application.name)
if (empCli) { if (empCli) {
//強調チェック //強調チェック
Object.keys(empCli).forEach(function (key6) { Object.keys(empCli).forEach(function(key6) {
var empCliList = empCli[key6] var empCliList = empCli[key6]
if (empCliList == via) { if (empCliList == via) {
boostback = 'emphasized' boostback = 'emphasized'
@ -506,7 +504,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
} }
if (muteCli) { if (muteCli) {
//ミュートチェック //ミュートチェック
Object.keys(muteCli).forEach(function (key7) { Object.keys(muteCli).forEach(function(key7) {
var muteCliList = muteCli[key7] var muteCliList = muteCli[key7]
if (muteCliList == via) { if (muteCliList == via) {
boostback = 'hide' boostback = 'hide'
@ -600,7 +598,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
if (mediack) { if (mediack) {
hasmedia = 'hasmedia' hasmedia = 'hasmedia'
var cwdt = 100 / toot.media_attachments.length var cwdt = 100 / toot.media_attachments.length
Object.keys(toot.media_attachments).forEach(function (key2) { Object.keys(toot.media_attachments).forEach(function(key2) {
var media = toot.media_attachments[key2] var media = toot.media_attachments[key2]
var purl = media.preview_url var purl = media.preview_url
media_ids = media_ids + media.id + ',' media_ids = media_ids + media.id + ','
@ -996,7 +994,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
menuct++ menuct++
} }
//このトゥート内のアクションを完了させるために、適当にIDを振る //このトゥート内のアクションを完了させるために、適当にIDを振る
var rand = randomStr(8) var rand = uuid()
//プラグイン機構 //プラグイン機構
var pluginBOT = plugins.buttonOnToot var pluginBOT = plugins.buttonOnToot
var pluginHtml = '' var pluginHtml = ''
@ -1400,7 +1398,7 @@ function client(name) {
} }
//Poll Parser //Poll Parser
function pollParse(poll, acct_id, emojis) { function pollParse(poll, acct_id, emojis) {
var rand = randomStr(8) var rand = uuid()
var datetype = localStorage.getItem('datetype') var datetype = localStorage.getItem('datetype')
var anime = localStorage.getItem('animation') var anime = localStorage.getItem('animation')
if (anime == 'yes' || !anime) { if (anime == 'yes' || !anime) {

View File

@ -1,5 +1,7 @@
const { AiScript, parse, values, utils } = require('@syuilo/aiscript') const { AiScript, parse, values, utils } = require('@syuilo/aiscript')
const gcc = require('textarea-caret') const gcc = require('textarea-caret')
const { v4: uuidv4 } = require('uuid')
global.uuid = uuidv4
global.getCaretCoordinates = gcc global.getCaretCoordinates = gcc
global.sanitizeHtml = require('sanitize-html') global.sanitizeHtml = require('sanitize-html')
global.asValue = values global.asValue = values

View File

@ -9,7 +9,7 @@
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "run-s util:*", "postinstall": "run-s util:*",
"util:hash": "node gitHash.js", "util:hash": "node gitHash.js",
"util:browserify": "browserify aiscript.js -o js/platform/aiscript.js", "util:browserify": "browserify native.js -o js/platform/native.js",
"construct": "node view/make/makeCli.js", "construct": "node view/make/makeCli.js",
"construct:store": "node view/make/makeCli.js --store", "construct:store": "node view/make/makeCli.js --store",
"dev": "run-p dev:*", "dev": "run-p dev:*",
@ -38,7 +38,8 @@
"url": "https://cutls.dev", "url": "https://cutls.dev",
"email": "p@cutls.com" "email": "p@cutls.com"
}, },
"contributor": [{ "contributor": [
{
"name": "とねぢ", "name": "とねぢ",
"url": "https://minohdon.jp/@toneji", "url": "https://minohdon.jp/@toneji",
"email": "solfa.tono@gmail.com" "email": "solfa.tono@gmail.com"
@ -71,6 +72,7 @@
"sweetalert2": "^11.0.17", "sweetalert2": "^11.0.17",
"system-font-families": "^0.4.1", "system-font-families": "^0.4.1",
"textarea-caret": "^3.1.0", "textarea-caret": "^3.1.0",
"uuid": "^8.3.2",
"vue": "^2.6.14" "vue": "^2.6.14"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1055,7 +1055,7 @@
<!--JS--> <!--JS-->
<script type="text/javascript" src="../../@@node_base@@/jquery/dist/jquery.js"></script> <script type="text/javascript" src="../../@@node_base@@/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="../../js/platform/first.js"></script> <script type="text/javascript" src="../../js/platform/first.js"></script>
<script type="text/javascript" src="../../js/platform/aiscript.js"></script> <script type="text/javascript" src="../../js/platform/native.js"></script>
<script type="text/javascript" src="../../js/platform/plugin.js"></script> <script type="text/javascript" src="../../js/platform/plugin.js"></script>
<script type="text/javascript" src="../../@@node_base@@/materialize-css/dist/js/materialize.js"></script> <script type="text/javascript" src="../../@@node_base@@/materialize-css/dist/js/materialize.js"></script>
<script type="text/javascript" src="../../@@node_base@@/grapheme-splitter/index.js"></script> <script type="text/javascript" src="../../@@node_base@@/grapheme-splitter/index.js"></script>

View File

@ -683,7 +683,7 @@
apiGet: no apiGet: no
}`, -1) }`, -1)
</script> </script>
<script type="text/javascript" src="../../js/platform/aiscript.js"></script> <script type="text/javascript" src="../../js/platform/native.js"></script>
<script type="text/javascript" src="../../js/platform/plugin.js"></script> <script type="text/javascript" src="../../js/platform/plugin.js"></script>
<script type="text/javascript" src="../../js/common/modal.js"></script> <script type="text/javascript" src="../../js/common/modal.js"></script>
<script type="text/javascript" src="../../js/common/about.js"></script> <script type="text/javascript" src="../../js/common/about.js"></script>

View File

@ -25,8 +25,8 @@
<body class=""> <body class="">
<script> <script>
var ver = '22.2.0 (Koume)' var ver = '22.3.0 (Koume)'
var gitHash = 'da76c6732db27e91a895277d14fd16f0c1434679' var gitHash = '679151e8eadafebe68b8c0887e9189caeb94474e'
//betaを入れるとバージョンチェックしない //betaを入れるとバージョンチェックしない
//var ver="beta"; //var ver="beta";
var acct_id = 0 var acct_id = 0
@ -1055,7 +1055,7 @@
<!--JS--> <!--JS-->
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script> <script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="../../js/platform/first.js"></script> <script type="text/javascript" src="../../js/platform/first.js"></script>
<script type="text/javascript" src="../../js/platform/aiscript.js"></script> <script type="text/javascript" src="../../js/platform/native.js"></script>
<script type="text/javascript" src="../../js/platform/plugin.js"></script> <script type="text/javascript" src="../../js/platform/plugin.js"></script>
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script> <script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
<script type="text/javascript" src="../../node_modules/grapheme-splitter/index.js"></script> <script type="text/javascript" src="../../node_modules/grapheme-splitter/index.js"></script>

View File

@ -645,7 +645,7 @@
class="material-icons left">list</i>Help/Docs</a> class="material-icons left">list</i>Help/Docs</a>
<a href="https://github.com/cutls/TheDesk" class="btn waves-effect black lighten-2" style="width:100%; max-width:40rem;"><i class="fab fa-github left"></i>GitHub</a> <a href="https://github.com/cutls/TheDesk" class="btn waves-effect black lighten-2" style="width:100%; max-width:40rem;"><i class="fab fa-github left"></i>GitHub</a>
<a href="index.html?mode=user&code=Cutls@1m.cutls.com" class="btn waves-effect blue lighten-2" style="width:100%; max-width:40rem;"><img src="../../img/desk_full.svg" class="left" width="25" style="padding-top:5px;">Main author: Cutls@1m.cutls.com</a> <a href="index.html?mode=user&code=Cutls@1m.cutls.com" class="btn waves-effect blue lighten-2" style="width:100%; max-width:40rem;"><img src="../../img/desk_full.svg" class="left" width="25" style="padding-top:5px;">Main author: Cutls@1m.cutls.com</a>
<br> TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/da76c6732db27e91a895277d14fd16f0c1434679">da76c6732db27e91a895277d14fd16f0c1434679</a> - <a onclick="checkupd(); return localStorage.removeItem('new-ver-skip'); location.href='index.html';" class="pointer pwa">Sprawdź aktualizacje</a><br> <br> TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/679151e8eadafebe68b8c0887e9189caeb94474e">679151e8eadafebe68b8c0887e9189caeb94474e</a> - <a onclick="checkupd(); return localStorage.removeItem('new-ver-skip'); location.href='index.html';" class="pointer pwa">Sprawdź aktualizacje</a><br>
<br> Kyash <br> Kyash
<br> <br>
<img src="../../img/kyash.png" width="100"><br> <img src="../../img/kyash.png" width="100"><br>
@ -653,7 +653,7 @@
<img src="https://status.cutls.com/badge-service?site=thedesk.top"> <img src="https://status.cutls.com/badge-service?site=thedesk.top">
</a><br> </a><br>
<h5>OSS License</h5> <h5>OSS License</h5>
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/da76c6732db27e91a895277d14fd16f0c1434679" alt="FOSSA Status"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a> <a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/679151e8eadafebe68b8c0887e9189caeb94474e" alt="FOSSA Status"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a>
<br> <br>
<span style="font-family:Open Sans;">Copyright &copy; TheDesk 2018 <span style="font-family:Open Sans;">Copyright &copy; TheDesk 2018
Under <a href="https://github.com/cutls/TheDesk/blob/master/LICENSE">GNU General Public License v3.0</a> and <a Under <a href="https://github.com/cutls/TheDesk/blob/master/LICENSE">GNU General Public License v3.0</a> and <a
@ -683,7 +683,7 @@
apiGet: no apiGet: no
}`, -1) }`, -1)
</script> </script>
<script type="text/javascript" src="../../js/platform/aiscript.js"></script> <script type="text/javascript" src="../../js/platform/native.js"></script>
<script type="text/javascript" src="../../js/platform/plugin.js"></script> <script type="text/javascript" src="../../js/platform/plugin.js"></script>
<script type="text/javascript" src="../../js/common/modal.js"></script> <script type="text/javascript" src="../../js/common/modal.js"></script>
<script type="text/javascript" src="../../js/common/about.js"></script> <script type="text/javascript" src="../../js/common/about.js"></script>

View File

@ -5246,6 +5246,11 @@ uuid@^3.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866"
integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==
uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
v8-compile-cache@^2.0.3: v8-compile-cache@^2.0.3:
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"