bugfix(webcam): display the wrong webcam if you connect to a remote printer with relativ webcam url (#345)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
41b21aa66e
commit
005ed8814b
@ -8,6 +8,10 @@ export default class BaseMixin extends Vue {
|
||||
return this.$store.getters['socket/getUrl']
|
||||
}
|
||||
|
||||
get hostUrl(): boolean {
|
||||
return this.$store.getters['socket/getHostUrl']
|
||||
}
|
||||
|
||||
get remoteMode() {
|
||||
return this.$store.state.socket.remoteMode
|
||||
}
|
||||
|
@ -35,9 +35,7 @@ export default class Mjpegstreamer extends Mixins(BaseMixin) {
|
||||
|
||||
get url() {
|
||||
const baseUrl = this.camSettings.url
|
||||
const hostUrl = new URL(this.printerUrl === undefined ? document.URL : this.printerUrl)
|
||||
|
||||
const url = new URL(baseUrl, hostUrl.origin)
|
||||
const url = new URL(baseUrl, this.printerUrl === undefined ? this.hostUrl.toString() : this.printerUrl)
|
||||
url.searchParams.append('bypassCache', this.refresh.toString())
|
||||
|
||||
return decodeURIComponent(url.toString())
|
||||
|
@ -95,9 +95,7 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
|
||||
|
||||
async setFrame() {
|
||||
const baseUrl = this.camSettings.url
|
||||
const hostUrl = new URL(this.printerUrl === undefined ? document.URL : this.printerUrl)
|
||||
|
||||
const url = new URL(baseUrl, hostUrl.origin)
|
||||
const url = new URL(baseUrl, this.printerUrl === undefined ? this.hostUrl.toString() : this.printerUrl)
|
||||
|
||||
url.searchParams.append('bypassCache', this.refresh.toString())
|
||||
url.searchParams.set('action', 'snapshot')
|
||||
|
@ -32,9 +32,7 @@ export default class Uv4lMjpeg extends Mixins(BaseMixin) {
|
||||
|
||||
get url() {
|
||||
const baseUrl = this.camSettings.url
|
||||
const hostUrl = new URL(this.printerUrl === null ? document.URL : this.printerUrl)
|
||||
|
||||
const url = new URL(baseUrl, hostUrl.origin)
|
||||
const url = new URL(baseUrl, this.printerUrl === null ? this.hostUrl.toString() : this.printerUrl)
|
||||
|
||||
return decodeURIComponent(url.toString())
|
||||
}
|
||||
|
@ -8,6 +8,10 @@ export const getters: GetterTree<SocketState, RootState> = {
|
||||
return "//" + state.hostname + (state.port !== 80 ? ":"+state.port : "")
|
||||
},
|
||||
|
||||
getHostUrl: (state) => {
|
||||
return (state.protocol === 'wss' ? 'https' : 'http')+"://" + state.hostname + '/'
|
||||
},
|
||||
|
||||
getWebsocketUrl: (state, getters) => {
|
||||
return state.protocol + ":" + getters['getUrl'] + "/websocket"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user