fix: fix webcam url with multiple moonraker instances (#1713)
* fix: fix webcam url with multiple moonraker instances Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: fix webcam url with multiple moonraker instances Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: parse hostPort to int Signed-off-by: Stefan Dej <meteyou@gmail.com> --------- Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
5b02b1236b
commit
1ad34107b2
@ -14,7 +14,7 @@ export default class BaseMixin extends Vue {
|
||||
}
|
||||
|
||||
get hostPort(): number {
|
||||
return this.$store.state.socket.port ?? 80
|
||||
return parseInt(this.$store.state.socket.port ?? 80)
|
||||
}
|
||||
|
||||
get instancesDB() {
|
||||
|
@ -23,8 +23,12 @@ export default class WebcamMixin extends Mixins(BaseMixin) {
|
||||
// overwrite url to baseUrl, if it is an absolute URL
|
||||
if (baseUrl.startsWith('http') || baseUrl.startsWith('://')) url = new URL(baseUrl)
|
||||
|
||||
if (baseUrl.startsWith('/webcam') && ![80, 7125, 7130].includes(this.hostPort)) {
|
||||
url.port = this.hostPort.toString()
|
||||
if (baseUrl.startsWith('/webcam')) {
|
||||
const ports = [80]
|
||||
ports.push(this.$store.state.server.config?.config?.server?.port ?? 7125)
|
||||
ports.push(this.$store.state.server.config?.config?.server?.ssl_port ?? 7130)
|
||||
|
||||
if (!ports.includes(this.hostPort)) url.port = this.hostPort.toString()
|
||||
}
|
||||
|
||||
return decodeURIComponent(url.toString())
|
||||
|
Loading…
x
Reference in New Issue
Block a user