Fix hashtag and list streaming of Pleroma

This commit is contained in:
AkiraFukushima 2018-10-06 00:08:41 +09:00
parent dc86b08c94
commit 3a62089c77
2 changed files with 13 additions and 9 deletions

View File

@ -441,6 +441,7 @@ ipcMain.on('start-local-streaming', (event, ac) => {
localStreaming = new StreamingManager(account) localStreaming = new StreamingManager(account)
localStreaming.start( localStreaming.start(
'public/local', 'public/local',
null,
(update) => { (update) => {
event.sender.send('update-start-local-streaming', update) event.sender.send('update-start-local-streaming', update)
}, },
@ -478,6 +479,7 @@ ipcMain.on('start-public-streaming', (event, ac) => {
publicStreaming = new StreamingManager(account) publicStreaming = new StreamingManager(account)
publicStreaming.start( publicStreaming.start(
'public', 'public',
null,
(update) => { (update) => {
event.sender.send('update-start-public-streaming', update) event.sender.send('update-start-public-streaming', update)
}, },
@ -514,7 +516,8 @@ ipcMain.on('start-list-streaming', (event, obj) => {
listStreaming = new StreamingManager(account) listStreaming = new StreamingManager(account)
listStreaming.start( listStreaming.start(
`list?list=${obj.list_id}`, 'list',
`list=${obj.list_id}`,
(update) => { (update) => {
event.sender.send('update-start-list-streaming', update) event.sender.send('update-start-list-streaming', update)
}, },
@ -551,7 +554,8 @@ ipcMain.on('start-tag-streaming', (event, obj) => {
tagStreaming = new StreamingManager(account) tagStreaming = new StreamingManager(account)
tagStreaming.start( tagStreaming.start(
`hashtag?tag=${obj.tag}`, 'hashtag',
`tag=${obj.tag}`,
(update) => { (update) => {
event.sender.send('update-start-tag-streaming', update) event.sender.send('update-start-tag-streaming', update)
}, },

View File

@ -34,13 +34,13 @@ export default class StreamingManager {
.catch(err => errCallback(err)) .catch(err => errCallback(err))
} }
start (path, updateCallback, errCallback) { start (path, params, updateCallback, errCallback) {
this.detectPleroma() this.detectPleroma()
.then(() => { .then(() => {
if (this.mastodon) { if (this.mastodon) {
this._startStreaming(path, updateCallback, errCallback) this._startStreaming(path, params, updateCallback, errCallback)
} else { } else {
this._startSocket(path, updateCallback, errCallback) this._startSocket(path, params, updateCallback, errCallback)
} }
}) })
.catch(err => errCallback(err)) .catch(err => errCallback(err))
@ -58,8 +58,8 @@ export default class StreamingManager {
this.streaming.startUserStreaming(updateCallback, notificationCallback, errCallback) this.streaming.startUserStreaming(updateCallback, notificationCallback, errCallback)
} }
_startStreaming (path, updateCallback, errCallback) { _startStreaming (path, params, updateCallback, errCallback) {
const target = `/streaming/${path}` const target = `/streaming/${path}?${params}`
this.streaming.start( this.streaming.start(
target, target,
updateCallback, updateCallback,
@ -78,13 +78,13 @@ export default class StreamingManager {
this.websocket.startUserStreaming(updateCallback, notificationCallback, errCallback) this.websocket.startUserStreaming(updateCallback, notificationCallback, errCallback)
} }
_startSocket (path, updateCallback, errCallback) { _startSocket (path, params, updateCallback, errCallback) {
let stream = path let stream = path
if (stream === 'public/local') { if (stream === 'public/local') {
stream = 'public:local' stream = 'public:local'
} }
this.websocket.start( this.websocket.start(
stream, `${stream}&${params}`,
updateCallback, updateCallback,
errCallback errCallback
) )