@@ -14,7 +14,7 @@ const STATE = {
1414 PENDING: 'PENDING',
1515};
1616
17−function useHostingStore(url) {
17+function useHostingStore(url, domain, disabled) {
1818 const client = new SolarisClient(url);
1919
2020 const { pointCursor } = usePointCursor();
@@ -26,7 +26,6 @@ function useHostingStore(url) {
2626 const [status, _setStatus] = useState(STATE.UNKNOWN);
2727 const setStatus = useCallback(
2828 s => {
29− console.log(s);
3029 _setStatus(s);
3130 },
3231 [_setStatus]
@@ -63,7 +62,7 @@ function useHostingStore(url) {
6362
6463 const getEvents = useCallback(() => {
6564 try {
66− if (Nothing.hasInstance(pointCursor)) {
65+ if (Nothing.hasInstance(pointCursor) || disabled) {
6766 return;
6867 }
6968 const patp = ob.patp(pointCursor.value);
@@ -74,21 +73,15 @@ function useHostingStore(url) {
7473 const url = client.getShipsByPatpUrl(patp) + '/events';
7574 const source = new EventSource(url);
7675
77− // source.onerror = () => setStatus(STATE.UNKNOWN);
78− // source.onmessage = console.log;
79−
8076 source.addEventListener('sys', event => {
81− // console.log(event);
8277 const sysEvent = JSON.parse(event.data);
8378 const time = new Date(sysEvent.object.firstTimestamp).getTime();
8479 if (time > startTime) {
85− console.log(sysEvent);
8680 setSysEvents(previous => [...previous, sysEvent]);
8781 }
8882 });
8983
9084 source.addEventListener('new', event => {
91− // console.log(event);
9285 const elapsed = (Date.now() - startTime) / 1000;
9386 if (event.data !== '') {
9487 setNewEvents(previous => [...previous, event.data]);
@@ -96,7 +89,6 @@ function useHostingStore(url) {
9689 if (event.data === '1-b') {
9790 setBootMessage('Compiling Hoon');
9891 setBootProgress(0.2);
99− console.log(`${elapsed}: compiling Hoon`);
10092 } else if (event.data === '1-c') {
10193 setBootProgress(0.25);
10294 } else if (event.data === '%arvo-assembly') {
@@ -127,6 +119,7 @@ function useHostingStore(url) {
127119 }
128120 }, [
129121 setError,
122+ disabled,
130123 resetEvents,
131124 client,
132125 pointCursor,
@@ -137,7 +130,7 @@ function useHostingStore(url) {
137130
138131 syncStatus = useCallback(async () => {
139132 try {
140− if (Nothing.hasInstance(pointCursor)) {
133+ if (Nothing.hasInstance(pointCursor) || disabled) {
141134 return;
142135 }
143136 const patp = ob.patp(pointCursor.value);
@@ -166,7 +159,15 @@ function useHostingStore(url) {
166159 } catch (error) {
167160 setError(error);
168161 }
169− }, [client, getEvents, pointCursor, resetEvents, setError, setStatus]);
162+ }, [
163+ client,
164+ getEvents,
165+ pointCursor,
166+ resetEvents,
167+ setError,
168+ setStatus,
169+ disabled,
170+ ]);
170171
171172 const hostedShipUrl = useMemo(
172173 () =>
@@ -177,14 +178,13 @@ function useHostingStore(url) {
177178 const create = useCallback(
178179 async keyfile => {
179180 try {
180− if (Nothing.hasInstance(pointCursor)) {
181+ if (Nothing.hasInstance(pointCursor) || disabled) {
181182 return;
182183 }
183184 const patp = ob.patp(pointCursor.value).slice(1);
184185 setError(undefined);
185186
186187 const start = Date.now();
187− console.log(start);
188188 setStatus(STATE.PENDING);
189189 setBootProgress(0.1);
190190
@@ -204,7 +204,7 @@ function useHostingStore(url) {
204204 setError(error);
205205 }
206206 },
207− [pointCursor, setError, setStatus, client, getEvents]
207+ [pointCursor, setError, setStatus, client, getEvents, disabled]
208208 );
209209
210210 return {
@@ -226,6 +226,7 @@ function useHostingStore(url) {
226226 bootProgress,
227227 bootMessage,
228228
229+ disabled,
229230 // debugging
230231 status,
231232 };