1import { useState, useEffect, useMemo } from 'react';
2import { Just } from 'folktale/maybe';
3import * as ob from 'urbit-ob';
5import { usePointCursor } from 'store/pointCursor';
7const DOMAIN = 'arvo.network';
15export default function useLocalHosting() {
16 const [status, setStatus] = useState(STATE.UNKNOWN);
18 const { pointCursor } = usePointCursor();
21 const updateStatus = async point => {
22 const patp = ob.patp(point).slice(1);
24 const { who } = await fetch(
25 `https://${patp}.${DOMAIN}/who.json`
26 ).then(r => r.json());
28 setStatus(STATE.RUNNING);
30 setStatus(STATE.MISSING);
33 setStatus(STATE.MISSING);
36 if (Just.hasInstance(pointCursor)) {
37 updateStatus(pointCursor.value);
44 `https://${ob.patp(pointCursor.value).slice(1)}.${DOMAIN}`,
48 const running = useMemo(() => status === STATE.RUNNING, [status]);
50 return { running, url };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list