Skip to content

Commit

Permalink
Merge pull request #640 from h3poteto/fix/pleroma/stream
Browse files Browse the repository at this point in the history
 Fix hashtag and list streaming of Pleroma
  • Loading branch information
h3poteto authored Oct 5, 2018
2 parents ac079fb + 3a62089 commit 9997434
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down Expand Up @@ -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)
},
Expand Down Expand Up @@ -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)
},
Expand Down Expand Up @@ -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)
},
Expand Down
14 changes: 7 additions & 7 deletions src/main/streaming_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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,
Expand All @@ -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
)
Expand Down

0 comments on commit 9997434

Please sign in to comment.