Compare commits

...

10 Commits

Author SHA1 Message Date
0c08c4024c Merge pull request 'chore(deps): update dependency @types/node to v24.10.7' (#34) from renovate/all-dependencies into main
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 4m47s
renovate / renovate (push) Successful in 37s
2026-01-10 18:00:52 +00:00
d36b14852f chore(deps): update dependency @types/node to v24.10.7 2026-01-10 18:00:50 +00:00
0682972459 Merge pull request 'chore(deps): update dependency @types/react to v19.2.8' (#33) from renovate/all-dependencies into main
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 4m44s
2026-01-10 10:00:55 +00:00
9a4b32b374 chore(deps): update dependency @types/react to v19.2.8 2026-01-10 10:00:52 +00:00
9ad57a408f Merge pull request 'chore(deps): update dependency @types/node to v24.10.6' (#32) from renovate/all-dependencies into main
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 4m49s
2026-01-10 02:00:53 +00:00
78c00d7af6 chore(deps): update dependency @types/node to v24.10.6 2026-01-10 02:00:50 +00:00
a5a2838448 Merge pull request 'chore(deps): update dependency @types/node to v24.10.5' (#31) from renovate/all-dependencies into main
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 7m12s
2026-01-10 01:00:53 +00:00
16efb43bec chore(deps): update dependency @types/node to v24.10.5 2026-01-10 01:00:51 +00:00
4824621d9c feat: implement the forwarder termination logic
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 5m57s
renovate / renovate (push) Successful in 48s
2026-01-06 18:34:37 +07:00
72108b1d3f feat: implement slug changing
Some checks failed
Docker Build and Push / build-and-push (push) Successful in 6m7s
renovate / renovate (push) Failing after 51s
2026-01-05 01:02:12 +07:00
3 changed files with 524 additions and 125 deletions

View File

@@ -0,0 +1,60 @@
import { auth } from "@/lib/auth";
import { headers } from "next/headers"
import { NextRequest } from "next/server";
export async function PATCH(req: NextRequest, context: { params: Promise<{ params: string[] }> }) {
const { params } = await context.params;
const requestHeaders = await headers();
const result = await auth.api.getToken({ headers: requestHeaders }).catch(() => null);
if (!result || typeof result !== "object" || !("token" in result)) {
return new Response("Unauthorized", { status: 401 });
}
const { token } = result as { token: string };
if (!token) {
return new Response("Unauthorized", { status: 401 });
}
const data = await fetch(`${process.env.API_URL}/api/session/${params.join("/")}`, {
method: "PATCH",
headers: {
authorization: `Bearer ${token}`,
},
cache: "no-store",
body: await req.text(),
})
return data;
}
export async function DELETE(req: NextRequest, context: { params: Promise<{ params: string[] }> }) {
const { params } = await context.params;
if (!params || params.length < 3) {
return new Response("Bad Request", { status: 400 });
}
const node = params[0]
const tunnelType = params[1]
const slug = params[2]
const requestHeaders = await headers();
const result = await auth.api.getToken({ headers: requestHeaders }).catch(() => null);
if (!result || typeof result !== "object" || !("token" in result)) {
return new Response("Unauthorized", { status: 401 });
}
const { token } = result as { token: string };
if (!token) {
return new Response("Unauthorized", { status: 401 });
}
const data = await fetch(`${process.env.API_URL}/api/session/${node}/${tunnelType}/${slug}`, {
method: "DELETE",
headers: {
authorization: `Bearer ${token}`,
},
cache: "no-store",
body: await req.text(),
})
return data;
}

View File

@@ -1,6 +1,6 @@
"use client" "use client"
import { useEffect, useState } from "react" import { useEffect, useState, type FormEvent } from "react"
import Link from "next/link" import Link from "next/link"
import { useRouter } from "next/navigation" import { useRouter } from "next/navigation"
import TunnelConfig, { type TunnelConfig as TunnelConfigType, type Server } from "@/components/tunnel-config" import TunnelConfig, { type TunnelConfig as TunnelConfigType, type Server } from "@/components/tunnel-config"
@@ -12,6 +12,8 @@ const defaultConfig: TunnelConfigType = {
localPort: 8000, localPort: 8000,
} }
const STOP_CONFIRMATION_TEXT = "YEAH SURE BUDDY"
const formatStartedAgo = (timestamp?: ApiTimestamp): string | undefined => { const formatStartedAgo = (timestamp?: ApiTimestamp): string | undefined => {
if (!timestamp) return undefined if (!timestamp) return undefined
const startedMs = timestamp.seconds * 1000 + Math.floor(timestamp.nanos / 1_000_000) const startedMs = timestamp.seconds * 1000 + Math.floor(timestamp.nanos / 1_000_000)
@@ -32,13 +34,13 @@ const toActiveConnection = (session: ApiSession): ActiveConnection => {
return { return {
id: session.slug || `${session.node}-${session.started_at?.seconds ?? Date.now()}`, id: session.slug || `${session.node}-${session.started_at?.seconds ?? Date.now()}`,
name: session.slug || session.node || "Unknown tunnel", name: session.slug || session.node || "Unknown tunnel",
slug: session.slug,
status: session.active ? "connected" : "error", status: session.active ? "connected" : "error",
protocol: (session.forwarding_type || "http").toLowerCase(), protocol: (session.forwarding_type || "http").toLowerCase(),
serverLabel: session.node || "Unknown node", serverLabel: session.node || "Unknown node",
node: session.node,
remote: session.slug ? `${session.slug}.${session.node}` : session.node || "—", remote: session.slug ? `${session.slug}.${session.node}` : session.node || "—",
startedAgo, startedAgo,
latencyMs: null,
dataInOut: undefined,
} }
} }
@@ -69,15 +71,15 @@ type ActiveConnectionStatus = "connected" | "pending" | "error"
type ActiveConnection = { type ActiveConnection = {
id: string id: string
name: string name: string
slug?: string
status: ActiveConnectionStatus status: ActiveConnectionStatus
protocol: string protocol: string
serverLabel: string serverLabel: string
node?: string
remote: string remote: string
localPort?: number localPort?: number
serverPort?: number serverPort?: number
startedAgo?: string startedAgo?: string
latencyMs?: number | null
dataInOut?: string
} }
export default function DashboardClient({ initialActiveConnections }: DashboardClientProps) { export default function DashboardClient({ initialActiveConnections }: DashboardClientProps) {
@@ -90,6 +92,25 @@ export default function DashboardClient({ initialActiveConnections }: DashboardC
) )
const { data: cachedSession } = authClient.useSession() const { data: cachedSession } = authClient.useSession()
const [session, setSession] = useState<SessionResponse["data"] | null>(cachedSession ?? null) const [session, setSession] = useState<SessionResponse["data"] | null>(cachedSession ?? null)
const [openActionId, setOpenActionId] = useState<string | null>(null)
const [stopModal, setStopModal] = useState<{
connectionId: string
node?: string
slug?: string
protocol?: string
name: string
} | null>(null)
const [stopModalInput, setStopModalInput] = useState("")
const [stopSaving, setStopSaving] = useState(false)
const [stopError, setStopError] = useState<string | null>(null)
const [slugModal, setSlugModal] = useState<{
connectionId: string
currentSlug: string
newSlug: string
node: string
} | null>(null)
const [slugError, setSlugError] = useState<string | null>(null)
const [slugSaving, setSlugSaving] = useState(false)
useEffect(() => { useEffect(() => {
setActiveConnections(initialActiveConnections.map(toActiveConnection)) setActiveConnections(initialActiveConnections.map(toActiveConnection))
@@ -101,133 +122,435 @@ export default function DashboardClient({ initialActiveConnections }: DashboardC
} }
}, [cachedSession, session]) }, [cachedSession, session])
const stopConnection = (id: string) => { const openStopModal = (connection: ActiveConnection) => {
setActiveConnections((prev) => prev.filter((conn) => conn.id !== id)) setStopModal({
setStatusMessage("Connection stopped") connectionId: connection.id,
node: connection.node || connection.serverLabel,
slug: connection.slug || connection.name,
protocol: connection.protocol,
name: connection.name,
})
setStopModalInput("")
setStopError(null)
setOpenActionId(null)
} }
return ( const closeStopModal = () => {
<main className="flex-1"> setStopModal(null)
<div className="max-w-7xl mx-auto px-4 py-8 space-y-6"> setStopModalInput("")
<div className="flex flex-col gap-1"> setStopSaving(false)
<h1 className="text-2xl font-semibold">Active Forwarding</h1> setStopError(null)
<p className="text-sm text-gray-400">Live tunnels for this session.</p> }
</div>
{statusMessage && ( const stopConnection = async () => {
<div className="rounded-lg border border-emerald-700 bg-emerald-900/40 px-4 py-3 text-sm text-emerald-200"> if (!stopModal) return
{statusMessage}
</div>
)}
<div className="rounded-lg border border-gray-800 bg-gray-900 p-5"> if (stopModalInput.trim() !== STOP_CONFIRMATION_TEXT) {
<div className="flex items-center justify-between mb-4"> setStopError("Please type the confirmation phrase exactly.")
<div> return
<h2 className="text-lg font-semibold">Active Connections</h2> }
<p className="text-sm text-gray-400">Monitor and manage your running tunnels</p>
const node = stopModal.node
const tunnelType = stopModal.protocol?.toLowerCase()
const slug = stopModal.slug
if (!node || !tunnelType || !slug) {
setStopError("Missing connection details; cannot stop.")
return
}
setStopSaving(true)
setStopError(null)
setStatusMessage(null)
try {
const endpoint = `/api/session/${encodeURIComponent(node)}/${encodeURIComponent(tunnelType)}/${encodeURIComponent(slug)}`
const response = await fetch(endpoint, {
method: "DELETE",
})
if (!response.ok) {
const message = await response.text()
setStopError(message || "Failed to stop connection.")
return
}
setActiveConnections((prev) => prev.filter((conn) => conn.id !== stopModal.connectionId))
setStatusMessage("Connection stopped")
closeStopModal()
} catch (error) {
console.error("Failed to stop connection", error)
setStopError("Failed to stop connection.")
} finally {
setStopSaving(false)
}
}
const openChangeSlugModal = (connection: ActiveConnection) => {
setSlugModal({
connectionId: connection.id,
currentSlug: connection.name,
newSlug: connection.name,
node: connection.node || connection.serverLabel,
})
setSlugError(null)
setOpenActionId(null)
}
const closeSlugModal = () => setSlugModal(null)
const validateSlug = (value: string): string | null => {
const trimmed = value.trim().toLowerCase()
if (trimmed.length < 3 || trimmed.length > 20) return "Slug must be 3-20 characters."
if (!/^[a-z0-9-]+$/.test(trimmed)) return "Only lowercase letters, numbers, and hyphens are allowed."
if (trimmed.startsWith("-") || trimmed.endsWith("-")) return "No leading or trailing hyphens."
return null
}
const submitSlugChange = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (!slugModal) return
const trimmedSlug = slugModal.newSlug.trim().toLowerCase()
const validationError = validateSlug(trimmedSlug)
setSlugError(validationError)
if (validationError) return
setSlugSaving(true)
setStatusMessage(null)
try {
const response = await fetch(`/api/session/${slugModal.node}`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ old: slugModal.currentSlug, new: trimmedSlug }),
})
if (!response.ok) {
const message = await response.text()
setSlugError(message || "Failed to update slug.")
return
}
setActiveConnections((prev) =>
prev.map((conn) =>
conn.id === slugModal.connectionId
? {
...conn,
name: trimmedSlug,
remote: conn.node ? `${trimmedSlug}.${conn.node}` : trimmedSlug,
}
: conn,
),
)
setStatusMessage("Slug updated")
setSlugModal(null)
} catch (error) {
console.error("Failed to update slug", error)
setSlugError("Failed to update slug.")
} finally {
setSlugSaving(false)
}
}
useEffect(() => {
if (slugModal || stopModal) {
const previousOverflow = document.body.style.overflow
document.body.style.overflow = "hidden"
return () => {
document.body.style.overflow = previousOverflow
}
}
}, [slugModal, stopModal])
useEffect(() => {
const closeOnEscape = (event: KeyboardEvent) => {
if (event.key === "Escape") {
setOpenActionId(null)
setSlugModal(null)
setStopModal(null)
}
}
window.addEventListener("keydown", closeOnEscape)
return () => window.removeEventListener("keydown", closeOnEscape)
}, [])
const stopModalContent = !stopModal
? null
: (
<div className="fixed inset-0 z-30 flex items-center justify-center bg-black/60 px-4">
<div className="w-full max-w-md rounded-lg border border-gray-800 bg-gray-900 p-6 shadow-xl">
<div className="flex items-start justify-between gap-4 mb-6">
<div className="flex items-start gap-3">
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-red-500/10 ring-1 ring-red-500/20">
<svg className="h-5 w-5 text-red-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
<div>
<h3 className="text-lg font-semibold text-white">Stop connection</h3>
<p className="mt-1 text-sm text-gray-400 leading-relaxed">
Type <span className="font-mono text-xs text-red-300 bg-red-950/50 px-1.5 py-0.5 rounded">{STOP_CONFIRMATION_TEXT}</span> to stop <span className="font-medium text-gray-300">{stopModal.slug || stopModal.name}</span> on {stopModal.node || "this node"}.
</p>
</div>
</div> </div>
<button <button
type="button" onClick={closeStopModal}
onClick={() => router.refresh()} className="flex h-8 w-8 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-gray-800 hover:text-gray-200"
className="text-sm text-emerald-400 hover:text-emerald-300" aria-label="Close modal"
> >
Refresh <svg className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</button> </button>
</div> </div>
{activeConnections.length === 0 ? ( <div className="mt-4 space-y-4">
<div className="rounded-lg border border-dashed border-gray-700 bg-gray-800/60 p-6 text-center text-gray-400"> <label className="block text-sm text-gray-300">
No active connections yet. Configure a tunnel to see it here. Confirmation phrase
<input
type="text"
value={stopModalInput}
onChange={(e) => {
setStopModalInput(e.target.value)
if (stopError) setStopError(null)
}}
placeholder={STOP_CONFIRMATION_TEXT}
className="mt-2 w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-white focus:border-emerald-500 focus:outline-none"
/>
</label>
{stopError && <p className="text-sm text-red-400">{stopError}</p>}
<div className="flex items-center justify-end gap-3">
<button
type="button"
onClick={closeStopModal}
className="rounded-md px-4 py-2 text-sm font-medium bg-gray-700 text-gray-200 border border-gray-700 hover:bg-gray-600 hover:border-gray-500"
disabled={stopSaving}
>
Cancel
</button>
<button
type="button"
onClick={stopConnection}
disabled={stopModalInput.trim() !== STOP_CONFIRMATION_TEXT || stopSaving}
className={`rounded-md px-4 py-2 text-sm font-medium text-white${stopModalInput.trim() === STOP_CONFIRMATION_TEXT && !stopSaving ? 'bg-red-600 hover:bg-red-700 border border-gray-500' : 'bg-red-900 hover:text-white-300 cursor-not-allowed border border-gray-700'}`}>
{stopSaving ? "Stopping..." : "Confirm stop"}
</button>
</div> </div>
) : ( </div>
<div className="space-y-3"> </div>
{activeConnections.map((connection) => { </div>
const metaParts: string[] = [] )
if (connection.localPort && connection.serverPort) {
metaParts.push(`Local ${connection.localPort} → Server ${connection.serverPort}`)
}
if (connection.startedAgo) {
metaParts.push(connection.startedAgo)
}
const metaText = metaParts.length > 0 ? metaParts.join(" · ") : "No session metadata yet"
return ( const slugModalContent = !slugModal
<div ? null
key={connection.id} : (
className="rounded-lg border border-gray-800 bg-gray-800/60 p-4 flex flex-col gap-3 md:flex-row md:items-center md:justify-between" <div className="fixed inset-0 z-20 flex items-center justify-center bg-black/60 px-4">
> <div className="w-full max-w-md rounded-lg border border-gray-800 bg-gray-900 p-6 shadow-xl">
<div className="space-y-1"> <div className="flex items-start justify-between gap-4">
<div className="flex items-center gap-2"> <div>
<span className="text-white font-medium">{connection.name}</span> <h3 className="text-lg font-semibold text-white">Change slug</h3>
<span <p className="text-sm text-gray-400">Update the identifier for this tunnel.</p>
className={`rounded-full px-2 py-0.5 text-xs font-semibold ${ </div>
connection.status === "connected" <button
onClick={closeSlugModal}
className="text-gray-400 hover:text-gray-200"
aria-label="Close modal"
>
×
</button>
</div>
<form onSubmit={submitSlugChange} className="mt-4 space-y-4">
<label className="block text-sm text-gray-300">
New slug
<input
type="text"
value={slugModal.newSlug}
onChange={(e) => {
const nextValue = e.target.value.toLowerCase()
setSlugModal((prev) => (prev ? { ...prev, newSlug: nextValue } : prev))
setSlugError(validateSlug(nextValue))
}}
className="mt-2 w-full rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-white focus:border-emerald-500 focus:outline-none"
placeholder={slugModal.currentSlug}
/>
{slugError && <p className="mt-2 text-sm text-red-400">{slugError}</p>}
</label>
<div className="flex items-center justify-end gap-3">
<button
type="button"
onClick={closeSlugModal}
className="rounded-md border border-gray-700 px-4 py-2 text-sm text-gray-200 hover:border-gray-500"
>
Cancel
</button>
<button
type="submit"
disabled={Boolean(slugError) || slugSaving}
className="rounded-md bg-emerald-600 px-4 py-2 text-sm font-medium text-white hover:bg-emerald-500 disabled:cursor-not-allowed disabled:opacity-60"
>
{slugSaving ? "Saving..." : "Save slug"}
</button>
</div>
</form>
</div>
</div>
)
return (
<>
<main className="flex-1">
<div className="max-w-7xl mx-auto px-4 py-8 space-y-6">
<div className="flex flex-col gap-1">
<h1 className="text-2xl font-semibold">Active Forwarding</h1>
<p className="text-sm text-gray-400">Live tunnels for this session.</p>
</div>
{statusMessage && (
<div className="rounded-lg border border-emerald-700 bg-emerald-900/40 px-4 py-3 text-sm text-emerald-200">
{statusMessage}
</div>
)}
<div className="rounded-lg border border-gray-800 bg-gray-900 p-5">
<div className="flex items-center justify-between mb-4">
<div>
<h2 className="text-lg font-semibold">Active Connections</h2>
<p className="text-sm text-gray-400">Monitor and manage your running tunnels</p>
</div>
<button
type="button"
onClick={() => router.refresh()}
className="text-sm text-emerald-400 hover:text-emerald-300"
>
Refresh
</button>
</div>
{activeConnections.length === 0 ? (
<div className="rounded-lg border border-dashed border-gray-700 bg-gray-800/60 p-6 text-center text-gray-400">
No active connections yet. Configure a tunnel to see it here.
</div>
) : (
<div className="space-y-3">
{activeConnections.map((connection) => {
const metaParts: string[] = []
if (connection.localPort && connection.serverPort) {
metaParts.push(`Local ${connection.localPort} → Server ${connection.serverPort}`)
}
if (connection.startedAgo) {
metaParts.push(connection.startedAgo)
}
const metaText = metaParts.length > 0 ? metaParts.join(" · ") : "No session metadata yet"
return (
<div
key={connection.id}
className="rounded-lg border border-gray-800 bg-gray-800/60 p-4 flex flex-col gap-3 md:flex-row md:items-center md:justify-between"
>
<div className="space-y-1">
<div className="flex items-center gap-2">
<span className="text-white font-medium">{connection.name}</span>
<span
className={`rounded-full px-2 py-0.5 text-xs font-semibold ${connection.status === "connected"
? "bg-emerald-900/60 text-emerald-300 border border-emerald-700" ? "bg-emerald-900/60 text-emerald-300 border border-emerald-700"
: connection.status === "pending" : connection.status === "pending"
? "bg-yellow-900/60 text-yellow-300 border border-yellow-700" ? "bg-yellow-900/60 text-yellow-300 border border-yellow-700"
: "bg-red-900/60 text-red-300 border border-red-700" : "bg-red-900/60 text-red-300 border border-red-700"
}`} }`}
> >
{connection.status === "connected" {connection.status === "connected"
? "Connected" ? "Connected"
: connection.status === "pending" : connection.status === "pending"
? "Reconnecting" ? "Reconnecting"
: "Error"} : "Error"}
</span> </span>
</div> </div>
<p className="text-sm text-gray-300"> <p className="text-sm text-gray-300">
{(connection.protocol || "http").toUpperCase()} · {connection.serverLabel} {(connection.protocol || "http").toUpperCase()} · {connection.serverLabel}
</p>
<p className="text-xs text-gray-400">{connection.remote || "—"}</p>
<p className="text-xs text-gray-500">{metaText}</p>
</div>
<div className="flex flex-wrap items-center gap-3 md:justify-end">
<div className="text-right">
<p className="text-sm text-gray-300">Latency</p>
<p className="text-lg font-semibold text-white">
{connection.latencyMs != null ? `${connection.latencyMs}ms` : "—"}
</p> </p>
</div> {(() => {
<div className="text-right"> const isTcp = connection.protocol === "tcp"
<p className="text-sm text-gray-300">Data</p> const isHttp = connection.protocol === "http" || connection.protocol === "https"
<p className="text-lg font-semibold text-white">{connection.dataInOut || "—"}</p> const httpRemote = connection.remote ? `https://${connection.remote}` : "—"
</div> const tcpRemote =
<button connection.node && connection.name
onClick={() => stopConnection(connection.id)} ? `tcp://${connection.node}:${connection.name}`
className="rounded-lg border border-gray-700 px-3 py-2 text-sm text-gray-200 hover:border-red-500 hover:text-red-200 transition" : connection.remote || "—"
>
Stop
</button>
</div>
</div>
)
})}
</div>
)}
</div>
<div className="rounded-lg border border-gray-800 bg-gray-900 p-5"> const displayRemote = isTcp ? tcpRemote : isHttp ? httpRemote : connection.remote || "—"
<div className="flex flex-col gap-2 mb-4 sm:flex-row sm:items-center sm:justify-between">
<div> return <p className="text-xs text-gray-400">{displayRemote}</p>
<h2 className="text-lg font-semibold">Custom Tunnel Configuration</h2> })()}
<p className="text-sm text-gray-400">Pick a location, test latency, and shape your tunnel exactly how you need.</p> <p className="text-xs text-gray-500">{metaText}</p>
</div> </div>
<Link href="/tunnel-not-found" className="text-sm text-emerald-400 hover:text-emerald-300">
View docs <div className="flex flex-wrap items-center gap-3 md:justify-end relative">
</Link> <button
onClick={() =>
setOpenActionId((current) => (current === connection.id ? null : connection.id))
}
className="rounded-lg border border-gray-700 px-3 py-2 text-sm text-gray-200 hover:border-gray-500 transition"
>
Actions
</button>
{openActionId === connection.id && (
<div className="absolute right-0 top-12 z-10 w-44 rounded-md border border-gray-700 bg-gray-800 shadow-lg">
<button
className="w-full px-3 py-2 text-left text-sm text-gray-200 hover:bg-gray-700"
onClick={() => openStopModal(connection)}
>
Stop connection
</button>
{connection.protocol !== "tcp" && (
<button
className="w-full px-3 py-2 text-left text-sm text-gray-200 hover:bg-gray-700"
onClick={() => openChangeSlugModal(connection)}
>
Change slug
</button>
)}
</div>
)}
</div>
</div>
)
})}
</div>
)}
</div> </div>
<TunnelConfig <div className="rounded-lg border border-gray-800 bg-gray-900 p-5">
config={tunnelConfig} <div className="flex flex-col gap-2 mb-4 sm:flex-row sm:items-center sm:justify-between">
onConfigChange={setTunnelConfig} <div>
selectedServer={selectedServer} <h2 className="text-lg font-semibold">Custom Tunnel Configuration</h2>
onServerSelect={setSelectedServer} <p className="text-sm text-gray-400">Pick a location, test latency, and shape your tunnel exactly how you need.</p>
isAuthenticated={Boolean(session)} </div>
userId={session?.user?.sshIdentifier} <Link href="/tunnel-not-found" className="text-sm text-emerald-400 hover:text-emerald-300">
/> View docs
</Link>
</div>
<TunnelConfig
config={tunnelConfig}
onConfigChange={setTunnelConfig}
selectedServer={selectedServer}
onServerSelect={setSelectedServer}
isAuthenticated={Boolean(session)}
userId={session?.user?.sshIdentifier}
/>
</div>
</div> </div>
</div> </main>
</main> {stopModalContent}
{slugModalContent}
</>
) )
} }

42
package-lock.json generated
View File

@@ -47,12 +47,14 @@
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/@better-auth/utils/-/utils-0.3.0.tgz", "resolved": "https://registry.npmjs.org/@better-auth/utils/-/utils-0.3.0.tgz",
"integrity": "sha512-W+Adw6ZA6mgvnSnhOki270rwJ42t4XzSK6YWGF//BbVXL6SwCLWfyzBc1lN2m/4RM28KubdBKQ4X5VMoLRNPQw==", "integrity": "sha512-W+Adw6ZA6mgvnSnhOki270rwJ42t4XzSK6YWGF//BbVXL6SwCLWfyzBc1lN2m/4RM28KubdBKQ4X5VMoLRNPQw==",
"license": "MIT" "license": "MIT",
"peer": true
}, },
"node_modules/@better-fetch/fetch": { "node_modules/@better-fetch/fetch": {
"version": "1.1.21", "version": "1.1.21",
"resolved": "https://registry.npmjs.org/@better-fetch/fetch/-/fetch-1.1.21.tgz", "resolved": "https://registry.npmjs.org/@better-fetch/fetch/-/fetch-1.1.21.tgz",
"integrity": "sha512-/ImESw0sskqlVR94jB+5+Pxjf+xBwDZF/N5+y2/q4EqD7IARUTSpPfIo8uf39SYpCxyOCtbyYpUrZ3F/k0zT4A==" "integrity": "sha512-/ImESw0sskqlVR94jB+5+Pxjf+xBwDZF/N5+y2/q4EqD7IARUTSpPfIo8uf39SYpCxyOCtbyYpUrZ3F/k0zT4A==",
"peer": true
}, },
"node_modules/@drizzle-team/brocli": { "node_modules/@drizzle-team/brocli": {
"version": "0.10.2", "version": "0.10.2",
@@ -1994,9 +1996,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.10.4", "version": "24.10.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.4.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.7.tgz",
"integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==", "integrity": "sha512-+054pVMzVTmRQV8BhpGv3UyfZ2Llgl8rdpDTon+cUH9+na0ncBVXj3wTUKh14+Kiz18ziM3b4ikpP5/Pc0rQEQ==",
"devOptional": true, "devOptional": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2009,6 +2011,7 @@
"integrity": "sha512-RmhMd/wD+CF8Dfo+cVIy3RR5cl8CyfXQ0tGgW6XBL8L4LM/UTEbNXYRbLwU6w+CgrKBNbrQWt4FUtTfaU5jSYQ==", "integrity": "sha512-RmhMd/wD+CF8Dfo+cVIy3RR5cl8CyfXQ0tGgW6XBL8L4LM/UTEbNXYRbLwU6w+CgrKBNbrQWt4FUtTfaU5jSYQ==",
"devOptional": true, "devOptional": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@types/node": "*", "@types/node": "*",
"pg-protocol": "*", "pg-protocol": "*",
@@ -2016,9 +2019,12 @@
} }
}, },
"node_modules/@types/react": { "node_modules/@types/react": {
"version": "19.2.7", "version": "19.2.8",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.8.tgz",
"integrity": "sha512-3MbSL37jEchWZz2p2mjntRZtPt837ij10ApxKfgmXCTuHWagYg7iA5bqPw6C8BMPfwidlvfPI/fxOc42HLhcyg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"csstype": "^3.2.2" "csstype": "^3.2.2"
} }
@@ -2151,6 +2157,7 @@
"version": "1.4.10", "version": "1.4.10",
"resolved": "https://registry.npmjs.org/@better-auth/core/-/core-1.4.10.tgz", "resolved": "https://registry.npmjs.org/@better-auth/core/-/core-1.4.10.tgz",
"integrity": "sha512-AThrfb6CpG80wqkanfrbN2/fGOYzhGladHFf3JhaWt/3/Vtf4h084T6PJLrDE7M/vCCGYvDI1DkvP3P1OB2HAg==", "integrity": "sha512-AThrfb6CpG80wqkanfrbN2/fGOYzhGladHFf3JhaWt/3/Vtf4h084T6PJLrDE7M/vCCGYvDI1DkvP3P1OB2HAg==",
"peer": true,
"dependencies": { "dependencies": {
"@standard-schema/spec": "^1.0.0", "@standard-schema/spec": "^1.0.0",
"zod": "^4.1.12" "zod": "^4.1.12"
@@ -2181,6 +2188,7 @@
"resolved": "https://registry.npmjs.org/better-call/-/better-call-1.1.7.tgz", "resolved": "https://registry.npmjs.org/better-call/-/better-call-1.1.7.tgz",
"integrity": "sha512-6gaJe1bBIEgVebQu/7q9saahVzvBsGaByEnE8aDVncZEDiJO7sdNB28ot9I6iXSbR25egGmmZ6aIURXyQHRraQ==", "integrity": "sha512-6gaJe1bBIEgVebQu/7q9saahVzvBsGaByEnE8aDVncZEDiJO7sdNB28ot9I6iXSbR25egGmmZ6aIURXyQHRraQ==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@better-auth/utils": "^0.3.0", "@better-auth/utils": "^0.3.0",
"@better-fetch/fetch": "^1.1.4", "@better-fetch/fetch": "^1.1.4",
@@ -2299,6 +2307,7 @@
"node_modules/d3-selection": { "node_modules/d3-selection": {
"version": "3.0.0", "version": "3.0.0",
"license": "ISC", "license": "ISC",
"peer": true,
"engines": { "engines": {
"node": ">=12" "node": ">=12"
} }
@@ -2391,6 +2400,7 @@
"integrity": "sha512-O9EC/miwdnRDY10qRxM8P3Pg8hXe3LyU4ZipReKOgTwn4OqANmftj8XJz1UPUAS6NMHf0E2htjsbQujUTkncCg==", "integrity": "sha512-O9EC/miwdnRDY10qRxM8P3Pg8hXe3LyU4ZipReKOgTwn4OqANmftj8XJz1UPUAS6NMHf0E2htjsbQujUTkncCg==",
"devOptional": true, "devOptional": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@drizzle-team/brocli": "^0.10.2", "@drizzle-team/brocli": "^0.10.2",
"@esbuild-kit/esm-loader": "^2.5.5", "@esbuild-kit/esm-loader": "^2.5.5",
@@ -2406,6 +2416,7 @@
"resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.45.1.tgz", "resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.45.1.tgz",
"integrity": "sha512-Te0FOdKIistGNPMq2jscdqngBRfBpC8uMFVwqjf6gtTVJHIQ/dosgV/CLBU2N4ZJBsXL5savCba9b0YJskKdcA==", "integrity": "sha512-Te0FOdKIistGNPMq2jscdqngBRfBpC8uMFVwqjf6gtTVJHIQ/dosgV/CLBU2N4ZJBsXL5savCba9b0YJskKdcA==",
"license": "Apache-2.0", "license": "Apache-2.0",
"peer": true,
"peerDependencies": { "peerDependencies": {
"@aws-sdk/client-rds-data": ">=3", "@aws-sdk/client-rds-data": ">=3",
"@cloudflare/workers-types": ">=4", "@cloudflare/workers-types": ">=4",
@@ -2545,6 +2556,7 @@
"devOptional": true, "devOptional": true,
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"peer": true,
"bin": { "bin": {
"esbuild": "bin/esbuild" "esbuild": "bin/esbuild"
}, },
@@ -2646,20 +2658,21 @@
"resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz", "resolved": "https://registry.npmjs.org/jose/-/jose-6.1.3.tgz",
"integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==", "integrity": "sha512-0TpaTfihd4QMNwrz/ob2Bp7X04yuxJkjRGi4aKmOqwhov54i6u79oCv7T+C7lo70MKH6BesI3vscD1yb/yzKXQ==",
"license": "MIT", "license": "MIT",
"peer": true,
"funding": { "funding": {
"url": "https://github.com/sponsors/panva" "url": "https://github.com/sponsors/panva"
} }
}, },
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/kysely": { "node_modules/kysely": {
"version": "0.28.9", "version": "0.28.9",
"resolved": "https://registry.npmjs.org/kysely/-/kysely-0.28.9.tgz", "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.28.9.tgz",
"integrity": "sha512-3BeXMoiOhpOwu62CiVpO6lxfq4eS6KMYfQdMsN/2kUCRNuF2YiEr7u0HLHaQU+O4Xu8YXE3bHVkwaQ85i72EuA==", "integrity": "sha512-3BeXMoiOhpOwu62CiVpO6lxfq4eS6KMYfQdMsN/2kUCRNuF2YiEr7u0HLHaQU+O4Xu8YXE3bHVkwaQ85i72EuA==",
"license": "MIT", "license": "MIT",
"peer": true,
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=20.0.0"
} }
@@ -2924,7 +2937,6 @@
"node_modules/loose-envify": { "node_modules/loose-envify": {
"version": "1.4.0", "version": "1.4.0",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"js-tokens": "^3.0.0 || ^4.0.0" "js-tokens": "^3.0.0 || ^4.0.0"
}, },
@@ -2974,6 +2986,7 @@
} }
], ],
"license": "MIT", "license": "MIT",
"peer": true,
"engines": { "engines": {
"node": "^20.0.0 || >=22.0.0" "node": "^20.0.0 || >=22.0.0"
} }
@@ -2989,6 +3002,7 @@
"resolved": "https://registry.npmjs.org/next/-/next-16.1.1.tgz", "resolved": "https://registry.npmjs.org/next/-/next-16.1.1.tgz",
"integrity": "sha512-QI+T7xrxt1pF6SQ/JYFz95ro/mg/1Znk5vBebsWwbpejj1T0A23hO7GYEaVac9QUOT2BIMiuzm0L99ooq7k0/w==", "integrity": "sha512-QI+T7xrxt1pF6SQ/JYFz95ro/mg/1Znk5vBebsWwbpejj1T0A23hO7GYEaVac9QUOT2BIMiuzm0L99ooq7k0/w==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@next/env": "16.1.1", "@next/env": "16.1.1",
"@swc/helpers": "0.5.15", "@swc/helpers": "0.5.15",
@@ -3068,7 +3082,6 @@
"node_modules/object-assign": { "node_modules/object-assign": {
"version": "4.1.1", "version": "4.1.1",
"license": "MIT", "license": "MIT",
"peer": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
@@ -3078,6 +3091,7 @@
"resolved": "https://registry.npmjs.org/pg/-/pg-8.16.3.tgz", "resolved": "https://registry.npmjs.org/pg/-/pg-8.16.3.tgz",
"integrity": "sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw==", "integrity": "sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"pg-connection-string": "^2.9.1", "pg-connection-string": "^2.9.1",
"pg-pool": "^3.10.1", "pg-pool": "^3.10.1",
@@ -3247,6 +3261,7 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
"license": "MIT", "license": "MIT",
"peer": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
@@ -3256,6 +3271,7 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"scheduler": "^0.27.0" "scheduler": "^0.27.0"
}, },
@@ -3265,8 +3281,7 @@
}, },
"node_modules/react-is": { "node_modules/react-is": {
"version": "16.13.1", "version": "16.13.1",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/react-simple-maps": { "node_modules/react-simple-maps": {
"version": "3.0.0", "version": "3.0.0",
@@ -3425,7 +3440,8 @@
"version": "4.1.18", "version": "4.1.18",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.18.tgz", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.18.tgz",
"integrity": "sha512-4+Z+0yiYyEtUVCScyfHCxOYP06L5Ne+JiHhY2IjR2KWMIWhJOYZKLSGZaP5HkZ8+bY0cxfzwDE5uOmzFXyIwxw==", "integrity": "sha512-4+Z+0yiYyEtUVCScyfHCxOYP06L5Ne+JiHhY2IjR2KWMIWhJOYZKLSGZaP5HkZ8+bY0cxfzwDE5uOmzFXyIwxw==",
"license": "MIT" "license": "MIT",
"peer": true
}, },
"node_modules/tailwindcss-animate": { "node_modules/tailwindcss-animate": {
"version": "1.0.7", "version": "1.0.7",