Skip to content

Commit

Permalink
Fix 0.0.0.0-related issues (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi authored Oct 18, 2024
1 parent ce4d7fc commit 5dff0d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
21 changes: 18 additions & 3 deletions src/viser/_viser.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,15 @@ def request_share_url_no_return() -> None: # To suppress type error.

# Form status print.
port = server._port # Port may have changed.
http_url = f"http://{host}:{port}"
ws_url = f"ws://{host}:{port}"
if host == "0.0.0.0":
# 0.0.0.0 is not a real IP and people are often confused by it;
# we'll just print localhost. This is questionable from a security
# perspective, but probably fine for our use cases.
http_url = f"http://localhost:{port}"
ws_url = f"ws://localhost:{port}"
else:
http_url = f"http://{host}:{port}"
ws_url = f"ws://{host}:{port}"
table = Table(
title=None,
show_header=False,
Expand All @@ -613,7 +620,15 @@ def request_share_url_no_return() -> None: # To suppress type error.
)
table.add_row("HTTP", http_url)
table.add_row("Websocket", ws_url)
rich.print(Panel(table, title="[bold]viser[/bold]", expand=False))
rich.print(
Panel(
table,
title="[bold]viser[/bold]"
if host == "0.0.0.0"
else "[bold]viser[/bold]",
expand=False,
)
)

self._share_tunnel: ViserTunnel | None = None

Expand Down
3 changes: 2 additions & 1 deletion src/viser/client/src/Splatting/GaussianSplats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { shaderMaterial } from "@react-three/drei";
import { SorterWorkerIncoming } from "./SplatSortWorker";
import { create } from "zustand";
import { Object3D } from "three";
import { v4 as uuidv4 } from "uuid";

/**Global splat state.*/
interface SplatState {
Expand Down Expand Up @@ -253,7 +254,7 @@ export const SplatObject = React.forwardRef<
const setBuffer = splatContext((state) => state.setBuffer);
const removeBuffer = splatContext((state) => state.removeBuffer);
const nodeRefFromId = splatContext((state) => state.nodeRefFromId);
const name = React.useMemo(() => crypto.randomUUID(), [buffer]);
const name = React.useMemo(() => uuidv4(), [buffer]);

const [obj, setRef] = React.useState<THREE.Group | null>(null);

Expand Down

0 comments on commit 5dff0d5

Please sign in to comment.