#317 nice reload
This commit is contained in:
parent
e402e0e7a7
commit
9d0f4096f8
|
@ -1572,15 +1572,15 @@ function mastodonBaseStreaming(acct_id) {
|
||||||
const start = `wss://${domain}/api/v1/streaming/?access_token=${at}`
|
const start = `wss://${domain}/api/v1/streaming/?access_token=${at}`
|
||||||
mastodonBaseWs[domain] = new WebSocket(start)
|
mastodonBaseWs[domain] = new WebSocket(start)
|
||||||
mastodonBaseWs[domain].onopen = function () {
|
mastodonBaseWs[domain].onopen = function () {
|
||||||
|
mastodonBaseWsStatus[domain] = 'connecting'
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
mastodonBaseWsStatus[domain] = 'available'
|
mastodonBaseWsStatus[domain] = 'available'
|
||||||
}, 1000)
|
}, 3000)
|
||||||
mastodonBaseWs[domain].send(`{"type":"subscribe","stream":"user"}`)
|
mastodonBaseWs[domain].send(`{"type":"subscribe","stream":"user"}`)
|
||||||
$('.notice_icon_acct_' + acct_id).removeClass('red-text')
|
$('.notice_icon_acct_' + acct_id).removeClass('red-text')
|
||||||
}
|
}
|
||||||
mastodonBaseWs[domain].onmessage = function (mess) {
|
mastodonBaseWs[domain].onmessage = function (mess) {
|
||||||
const typeA = JSON.parse(mess.data).event
|
const typeA = JSON.parse(mess.data).event
|
||||||
console.log(domain + ':' + typeA)
|
|
||||||
if (typeA == 'delete') {
|
if (typeA == 'delete') {
|
||||||
$(`[unique-id=${JSON.parse(mess.data).payload}]`).hide()
|
$(`[unique-id=${JSON.parse(mess.data).payload}]`).hide()
|
||||||
$(`[unique-id=${JSON.parse(mess.data).payload}]`).remove()
|
$(`[unique-id=${JSON.parse(mess.data).payload}]`).remove()
|
||||||
|
@ -1589,7 +1589,6 @@ function mastodonBaseStreaming(acct_id) {
|
||||||
const tl = JSON.parse(mess.data).stream
|
const tl = JSON.parse(mess.data).stream
|
||||||
const obj = JSON.parse(JSON.parse(mess.data).payload)
|
const obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||||
const tls = getTlMeta(tl[0], tl, acct_id, obj)
|
const tls = getTlMeta(tl[0], tl, acct_id, obj)
|
||||||
console.log(domain + ':' + tls)
|
|
||||||
insertTl(obj, tls)
|
insertTl(obj, tls)
|
||||||
} else if (typeA == 'filters_changed') {
|
} else if (typeA == 'filters_changed') {
|
||||||
filterUpdate(acct_id)
|
filterUpdate(acct_id)
|
||||||
|
@ -1623,19 +1622,23 @@ function mastodonBaseStreaming(acct_id) {
|
||||||
notf(acct_id, 0) //fallback
|
notf(acct_id, 0) //fallback
|
||||||
console.error("Error closing " + domain)
|
console.error("Error closing " + domain)
|
||||||
console.error(error)
|
console.error(error)
|
||||||
if (mastodonBaseWsStatus[domain] == 'available') location.reload()
|
if (mastodonBaseWsStatus[domain] == 'available') alert(domain)
|
||||||
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
mastodonBaseWsStatus[domain] = 'cannotuse'
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
||||||
}, 2000)
|
}, 3000)
|
||||||
mastodonBaseWs[domain] = false
|
mastodonBaseWs[domain] = false
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
mastodonBaseWs[domain].onclose = function () {
|
mastodonBaseWs[domain].onclose = function () {
|
||||||
notf(acct_id, 0) //fallback
|
notf(acct_id, 0) //fallback
|
||||||
console.warn("Closing " + domain)
|
console.warn("Closing " + domain)
|
||||||
if (mastodonBaseWsStatus[domain] == 'available') location.reload()
|
if (mastodonBaseWsStatus[domain] == 'available') alert(domain)
|
||||||
mastodonBaseWs[domain] = false
|
mastodonBaseWs[domain] = false
|
||||||
mastodonBaseWsStatus[domain] = 'cannotuse'
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
||||||
|
setTimeout(function () {
|
||||||
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
||||||
|
}, 3000)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
413
app/js/tl/tl.js
413
app/js/tl/tl.js
|
@ -206,7 +206,7 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
||||||
additional(acct_id, tlid)
|
additional(acct_id, tlid)
|
||||||
jQuery('time.timeago').timeago()
|
jQuery('time.timeago').timeago()
|
||||||
todc()
|
todc()
|
||||||
reload(type, '', acct_id, tlid, data, mute, delc, voice)
|
reload(type, 'from timeline to reload', acct_id, tlid, data, mute, delc, voice)
|
||||||
if (type == 'home' || type == 'notf') {
|
if (type == 'home' || type == 'notf') {
|
||||||
//Markers
|
//Markers
|
||||||
var markers = localStorage.getItem('markers')
|
var markers = localStorage.getItem('markers')
|
||||||
|
@ -248,231 +248,241 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
||||||
}, 100)
|
}, 100)
|
||||||
} else {
|
} else {
|
||||||
var domain = localStorage.getItem('domain_' + acct_id)
|
var domain = localStorage.getItem('domain_' + acct_id)
|
||||||
if(mastodonBaseWsStatus[domain] == 'cannotuse') {
|
if (mastodonBaseWsStatus[domain] == 'cannotuse') {
|
||||||
oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode)
|
oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode)
|
||||||
} else if(mastodonBaseWs[domain] == 'undetected') {
|
} else if (mastodonBaseWsStatus[domain] == 'undetected' || mastodonBaseWsStatus[domain] == 'connecting') {
|
||||||
const mbws = setInterval(function () {
|
const mbws = setInterval(function () {
|
||||||
if(mastodonBaseWsStatus[domain] == 'cannotuse') {
|
if (mastodonBaseWsStatus[domain] == 'cannotuse') {
|
||||||
oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode)
|
oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode)
|
||||||
clearInterval(mbws)
|
clearInterval(mbws)
|
||||||
} else if(mastodonBaseWsStatus[domain] == 'available') {
|
} else if (mastodonBaseWsStatus[domain] == 'available') {
|
||||||
stremaingSubscribe(type, cc, acct_id, tlid, data, mute, delc, voice, mode)
|
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||||
|
stremaingSubscribe(type, acct_id, data)
|
||||||
clearInterval(mbws)
|
clearInterval(mbws)
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else if(mastodonBaseWsStatus[domain] == 'available') {
|
} else if (mastodonBaseWsStatus[domain] == 'available') {
|
||||||
stremaingSubscribe(type, cc, acct_id, tlid, data, mute, delc, voice, mode)
|
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||||
|
stremaingSubscribe(type, acct_id, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function stremaingSubscribe(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
function stremaingSubscribe(type, acct_id, data, unsubscribe) {
|
||||||
|
let command = 'subscribe'
|
||||||
|
if (unsubscribe) command = 'unsubscribe'
|
||||||
let stream
|
let stream
|
||||||
const domain = localStorage.getItem('domain_' + acct_id)
|
const domain = localStorage.getItem('domain_' + acct_id)
|
||||||
if(type === 'local' || type === 'mix' ) { stream = 'public:local' }
|
if(type == 'home') return false
|
||||||
else if(type === 'local-media' ) { stream = 'public:local:media' }
|
if (type === 'local' || type === 'mix') { stream = 'public:local' }
|
||||||
else if(type === 'pub' ) { stream = 'public' }
|
else if (type === 'local-media') { stream = 'public:local:media' }
|
||||||
else if(type === 'pub-media' ) { stream = 'public:media' }
|
else if (type === 'pub') { stream = 'public' }
|
||||||
else if(type === 'list' ) {
|
else if (type === 'pub-media') { stream = 'public:media' }
|
||||||
mastodonBaseWs[domain].send(`{"type":"subscribe","stream":"list","list":"${data}"}`)
|
else if (type === 'list') {
|
||||||
}else if(type === 'tag' ) {
|
mastodonBaseWs[domain].send(`{"type":"${command}","stream":"list","list":"${data}"}`)
|
||||||
|
return true
|
||||||
|
} else if (type === 'tag') {
|
||||||
let arr = []
|
let arr = []
|
||||||
let name = data
|
let name = data
|
||||||
if(data.name) name = data.name
|
if (data.name) name = data.name
|
||||||
arr.push(name)
|
arr.push(name)
|
||||||
if(data.any) arr = arr.concat(data.any.split(','))
|
if (data.any) arr = arr.concat(data.any.split(','))
|
||||||
if(data.all) arr = arr.concat(data.all.split(','))
|
if (data.all) arr = arr.concat(data.all.split(','))
|
||||||
for(const tag of arr) {
|
for (const tag of arr) {
|
||||||
mastodonBaseWs[domain].send(`{"type":"subscribe","stream":"hashtag","tag":"${tag}"}`)
|
mastodonBaseWs[domain].send(`{"type":"${command}","stream":"hashtag","tag":"${tag}"}`)
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
mastodonBaseWs[domain].send(`{"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
|
||||||
if (localStorage.getItem('streaming_' + acct_id)) {
|
const domain = localStorage.getItem(`domain_${acct_id}`)
|
||||||
var wss = localStorage.getItem('streaming_' + acct_id)
|
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||||
|
if (localStorage.getItem('streaming_' + acct_id)) {
|
||||||
|
var wss = localStorage.getItem('streaming_' + acct_id)
|
||||||
|
} else {
|
||||||
|
var wss = 'wss://' + domain
|
||||||
|
}
|
||||||
|
if (type == 'home') {
|
||||||
|
var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
|
||||||
|
} else if (type == 'pub') {
|
||||||
|
var add = ''
|
||||||
|
if (remoteOnlyCk(tlid)) {
|
||||||
|
add = '&remote=true'
|
||||||
|
}
|
||||||
|
var start = wss + '/api/v1/streaming/?stream=public&access_token=' + at + add
|
||||||
|
} else if (type == 'pub-media') {
|
||||||
|
var add = ''
|
||||||
|
if (remoteOnlyCk(tlid)) {
|
||||||
|
add = '&remote=true'
|
||||||
|
} var start =
|
||||||
|
wss + '/api/v1/streaming/?stream=public:media&access_token=' + at + add
|
||||||
|
} else if (type == 'local') {
|
||||||
|
var start =
|
||||||
|
wss + '/api/v1/streaming/?stream=public:local&access_token=' + at
|
||||||
|
} else if (type == 'local-media') {
|
||||||
|
var start =
|
||||||
|
wss +
|
||||||
|
'/api/v1/streaming/?stream=public:local:media&only_media=true&access_token=' +
|
||||||
|
at
|
||||||
|
} else if (type == 'tag') {
|
||||||
|
var tag = localStorage.getItem('tag-range')
|
||||||
|
if (tag == 'local') {
|
||||||
|
data = data + '&local=true'
|
||||||
|
}
|
||||||
|
if (data.name) {
|
||||||
|
data = data.name
|
||||||
|
}
|
||||||
|
var start =
|
||||||
|
wss +
|
||||||
|
'/api/v1/streaming/?stream=hashtag&tag=' +
|
||||||
|
data +
|
||||||
|
'&access_token=' +
|
||||||
|
at + add
|
||||||
|
} else if (type == 'noauth') {
|
||||||
|
var start = 'wss://' + acct_id + '/api/v1/streaming/?stream=public:local'
|
||||||
|
} else if (type == 'list') {
|
||||||
|
var start =
|
||||||
|
wss +
|
||||||
|
'/api/v1/streaming/?stream=list&list=' +
|
||||||
|
data +
|
||||||
|
'&access_token=' +
|
||||||
|
at
|
||||||
|
} else if (type == 'dm') {
|
||||||
|
var start = wss + '/api/v1/streaming/?stream=direct&access_token=' + at
|
||||||
|
}
|
||||||
|
var wsid = websocket.length
|
||||||
|
localStorage.setItem('wss_' + tlid, wsid)
|
||||||
|
websocket[wsid] = new WebSocket(start)
|
||||||
|
websocket[wsid].onopen = function (mess) {
|
||||||
|
console.table({
|
||||||
|
tlid: tlid,
|
||||||
|
type: 'Connect Streaming API' + type,
|
||||||
|
domain: domain,
|
||||||
|
message: [mess],
|
||||||
|
})
|
||||||
|
errorct = 0
|
||||||
|
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||||
|
}
|
||||||
|
websocket[wsid].onmessage = function (mess) {
|
||||||
|
console.log([tlid + ':Receive Streaming API:', JSON.parse(mess.data)])
|
||||||
|
if (misskey) {
|
||||||
|
if (JSON.parse(mess.data).type == 'note') {
|
||||||
|
var obj = JSON.parse(mess.data).body
|
||||||
|
if (voice) {
|
||||||
|
say(obj.text)
|
||||||
|
}
|
||||||
|
websocketNotf[acct_id].send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: 'capture',
|
||||||
|
id: obj.id,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
var templete = misskeyParse([obj], type, acct_id, tlid, '', mute)
|
||||||
|
var pool = localStorage.getItem('pool_' + tlid)
|
||||||
|
if (pool) {
|
||||||
|
pool = templete + pool
|
||||||
|
} else {
|
||||||
|
pool = templete
|
||||||
|
}
|
||||||
|
localStorage.setItem('pool_' + tlid, pool)
|
||||||
|
scrollck()
|
||||||
|
jQuery('time.timeago').timeago()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var wss = 'wss://' + domain
|
var typeA = JSON.parse(mess.data).event
|
||||||
}
|
if (typeA == 'delete') {
|
||||||
if (type == 'home') {
|
var obj = JSON.parse(mess.data).payload
|
||||||
var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
|
if (delc == 'true') {
|
||||||
} else if (type == 'pub') {
|
$(
|
||||||
var add = ''
|
'#timeline_' +
|
||||||
if (remoteOnlyCk(tlid)) {
|
tlid +
|
||||||
add = '&remote=true'
|
' [unique-id=' +
|
||||||
}
|
JSON.parse(mess.data).payload +
|
||||||
var start = wss + '/api/v1/streaming/?stream=public&access_token=' + at + add
|
']'
|
||||||
} else if (type == 'pub-media') {
|
).addClass('emphasized')
|
||||||
var add = ''
|
$(
|
||||||
if (remoteOnlyCk(tlid)) {
|
'#timeline_' +
|
||||||
add = '&remote=true'
|
tlid +
|
||||||
} var start =
|
' [unique-id=' +
|
||||||
wss + '/api/v1/streaming/?stream=public:media&access_token=' + at + add
|
JSON.parse(mess.data).payload +
|
||||||
} else if (type == 'local') {
|
']'
|
||||||
var start =
|
).addClass('by_delcatch')
|
||||||
wss + '/api/v1/streaming/?stream=public:local&access_token=' + at
|
} else {
|
||||||
} else if (type == 'local-media') {
|
$('[unique-id=' + JSON.parse(mess.data).payload + ']').hide()
|
||||||
var start =
|
$('[unique-id=' + JSON.parse(mess.data).payload + ']').remove()
|
||||||
wss +
|
|
||||||
'/api/v1/streaming/?stream=public:local:media&only_media=true&access_token=' +
|
|
||||||
at
|
|
||||||
} else if (type == 'tag') {
|
|
||||||
var tag = localStorage.getItem('tag-range')
|
|
||||||
if (tag == 'local') {
|
|
||||||
data = data + '&local=true'
|
|
||||||
}
|
|
||||||
if(data.name) {
|
|
||||||
data = data.name
|
|
||||||
}
|
|
||||||
var start =
|
|
||||||
wss +
|
|
||||||
'/api/v1/streaming/?stream=hashtag&tag=' +
|
|
||||||
data +
|
|
||||||
'&access_token=' +
|
|
||||||
at + add
|
|
||||||
} else if (type == 'noauth') {
|
|
||||||
var start = 'wss://' + acct_id + '/api/v1/streaming/?stream=public:local'
|
|
||||||
} else if (type == 'list') {
|
|
||||||
var start =
|
|
||||||
wss +
|
|
||||||
'/api/v1/streaming/?stream=list&list=' +
|
|
||||||
data +
|
|
||||||
'&access_token=' +
|
|
||||||
at
|
|
||||||
} else if (type == 'dm') {
|
|
||||||
var start = wss + '/api/v1/streaming/?stream=direct&access_token=' + at
|
|
||||||
}
|
|
||||||
var wsid = websocket.length
|
|
||||||
localStorage.setItem('wss_' + tlid, wsid)
|
|
||||||
websocket[wsid] = new WebSocket(start)
|
|
||||||
websocket[wsid].onopen = function (mess) {
|
|
||||||
console.table({
|
|
||||||
tlid: tlid,
|
|
||||||
type: 'Connect Streaming API' + type,
|
|
||||||
domain: domain,
|
|
||||||
message: [mess],
|
|
||||||
})
|
|
||||||
errorct = 0
|
|
||||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
|
||||||
}
|
|
||||||
websocket[wsid].onmessage = function (mess) {
|
|
||||||
console.log([tlid + ':Receive Streaming API:', JSON.parse(mess.data)])
|
|
||||||
if (misskey) {
|
|
||||||
if (JSON.parse(mess.data).type == 'note') {
|
|
||||||
var obj = JSON.parse(mess.data).body
|
|
||||||
if (voice) {
|
|
||||||
say(obj.text)
|
|
||||||
}
|
|
||||||
websocketNotf[acct_id].send(
|
|
||||||
JSON.stringify({
|
|
||||||
type: 'capture',
|
|
||||||
id: obj.id,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
var templete = misskeyParse([obj], type, acct_id, tlid, '', mute)
|
|
||||||
var pool = localStorage.getItem('pool_' + tlid)
|
|
||||||
if (pool) {
|
|
||||||
pool = templete + pool
|
|
||||||
} else {
|
|
||||||
pool = templete
|
|
||||||
}
|
|
||||||
localStorage.setItem('pool_' + tlid, pool)
|
|
||||||
scrollck()
|
|
||||||
jQuery('time.timeago').timeago()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else if (typeA == 'update' || typeA == 'conversation') {
|
||||||
var typeA = JSON.parse(mess.data).event
|
if (
|
||||||
if (typeA == 'delete') {
|
!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')
|
||||||
var obj = JSON.parse(mess.data).payload
|
) {
|
||||||
if (delc == 'true') {
|
//markers show中はダメ
|
||||||
$(
|
var obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||||
'#timeline_' +
|
|
||||||
tlid +
|
|
||||||
' [unique-id=' +
|
|
||||||
JSON.parse(mess.data).payload +
|
|
||||||
']'
|
|
||||||
).addClass('emphasized')
|
|
||||||
$(
|
|
||||||
'#timeline_' +
|
|
||||||
tlid +
|
|
||||||
' [unique-id=' +
|
|
||||||
JSON.parse(mess.data).payload +
|
|
||||||
']'
|
|
||||||
).addClass('by_delcatch')
|
|
||||||
} else {
|
|
||||||
$('[unique-id=' + JSON.parse(mess.data).payload + ']').hide()
|
|
||||||
$('[unique-id=' + JSON.parse(mess.data).payload + ']').remove()
|
|
||||||
}
|
|
||||||
} else if (typeA == 'update' || typeA == 'conversation') {
|
|
||||||
if (
|
if (
|
||||||
!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')
|
$('#timeline_' + tlid + ' [toot-id=' + obj.id + ']').length < 1
|
||||||
) {
|
) {
|
||||||
//markers show中はダメ
|
if (voice) {
|
||||||
var obj = JSON.parse(JSON.parse(mess.data).payload)
|
say(obj.content)
|
||||||
if (
|
|
||||||
$('#timeline_' + tlid + ' [toot-id=' + obj.id + ']').length < 1
|
|
||||||
) {
|
|
||||||
if (voice) {
|
|
||||||
say(obj.content)
|
|
||||||
}
|
|
||||||
var templete = parse([obj], type, acct_id, tlid, '', mute, type)
|
|
||||||
if (
|
|
||||||
$('timeline_box_' + tlid + '_box .tl-box').scrollTop() === 0
|
|
||||||
) {
|
|
||||||
$('#timeline_' + tlid).prepend(templete)
|
|
||||||
} else {
|
|
||||||
var pool = localStorage.getItem('pool_' + tlid)
|
|
||||||
if (pool) {
|
|
||||||
pool = templete + pool
|
|
||||||
} else {
|
|
||||||
pool = templete
|
|
||||||
}
|
|
||||||
localStorage.setItem('pool_' + tlid, pool)
|
|
||||||
}
|
|
||||||
scrollck()
|
|
||||||
additional(acct_id, tlid)
|
|
||||||
jQuery('time.timeago').timeago()
|
|
||||||
} else {
|
|
||||||
todo('二重取得発生中')
|
|
||||||
}
|
}
|
||||||
|
var templete = parse([obj], type, acct_id, tlid, '', mute, type)
|
||||||
todc()
|
if (
|
||||||
|
$('timeline_box_' + tlid + '_box .tl-box').scrollTop() === 0
|
||||||
|
) {
|
||||||
|
$('#timeline_' + tlid).prepend(templete)
|
||||||
|
} else {
|
||||||
|
var pool = localStorage.getItem('pool_' + tlid)
|
||||||
|
if (pool) {
|
||||||
|
pool = templete + pool
|
||||||
|
} else {
|
||||||
|
pool = templete
|
||||||
|
}
|
||||||
|
localStorage.setItem('pool_' + tlid, pool)
|
||||||
|
}
|
||||||
|
scrollck()
|
||||||
|
additional(acct_id, tlid)
|
||||||
|
jQuery('time.timeago').timeago()
|
||||||
|
} else {
|
||||||
|
todo('二重取得発生中')
|
||||||
}
|
}
|
||||||
} else if (typeA == 'filters_changed') {
|
|
||||||
filterUpdate(acct_id)
|
todc()
|
||||||
} else if (~typeA.indexOf('announcement')) {
|
|
||||||
announ(acct_id, tlid)
|
|
||||||
}
|
}
|
||||||
|
} else if (typeA == 'filters_changed') {
|
||||||
|
filterUpdate(acct_id)
|
||||||
|
} else if (~typeA.indexOf('announcement')) {
|
||||||
|
announ(acct_id, tlid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
websocket[wsid].onerror = function (error) {
|
}
|
||||||
console.error('Error closing')
|
websocket[wsid].onerror = function (error) {
|
||||||
console.error(error)
|
console.error('Error closing')
|
||||||
if (mode == 'error') {
|
console.error(error)
|
||||||
$('#notice_icon_' + tlid).addClass('red-text')
|
if (mode == 'error') {
|
||||||
todo('WebSocket Error ' + error)
|
$('#notice_icon_' + tlid).addClass('red-text')
|
||||||
} else {
|
todo('WebSocket Error ' + error)
|
||||||
errorct++
|
} else {
|
||||||
console.log(errorct)
|
errorct++
|
||||||
if (errorct < 3) {
|
console.log(errorct)
|
||||||
reconnector(tlid, type, acct_id, data, 'error')
|
if (errorct < 3) {
|
||||||
}
|
reconnector(tlid, type, acct_id, data, 'error')
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
websocket[wsid].onclose = function () {
|
return false
|
||||||
console.warn('Closing ' + tlid)
|
}
|
||||||
if (mode == 'error') {
|
websocket[wsid].onclose = function () {
|
||||||
$('#notice_icon_' + tlid).addClass('red-text')
|
console.warn('Closing ' + tlid)
|
||||||
todo('WebSocket Closed')
|
if (mode == 'error') {
|
||||||
} else {
|
$('#notice_icon_' + tlid).addClass('red-text')
|
||||||
errorct++
|
todo('WebSocket Closed')
|
||||||
console.log(errorct)
|
} else {
|
||||||
if (errorct < 3) {
|
errorct++
|
||||||
reconnector(tlid, type, acct_id, data, 'error')
|
console.log(errorct)
|
||||||
}
|
if (errorct < 3) {
|
||||||
|
reconnector(tlid, type, acct_id, data, 'error')
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//一定のスクロールで発火
|
//一定のスクロールで発火
|
||||||
function moreload(type, tlid) {
|
function moreload(type, tlid) {
|
||||||
|
@ -1037,7 +1047,7 @@ function reconnector(tlid, type, acct_id, data, mode) {
|
||||||
var voice = false
|
var voice = false
|
||||||
}
|
}
|
||||||
var mute = getFilterTypeByAcct(acct_id, type)
|
var mute = getFilterTypeByAcct(acct_id, type)
|
||||||
reload(type, '', acct_id, tlid, data, mute, '', voice, mode)
|
var domain = localStorage.getItem('domain_' + acct_id)
|
||||||
}
|
}
|
||||||
M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 })
|
M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 })
|
||||||
}
|
}
|
||||||
|
@ -1047,6 +1057,12 @@ function columnReload(tlid, type) {
|
||||||
var multi = localStorage.getItem('column')
|
var multi = localStorage.getItem('column')
|
||||||
var obj = JSON.parse(multi)
|
var obj = JSON.parse(multi)
|
||||||
var acct_id = obj[tlid].domain
|
var acct_id = obj[tlid].domain
|
||||||
|
var domain = localStorage.getItem('domain_' + acct_id)
|
||||||
|
if (mastodonBaseWsStatus[domain] == 'available') {
|
||||||
|
stremaingSubscribe(type, acct_id, obj[tlid].data, true)
|
||||||
|
parseColumn(tlid, true)
|
||||||
|
return true
|
||||||
|
}
|
||||||
if (type == 'mix' || type == 'integrated' || type == 'plus') {
|
if (type == 'mix' || type == 'integrated' || type == 'plus') {
|
||||||
if (localStorage.getItem('voice_' + tlid)) {
|
if (localStorage.getItem('voice_' + tlid)) {
|
||||||
var voice = true
|
var voice = true
|
||||||
|
@ -1066,15 +1082,10 @@ function columnReload(tlid, type) {
|
||||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||||
getBookmark(acct_id, tlid, false)
|
getBookmark(acct_id, tlid, false)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var wss = localStorage.getItem('wss_' + tlid)
|
var wss = localStorage.getItem('wss_' + tlid)
|
||||||
websocket[wss].close()
|
websocket[wss].close()
|
||||||
if (localStorage.getItem('voice_' + tlid)) {
|
parseColumn(tlid, false)
|
||||||
var voice = true
|
|
||||||
} else {
|
|
||||||
var voice = false
|
|
||||||
}
|
|
||||||
var mute = getFilterTypeByAcct(acct_id, type)
|
|
||||||
parseColumn(tlid)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Markers
|
//Markers
|
||||||
|
|
|
@ -42,18 +42,16 @@ function parseColumn(target, dontclose) {
|
||||||
var multi = localStorage.getItem('multi')
|
var multi = localStorage.getItem('multi')
|
||||||
if (multi) {
|
if (multi) {
|
||||||
var obj = JSON.parse(multi)
|
var obj = JSON.parse(multi)
|
||||||
|
|
||||||
var templete
|
var templete
|
||||||
Object.keys(obj).forEach(function (key) {
|
Object.keys(obj).forEach(function (key) {
|
||||||
var acct = obj[key]
|
var acct = obj[key]
|
||||||
|
|
||||||
localStorage.setItem('name_' + key, acct.name)
|
localStorage.setItem('name_' + key, acct.name)
|
||||||
localStorage.setItem('user_' + key, acct.user)
|
localStorage.setItem('user_' + key, acct.user)
|
||||||
localStorage.setItem('user-id_' + key, acct.id)
|
localStorage.setItem('user-id_' + key, acct.id)
|
||||||
localStorage.setItem('prof_' + key, acct.prof)
|
localStorage.setItem('prof_' + key, acct.prof)
|
||||||
localStorage.setItem('domain_' + key, acct.domain)
|
localStorage.setItem('domain_' + key, acct.domain)
|
||||||
localStorage.setItem('acct_' + key + '_at', acct.at)
|
localStorage.setItem('acct_' + key + '_at', acct.at)
|
||||||
mastodonBaseStreaming(key)
|
if(!target) mastodonBaseStreaming(key)
|
||||||
ckdb(key)
|
ckdb(key)
|
||||||
//フィルターデータ読もう
|
//フィルターデータ読もう
|
||||||
getFilter(key)
|
getFilter(key)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user