Skip to content
Closed
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
2 changes: 1 addition & 1 deletion be/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

libp2p:
listenMultiaddrs:
- /ip4/127.0.0.1/tcp/8080/ws
- /ip4/0.0.0.0/tcp/8080/ws
announceMultiaddrs:
- /ip4/127.0.0.1/tcp/8080/ws
# - /dns4/example.com/tcp/443/wss Example of multiaddr with Secure WebSockets
Expand Down
2 changes: 1 addition & 1 deletion be/src/start-libp2p-relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function startLibp2pRelay({
const peerMessageExchange = new PeerMessageExchangeProtocol({
protocolId: "/icod2/relay-peer-message-exchange/1.0.0",
});
peerMessageExchange.initialize(libp2p);
peerMessageExchange.initialize(libp2p, { skipHandleInitialization: false });

logger.info(
{ peerId, shortPeerId: shortenPeerId(peerId) },
Expand Down
54 changes: 53 additions & 1 deletion fe/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,63 @@
body {
margin: 0;
}

#root {
min-height: 100vh;
}

.preload {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100vh;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
color: #c089ff;
background: transparent;
opacity: 0;
animation: preload-fade 1500ms ease forwards;
animation-delay: 750ms;
}

.preload__spinner {
width: 48px;
height: 48px;
border: 4px solid rgba(192, 137, 255, 0.25);
border-top-color: #c089ff;
border-radius: 50%;
animation: preload-spin 1s linear infinite;
margin-bottom: 12px;
}

@keyframes preload-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@keyframes preload-fade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>
<title>Stashcrate</title>
</head>
<body>
<div id="root"></div>
<div id="root">
<div class="preload">
<div class="preload__spinner"></div>
<p>Loading Stashcrate...</p>
</div>
</div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
45 changes: 23 additions & 22 deletions fe/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Theme } from "@radix-ui/themes";
import { type FC, lazy, useEffect, useState } from "react";
import { type FC, useEffect, useState } from "react";
import {
createBrowserRouter,
Link,
Expand All @@ -9,22 +9,6 @@ import {
import Welcome from "./components/Box/sub-pages/Welcome";
import { MainLayout } from "./components/layout/MainLayout";

const LazyUnlockBox = lazy(
() => import("./components/Box/sub-pages/RestoreBoxes/LockedBox"),
);
const LazyLockBox = lazy(() =>
import("./components/Box/sub-pages/CreationBoxes").then((mod) => ({
default: mod.RootLockBox,
})),
);
const LazyComponentsDemo = lazy(() => import("./components/ComponentsDemo"));
const LazyCryptoPlayground = lazy(
() => import("./components/CryptoPlayground"),
);
const LazyDecodePlayground = lazy(
() => import("./components/DecodePlayground"),
);

function useSystemTheme() {
const [theme, setTheme] = useState<"light" | "dark">("light");

Expand Down Expand Up @@ -83,23 +67,40 @@ const router = createBrowserRouter([
children: [
{
path: "/crypto-poc",
Component: LazyCryptoPlayground,
async lazy() {
const mod = await import("./components/CryptoPlayground");
return { Component: mod.default };
},
},
{
path: "/components-demo",
Component: LazyComponentsDemo,
async lazy() {
const mod = await import("./components/ComponentsDemo");
return { Component: mod.default };
},
},
{
path: "/decode-poc",
Component: LazyDecodePlayground,
async lazy() {
const mod = await import("./components/DecodePlayground");
return { Component: mod.default };
},
},
{
path: "/unlock-box/:roomToken?",
Component: LazyUnlockBox,
async lazy() {
const mod = await import(
"./components/Box/sub-pages/RestoreBoxes/LockedBox"
);
return { Component: mod.default };
},
},
{
path: "/lock-box/:roomToken?",
Component: LazyLockBox,
async lazy() {
const mod = await import("./components/Box/sub-pages/CreationBoxes");
return { Component: mod.RootLockBox };
},
},
{
path: "/",
Expand Down
53 changes: 32 additions & 21 deletions fe/src/components/Box/sub-pages/Welcome.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type React from "react";
import type { ReactNode } from "react";
import { Link } from "react-router-dom";
import { NavLink } from "react-router-dom";
import { Button } from "@/ui/Button";
import { Typography } from "@/ui/Typography";

Expand All @@ -16,31 +16,37 @@ const Welcome: React.FC = () => {
<>
<p className="my-1">Start by creating a box. You’ll:</p>
<ul className="my-1">
<li>- Define the message or content you want to protect.</li>
<li>Define the message or content you want to protect.</li>
<li>
- Invite other keyholders (your friends or devices) to join.
Invite other keyholders (your friends or devices) to join.
</li>
<li>
- Set a key threshold (e.g. 3 out of 5) — the number of
keyholders required to unlock the box later
Set a key threshold (e.g. 3 out of 5) — the number of keyholders
required to unlock the box later
</li>
<li>
- Lock the Box, downloads yours and share the remainig Locked
Lock the Box, downloads yours and share the remainig Locked
Boxes with every keyholder
</li>
<li>
- Every Locked Box contains the same ecrypted message, but a
Every Locked Box contains the same ecrypted message, but a
different key.
</li>
</ul>
</>
}
buttonSlot={
<Link to="/lock-box" style={{ textDecoration: "none" }}>
<Button variant="prominent" className="text-nowrap">
Create Box
</Button>
</Link>
<NavLink to="/lock-box" style={{ textDecoration: "none" }}>
{({ isPending, isTransitioning }) => (
<Button
variant="prominent"
className="text-nowrap"
loading={isPending || isTransitioning}
>
Create Box
</Button>
)}
</NavLink>
}
/>
<InfoBox
Expand All @@ -53,22 +59,27 @@ const Welcome: React.FC = () => {
</p>
<ul className="my-1">
<li>
- At least the required number of keyholds (as set during
creation by Key Trehsold) agree to open it.
At least the required number of keyholds (as set during creation
by Key Trehsold) agree to open it.
</li>
<li>
- You’ll confirm your intent to unlock the content with
keyholders
You’ll confirm your intent to unlock the content with keyholders
</li>
</ul>
</>
}
buttonSlot={
<Link to="/unlock-box" style={{ textDecoration: "none" }}>
<Button variant="prominent" className="whitespace-nowrap">
Open a Locked Box
</Button>
</Link>
<NavLink to="/unlock-box" style={{ textDecoration: "none" }}>
{({ isPending, isTransitioning }) => (
<Button
variant="prominent"
className="whitespace-nowrap"
loading={isPending || isTransitioning}
>
Open a Locked Box
</Button>
)}
</NavLink>
}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion libs/protocols/src/peers-message-exchange-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class PeerMessageExchangeProtocol<

this.libp2p = libp2p;

if (skipHandleInitialization) {
if (skipHandleInitialization === false) {
registerProtoHandle(this.protocolId, libp2p, (message, peerId) => {
const jsonMessage = parseJsonSafely(message);
if (!jsonMessage) return;
Expand Down