Add crud for browser targets

This commit is contained in:
Owen
2026-05-15 14:07:48 -07:00
parent 00e1675f7b
commit 75b5afd544
20 changed files with 934 additions and 27 deletions

View File

@@ -35,6 +35,7 @@ declare module "react" {
type Target = {
ip: string;
port: number;
authToken: string;
};
type FormState = {
@@ -219,9 +220,16 @@ export default function RdpClient({
);
}
const destination = target ? `${target.ip}:${target.port}` : "";
if (!target) {
toast({
variant: "destructive",
title: "No target",
description: "No connection target available"
});
return;
}
console.log("Starting RDP session with destination:", destination);
const destination = `${target.ip}:${target.port}`;
const builder = userInteraction
.configBuilder()
@@ -232,7 +240,7 @@ export default function RdpClient({
`${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/gateway/rdp`
)
.withServerDomain(form.domain)
.withAuthToken("test-token")
.withAuthToken(target.authToken)
.withDesktopSize({
width: window.innerWidth,
height: window.innerHeight

View File

@@ -15,7 +15,7 @@ export default async function RdpPage() {
const host = headersList.get("host") || "";
const hostname = host.split(":")[0];
let target: { ip: string; port: number } | null = null;
let target: { ip: string; port: number; authToken: string } | null = null;
let error: string | null = null;
try {

View File

@@ -9,6 +9,7 @@ import { Label } from "@/components/ui/label";
type Target = {
ip: string;
port: number;
authToken: string;
};
type FormState = {
@@ -125,12 +126,18 @@ export default function SshClient({
setConnectError(null);
setConnecting(true);
if (!target) {
setConnectError("No target specified");
setConnecting(false);
return;
}
const proxyAddress = `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/gateway/ssh`;
const url = new URL(proxyAddress);
url.searchParams.set("host", target?.ip ?? "");
url.searchParams.set("port", String(target?.port ?? 22));
url.searchParams.set("host", target.ip ?? "");
url.searchParams.set("port", String(target.port ?? 22));
url.searchParams.set("username", form.username);
url.searchParams.set("authToken", "test-token");
url.searchParams.set("authToken", target.authToken ?? "");
const ws = new WebSocket(url.toString(), ["ssh"]);
wsRef.current = ws;

View File

@@ -15,7 +15,7 @@ export default async function SshPage() {
const host = headersList.get("host") || "";
const hostname = host.split(":")[0];
let target: { ip: string; port: number } | null = null;
let target: { ip: string; port: number; authToken: string } | null = null;
let error: string | null = null;
try {

View File

@@ -9,6 +9,7 @@ import { toast } from "@app/hooks/useToast";
type Target = {
ip: string;
port: number;
authToken: string;
};
type FormState = {
@@ -91,7 +92,7 @@ export default function VncClient({
const params = new URLSearchParams({
host: target.ip,
port: String(target.port),
authToken: "test-token"
authToken: target.authToken
});
const wsUrl = `${base}?${params.toString()}`;

View File

@@ -15,7 +15,7 @@ export default async function VncPage() {
const host = headersList.get("host") || "";
const hostname = host.split(":")[0];
let target: { ip: string; port: number } | null = null;
let target: { ip: string; port: number; authToken: string } | null = null;
let error: string | null = null;
try {