mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-31 09:22:49 -05:00
Fix options update for multiple views with same URL
This commit is contained in:
@@ -30,7 +30,6 @@ export default class StreamWindow extends EventEmitter {
|
|||||||
this.backgroundView = null
|
this.backgroundView = null
|
||||||
this.overlayView = null
|
this.overlayView = null
|
||||||
this.views = new Map()
|
this.views = new Map()
|
||||||
this.viewsByURL = new Map()
|
|
||||||
this.viewActions = null
|
this.viewActions = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +252,6 @@ export default class StreamWindow extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newViews = new Map()
|
const newViews = new Map()
|
||||||
const newViewsByURL = new Map()
|
|
||||||
for (const { box, view } of viewsToDisplay) {
|
for (const { box, view } of viewsToDisplay) {
|
||||||
const { content, x, y, w, h, spaces } = box
|
const { content, x, y, w, h, spaces } = box
|
||||||
const pos = {
|
const pos = {
|
||||||
@@ -267,7 +265,6 @@ export default class StreamWindow extends EventEmitter {
|
|||||||
view.send({ type: 'OPTIONS', options: getDisplayOptions(stream) })
|
view.send({ type: 'OPTIONS', options: getDisplayOptions(stream) })
|
||||||
view.send({ type: 'DISPLAY', pos, content })
|
view.send({ type: 'DISPLAY', pos, content })
|
||||||
newViews.set(view.state.context.id, view)
|
newViews.set(view.state.context.id, view)
|
||||||
newViewsByURL.set(content.url, view)
|
|
||||||
}
|
}
|
||||||
for (const view of unusedViews) {
|
for (const view of unusedViews) {
|
||||||
const browserView = view.state.context.view
|
const browserView = view.state.context.view
|
||||||
@@ -275,7 +272,6 @@ export default class StreamWindow extends EventEmitter {
|
|||||||
browserView.destroy()
|
browserView.destroy()
|
||||||
}
|
}
|
||||||
this.views = newViews
|
this.views = newViews
|
||||||
this.viewsByURL = newViewsByURL
|
|
||||||
this.emitState()
|
this.emitState()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,14 +320,17 @@ export default class StreamWindow extends EventEmitter {
|
|||||||
|
|
||||||
onState(state) {
|
onState(state) {
|
||||||
this.send('state', state)
|
this.send('state', state)
|
||||||
for (const stream of state.streams) {
|
for (const view of this.views.values()) {
|
||||||
const { link } = stream
|
const { url } = view.state.context.content
|
||||||
this.viewsByURL.get(link)?.send?.({
|
const stream = state.streams.byURL.get(url)
|
||||||
|
if (stream) {
|
||||||
|
view.send({
|
||||||
type: 'OPTIONS',
|
type: 'OPTIONS',
|
||||||
options: getDisplayOptions(stream),
|
options: getDisplayOptions(stream),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
send(...args) {
|
send(...args) {
|
||||||
this.overlayView.webContents.send(...args)
|
this.overlayView.webContents.send(...args)
|
||||||
|
|||||||
@@ -67,7 +67,10 @@ export async function* combineDataSources(dataSources) {
|
|||||||
dataByURL.set(data.link, { ...existing, ...data })
|
dataByURL.set(data.link, { ...existing, ...data })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yield [...dataByURL.values()]
|
const streams = [...dataByURL.values()]
|
||||||
|
// Retain the index to speed up local lookups
|
||||||
|
streams.byURL = dataByURL
|
||||||
|
yield streams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user