Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cert status #196

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion client/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const StatusPage = lazy(
() => import(/* webpackChunkName: "Others" */ './routes/status/Status')
)
const AffiliateSalesPage = lazy(
() => import(/* webpackChunkName: "Others" */ './routes/affiliate/AffiliateStatus')
() =>
import(
/* webpackChunkName: "Others" */ './routes/affiliate/AffiliateStatus'
)
)
const WaitingRoom = lazy(
() =>
Expand All @@ -30,6 +33,11 @@ const OpenWidgetsPage = lazy(
/* webpackChunkName: "Others" */ './routes/openWidgets/OpenWidgetsPage'
)
)
const CertStatus = lazy(
() =>
import(/* webpackChunkName: "Others" */ './routes/cert-status/CertStatus')
)

console.log('### WaitingRoom', WaitingRoom)

const AppRoutes = () => {
Expand All @@ -45,6 +53,7 @@ const AppRoutes = () => {
<Route path="affiliatesales/" element={<AffiliateSalesPage />} />
<Route path="details/" element={<DetailsPage />} />
<Route path="live/" element={<LiveStreamPage />} />
<Route path="cert/" element={<CertStatus />} />
<Route path="*" element={<HomePage />} />
</Routes>
</Suspense>
Expand Down
14 changes: 7 additions & 7 deletions client/src/api/mainApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export interface Link {
export interface HtmlWidget {
id: string
attributes: {
any: string;
};
title: string;
owner: string;
any: string
}
title: string
owner: string
}

export const mainApi = {
Expand Down Expand Up @@ -136,10 +136,10 @@ export const mainApi = {
return base.post<HtmlWidget>(`/widgets/`, {
attributes,
owner,
title
title,
})
},

getHtmlWidget: (id: string) => base.get<HtmlWidget>(`/widgets/${id}`),

auth: async ({
Expand Down Expand Up @@ -167,4 +167,4 @@ export const mainApi = {
.then((result) => result.status === 200)
.catch(() => false)
},
}
}
48 changes: 45 additions & 3 deletions client/src/api/relayApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ export interface RenewNftMetada {
error?: string
}

export interface RenewCert {
success: boolean
sld?: string
mcJobId?: any
nakedJobId?: any
error?: any
certExist?: boolean
}

export const relayApi = () => {
return {
enableSubdomains: async (domainName: string) => {
Expand Down Expand Up @@ -97,12 +106,13 @@ export const relayApi = () => {
}
},
createCert: async ({ domain }: { domain: string }) => {
const {
data: { success, sld },
} = await base.post('/cert', { domain })
const response = await base.post('/cert', { domain })
const { success, wcJobId, nakedJobId, sld, error } = response.data
console.log('creatCert response', success, wcJobId, nakedJobId, sld)
return {
success,
sld,
error,
}
},
genNFT: async ({ domain }: { domain: string }) => {
Expand Down Expand Up @@ -163,6 +173,38 @@ export const relayApi = () => {
error,
}
},
certStatus: async ({ domain }: { domain: string }): Promise<any> => {
console.log('certStatus function', domain)
try {
const response = await base.post('/cert-job-lookup', { domain })
console.log('certStatus', domain, response)
return response.data
} catch (ex) {
console.log('certStatus error', ex)
return ex
}
},
renewCert: async ({ domain }: { domain: string }): Promise<RenewCert> => {
try {
const {
data: { success, sld, mcJobId, nakedJobId, error },
} = await base.post('/renew-cert', { domain })
return {
success,
sld,
mcJobId,
nakedJobId,
error,
}
} catch (e) {
console.log('renewCert', { e })
return {
success: false,
error: e,
certExist: !e.response.data.error.includes('does not exist'),
}
}
},
}
}

Expand Down
41 changes: 22 additions & 19 deletions client/src/components/widgets/MediaWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ import isUrl from 'is-url'
import { WidgetControls, WidgetsContainer } from './Widgets.styles'
import { loadEmbedJson } from '../../modules/embedly/embedly'
import { CloseCircle } from '../icons/CloseCircle'
import {Box} from "grommet/components/Box";
import {Text} from "grommet/components/Text";
import {Pin} from "../icons/Pin";
import { FiLink } from 'react-icons/fi';
import config from "../../../config";
import {Anchor} from "grommet";
import {useLocation} from "react-router";
import {toast} from "react-toastify";
import {getLevenshteinDistance} from "../../utils/string";
import { Box } from 'grommet/components/Box'
import { Text } from 'grommet/components/Text'
import { Pin } from '../icons/Pin'
import { FiLink } from 'react-icons/fi'
import config from '../../../config'
import { Anchor } from 'grommet'
import { useLocation } from 'react-router'
import { toast } from 'react-toastify'
import { getLevenshteinDistance } from '../../utils/string'
import IframeWidget from './IframeWidget'


const StakingWidget = lazy(
() => import(/* webpackChunkName: "StakingWidget" */ './StakingWidget')
)
Expand All @@ -32,8 +31,16 @@ interface Props {
onDelete: () => void
}

export const MediaWidget: React.FC<Props> = ({ domainName, value, type, uuid, isOwner, isPinned, onDelete, onPin }) => {

export const MediaWidget: React.FC<Props> = ({
domainName,
value,
type,
uuid,
isOwner,
isPinned,
onDelete,
onPin,
}) => {
const [widget, setWidget] = useState<any>()
const [isLoading, setLoading] = useState(true)
const [stakingValidator, setStakingValidator] = useState<string>('')
Expand Down Expand Up @@ -121,7 +128,7 @@ export const MediaWidget: React.FC<Props> = ({ domainName, value, type, uuid, is
if (isUrl(value)) {
loadData(value)
} else {
setLoading(false);
setLoading(false)
}

if (value === '1621679626610425857') {
Expand Down Expand Up @@ -175,12 +182,8 @@ export const MediaWidget: React.FC<Props> = ({ domainName, value, type, uuid, is
)}
<WidgetsContainer isWidgetLoading={isLoading} ref={ref}>
<Box pad={{ bottom: '2em' }}>
{
type === 'staking' && (<StakingWidget validator={stakingValidator} />)
}
{
type === 'iframe' && (<IframeWidget id={value} />)
}
{type === 'staking' && <StakingWidget validator={stakingValidator} />}
{type === 'iframe' && <IframeWidget id={value} />}
{!stakingValidator && widget && (!isLoading || inView) && (
<blockquote className="embedly-card" style={{ zIndex: '10' }}>
<h4>
Expand Down
26 changes: 14 additions & 12 deletions client/src/routes/affiliate/AffiliateStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,27 @@ const Stats = observer(() => {
<Container>
<Title>1Country Affiliate Sales</Title>
<FlexRow style={{ alignItems: 'left' }}>

<div id="container" style={{ display: 'flex', justifyContent: 'left' }}>
<iframe
title='numsales'
src='//plotly.com/~abhinav55/1.embed'
width='600'
height='500'
title="numsales"
src="//plotly.com/~abhinav55/1.embed"
width="600"
height="500"
/>
<div><h1><br /></h1></div>
<div>
<h1>
<br />
</h1>
</div>
<iframe
title='numsales'
src='//plotly.com/~abhinav55/3.embed'
width='600'
height='500'
title="numsales"
src="//plotly.com/~abhinav55/3.embed"
width="600"
height="500"
/>
</div>
</FlexRow>
</Container>

</Container>
)
})

Expand Down
Loading