mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 21:03:46 +00:00
wip inspector
This commit is contained in:
parent
7a5bb2b8b0
commit
f67b6fc4b1
8 changed files with 198 additions and 152 deletions
|
|
@ -51,10 +51,24 @@ const getDefaultEndpoint = () => {
|
|||
return origin;
|
||||
};
|
||||
|
||||
const getInitialConnection = () => {
|
||||
if (typeof window === "undefined") {
|
||||
return { endpoint: "http://127.0.0.1:2468", token: "" };
|
||||
}
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const urlParam = params.get("url")?.trim();
|
||||
const tokenParam = params.get("token") ?? "";
|
||||
return {
|
||||
endpoint: urlParam && urlParam.length > 0 ? urlParam : getDefaultEndpoint(),
|
||||
token: tokenParam
|
||||
};
|
||||
};
|
||||
|
||||
export default function App() {
|
||||
const issueTrackerUrl = "https://github.com/rivet-dev/sandbox-agent/issues/new";
|
||||
const [endpoint, setEndpoint] = useState(getDefaultEndpoint);
|
||||
const [token, setToken] = useState("");
|
||||
const initialConnectionRef = useRef(getInitialConnection());
|
||||
const [endpoint, setEndpoint] = useState(initialConnectionRef.current.endpoint);
|
||||
const [token, setToken] = useState(initialConnectionRef.current.token);
|
||||
const [connected, setConnected] = useState(false);
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
const [connectError, setConnectError] = useState<string | null>(null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue