@@ -14,7 +14,7 @@ const STATE = {
14 PENDING: 'PENDING',
14 PENDING: 'PENDING',
17−function useHostingStore(url) {
17+function useHostingStore(url, domain, disabled) {
18 const client = new SolarisClient(url);
18 const client = new SolarisClient(url);
20 const { pointCursor } = usePointCursor();
20 const { pointCursor } = usePointCursor();
@@ -26,7 +26,6 @@ function useHostingStore(url) {
26 const [status, _setStatus] = useState(STATE.UNKNOWN);
26 const [status, _setStatus] = useState(STATE.UNKNOWN);
27 const setStatus = useCallback(
27 const setStatus = useCallback(
30 _setStatus(s);
29 _setStatus(s);
32 [_setStatus]
31 [_setStatus]
@@ -63,7 +62,7 @@ function useHostingStore(url) {
64 const getEvents = useCallback(() => {
63 const getEvents = useCallback(() => {
66− if (Nothing.hasInstance(pointCursor)) {
65+ if (Nothing.hasInstance(pointCursor) || disabled) {
69 const patp = ob.patp(pointCursor.value);
68 const patp = ob.patp(pointCursor.value);
@@ -74,21 +73,15 @@ function useHostingStore(url) {
74 const url = client.getShipsByPatpUrl(patp) + '/events';
73 const url = client.getShipsByPatpUrl(patp) + '/events';
75 const source = new EventSource(url);
74 const source = new EventSource(url);
77− // source.onerror = () => setStatus(STATE.UNKNOWN);
78− // source.onmessage = console.log;
80 source.addEventListener('sys', event => {
76 source.addEventListener('sys', event => {
81− // console.log(event);
82 const sysEvent = JSON.parse(event.data);
77 const sysEvent = JSON.parse(event.data);
83 const time = new Date(sysEvent.object.firstTimestamp).getTime();
78 const time = new Date(sysEvent.object.firstTimestamp).getTime();
84 if (time > startTime) {
79 if (time > startTime) {
85− console.log(sysEvent);
86 setSysEvents(previous => [...previous, sysEvent]);
80 setSysEvents(previous => [...previous, sysEvent]);
90 source.addEventListener('new', event => {
84 source.addEventListener('new', event => {
91− // console.log(event);
92 const elapsed = (Date.now() - startTime) / 1000;
85 const elapsed = (Date.now() - startTime) / 1000;
93 if (event.data !== '') {
86 if (event.data !== '') {
94 setNewEvents(previous => [...previous, event.data]);
87 setNewEvents(previous => [...previous, event.data]);
@@ -96,7 +89,6 @@ function useHostingStore(url) {
96 if (event.data === '1-b') {
89 if (event.data === '1-b') {
97 setBootMessage('Compiling Hoon');
90 setBootMessage('Compiling Hoon');
98 setBootProgress(0.2);
91 setBootProgress(0.2);
99− console.log(`${elapsed}: compiling Hoon`);
100 } else if (event.data === '1-c') {
92 } else if (event.data === '1-c') {
101 setBootProgress(0.25);
93 setBootProgress(0.25);
102 } else if (event.data === '%arvo-assembly') {
94 } else if (event.data === '%arvo-assembly') {
@@ -127,6 +119,7 @@ function useHostingStore(url) {
129 setError,
121 setError,
130 resetEvents,
123 resetEvents,
132 pointCursor,
125 pointCursor,
@@ -137,7 +130,7 @@ function useHostingStore(url) {
138 syncStatus = useCallback(async () => {
131 syncStatus = useCallback(async () => {
140− if (Nothing.hasInstance(pointCursor)) {
133+ if (Nothing.hasInstance(pointCursor) || disabled) {
143 const patp = ob.patp(pointCursor.value);
136 const patp = ob.patp(pointCursor.value);
@@ -166,7 +159,15 @@ function useHostingStore(url) {
166 } catch (error) {
159 } catch (error) {
167 setError(error);
160 setError(error);
169− }, [client, getEvents, pointCursor, resetEvents, setError, setStatus]);
162+ }, [
171 const hostedShipUrl = useMemo(
172 const hostedShipUrl = useMemo(
@@ -177,14 +178,13 @@ function useHostingStore(url) {
177 const create = useCallback(
178 const create = useCallback(
178 async keyfile => {
179 async keyfile => {
180− if (Nothing.hasInstance(pointCursor)) {
181+ if (Nothing.hasInstance(pointCursor) || disabled) {
183 const patp = ob.patp(pointCursor.value).slice(1);
184 const patp = ob.patp(pointCursor.value).slice(1);
184 setError(undefined);
185 setError(undefined);
186 const start = Date.now();
187 const start = Date.now();
188 setStatus(STATE.PENDING);
188 setStatus(STATE.PENDING);
189 setBootProgress(0.1);
189 setBootProgress(0.1);
@@ -204,7 +204,7 @@ function useHostingStore(url) {
204 setError(error);
204 setError(error);
207− [pointCursor, setError, setStatus, client, getEvents]
207+ [pointCursor, setError, setStatus, client, getEvents, disabled]
@@ -226,6 +226,7 @@ function useHostingStore(url) {
226 bootProgress,
226 bootProgress,
227 bootMessage,
227 bootMessage,
229 // debugging
230 // debugging