url.streaming_url may return URL begins with https://

This commit is contained in:
cutls 2021-04-01 17:06:56 +09:00
parent bb60f28b63
commit 2e84fc5cdc
2 changed files with 2 additions and 2 deletions

View File

@ -1563,7 +1563,7 @@ function mastodonBaseStreaming(acct_id) {
const at = localStorage.getItem(`acct_${acct_id}_at`) const at = localStorage.getItem(`acct_${acct_id}_at`)
let wss = 'wss://' + domain let wss = 'wss://' + domain
if (localStorage.getItem('streaming_' + acct_id)) { if (localStorage.getItem('streaming_' + acct_id)) {
wss = localStorage.getItem('streaming_' + acct_id) wss = localStorage.getItem('streaming_' + acct_id).replace('https://', 'wss://')
} }
const start = `${wss}/api/v1/streaming/?access_token=${at}` const start = `${wss}/api/v1/streaming/?access_token=${at}`
mastodonBaseWs[domain] = new WebSocket(start) mastodonBaseWs[domain] = new WebSocket(start)

View File

@ -299,7 +299,7 @@ function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
const domain = localStorage.getItem(`domain_${acct_id}`) const domain = localStorage.getItem(`domain_${acct_id}`)
var at = localStorage.getItem('acct_' + acct_id + '_at') var at = localStorage.getItem('acct_' + acct_id + '_at')
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).replace('https://', 'wss://')
} else { } else {
var wss = 'wss://' + domain var wss = 'wss://' + domain
} }