diff options
| author | polwex <polwex@sortug.com> | 2025-10-06 10:13:39 +0700 |
|---|---|---|
| committer | polwex <polwex@sortug.com> | 2025-10-06 10:13:39 +0700 |
| commit | 8751ba26ebf7b7761b9e237f2bf3453623dd1018 (patch) | |
| tree | dc37f12b3fd9b1a1e7a1b54a51c80697f37a04e8 /gui/src/logic/api.ts | |
| parent | 6704650dcfccf609ccc203308df9004e0b511bb6 (diff) | |
added frontend WS connection for demonstration purposes
Diffstat (limited to 'gui/src/logic/api.ts')
| -rw-r--r-- | gui/src/logic/api.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gui/src/logic/api.ts b/gui/src/logic/api.ts new file mode 100644 index 0000000..124be56 --- /dev/null +++ b/gui/src/logic/api.ts @@ -0,0 +1,15 @@ +import Urbit from "urbit-api"; + +export const URL = import.meta.env.PROD ? "" : "http://localhost:8090"; + +export async function start(): Promise<Urbit> { + const airlock = new Urbit(URL, ""); + const res = await fetch(URL + "/~/host"); + const ship = await res.text(); + airlock.ship = ship.slice(1); + airlock.our = ship; + airlock.desk = "nostrill"; + await airlock.poke({ app: "hood", mark: "helm-hi", json: "opening airlock" }); + await airlock.eventSource(); + return airlock; +} |
