Correcting some bugs and working on responsive.

This commit is contained in:
charles-gauthereau
2024-11-23 21:15:14 +01:00
parent b22b8a9286
commit d1e98eaa11
3 changed files with 8 additions and 3 deletions
@@ -86,7 +86,7 @@ export default async function RoutePage(props: PageParams<{ agentId: string }>)
href={`/dashboard/agents/${agent.id}/edit`}> href={`/dashboard/agents/${agent.id}/edit`}>
<GearIcon className="w-7 h-7"/> <GearIcon className="w-7 h-7"/>
</Link> </Link>
<AgentModalKey> <AgentModalKey agent={agent}>
<Button variant="outline"> <Button variant="outline">
<KeyRound/> <KeyRound/>
</Button> </Button>
@@ -16,13 +16,17 @@ import {generateEdgeKey} from "@/utils/edge_key";
import {Copy} from "lucide-react"; import {Copy} from "lucide-react";
import {useState} from "react"; import {useState} from "react";
import {CopyButton} from "@/components/wrappers/copy-button"; import {CopyButton} from "@/components/wrappers/copy-button";
import {Agent} from "@prisma/client";
import {getServerUrl} from "@/utils/get-server-url";
export type agentRegistrationDialogProps = PropsWithChildren<{}> export type agentRegistrationDialogProps = PropsWithChildren<{
agent: Agent
}>
export function AgentModalKey(props: agentRegistrationDialogProps) { export function AgentModalKey(props: agentRegistrationDialogProps) {
const edge_key = generateEdgeKey('https://ok.com', '1234567'); const edge_key = generateEdgeKey(getServerUrl(), props.agent.id);
const code = `EDGE_KEY = ${edge_key}`; const code = `EDGE_KEY = ${edge_key}`;
return ( return (
+1
View File
@@ -4,6 +4,7 @@ export function generateEdgeKey(serverUrl: string, agentId: string): string {
serverUrl, serverUrl,
agentId, agentId,
}; };
console.log(edgeKeyData);
const edgeKeyJson = JSON.stringify(edgeKeyData); const edgeKeyJson = JSON.stringify(edgeKeyData);
const edgeKeyBuffer = Buffer.from(edgeKeyJson, 'utf-8'); const edgeKeyBuffer = Buffer.from(edgeKeyJson, 'utf-8');
const edgeKeyBase64 = edgeKeyBuffer.toString('base64').replace(/=+$/, '').replace(/\+/g, '-').replace(/\//g, '_'); const edgeKeyBase64 = edgeKeyBuffer.toString('base64').replace(/=+$/, '').replace(/\+/g, '-').replace(/\//g, '_');