1import{j as e,r as t}from"./vendor-react-BenwEZ-b.js";import{b as O}from"./vendor-router-D8mXmlbA.js";import{H as F}from"./Header-43mo69Rn.js";import{g as V,s as K}from"./local-secrets-storage-CTZSZw6E.js";import"./dates-CpQPKctL.js";import"./vendor-icons-BFVy5pDx.js";import"./index-DCh_f_2J.js";import"./vendor-query-pLV57elM.js";function U(){const p=O(),[o,y]=t.useState(""),[s,f]=t.useState(""),[u,x]=t.useState("22"),[n,S]=t.useState("root"),[i,j]=t.useState(""),[H,C]=t.useState([]),[h,R]=t.useState(0),[Y,D]=t.useState(""),[T,P]=t.useState(!0),[g,v]=t.useState(!1),[l,d]=t.useState(!1),[k,b]=t.useState(""),[c,w]=t.useState(!1),[z,a]=t.useState(""),[A,E]=t.useState(!1);t.useEffect(()=>{const r=V();if(r.servers?.validated){R(r.servers.count);const m=r.servers.serverConfigs||[];C(m.map((B,I)=>({id:`local-${I}`,name:B.serverName,host:B.host})))}P(!1)},[]);async function W(){if(!o||!s||!n||!i){a("Please fill in all fields");return}v(!0),a(""),b("");try{const r=await fetch("/api/organization/servers",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverName:o,host:s,port:parseInt(u),sshUser:n,sshPrivateKey:i,testOnly:!0})}),m=await r.json();if(!r.ok)throw new Error(m.details||m.error||"Test failed");d(!0),b(m.testResult?.output||"Connection successful!"),alert("â
SSH connection successful!")}catch(r){console.error("SSH test error:",r),a(`Test failed: ${r.message}`),d(!1)}finally{v(!1)}}async function N(){if(!o||!s||!n||!i){a("Please fill in all fields");return}if(!l){a("Please test the SSH connection first");return}w(!0),a("");try{K({serverName:o,host:s,port:parseInt(u),sshUser:n,sshPrivateKey:i}),E(!0),y(""),f(""),x("22"),S("root"),j(""),d(!1),b("")}catch(r){console.error("Save server error:",r),a(`Failed to save: ${r.message}`)}finally{w(!1)}}return A?e.jsx("div",{style:{minHeight:"100vh",background:"linear-gradient(135deg, #1e293b 0%, #0f172a 100%)",padding:"2rem",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{maxWidth:"600px",background:"rgba(255, 255, 255, 0.05)",border:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"1rem",padding:"3rem",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"4rem",marginBottom:"1.5rem"},children:"â
"}),e.jsx("h1",{style:{fontSize:"2rem",fontWeight:700,color:"#10b981",marginBottom:"1rem"},children:"Server Configured Successfully!"}),e.jsx("p",{style:{fontSize:"1.1rem",color:"#94a3b8",marginBottom:"2rem",lineHeight:1.6},children:"Your server SSH key has been validated and saved. After deployment, it will be stored in your Fly.io app's encrypted secrets. VixPro AI can now monitor and manage this server."}),e.jsx("div",{style:{display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},children:e.jsx("button",{onClick:()=>p("/setup/configuration"),style:{padding:"0.75rem 2rem",background:"linear-gradient(135deg, #10b981 0%, #059669 100%)",color:"white",border:"none",borderRadius:"0.5rem",fontWeight:600,cursor:"pointer",fontSize:"1rem",boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},children:"Continue to Setup"})}),e.jsx("p",{style:{textAlign:"center",marginTop:"1.5rem",fontSize:"0.9rem",color:"#94a3b8"},children:"You can add more servers after deployment through the dashboard."})]})}):e.jsxs("div",{className:"main-layout",children:[e.jsx(F,{}),e.jsx("div",{className:"main-content",children:e.jsxs("div",{style:{maxWidth:"800px",margin:"0 auto"},children:[e.jsxs("div",{style:{marginBottom:"2rem",textAlign:"center"},children:[e.jsx("h1",{style:{fontSize:"2.5rem",fontWeight:700,marginBottom:"0.5rem"},children:"Add Server & SSH Key"}),e.jsxs("p",{style:{fontSize:"1.1rem",color:"var(--text-secondary)"},children:["Add ",e.jsx("strong",{children:"1 server"})," during onboarding. You can add more servers after deployment."]})]}),z&&e.jsx("div",{style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",borderRadius:"0.5rem",padding:"1rem",marginBottom:"1.5rem",color:"#fca5a5"},children:z}),!T&&h>0&&e.jsxs("div",{style:{background:"rgba(16, 185, 129, 0.1)",border:"1px solid rgba(16, 185, 129, 0.3)",borderRadius:"0.5rem",padding:"1.25rem",marginBottom:"1.5rem"},children:[e.jsxs("p",{style:{color:"#10b981",fontSize:"0.95rem",fontWeight:600,marginBottom:"0.75rem"},children:["â
Configured Servers: ",h]}),e.jsx("div",{style:{paddingLeft:"1.5rem"},children:H.map(r=>e.jsxs("div",{style:{color:"#86efac",fontSize:"0.9rem",marginBottom:"0.5rem"}
1,children:["⢠",r.name," (",r.host,")"]},r.id))})]}),e.jsxs("div",{style:{background:"rgba(59, 130, 246, 0.1)",border:"1px solid rgba(59, 130, 246, 0.3)",borderRadius:"0.5rem",padding:"1.25rem",marginBottom:"1.5rem"},children:[e.jsx("p",{style:{color:"#93c5fd",fontSize:"0.95rem",fontWeight:600,marginBottom:"0.5rem"},children:"â¹ï¸ Onboarding Requirement"}),e.jsxs("p",{style:{color:"#bfdbfe",fontSize:"0.9rem",lineHeight:1.6,margin:0},children:["Add ",e.jsx("strong",{children:"1 server only"})," during the onboarding process. After your agent is deployed, you can add your remaining servers (up to ","{plan limit}",") through the dashboard."]})]}),e.jsxs("div",{style:{background:"rgba(255, 255, 255, 0.05)",border:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"1rem",padding:"2rem",marginBottom:"2rem"},children:[e.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:600,color:"white",marginBottom:"1.5rem"},children:"ð How to Add a Server"}),e.jsxs("div",{style:{background:"rgba(0, 0, 0, 0.2)",border:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0.5rem",padding:"1.5rem",color:"#cbd5e1",fontSize:"0.9rem",lineHeight:1.6},children:[e.jsxs("ol",{style:{marginLeft:"1.5rem",marginBottom:"1.5rem"},children:[e.jsxs("li",{style:{marginBottom:"0.75rem"},children:[e.jsx("strong",{style:{color:"white"},children:"Enter server details:"}),e.jsx("br",{}),"Name, hostname/IP, port (default 22), and SSH user (default root)"]}),e.jsxs("li",{style:{marginBottom:"0.75rem"},children:[e.jsx("strong",{style:{color:"white"},children:"Paste your SSH private key:"}),e.jsx("br",{}),"The key must already have access to the server",e.jsx("br",{}),e.jsx("em",{style:{color:"#fbbf24",fontSize:"0.85rem"},children:"â ï¸ This will be validated and stored in your Fly.io app after deployment"})]}),e.jsxs("li",{style:{marginBottom:"0.75rem"},children:[e.jsx("strong",{style:{color:"white"},children:"Test the connection:"}),e.jsx("br",{}),"We'll verify VixPro AI can connect to your server"]}),e.jsxs("li",{children:[e.jsx("strong",{style:{color:"white"},children:"Save:"}),e.jsx("br",{}),"SSH key stored as ",e.jsxs("code",{style:{background:"rgba(0,0,0,0.3)",padding:"0.125rem 0.25rem"},children:["SSH_KEY_","{SERVER_NAME}"]})," in Fly.io encrypted secrets"]})]}),e.jsx("div",{style:{background:"rgba(59, 130, 246, 0.1)",border:"1px solid rgba(59, 130, 246, 0.3)",borderRadius:"0.5rem",padding:"1rem",marginTop:"1rem"},children:e.jsxs("p",{style:{color:"#93c5fd",fontSize:"0.85rem",margin:0},children:["ð¡ ",e.jsx("strong",{children:"Tip:"})," Use a dedicated SSH key for VixPro AI. You can create a new key pair with ",e.jsx("code",{style:{background:"rgba(0,0,0,0.3)",padding:"0.125rem 0.25rem"},children:"ssh-keygen -t ed25519"})," and add the public key to your server's ",e.jsx("code",{style:{background:"rgba(0,0,0,0.3)",padding:"0.125rem 0.25rem"},children:"authorized_keys"}),"."]})})]})]}),e.jsxs("div",{style:{background:"rgba(255, 255, 255, 0.05)",border:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"1rem",padding:"2rem",marginBottom:"2rem"},children:[e.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:600,color:"white",marginBottom:"1.5rem"},children:"ð¥ï¸ Server Configuration"}),e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsxs("label",{style:{display:"block",color:"#cbd5e1",fontSize:"0.9rem",marginBottom:"0.5rem"},children:["Server Name ",e.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),e.jsx("input",{type:"text",value:o,onChange:r=>{y(r.target.value),d(!1),a("")},placeholder:"prod-web-01",style:{width:"100%",padding:"0.75rem",background:"rgba(0, 0, 0, 0.3)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"0.5rem",color:"white",fontSize:"1rem"}}),e.jsxs("p",{style:{color:"#94a3b8",fontSize:"0.8rem",marginTop:"0.25rem"},children:["Alphanumeric and hyphens only. Used for secret naming: ssh-",o||"server-name"]})]}),e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsxs("label",{style:{display:"block",color:"#cbd5e1",fontSize:"0.9rem",marginBottom:"0.5rem"},children:["Host (IP or Domain) ",e.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),e.jsx("input",{type:"text",value:s,onChange:r=>{f(r.target.value),d(!1),a("")},placeholder:"192.168.1.100 or server.example.com",style:{width:"100%",padding:"0.75rem",background:"rgba(0, 0, 0, 0.3)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"0.5rem",color:"white",fontSize:"1rem"}})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr",gap:"1rem",marginBottom:"1.5rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",color:"#cbd5e1",fontSize:"0.9rem",marginBottom:"0.5rem"},children:"Port"}),e.jsx("input",{type:"number",value:u,onChange:r=>{x(r.target.value),d(!1),a("")},style:{width:"100%",padding:"0.75rem",background:"rgba(0, 0, 0, 0.3)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"0.5rem",color:"white",fontSize:"1rem"}})]}),e.jsxs("div",{children:[e.jsxs("label",{style:{display:"block",color:"#cbd5e1",fontSize:"0.9rem",marginBottom:"0.5rem"},children:["SSH User ",e.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),e.jsx("input",{type:"text",value:n,onChange:r=>{S(r.target.value),d(!1),a("")},style:{width:"100%",padding:"0.75rem",background:"rgba(0, 0, 0, 0.3)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"0.5rem",color:"white",fontSize:"1rem"}})]})]}),e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsxs("label",{style:{display:"block",color:"#cbd5e1",fontSize:"0.9rem",marginBottom:"0.5rem"},children:["SSH Private Key ",e.jsx("span",{style:{color:"#ef4444"},children:"*"})]}),e.jsx("textarea",{value:i,onChange:r=>{j(r.target.value),d(!1),a("")},placeholder:`-----BEGIN OPENSSH PRIVATE KEY----- 2... 3-----END OPENSSH PRIVATE KEY-----`,rows:8,style:{width:"100%",padding:"0.75rem",background:"rgba(0, 0, 0, 0.3)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"0.5rem",color:"white",fontSize:"0.9rem",fontFamily:"monospace",resize:"vertical"}})]}),k&&e.jsxs("div",{style:{background:"rgba(16, 185, 129, 0.1)",border:"1px solid rgba(16, 185, 129, 0.3)",borderRadius:"0.5rem",padding:"1rem",marginBottom:"1.5rem"},children:[e.jsx("p",{style:{color:"#10b981",fontSize:"0.85rem",fontWeight:600,marginBottom:"0.5rem"},children:"â Connection Test Output:"}),e.jsx("pre",{style:{color:"#86efac",fontSize:"0.8rem",fontFamily:"monospace",whiteSpace:"pre-wrap",margin:0},children:k})]}),e.jsx("button",{onClick:W,disabled:!o||!s||!n||!i||g,style:{padding:"0.75rem 1.5rem",background:l?"linear-gradient(135deg, #10b981 0%, #059669 100%)":"rgba(255, 255, 255, 0.1)",color:"white",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"0.5rem",fontWeight:600,cursor:!o||!s||!n||!i||g?"not-allowed":"pointer",fontSize:"1rem",opacity:!o||!s||!n||!i||g?.5:1,marginBottom:"1rem"},children:g?"Testing Connection...":l?"â Connection Tested":"Test SSH Connection"})]}),e.jsxs("div",{style:{background:"rgba(59, 130, 246, 0.1)",border:"1px solid rgba(59, 130, 246, 0.3)",borderRadius:"0.5rem",padding:"1.25rem",marginBottom:"1.5rem"},children:[e.jsxs("p",{style:{color:"#93c5fd",fontSize:"0.95rem",lineHeight:1.6,margin:0,marginBottom:"0.75rem"},children:["ð¡ ",e.jsx("strong",{children:"Where SSH Keys Are Saved:"})]}),e.jsxs("p",{style:{color:"#bfdbfe",fontSize:"0.9rem",lineHeight:1.6,margin:0,paddingLeft:"1.5rem"},children:[e.jsx("strong",{children:"During Onboarding (Before Deployment):"}),e.jsx("br",{}),"When you test and save your SSH key, it is temporarily stored in your browser's localStorage. This allows you to take breaks during setup without losing your progress.",e.jsx("br",{}),e.jsx("br",{}),e.jsx("strong",{children:"After Deployment to Fly.io:"}),e.jsx("br",{}),"Once you deploy your VixPro agent, the validated SSH key is securely transferred from localStorage to your Fly.io app's encrypted secret store as an environment variable.",e.jsx("br",{}),e.jsx("br",{}),"Saved as: ",e.jsxs("code",{style:{background:"rgba(0,0,0,0.3)",padding:"0.125rem 0.375rem",borderRadius:"0.25rem"},children:["ssh-",o||"{server-name}"]}),e.jsx("br",{}),e.jsx("br",{}),e.jsx("em",{style:{color:"#93c5fd",fontSize:"0.85rem"},children:"â SSH keys are stored in your isolated Fly.io container, not on our servers. Only your VixPro agent can access them."})]})]}),e.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"flex-end",flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>p("/setup/configuration"),style:{padding:"0.75rem 1.5rem",background:"rgba(255, 255, 255, 0.1)",color:"white",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"0.5rem",fontWeight:600,cursor:"pointer",fontSize:"1rem"},children:h>0?"Back to Setup":"Skip for Now"}),e.jsx("button",{onClick:N,disabled:!o||!s||!n||!i||!l||c,style:{padding:"0.75rem 1.5rem",background:!o||!s||!n||!i||!l||c?"rgba(16, 185, 129, 0.3)":"linear-gradient(135deg, #10b981 0%, #059669 100%)",color:"white",border:"none",borderRadius:"0.5rem",fontWeight:600,cursor:!o||!s||!n||!i||!l||c?"not-allowed":"pointer",fontSize:"1rem",boxShadow:!o||!s||!n||!i||!l||c?"none":"0 2px 8px rgba(16, 185, 129, 0.3)"},children:c?"Saving...":"Add Server"})]})]})})]})}function X(){return e.jsx(t.Suspense,{fallback:e.jsx("div",{style:{minHeight:"100vh",background:"linear-gradient(135deg, #1e293b 0%, #0f172a 100%)",display:"flex",alignItems:"center",justifyContent:"center",color:"white"},children:"Loading..."}),children:e.jsx(U,{})})}
3export{X as default}; 4//# sourceMappingURL=SetupServersPage-BCKC026d.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.