Coding for the KIRENAI streaming
This commit is contained in:
parent
dc08f46909
commit
8982058a25
|
@ -211,6 +211,7 @@ function notfCommon(acct_id, tlid, sys, stream) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function notfWS(misskey, acct_id, tlid, domain, at) {
|
function notfWS(misskey, acct_id, tlid, domain, at) {
|
||||||
|
if(mastodonBaseWsStatus[domain] == 'available') return false
|
||||||
if (!misskey) {
|
if (!misskey) {
|
||||||
if (localStorage.getItem('streaming_' + acct_id)) {
|
if (localStorage.getItem('streaming_' + acct_id)) {
|
||||||
var wss = localStorage.getItem('streaming_' + acct_id)
|
var wss = localStorage.getItem('streaming_' + acct_id)
|
||||||
|
@ -262,7 +263,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
websocketNotf[acct_id].onerror = function(error) {
|
websocketNotf[acct_id].onerror = function(error) {
|
||||||
console.error('WebSocket Error ' + error)
|
console.error('WebSocket Error ', error)
|
||||||
errorct++
|
errorct++
|
||||||
console.log(errorct)
|
console.log(errorct)
|
||||||
if (errorct < 3) {
|
if (errorct < 3) {
|
||||||
|
@ -270,7 +271,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
websocketNotf[acct_id].onclose = function(error) {
|
websocketNotf[acct_id].onclose = function(error) {
|
||||||
console.error('WebSocket Close ' + error)
|
console.error('WebSocket Close ', error)
|
||||||
errorct++
|
errorct++
|
||||||
console.log(errorct)
|
console.log(errorct)
|
||||||
if (errorct < 3) {
|
if (errorct < 3) {
|
||||||
|
|
|
@ -1549,6 +1549,7 @@ function pollParse(poll, acct_id, emojis) {
|
||||||
var mastodonBaseWs = {}
|
var mastodonBaseWs = {}
|
||||||
var mastodonBaseWsStatus = {}
|
var mastodonBaseWsStatus = {}
|
||||||
function mastodonBaseStreaming(acct_id) {
|
function mastodonBaseStreaming(acct_id) {
|
||||||
|
console.log('start to connect mastodonBaseStreaming of ' + acct_id)
|
||||||
notfCommon(acct_id, 0, null, 'no')
|
notfCommon(acct_id, 0, null, 'no')
|
||||||
const domain = localStorage.getItem(`domain_${acct_id}`)
|
const domain = localStorage.getItem(`domain_${acct_id}`)
|
||||||
if (mastodonBaseWsStatus[domain]) return
|
if (mastodonBaseWsStatus[domain]) return
|
||||||
|
@ -1612,14 +1613,16 @@ function mastodonBaseStreaming(acct_id) {
|
||||||
console.error("Error closing " + domain)
|
console.error("Error closing " + domain)
|
||||||
console.error(error)
|
console.error(error)
|
||||||
if (mastodonBaseWsStatus[domain] == 'available') {
|
if (mastodonBaseWsStatus[domain] == 'available') {
|
||||||
M.toast({
|
/*M.toast({
|
||||||
html:
|
html:
|
||||||
`${lang.lang_parse_disconnected}<button class="btn-flat toast-action" onclick="location.reload()">${lang.lang_layout_reconnect}</button>`,
|
`${lang.lang_parse_disconnected}<button class="btn-flat toast-action" onclick="location.reload()">${lang.lang_layout_reconnect}</button>`,
|
||||||
completeCallback: function () {
|
completeCallback: function () {
|
||||||
mastodonBaseWs[domain] = new WebSocket(start)
|
parseColumn()
|
||||||
|
|
||||||
},
|
},
|
||||||
displayLength: 3000
|
displayLength: 3000
|
||||||
})
|
})*/
|
||||||
|
parseColumn()
|
||||||
}
|
}
|
||||||
mastodonBaseWsStatus[domain] = 'cannotuse'
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -1632,14 +1635,16 @@ function mastodonBaseStreaming(acct_id) {
|
||||||
notfCommon(acct_id, 0, null, 'only') //fallback
|
notfCommon(acct_id, 0, null, 'only') //fallback
|
||||||
console.warn("Closing " + domain)
|
console.warn("Closing " + domain)
|
||||||
if (mastodonBaseWsStatus[domain] == 'available') {
|
if (mastodonBaseWsStatus[domain] == 'available') {
|
||||||
M.toast({
|
/*M.toast({
|
||||||
html:
|
html:
|
||||||
`${lang.lang_parse_disconnected}<button class="btn-flat toast-action" onclick="location.reload()">${lang.lang_layout_reconnect}</button>`,
|
`${lang.lang_parse_disconnected}<button class="btn-flat toast-action" onclick="location.reload()">${lang.lang_layout_reconnect}</button>`,
|
||||||
completeCallback: function () {
|
completeCallback: function () {
|
||||||
mastodonBaseWs[domain] = new WebSocket(start)
|
parseColumn()
|
||||||
|
|
||||||
},
|
},
|
||||||
displayLength: 3000
|
displayLength: 3000
|
||||||
})
|
})*/
|
||||||
|
parseColumn()
|
||||||
}
|
}
|
||||||
mastodonBaseWs[domain] = false
|
mastodonBaseWs[domain] = false
|
||||||
mastodonBaseWsStatus[domain] = 'cannotuse'
|
mastodonBaseWsStatus[domain] = 'cannotuse'
|
||||||
|
|
BIN
app/source/bubble.wav
Normal file
BIN
app/source/bubble.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user