+
+
Review Imported Hosts
+
+
+
+
+
+
+ {error && (
+
+ {error}
+
+ )}
+
+ {errors?.length > 0 && (
+
+
Issues found during parsing
+
+ {errors.map((e, i) => (
+ - {e}
))}
)}
- {/* Conflicts */}
- {hasConflicts && (
-
-
- Conflicts Detected ({conflicts.length})
-
-
- The following domains already exist. Choose how to handle each conflict:
-
-
- {conflicts.map((domain) => (
-
- {domain}
-
-
- ))}
-
-
- )}
-
- {/* Preview Hosts */}
-
-
-
- Hosts to Import ({hosts.length})
-
-
-
-
-
-
- |
- Domain
- |
-
- Forward To
- |
-
- SSL
- |
-
- Features
- |
-
-
-
- {hosts.map((host, idx) => {
- const isConflict = conflicts.includes(host.domain_names)
- return (
-
- |
-
- {host.domain_names}
- {isConflict && (
-
- Conflict
-
- )}
-
- |
-
-
- {host.forward_scheme}://{host.forward_host}:{host.forward_port}
-
- |
-
- {host.ssl_forced && (
-
- SSL
-
- )}
- |
-
-
- {host.http2_support && (
-
- HTTP/2
-
- )}
- {host.websocket_support && (
-
- WS
-
- )}
-
- |
-
- )
- })}
-
-
-
-
-
- {/* Actions */}
-
-
-
+
+
+
+
+ |
+ Domain Names
+ |
+
+ Conflict Resolution
+ |
+
+
+
+ {hosts.map((h, idx) => {
+ const domain = h.domain_names
+ const hasConflict = conflictDomains.includes(domain)
+ return (
+
+ |
+ {domain}
+ |
+
+ {hasConflict ? (
+
+ ) : (
+
+ No conflict
+
+ )}
+ |
+
+ )
+ })}
+
+
)
diff --git a/frontend/src/components/ProxyHostForm.tsx b/frontend/src/components/ProxyHostForm.tsx
index 5b16be54..3f98151e 100644
--- a/frontend/src/components/ProxyHostForm.tsx
+++ b/frontend/src/components/ProxyHostForm.tsx
@@ -1,6 +1,6 @@
-import { useState, useEffect } from 'react'
-import { ProxyHost, Location } from '../hooks/useProxyHosts'
-import { remoteServersAPI } from '../services/api'
+import { useState } from 'react'
+import type { ProxyHost } from '../api/proxyHosts'
+import { useRemoteServers } from '../hooks/useRemoteServers'
interface ProxyHostFormProps {
host?: ProxyHost
@@ -8,15 +8,6 @@ interface ProxyHostFormProps {
onCancel: () => void
}
-interface RemoteServer {
- uuid: string
- name: string
- provider: string
- host: string
- port: number
- enabled: boolean
-}
-
export default function ProxyHostForm({ host, onSubmit, onCancel }: ProxyHostFormProps) {
const [formData, setFormData] = useState({
domain_names: host?.domain_names || '',
@@ -29,48 +20,14 @@ export default function ProxyHostForm({ host, onSubmit, onCancel }: ProxyHostFor
hsts_subdomains: host?.hsts_subdomains ?? false,
block_exploits: host?.block_exploits ?? true,
websocket_support: host?.websocket_support ?? false,
- locations: host?.locations || [] as Location[],
+ advanced_config: host?.advanced_config || '',
enabled: host?.enabled ?? true,
})
- const [remoteServers, setRemoteServers] = useState
([])
+ const { servers: remoteServers } = useRemoteServers()
const [loading, setLoading] = useState(false)
const [error, setError] = useState(null)
- useEffect(() => {
- const fetchServers = async () => {
- try {
- const servers = await remoteServersAPI.list(true)
- setRemoteServers(servers)
- } catch (err) {
- console.error('Failed to fetch remote servers:', err)
- }
- }
- fetchServers()
- }, [])
-
- const addLocation = () => {
- setFormData({
- ...formData,
- locations: [
- ...formData.locations,
- { path: '/', forward_scheme: 'http', forward_host: '', forward_port: 80 }
- ]
- })
- }
-
- const removeLocation = (index: number) => {
- const newLocations = [...formData.locations]
- newLocations.splice(index, 1)
- setFormData({ ...formData, locations: newLocations })
- }
-
- const updateLocation = (index: number, field: keyof Location, value: any) => {
- const newLocations = [...formData.locations]
- newLocations[index] = { ...newLocations[index], [field]: value }
- setFormData({ ...formData, locations: newLocations })
- }
-
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
setLoading(true)
@@ -253,83 +210,18 @@ export default function ProxyHostForm({ host, onSubmit, onCancel }: ProxyHostFor
- {/* Custom Locations */}
+ {/* Advanced Config */}
-
-
-
-
-
-
- {formData.locations.map((location, index) => (
-
-
-
-
- updateLocation(index, 'path', e.target.value)}
- placeholder="/api"
- className="w-full bg-gray-800 border border-gray-600 rounded px-3 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
- />
-
-
-
-
-
-
-
- updateLocation(index, 'forward_host', e.target.value)}
- placeholder="10.0.0.1"
- className="w-full bg-gray-800 border border-gray-600 rounded px-3 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
- />
-
-
-
- updateLocation(index, 'forward_port', parseInt(e.target.value))}
- className="w-full bg-gray-800 border border-gray-600 rounded px-3 py-1 text-sm text-white focus:outline-none focus:ring-1 focus:ring-blue-500"
- />
-
-
-
-
-
-
- ))}
- {formData.locations.length === 0 && (
-
- No custom locations defined
-
- )}
-
+
+
{/* Actions */}
diff --git a/frontend/src/components/RemoteServerForm.tsx b/frontend/src/components/RemoteServerForm.tsx
index 0b6c5431..2fc635aa 100644
--- a/frontend/src/components/RemoteServerForm.tsx
+++ b/frontend/src/components/RemoteServerForm.tsx
@@ -1,59 +1,49 @@
-import { useState } from 'react'
-import { RemoteServer } from '../hooks/useRemoteServers'
-import { remoteServersAPI } from '../services/api'
+import { useEffect, useState } from 'react'
+import type { RemoteServer } from '../api/remoteServers'
-interface RemoteServerFormProps {
+interface Props {
server?: RemoteServer
onSubmit: (data: Partial