diff --git a/common/crypto.ts b/common/crypto.ts index a427742..8d5a771 100644 --- a/common/crypto.ts +++ b/common/crypto.ts @@ -1,7 +1,7 @@ import bcrypt from 'bcryptjs'; -import * as U from '@common/utilities'; import * as C from '@common/constants'; +import * as U from '@common/utilities'; export async function attemptHash(password) { if (U.isEmpty(password)) { diff --git a/common/requests.ts b/common/requests.ts index 0037422..614aff8 100644 --- a/common/requests.ts +++ b/common/requests.ts @@ -5,7 +5,6 @@ import * as C from '@common/constants'; export const get = async (route, host = C.api.host): Promise => { try { const token = Cookies.get(C.auth); - let r = await fetch(`${host}${route}`, { method: 'GET', headers: { @@ -28,7 +27,7 @@ export const get = async (route, host = C.api.host): Promise => { return { error: j.error }; } - console.log(route, j); + return j; } catch (e) { console.log(route, e); @@ -38,7 +37,6 @@ export const get = async (route, host = C.api.host): Promise => { export const post = async (route, payload, host = C.api.host): Promise => { try { - const token = Cookies.get(C.auth); let r = await fetch(`${host}${route}`, { @@ -56,7 +54,6 @@ export const post = async (route, payload, host = C.api.host): Promise => { } const j = await r.json(); - if (!j) { return { error: 'No response from the server.' }; } @@ -67,7 +64,6 @@ export const post = async (route, payload, host = C.api.host): Promise => { return j; } catch (e) { - console.log(e); console.log(route, e); return { error: 'Something went wrong on our end' }; } @@ -100,7 +96,6 @@ export const put = async (route, payload, host = C.api.host): Promise => { return { error: j.error }; } - console.log(route, j); return j; } catch (e) { console.log(route, e); @@ -135,7 +130,6 @@ export const del = async (route: string, payload?: object, host = C.api.host): P return { error: j.error }; } - console.log(route, j); return j; } catch (e) { console.log(route, e); diff --git a/common/utilities.ts b/common/utilities.ts index c0d5c16..8ab2644 100644 --- a/common/utilities.ts +++ b/common/utilities.ts @@ -1,8 +1,8 @@ -import { FilecoinNumber, Converter } from '@glif/filecoin-number'; +import { FilecoinNumber } from '@glif/filecoin-number'; -import * as Cookies from '@vendor/cookie-cutter'; import * as C from '@common/constants'; import * as R from '@common/requests'; +import * as Cookies from '@vendor/cookie-cutter'; export const formatEstuaryRetrievalUrl = (cid: string) => { return `${C.api.host}/gw/ipfs/${cid}` @@ -33,7 +33,6 @@ export const pad = (num: number, size: number): any => { export const toDateSinceEpoch = (epoch) => { const d = new Date(1000 * (epoch * 30 + 1598306400)); - return toDate(d); }; @@ -103,7 +102,6 @@ export function inUSDPrice(number = 0, price = 0) { } export const getViewerFromFission = async ({ fs, path }) => { - console.log({ path }); const maybePathExists = await fs.exists(path); if (!maybePathExists) { @@ -114,12 +112,11 @@ export const getViewerFromFission = async ({ fs, path }) => { const token = await fs.read(path); if (!token) { - console.log('Failed to authenticate with Fission.'); return null; } const viewer = await getViewerFromToken(token); - console.log({ fissionSourcedViewer: viewer }); + return viewer; }; @@ -133,7 +130,7 @@ export const getViewerFromToken = async (token) => { }); const json = await response.json(); - console.log(json); + if (!json) { return null; } @@ -160,7 +157,7 @@ export const getViewerFromHeader = async (headers) => { }); const json = await response.json(); - console.log(json); + if (!json) { return null; } @@ -171,7 +168,6 @@ export const getViewerFromHeader = async (headers) => { return json; } catch (e) { - console.log(e); return null; } }; diff --git a/components/UploadFileContainer.tsx b/components/UploadFileContainer.tsx index 3a27c91..19100db 100644 --- a/components/UploadFileContainer.tsx +++ b/components/UploadFileContainer.tsx @@ -1,13 +1,13 @@ import styles from '@components/UploadFileContainer.module.scss'; -import * as React from 'react'; -import * as U from '@common/utilities'; import * as C from '@common/constants'; import * as R from '@common/requests'; +import * as U from '@common/utilities'; +import * as React from 'react'; -import LoaderSpinner from '@components/LoaderSpinner'; -import Button from '@components/Button'; import ActionRow from '@components/ActionRow'; +import Button from '@components/Button'; +import LoaderSpinner from '@components/LoaderSpinner'; import Cookies from 'js-cookie'; export default class UploadFileContainer extends React.Component { @@ -74,8 +74,6 @@ export default class UploadFileContainer extends React.Component { formData.append('data', this.state.data.file, this.state.data.filename); - console.log(formData); - this.setState({ mode: 4 }); this.props.onUploadFile({ staging: this.state.staging }); @@ -119,7 +117,6 @@ export default class UploadFileContainer extends React.Component { }; xhr.onloadend = (event: any) => { - console.log(event); if (event.target && event.target.status === 200 && event.target.response) { let json = {}; try { @@ -140,7 +137,7 @@ export default class UploadFileContainer extends React.Component { handleSelectFile = (e) => { e.persist(); - console.log('select file: ', e.target); + if (e.target.files.length == 0) { return; } @@ -153,7 +150,6 @@ export default class UploadFileContainer extends React.Component { handleDrop = (e) => { e.preventDefault(); e.stopPropagation(); - console.log('dropped a thing: ', e.dataTransfer.files); if (this.state.mode !== 3) { return; @@ -171,7 +167,6 @@ export default class UploadFileContainer extends React.Component { const file = e.dataTransfer.files[0]; this.setState({ loading: true }); - this.doFileUpload(file, file.name); }; diff --git a/components/UploadItem.tsx b/components/UploadItem.tsx index f578d09..73b1faa 100644 --- a/components/UploadItem.tsx +++ b/components/UploadItem.tsx @@ -1,14 +1,14 @@ import styles from '@components/UploadItem.module.scss'; -import * as React from 'react'; -import * as U from '@common/utilities'; import * as C from '@common/constants'; import * as R from '@common/requests'; +import * as U from '@common/utilities'; +import * as React from 'react'; -import Cookies from 'js-cookie'; -import ProgressBlock from '@components/ProgressBlock'; import ActionRow from '@components/ActionRow'; import LoaderSpinner from '@components/LoaderSpinner'; +import ProgressBlock from '@components/ProgressBlock'; +import Cookies from 'js-cookie'; export class PinStatusElement extends React.Component { state = { pinned: false, delegates: ['none'] }; @@ -17,10 +17,8 @@ export class PinStatusElement extends React.Component { const checkPinStatus = () => { window.setTimeout(async () => { const response = await R.get(`/pinning/pins/${this.props.id}`, this.props.host); - console.log(response); if (response.status === 'pinned') { - console.log('stop loop'); this.setState({ pinned: true, ...response }); this.forceUpdate(); return; @@ -38,7 +36,7 @@ export class PinStatusElement extends React.Component { return ( This CID is pinned. - Delegate {this.state.delegates && this.state.delegates.length > 0 ? this.state.delegates[0] : ""} + Delegate {this.state.delegates && this.state.delegates.length > 0 ? this.state.delegates[0] : ''} ); } @@ -64,7 +62,6 @@ export default class UploadItem extends React.Component { upload = async () => { if (this.state.loaded > 0) { - console.log('already attempted', this.props.file.id); return; } diff --git a/components/UploadZone.tsx b/components/UploadZone.tsx index 8784ef8..0203f51 100644 --- a/components/UploadZone.tsx +++ b/components/UploadZone.tsx @@ -1,11 +1,9 @@ import styles from '@components/UploadZone.module.scss'; import * as React from 'react'; -import * as U from '@common/utilities'; -import * as C from '@common/constants'; -import LoaderSpinner from '@components/LoaderSpinner'; import Button from '@components/Button'; +import LoaderSpinner from '@components/LoaderSpinner'; const MODES = { 1: 'WAITING', @@ -100,7 +98,6 @@ export default class UploadZone extends React.Component { handlePushFiles = async (files) => { for await (const file of files) { if (!file.type && file.size % 4096 == 0) { - console.log('folder', file); window.alert(`Estuary does not support folder upload at the moment, skipping "${file.name}"`); continue; } diff --git a/pages/admin/analytics.tsx b/pages/admin/analytics.tsx index 6b2f27f..7582937 100644 --- a/pages/admin/analytics.tsx +++ b/pages/admin/analytics.tsx @@ -43,10 +43,7 @@ function AdminAnalyticsPage(props: any) { console.log(response.error); return; } - - console.log(response); }; - run(); }, []); diff --git a/pages/admin/balance.tsx b/pages/admin/balance.tsx index e247249..2a57b58 100644 --- a/pages/admin/balance.tsx +++ b/pages/admin/balance.tsx @@ -24,9 +24,9 @@ const sendEscrow = async (state, setState, host) => { } const response = await R.post(`/admin/add-escrow/${state.amount}`, {}, host); - console.log(response); if (response.error) { + console.log(response.error); alert('Something went wrong, please try again.'); setState({ ...state, amount: 0, loading: false }); return; diff --git a/pages/admin/content.tsx b/pages/admin/content.tsx index 5d442c8..9c4fbd5 100644 --- a/pages/admin/content.tsx +++ b/pages/admin/content.tsx @@ -45,7 +45,6 @@ function AdminContentPage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get('/admin/cm/offload/candidates', props.api); - console.log(response); if (response && response.error) { return; diff --git a/pages/admin/impersonate.tsx b/pages/admin/impersonate.tsx index 40f8527..17ef104 100644 --- a/pages/admin/impersonate.tsx +++ b/pages/admin/impersonate.tsx @@ -47,7 +47,6 @@ const onSubmit = async (event, state, setState) => { return null; } - console.log('Impersonating...'); Cookies.set(C.auth, state.key); window.location.reload(); }; diff --git a/pages/admin/invites.tsx b/pages/admin/invites.tsx index c9c9324..9752e62 100644 --- a/pages/admin/invites.tsx +++ b/pages/admin/invites.tsx @@ -48,7 +48,7 @@ function AdminInvitesPage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get('/admin/invites', props.api); - console.log(response); + setState({ ...state, invites: response && response.length ? response.reverse() : [] }); }; @@ -75,7 +75,7 @@ function AdminInvitesPage(props: any) { setState({ ...state, loading: true }); await R.post(`/admin/invite/${state.key}`, {}, props.api); const response = await R.get('/admin/invites', props.api); - console.log(response); + setState({ ...state, loading: false, @@ -94,7 +94,7 @@ function AdminInvitesPage(props: any) { setState({ ...state, loading: true }); await R.post(`/admin/invite/${generatedKey}`, {}, props.api); const response = await R.get('/admin/invites', props.api); - console.log(response); + return setState({ ...state, loading: false, @@ -106,7 +106,7 @@ function AdminInvitesPage(props: any) { setState({ ...state, loading: true }); await R.post(`/admin/invite/${state.key}`, {}, props.api); const response = await R.get('/admin/invites', props.api); - console.log(response); + setState({ ...state, loading: false, diff --git a/pages/admin/providers.tsx b/pages/admin/providers.tsx index 3daf1e5..23b98f0 100644 --- a/pages/admin/providers.tsx +++ b/pages/admin/providers.tsx @@ -49,8 +49,6 @@ const refresh = async (state, setState, host) => { map[m.miner] = m; } - console.log(map); - const list = await R.get('/public/miners', host); const miners = list.map((each) => { diff --git a/pages/admin/shuttle.tsx b/pages/admin/shuttle.tsx index 0716796..21dc698 100644 --- a/pages/admin/shuttle.tsx +++ b/pages/admin/shuttle.tsx @@ -46,7 +46,7 @@ function AdminShuttlePage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get('/admin/shuttle/list', props.api); - console.log(response); + setState({ ...state, shuttles: response && response.length ? response : [] }); }; @@ -69,7 +69,7 @@ function AdminShuttlePage(props: any) { setState({ ...state, loading: true }); await R.post(`/admin/shuttle/init`, {}, props.api); const response = await R.get('/admin/shuttle/list', props.api); - console.log(response); + setState({ ...state, loading: false, shuttles: response && response.length ? response : [] }); }} > diff --git a/pages/admin/stats.tsx b/pages/admin/stats.tsx index 9f27196..d80dda7 100644 --- a/pages/admin/stats.tsx +++ b/pages/admin/stats.tsx @@ -82,8 +82,6 @@ function AdminStatsPage(props) { const sidebarElement = ; - console.log(props.viewer); - return ( } sidebar={sidebarElement}> diff --git a/pages/api-admin.tsx b/pages/api-admin.tsx index cffa910..d2d1d8a 100644 --- a/pages/api-admin.tsx +++ b/pages/api-admin.tsx @@ -40,7 +40,7 @@ const REDACTED_TOKEN_STRING = '•'.repeat(42); function APIPage(props: any) { const viewerToken = Cookie.get(C.auth); - console.log(viewerToken); + const [state, setState] = React.useState({ keys: [], loading: false }); const [showCreateKeyModal, setShowCreateKeyModal] = React.useState(false); const [showCreatePermanentKeyModal, setShowCreatePermanentKeyModal] = React.useState(false); @@ -48,8 +48,6 @@ function APIPage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get('/user/api-keys', props.api); - console.log(response); - if (response && !response.error) { setState({ ...state, keys: response }); } diff --git a/pages/api/fil-usd.ts b/pages/api/fil-usd.ts index 67d4bc6..b97654e 100644 --- a/pages/api/fil-usd.ts +++ b/pages/api/fil-usd.ts @@ -9,7 +9,6 @@ export default async function getPrice(req: any, res: any) { 'https://cloud.iexapis.com/stable/crypto/filusdt/price?token=pk_aa330a89a4724944ae1a525879a19f2d' ); json = await response.json(); - console.log(json); } catch (e) { console.log(e); return res.status(500).json({ error: 'Network price issue.' }); diff --git a/pages/content/[id].tsx b/pages/content/[id].tsx index 8fa9082..1759b96 100644 --- a/pages/content/[id].tsx +++ b/pages/content/[id].tsx @@ -33,8 +33,6 @@ function LocalContentPage(props) { const run = async () => { const response = await R.get(`/content/status/${props.id}`, props.api); - console.log(response); - if (response && !response.error) { return setState({ content: { ...response } }); } diff --git a/pages/deals/[id].tsx b/pages/deals/[id].tsx index ed0c013..950eea7 100644 --- a/pages/deals/[id].tsx +++ b/pages/deals/[id].tsx @@ -32,7 +32,7 @@ function DealPage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get(`/deals/status/${props.id}`, props.api); - console.log(response); + if (response && !response.error) { setState({ ...response }); } diff --git a/pages/errors/[id].tsx b/pages/errors/[id].tsx index 4b01811..9e268ae 100644 --- a/pages/errors/[id].tsx +++ b/pages/errors/[id].tsx @@ -32,7 +32,6 @@ function DealErrorPage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get(`/content/failures/${props.id}`, props.api); - console.log(response); if (response && response.length) { return setState({ logs: response }); diff --git a/pages/home.tsx b/pages/home.tsx index 23ebdc3..a980b60 100644 --- a/pages/home.tsx +++ b/pages/home.tsx @@ -73,9 +73,6 @@ function HomePage(props: any) { run(); }, []); - console.log(props.viewer); - console.log(state); - const sidebarElement = ; return ( diff --git a/pages/index.tsx b/pages/index.tsx index 0e9d4bc..868937b 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -40,7 +40,9 @@ function IndexPage(props: any) { try { miners = await R.get('/public/miners', props.api); stats = await R.get('/api/v1/stats/info', C.api.metricsHost); - } catch (e) {} + } catch (e) { + console.log(e); + } if ((miners && miners.error) || (stats && stats.error)) { return setState({ ...state, miners: [], totalStorage: 0, totalFilesStored: 0, totalObjectsRef: 0, ready: true }); diff --git a/pages/providers/deals/[id].tsx b/pages/providers/deals/[id].tsx index 68e26d2..4796bb6 100644 --- a/pages/providers/deals/[id].tsx +++ b/pages/providers/deals/[id].tsx @@ -23,9 +23,6 @@ function MinerDealsPage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get(`/public/miners/deals/${props.id}`, props.api); - - console.log(response); - if (response && response.length) { return setState({ logs: response }); } diff --git a/pages/providers/errors/[id].tsx b/pages/providers/errors/[id].tsx index d0263e2..1ba9f49 100644 --- a/pages/providers/errors/[id].tsx +++ b/pages/providers/errors/[id].tsx @@ -23,7 +23,6 @@ function MinerErrorPage(props: any) { React.useEffect(() => { const run = async () => { const response = await R.get(`/public/miners/failures/${props.id}`, props.api); - console.log(response); if (response && response.length) { return setState({ logs: response }); diff --git a/pages/providers/public/watch.tsx b/pages/providers/public/watch.tsx index a8b006b..2bc307c 100644 --- a/pages/providers/public/watch.tsx +++ b/pages/providers/public/watch.tsx @@ -106,8 +106,6 @@ function WatchProvidersPage(props: any) { const navigationElement = ; - console.log(state.providers); - return ( diff --git a/pages/settings.tsx b/pages/settings.tsx index f5a98dc..614f7d0 100644 --- a/pages/settings.tsx +++ b/pages/settings.tsx @@ -87,8 +87,6 @@ function SettingsPage(props: any) { const [address, setAddress] = React.useState(''); const [balance, setBalance] = React.useState(0); - console.log({ viewer }); - const sidebarElement = ; if (!viewer) { diff --git a/pages/sign-in.tsx b/pages/sign-in.tsx index fd7799a..00575c9 100644 --- a/pages/sign-in.tsx +++ b/pages/sign-in.tsx @@ -104,16 +104,12 @@ async function handleSignIn(state: any, host) { return { error: 'Failed to authenticate' }; } - console.log('Authenticated using legacy scheme.'); - Cookies.set(C.auth, retryJSON.token); - console.log('Attempting legacy scheme revision on your behalf'); - try { const response = await R.put('/user/password', { newPasswordHash: state.passwordHash }, host); } catch (e) { - console.log('Failure:', e); + console.log(e); } window.location.href = '/home'; @@ -129,7 +125,6 @@ async function handleSignIn(state: any, host) { return { error: 'Failed to authenticate' }; } - console.log('Authenticated using advanced scheme.'); Cookies.set(C.auth, j.token); window.location.href = '/home'; return; diff --git a/pages/staging/index.tsx b/pages/staging/index.tsx index 546ec61..02941b6 100644 --- a/pages/staging/index.tsx +++ b/pages/staging/index.tsx @@ -38,7 +38,6 @@ function StagingPage(props) { React.useEffect(() => { const run = async () => { const zones = await R.get('/content/staging-zones', props.api); - console.log(zones); if (!zones || zones.error) { return; @@ -50,8 +49,6 @@ function StagingPage(props) { run(); }, []); - console.log(props.viewer); - const sidebarElement = ; return ( diff --git a/pages/upload.tsx b/pages/upload.tsx index 9910361..027df9e 100644 --- a/pages/upload.tsx +++ b/pages/upload.tsx @@ -62,7 +62,6 @@ export default class UploadPage extends React.Component { _handleFile = async (file) => { if (!file) { - console.log('MISSING DATA'); return; } @@ -95,7 +94,6 @@ export default class UploadPage extends React.Component { }; render() { - console.log(this.state.files); const sidebarElement = ; return ( diff --git a/pages/verify-cid.tsx b/pages/verify-cid.tsx index a47bc88..d392653 100644 --- a/pages/verify-cid.tsx +++ b/pages/verify-cid.tsx @@ -62,11 +62,10 @@ const onCheckCID = async (state, setState, host) => { const response = await R.get(`/public/by-cid/${state.cid}`, host); if (response.error) { - return setState({ ...state, working: false, data: {error: response.error} }); + return setState({ ...state, working: false, data: { error: response.error } }); } if (history.pushState) { - console.log('Update search param.'); let searchParams = new URLSearchParams(window.location.search); searchParams.set('cid', state.cid); let newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + searchParams.toString(); @@ -179,7 +178,9 @@ function VerifyCIDPage(props: any) {

Request Error

There was an error verifying this CID

- {state.data.error.code}: {state.data.error.details} + + {state.data.error.code}: {state.data.error.details} +
); } diff --git a/pages/your-miners.tsx b/pages/your-miners.tsx index 3c02f4a..7c6bee6 100644 --- a/pages/your-miners.tsx +++ b/pages/your-miners.tsx @@ -48,7 +48,6 @@ const onGetMinerHex = async (e, state, setState, host) => { } setState({ ...state, hexmsg: response.hexmsg }); - console.log(response); }; const onClaimMiner = async (e, state, setState, host) => { @@ -90,8 +89,6 @@ function YourMinerPage(props: any) { const sidebarElement = ; - console.log(viewer); - return ( } sidebar={sidebarElement}>