Working send and updated account structure
This commit is contained in:
+6
-1
@@ -62,8 +62,13 @@ export default class Enclave<P = Page> {
|
||||
|
||||
const timestamp = Date.now();
|
||||
|
||||
if (!this.server?.serverPublicKey) {
|
||||
console.error("Server pubkey not initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
const signature = new TextEncoder().encode(
|
||||
`${timestamp}@${this.server?.hostname}@${content}`,
|
||||
`${timestamp}@${base58.encode(this.server?.serverPublicKey)}@${content}`,
|
||||
);
|
||||
|
||||
this.server?.websocket?.send({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Enclave from "@/app/app";
|
||||
import ChannelPage from "./channel/ChannelPage";
|
||||
import { Channel } from "@/app/protocol";
|
||||
import { Channel } from "@/lib/types";
|
||||
|
||||
export type ChannelPageProps = {
|
||||
kind: "channel";
|
||||
|
||||
@@ -20,8 +20,8 @@ export default function AccountCard({
|
||||
<Card className="px-3 py-3 h-full w-full flex flex-row">
|
||||
<div className="flex gap-2.5 items-center w-full">
|
||||
<Avatar className="h-full w-auto aspect-square">
|
||||
<AvatarImage src={account.avatar} />
|
||||
<AvatarFallback>{account.displayName[0]}</AvatarFallback>
|
||||
<AvatarImage src={account.meta.avatar} />
|
||||
<AvatarFallback>{account.meta.displayName[0]}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex flex-col w-full">
|
||||
<span
|
||||
@@ -34,7 +34,7 @@ export default function AccountCard({
|
||||
);
|
||||
}}
|
||||
>
|
||||
<p>{account.displayName}</p>
|
||||
<p>{account.meta.displayName}</p>
|
||||
<CopyIcon className="text-muted-foreground size-3" />
|
||||
</span>
|
||||
<span className="text-muted-foreground">Online</span>
|
||||
|
||||
@@ -68,16 +68,16 @@ export function NewProfilePage({
|
||||
|
||||
const { secretKey } = ed.keygen();
|
||||
|
||||
const newAccount = {
|
||||
displayName: name,
|
||||
privateKey: base58.encode(secretKey),
|
||||
avatar: avatar ?? undefined,
|
||||
};
|
||||
|
||||
appRef.current.accounts.activeAccount =
|
||||
appRef.current.accounts.accounts.length;
|
||||
|
||||
appRef.current.accounts.accounts.push(newAccount);
|
||||
appRef.current.accounts.accounts.push({
|
||||
meta: {
|
||||
displayName: name,
|
||||
avatar: avatar ?? undefined,
|
||||
},
|
||||
privateKey: base58.encode(secretKey),
|
||||
});
|
||||
|
||||
saveAccounts(appRef.current.accounts);
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Enclave from "@/app/app";
|
||||
import { Channel, ChannelKind } from "@/app/protocol";
|
||||
import { Channel, ChannelKind } from "@/lib/types";
|
||||
import { ChevronDown, ChevronUp, HashIcon } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import AccountCard from "./AccountCard";
|
||||
|
||||
Reference in New Issue
Block a user