webcam: fix default host fallback
Fallback to the loopback if unable to determine the local ip address. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
0188b81d4a
commit
6e253b0d42
|
@ -63,10 +63,9 @@ class WebcamManager:
|
||||||
machine: Machine = self.server.lookup_component("machine")
|
machine: Machine = self.server.lookup_component("machine")
|
||||||
pubnet = await machine.get_public_network()
|
pubnet = await machine.get_public_network()
|
||||||
ip: Optional[str] = pubnet.get("address")
|
ip: Optional[str] = pubnet.get("address")
|
||||||
default_host = f"http://{pubnet['hostname']}"
|
if ip:
|
||||||
if ip is not None:
|
|
||||||
default_host = f"http://{ip}"
|
default_host = f"http://{ip}"
|
||||||
WebCam.set_default_host(default_host)
|
WebCam.set_default_host(default_host)
|
||||||
db: MoonrakerDatabase = self.server.lookup_component("database")
|
db: MoonrakerDatabase = self.server.lookup_component("database")
|
||||||
saved_cams: Dict[str, Any] = await db.get_item("webcams", default={})
|
saved_cams: Dict[str, Any] = await db.get_item("webcams", default={})
|
||||||
for cam_data in saved_cams.values():
|
for cam_data in saved_cams.values():
|
||||||
|
|
Loading…
Reference in New Issue