add new fi

This commit is contained in:
cutls 2021-06-18 16:16:37 +09:00
parent 36ad187296
commit d62bc57368
8 changed files with 4235 additions and 4586 deletions

View File

@ -1,60 +1,71 @@
//ディレクトリ //ディレクトリ
//ディレクトリトグル //ディレクトリトグル
function dirMenu() { function dirMenu() {
$("#dir-contents").html("") $('#dir-contents').html('')
directory() directory('directory')
$("#left-menu a").removeClass("active") $('#left-menu a').removeClass('active')
$("#dirMenu").addClass("active") $('#dirMenu').addClass('active')
$(".menu-content").addClass("hide") $('.menu-content').addClass('hide')
$("#dir-box").removeClass("hide") $('#dir-box').removeClass('hide')
} }
function dirselCk() { function dirselCk() {
var acct = $("#dir-acct-sel").val() var acct = $('#dir-acct-sel').val()
if (acct == "noauth") { if (acct == 'noauth') {
$("#dirNoAuth").removeClass("hide") $('#dirNoAuth').removeClass('hide')
} else { } else {
$("#dirNoAuth").addClass("hide") $('#dirNoAuth').addClass('hide')
directory() directory('check')
} }
} }
function directory(isMore) {
var order = $("[name=sort]:checked").val() function dirChange(mode) {
if (mode === 'directory') $('#directoryConfig').removeClass('hide')
if (mode === 'suggest') $('#directoryConfig').addClass('hide')
directory(mode)
}
function directory(modeRaw, isMore) {
const mode = modeRaw === 'check' ? $('[name=dirsug]:checked').val() : modeRaw
var order = $('[name=sort]:checked').val()
if (!order) { if (!order) {
order = "active" order = 'active'
} }
var local_only = $("#local_only:checked").val() var local_only = $('#local_only:checked').val()
if (local_only) { if (local_only) {
local_only = "true" local_only = 'true'
} else { } else {
local_only = "false" local_only = 'false'
} }
var acct_id = $("#dir-acct-sel").val() var acct_id = $('#dir-acct-sel').val()
if (acct_id == "noauth") { if (acct_id == 'noauth') {
var domain = $("#dirNoAuth-url").val() var domain = $('#dirNoAuth-url').val()
var at = "" var at = ''
} else { } else {
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')
} }
if (isMore) { if (isMore) {
var addOffset = $("#dir-contents .cvo").length var addOffset = $('#dir-contents .cvo').length
$("#dir-contents").append(`<div class="progress transparent"><div class="indeterminate"></div></div>`) $('#dir-contents').append(`<div class="progress transparent"><div class="indeterminate"></div></div>`)
} else { } else {
var addOffset = 0 var addOffset = 0
$("#dir-contents").html(`<div class="progress transparent"><div class="indeterminate"></div></div>`) $('#dir-contents').html(`<div class="progress transparent"><div class="indeterminate"></div></div>`)
} }
var start = "https://" + domain + "/api/v1/directory?order=" + order + "&local=" + local_only + "&offset=" + addOffset let start = `https://${domain}/api/v1/directory?order=${order}&local=${local_only}&offset=${addOffset}`
if (mode === 'suggest') start = `https://${domain}/api/v2/suggestions`
console.log(start) console.log(start)
fetch(start, { fetch(start, {
method: "GET", method: 'GET',
headers: { headers: {
"content-type": "application/json", 'content-type': 'application/json',
Authorization: "Bearer " + at Authorization: 'Bearer ' + at,
} },
}) })
.then(function(response) { .then(function(response) {
$("#dir-contents .progress").remove() $('#dir-contents .progress').remove()
if (!response.ok) { if (!response.ok) {
$('#dir-contents').html(`v2 follow suggestion is supported by Mastodon 3.4.0 or above.`)
response.text().then(function(text) { response.text().then(function(text) {
setLog(response.url, response.status, text) setLog(response.url, response.status, text)
}) })
@ -62,17 +73,24 @@ function directory(isMore) {
return response.json() return response.json()
}) })
.catch(function(error) { .catch(function(error) {
setLog(start, "JSON", error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function(json) {
if (json) { if (json) {
$("#moreDir").removeClass("disabled") $('#moreDir').removeClass('disabled')
var html = userparse(json, null, acct_id, "dir", null) let obj = []
$("#dir-contents").append(html) if (mode === 'suggest') {
jQuery("time.timeago").timeago() $('#moreDir').addClass('disabled')
for (const suggest of json) obj.push(suggest.account)
} else { } else {
$("#moreDir").addClass("disabled") obj = json
}
var html = userparse(obj, null, acct_id, 'dir', null)
$('#dir-contents').append(html)
jQuery('time.timeago').timeago()
} else {
$('#moreDir').addClass('disabled')
} }
}) })
} }

View File

@ -1,6 +1,7 @@
//TL取得 //TL取得
moreloading = false moreloading = false
var errorct = 0 var errorct = 0
function tl(type, data, acct_id, tlid, delc, voice, mode) { function tl(type, data, acct_id, tlid, delc, voice, mode) {
scrollevent() scrollevent()
$('#unread_' + tlid + ' .material-icons').removeClass('teal-text') $('#unread_' + tlid + ' .material-icons').removeClass('teal-text')
@ -182,7 +183,7 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) {
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
response.text().then(function(text) { response.text().then(function(text) {
$('#landing_' + tlid).append(`<div>${response.status}</div><div>${escapeHTML(text)}`) $('#landing_' + tlid).append(`<div>${response.status}</div><div>${$.strip_tags(text)}`)
setLog(response.url, response.status, text) setLog(response.url, response.status, text)
}) })
} }
@ -269,17 +270,14 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
} }
} }
} }
function stremaingSubscribe(type, acct_id, data, unsubscribe) { function stremaingSubscribe(type, acct_id, data, unsubscribe) {
let command = 'subscribe' let command = 'subscribe'
if (unsubscribe) command = 'unsubscribe' if (unsubscribe) command = 'unsubscribe'
let stream let stream
const domain = localStorage.getItem('domain_' + acct_id) const domain = localStorage.getItem('domain_' + acct_id)
if (type == 'home') return false if (type == 'home') return false
if (type === 'local' || type === 'mix') { stream = 'public:local' } if (type === 'local' || type === 'mix') { stream = 'public:local' } else if (type === 'local-media') { stream = 'public:local:media' } else if (type === 'pub') { stream = 'public' } else if (type === 'pub-media') { stream = 'public:media' } else if (type === 'list') {
else if (type === 'local-media') { stream = 'public:local:media' }
else if (type === 'pub') { stream = 'public' }
else if (type === 'pub-media') { stream = 'public:media' }
else if (type === 'list') {
mastodonBaseWs[domain].send(JSON.stringify({ type: command, stream: 'list', list: data })) mastodonBaseWs[domain].send(JSON.stringify({ type: command, stream: 'list', list: data }))
return true return true
} else if (type === 'tag') { } else if (type === 'tag') {
@ -296,6 +294,7 @@ function stremaingSubscribe(type, acct_id, data, unsubscribe) {
} }
mastodonBaseWs[domain].send(JSON.stringify({ type: command, stream: stream })) mastodonBaseWs[domain].send(JSON.stringify({ type: command, stream: stream }))
} }
function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
var misskey = false var misskey = false
const domain = localStorage.getItem(`domain_${acct_id}`) const domain = localStorage.getItem(`domain_${acct_id}`)
@ -317,7 +316,8 @@ function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
var add = '' var add = ''
if (remoteOnlyCk(tlid)) { if (remoteOnlyCk(tlid)) {
add = '&remote=true' add = '&remote=true'
} var start = }
var start =
wss + '/api/v1/streaming/?stream=public:media&access_token=' + at + add wss + '/api/v1/streaming/?stream=public:media&access_token=' + at + add
} else if (type == 'local') { } else if (type == 'local') {
var start = var start =
@ -415,9 +415,7 @@ function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
$('[unique-id=' + JSON.parse(mess.data).payload + ']').remove() $('[unique-id=' + JSON.parse(mess.data).payload + ']').remove()
} }
} else if (typeA == 'update' || typeA == 'conversation') { } else if (typeA == 'update' || typeA == 'conversation') {
if ( if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')
) {
//markers show中はダメ //markers show中はダメ
var obj = JSON.parse(JSON.parse(mess.data).payload) var obj = JSON.parse(JSON.parse(mess.data).payload)
if ( if (
@ -969,6 +967,7 @@ function typePs(type) {
return 'userList' return 'userList'
} }
} }
function misskeycom(type, data) { function misskeycom(type, data) {
if (type == 'home') { if (type == 'home') {
return 'timeline' return 'timeline'
@ -1024,6 +1023,7 @@ function icon(type) {
} }
return response return response
} }
function reconnector(tlid, type, acct_id, data, mode) { function reconnector(tlid, type, acct_id, data, mode) {
console.log('%c Reconnector:' + mode + '(timeline' + tlid + ')', 'color:pink') console.log('%c Reconnector:' + mode + '(timeline' + tlid + ')', 'color:pink')
if (type == 'mix' || type == 'integrated' || type == 'plus') { if (type == 'mix' || type == 'integrated' || type == 'plus') {
@ -1053,6 +1053,7 @@ function reconnector(tlid, type, acct_id, data, mode) {
} }
M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 }) M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 })
} }
function columnReload(tlid, type) { function columnReload(tlid, type) {
$('#notice_icon_' + tlid).addClass('red-text') $('#notice_icon_' + tlid).addClass('red-text')
$('#unread_' + tlid + ' .material-icons').removeClass('teal-text') $('#unread_' + tlid + ' .material-icons').removeClass('teal-text')
@ -1152,6 +1153,7 @@ function getMarker(tlid, type, acct_id) {
} }
}) })
} }
function showUnread(tlid, type, acct_id) { function showUnread(tlid, type, acct_id) {
if ($('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) { if ($('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
goTop(tlid) goTop(tlid)
@ -1205,6 +1207,7 @@ function showUnread(tlid, type, acct_id) {
}) })
} }
var ueloadlock = false var ueloadlock = false
function ueload(tlid) { function ueload(tlid) {
if (ueloadlock) { if (ueloadlock) {
return false return false
@ -1261,6 +1264,7 @@ function ueload(tlid) {
ueloadlock = false ueloadlock = false
}) })
} }
function asRead(callback) { function asRead(callback) {
//Markers //Markers
var markers = localStorage.getItem('markers') var markers = localStorage.getItem('markers')
@ -1320,6 +1324,7 @@ function asRead(callback) {
} }
} }
} }
function asReadEnd() { function asReadEnd() {
//Markers //Markers
var markers = localStorage.getItem('markers') var markers = localStorage.getItem('markers')
@ -1397,6 +1402,7 @@ function getBookmark(acct_id, tlid, more) {
} }
} }
} }
function getUtl(acct_id, tlid, data, more) { function getUtl(acct_id, tlid, data, more) {
moreloading = true moreloading = true

File diff suppressed because it is too large Load Diff

View File

@ -179,6 +179,7 @@
"foundBug": "I found a bug", "foundBug": "I found a bug",
"show": "Show", "show": "Show",
"directory": "Directory", "directory": "Directory",
"discover": "Discover",
"active": "Recently active", "active": "Recently active",
"newcomer": "New arrivals", "newcomer": "New arrivals",
"local_only": "Local only", "local_only": "Local only",

View File

@ -177,6 +177,7 @@
"foundBug": "バグあるんやけど", "foundBug": "バグあるんやけど",
"show": "表示", "show": "表示",
"directory": "ディレクトリ", "directory": "ディレクトリ",
"discover": "見つける",
"active": "最新活動順", "active": "最新活動順",
"newcomer": "新規順", "newcomer": "新規順",
"local_only": "ローカルだけ", "local_only": "ローカルだけ",

View File

@ -93,7 +93,7 @@
"change": "変更", "change": "変更",
"followReq": "フォローリクエスト", "followReq": "フォローリクエスト",
"likeHimOrHer": "似てる", "likeHimOrHer": "似てる",
"frc":"おすすめ", "frc": "おすすめフォロー",
"more": "もっと", "more": "もっと",
"endorse": "紹介する", "endorse": "紹介する",
"openinbrowser": "ブラウザで開く", "openinbrowser": "ブラウザで開く",
@ -179,6 +179,7 @@
"foundBug": "バグを見つけた", "foundBug": "バグを見つけた",
"show": "表示", "show": "表示",
"directory": "ディレクトリ", "directory": "ディレクトリ",
"discover": "見つける",
"active": "最新活動順", "active": "最新活動順",
"newcomer": "新規順", "newcomer": "新規順",
"local_only": "ローカルのみ", "local_only": "ローカルのみ",

File diff suppressed because it is too large Load Diff

View File

@ -688,7 +688,7 @@
style="width:100%; max-width:40rem;"><img src="../../img/desk_full.svg" class="left" width="25" 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> style="padding-top:5px;">Main author: Cutls@1m.cutls.com</a>
<br> <br>
TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/5621ffbe42a1de361ccee0e679c97d30da436aab">5621ffbe42a1de361ccee0e679c97d30da436aab</a> - <a TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/36ad187296f74ae3ed6cb12a4ef26b27d8d13d0f">36ad187296f74ae3ed6cb12a4ef26b27d8d13d0f</a> - <a
onclick="checkupd(); return localStorage.removeItem('new-ver-skip'); location.href='index.html';" onclick="checkupd(); return localStorage.removeItem('new-ver-skip'); location.href='index.html';"
class="pointer pwa">Sprawdź aktualizacje</a><br> class="pointer pwa">Sprawdź aktualizacje</a><br>
<br> <br>
@ -698,7 +698,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/5621ffbe42a1de361ccee0e679c97d30da436aab" <a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/36ad187296f74ae3ed6cb12a4ef26b27d8d13d0f"
alt="FOSSA Status"><img alt="FOSSA Status"><img
src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a> src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a>
<br> <br>