Skip to content

Commit

Permalink
mainnet deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ronykris committed Jan 13, 2025
1 parent 5e9056f commit 7fe5d6b
Show file tree
Hide file tree
Showing 13 changed files with 1,011 additions and 126 deletions.
Binary file added DeDA-logo-removebg-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions DeDA-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions canister_ids.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"deda_backend": {
"ic": "ds2zq-sqaaa-aaaag-atyyq-cai"
},
"deda_frontend": {
"ic": "d3zsm-eyaaa-aaaag-atyza-cai"
}
}
Binary file added icp-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
957 changes: 860 additions & 97 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/deda_frontend/public/.ic-assets.json5
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// See: https://github.com/WebAssembly/content-security-policy/blob/main/proposals/CSP.md.
// - We added img-src data: because data: images are used often.
// - frame-ancestors: none mitigates clickjacking attacks. See https://owasp.org/www-community/attacks/Clickjacking.
"Content-Security-Policy": "default-src 'self';script-src 'self' 'unsafe-eval';connect-src 'self' http://localhost:* https://icp0.io https://*.icp0.io https://icp-api.io;img-src 'self' data:;style-src * 'unsafe-inline';style-src-elem * 'unsafe-inline';font-src *;object-src 'none';base-uri 'self';frame-ancestors 'none';form-action 'self';upgrade-insecure-requests;",
"Content-Security-Policy": "default-src 'self';script-src 'self';connect-src 'self' <http://localhost:*> <https://icp0.io> <https://*.icp0.io> <https://icp-api.io> <https://ic0.app;img-src> 'self' data:;style-src * 'unsafe-inline';style-src-elem * 'unsafe-inline';font-src *;object-src 'none';base-uri 'self';frame-ancestors 'none';form-action 'self';upgrade-insecure-requests;",

// Security: The permissions policy disables all features for security reasons. If your site needs such permissions, activate them.
// To configure permissions go here https://www.permissionspolicy.com/
Expand Down
Binary file added src/deda_frontend/public/DeDA-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/deda_frontend/public/icp-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 11 additions & 5 deletions src/deda_frontend/src/components/AddDataRequestNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ import { Input } from "./ui/input"
import { useRecoilValue } from 'recoil';
import { userState } from '../state/userState';

const agent = new HttpAgent({ host: `http://localhost:4943/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}` });
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
const isLocal = process.env.DFX_NETWORK !== "ic";
const host = isLocal ? "http://localhost:4943" : "https://ic0.app";

const agent = new HttpAgent({ host: `${host}/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}` });
if (isLocal) {
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
}

const backend = Actor.createActor(idlFactory as any, { agent, canisterId: process.env.CANISTER_ID_DEDA_BACKEND as string });

interface DataRequest {
Expand Down
22 changes: 15 additions & 7 deletions src/deda_frontend/src/components/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ const LandingPage: React.FC = () => {
<p className="mt-8 max-w-lg text-xl/7 font-medium text-gray-950/75 sm:text-2xl/8">
Empowering Fair, Transparent, and Quality-Driven Data for AI and ML Innovation.
</p>
<div className="mt-12 flex flex-col gap-x-6 gap-y-4 sm:flex-row">
<a className="inline-flex items-center justify-center px-4 py-[calc(theme(spacing.2)-1px)] rounded-full border border-transparent bg-gray-950 shadow-md whitespace-nowrap text-base font-medium text-white data-[disabled]:bg-gray-950 data-[hover]:bg-gray-800 data-[disabled]:opacity-40" data-headlessui-state="" href="/dashboard">Get started</a>
{/* <a className="relative inline-flex items-center justify-center px-4 py-[calc(theme(spacing.2)-1px)] rounded-full border border-transparent bg-white/15 shadow-md ring-1 ring-[#D15052]/15 after:absolute after:inset-0 after:rounded-full after:shadow-[inset_0_0_2px_1px_#ffffff4d] whitespace-nowrap text-base font-medium text-gray-950 data-[disabled]:bg-white/15 data-[hover]:bg-white/20 data-[disabled]:opacity-40" data-headlessui-state="" href="/pricing">See pricing</a> */}
<div className="mt-12 flex flex-col gap-y-6 sm:gap-y-4 sm:flex-row">
<a className="inline-flex items-center justify-center px-4 py-2 rounded-full border border-transparent bg-gray-950 shadow-md text-base font-medium text-white hover:bg-gray-800 disabled:opacity-40"
href="/dashboard">Get started</a>
</div>
<div className="mt-6 flex flex-col gap-y-6 sm:gap-y-4 sm:flex-row">
<div className="relative pb-16 text-center sm:pb-24">
<img src="/icp-badge.svg" className='w-48 m-auto mt-2'/>
</div>
</div>
</div>
</div>
</div>
Expand All @@ -44,7 +49,8 @@ const LandingPage: React.FC = () => {
<div className="mt-10 grid grid-cols-1 gap-4 sm:mt-16 lg:grid-cols-6 lg:grid-rows-2">
<div className="max-lg:rounded-t-4xl lg:col-span-3 lg:rounded-tl-4xl group relative flex flex-col overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-black/5 data-[dark]:bg-gray-800 data-[dark]:ring-white/15">
<div className="relative h-80 shrink-0">
<div className="h-80 bg-[url(/1.jpg)] bg-cover bg-no-repeat" />
{/*<div className="h-80 bg-[url(/1.jpg)] bg-cover bg-no-repeat" />*/}
<img src="/1.jpg" alt="Background Image" className="h-80 w-full object-cover" />
<div className="absolute inset-0 bg-gradient-to-t from-white to-50% group-data-[dark]:from-gray-800 group-data-[dark]:from-[-25%]" />
</div>
<div className="relative p-10">
Expand All @@ -55,7 +61,7 @@ const LandingPage: React.FC = () => {
</div>
<div className="lg:col-span-3 lg:rounded-tr-4xl group relative flex flex-col overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-black/5 data-[dark]:bg-gray-800 data-[dark]:ring-white/15">
<div className="relative h-80 shrink-0">
<div className="h-80 bg-[url(/2.jpg)] bg-cover bg-no-repeat" />
<img src="/2.jpg" alt="Background Image" className="h-80 w-full object-cover" />
<div className="absolute inset-0 bg-gradient-to-t from-white to-50% group-data-[dark]:from-gray-800 group-data-[dark]:from-[-25%]"></div>
</div>
<div className="relative p-10">
Expand All @@ -66,7 +72,8 @@ const LandingPage: React.FC = () => {
</div>
<div className="lg:col-span-4 lg:rounded-bl-4xl group relative flex flex-col overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-black/5 data-[dark]:bg-gray-800 data-[dark]:ring-white/15">
<div className="relative h-80 shrink-0">
<div className="h-80 bg-[url(/4.jpg)] bg-cover bg-no-repeat" />
{/*<div className="h-80 bg-[url(/4.jpg)] bg-cover bg-no-repeat" />*/}
<img src="/4.jpg" alt="Background Image" className="h-80 w-full object-cover" />
<div className="absolute inset-0 bg-gradient-to-t from-white to-50% group-data-[dark]:from-gray-800 group-data-[dark]:from-[-25%]"></div>
</div>
<div className="relative p-10">
Expand All @@ -77,7 +84,8 @@ const LandingPage: React.FC = () => {
</div>
<div className="lg:col-span-2 group relative flex flex-col overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-black/5 data-[dark]:bg-gray-800 data-[dark]:ring-white/15">
<div className="relative h-80 shrink-0">
<div className="h-80 bg-[url(/3.jpg)] bg-cover bg-no-repeat" />
{/*<div className="h-80 bg-[url(/3.jpg)] bg-cover bg-no-repeat" />*/}
<img src="/3.jpg" alt="Background Image" className="h-80 w-full object-cover" />
<div className="absolute inset-0 bg-gradient-to-t from-white to-50% group-data-[dark]:from-gray-800 group-data-[dark]:from-[-25%]"></div>
</div>
<div className="relative p-10">
Expand Down
29 changes: 23 additions & 6 deletions src/deda_frontend/src/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ import { useNavigate } from 'react-router-dom';

const canisterId = process.env.CANISTER_ID_DEDA_BACKEND as string;

const isLocal = process.env.DFX_NETWORK !== "ic";
const host = isLocal ? "http://localhost:4943" : "https://ic0.app";

//const agent = new HttpAgent({host: "http://127.0.0.1:4943"}); //http://be2us-64aaa-aaaaa-qaabq-cai.localhost:4943/
const agent = new HttpAgent({host: `http://localhost:4943/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}`});
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
const agent = new HttpAgent({host: `${host}/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}`});
if (isLocal) {
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
}

const backend = Actor.createActor(deda_backend_idl as any, { agent, canisterId: canisterId });
console.log(backend);

Expand All @@ -36,9 +42,20 @@ const Login: React.FC = () => {
idleTimeout: 1000 * 60 * 60
}
});
const identityProvider = () => {
if (process.env.DFX_NETWORK === "local") {
return `http://${process.env.CANISTER_ID_INTERNET_IDENTITY}.localhost:4943`;
} else if (process.env.DFX_NETWORK === "ic") {
return `https://identity.ic0.app`;
} else {
return `https://identity.ic0.app`;
}
};

await authClient.login({
//identityProvider: `http://127.0.0.1:4943/?canisterId=${process.env.CANISTER_ID_INTERNET_IDENTITY}`,
identityProvider: `http://${process.env.CANISTER_ID_INTERNET_IDENTITY}.localhost:4943/`,
//identityProvider: `http://${process.env.CANISTER_ID_INTERNET_IDENTITY}.localhost:4943/`,
identityProvider: identityProvider(),
onSuccess: async () => {
console.log("Login successful");
const identity = authClient.getIdentity().getPrincipal().toString();
Expand Down
15 changes: 10 additions & 5 deletions src/deda_frontend/src/components/SubmitDataNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ import {
TabsTrigger,
} from "./ui/tabs"

const isLocal = process.env.DFX_NETWORK !== "ic";
const host = isLocal ? "http://localhost:4943" : "https://ic0.app";

const agent = new HttpAgent({ host: `${host}/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}` });
if (isLocal) {
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
}

const agent = new HttpAgent({ host: `http://localhost:4943/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}` });
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
const backend = Actor.createActor(idlFactory as any, { agent, canisterId: process.env.CANISTER_ID_DEDA_BACKEND as string });

interface DataSubmission {
Expand Down
16 changes: 11 additions & 5 deletions src/deda_frontend/src/components/uploadDataCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ import { Principal } from '@dfinity/principal';

const canisterId = process.env.CANISTER_ID_DEDA_BACKEND as string;

const agent = new HttpAgent({ host: `http://localhost:4943/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}` });
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
const isLocal = process.env.DFX_NETWORK !== "ic";
const host = isLocal ? "http://localhost:4943" : "https://ic0.app";

const agent = new HttpAgent({ host: `${host}/?canisterId=${process.env.CANISTER_ID_DEDA_FRONTEND}` });
if (isLocal) {
agent.fetchRootKey().catch(err => {
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
console.error(err);
});
}

const backend = Actor.createActor(deda_backend_idl as any, { agent, canisterId: canisterId });
console.log(backend);

Expand Down

0 comments on commit 7fe5d6b

Please sign in to comment.