Merge pull request #640 from h3poteto/fix/pleroma/stream
Fix hashtag and list streaming of Pleroma
This commit is contained in:
commit
9997434c82
|
@ -441,6 +441,7 @@ ipcMain.on('start-local-streaming', (event, ac) => {
|
|||
localStreaming = new StreamingManager(account)
|
||||
localStreaming.start(
|
||||
'public/local',
|
||||
null,
|
||||
(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.start(
|
||||
'public',
|
||||
null,
|
||||
(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.start(
|
||||
`list?list=${obj.list_id}`,
|
||||
'list',
|
||||
`list=${obj.list_id}`,
|
||||
(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.start(
|
||||
`hashtag?tag=${obj.tag}`,
|
||||
'hashtag',
|
||||
`tag=${obj.tag}`,
|
||||
(update) => {
|
||||
event.sender.send('update-start-tag-streaming', update)
|
||||
},
|
||||
|
|
|
@ -34,13 +34,13 @@ export default class StreamingManager {
|
|||
.catch(err => errCallback(err))
|
||||
}
|
||||
|
||||
start (path, updateCallback, errCallback) {
|
||||
start (path, params, updateCallback, errCallback) {
|
||||
this.detectPleroma()
|
||||
.then(() => {
|
||||
if (this.mastodon) {
|
||||
this._startStreaming(path, updateCallback, errCallback)
|
||||
this._startStreaming(path, params, updateCallback, errCallback)
|
||||
} else {
|
||||
this._startSocket(path, updateCallback, errCallback)
|
||||
this._startSocket(path, params, updateCallback, errCallback)
|
||||
}
|
||||
})
|
||||
.catch(err => errCallback(err))
|
||||
|
@ -58,8 +58,8 @@ export default class StreamingManager {
|
|||
this.streaming.startUserStreaming(updateCallback, notificationCallback, errCallback)
|
||||
}
|
||||
|
||||
_startStreaming (path, updateCallback, errCallback) {
|
||||
const target = `/streaming/${path}`
|
||||
_startStreaming (path, params, updateCallback, errCallback) {
|
||||
const target = `/streaming/${path}?${params}`
|
||||
this.streaming.start(
|
||||
target,
|
||||
updateCallback,
|
||||
|
@ -78,13 +78,13 @@ export default class StreamingManager {
|
|||
this.websocket.startUserStreaming(updateCallback, notificationCallback, errCallback)
|
||||
}
|
||||
|
||||
_startSocket (path, updateCallback, errCallback) {
|
||||
_startSocket (path, params, updateCallback, errCallback) {
|
||||
let stream = path
|
||||
if (stream === 'public/local') {
|
||||
stream = 'public:local'
|
||||
}
|
||||
this.websocket.start(
|
||||
stream,
|
||||
`${stream}&${params}`,
|
||||
updateCallback,
|
||||
errCallback
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue