From 7795adf173f46c57a9adc842f00e9e48fb8774cd Mon Sep 17 00:00:00 2001 From: cutls Date: Thu, 17 Sep 2020 21:05:01 +0900 Subject: [PATCH] #353 subscription type streaming JSON bug --- app/js/tl/mix.js | 4 ++-- app/js/tl/parse.js | 2 +- app/js/tl/tl.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/js/tl/mix.js b/app/js/tl/mix.js index 20ff99f9..0be535db 100644 --- a/app/js/tl/mix.js +++ b/app/js/tl/mix.js @@ -27,12 +27,12 @@ async function mixtl(acct_id, tlid, type, delc, voice) { mixre(acct_id, tlid, 'mix', mute, voice, '') clearInterval(mbws) } else if(mastodonBaseWsStatus[domain] == 'available') { - mastodonBaseWs[domain].send(`{"type":"subscribe","stream":"public:local"}`) + mastodonBaseWs[domain].send(JSON.stringify({type: 'subscribe', stream: 'public:local'})) clearInterval(mbws) } }, 1000) } else if(mastodonBaseWsStatus[domain] == 'available') { - mastodonBaseWs[domain].send(`{"type":"subscribe","stream":"public:local"}`) + mastodonBaseWs[domain].send(JSON.stringify({type: 'subscribe', stream: 'public:local'})) } $(window).scrollTop(0) diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 4692463c..b711dc71 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -1564,7 +1564,7 @@ function mastodonBaseStreaming(acct_id) { setTimeout(function () { mastodonBaseWsStatus[domain] = 'available' }, 3000) - mastodonBaseWs[domain].send(`{"type":"subscribe","stream":"user"}`) + mastodonBaseWs[domain].send(JSON.stringify({type: 'subscribe', stream: 'user'})) $('.notice_icon_acct_' + acct_id).removeClass('red-text') } mastodonBaseWs[domain].onmessage = function (mess) { diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index 1734db4c..ca133262 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -278,7 +278,7 @@ function stremaingSubscribe(type, acct_id, data, unsubscribe) { else if (type === 'pub') { stream = 'public' } else if (type === 'pub-media') { stream = 'public:media' } else if (type === 'list') { - mastodonBaseWs[domain].send(`{"type":"${command}","stream":"list","list":"${data}"}`) + mastodonBaseWs[domain].send(JSON.stringify({type: command, stream: 'list', list: data})) return true } else if (type === 'tag') { let arr = [] @@ -288,11 +288,11 @@ function stremaingSubscribe(type, acct_id, data, unsubscribe) { if (data.any) arr = arr.concat(data.any.split(',')) if (data.all) arr = arr.concat(data.all.split(',')) for (const tag of arr) { - mastodonBaseWs[domain].send(`{"type":"${command}","stream":"hashtag","tag":"${tag}"}`) + mastodonBaseWs[domain].send(JSON.stringify({type: command, stream: 'hashtag', tag: tag})) } return true } - mastodonBaseWs[domain].send(`{"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) { var misskey = false