@undefineds.co/xpod 0.4.19 → 0.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/container/common.js +2 -1
- package/dist/api/handlers/AiConfigHandler.js +10 -2
- package/dist/runtime/host/node/NodeRuntimeHost.js +7 -3
- package/dist/runtime/port-finder.d.ts +0 -5
- package/dist/runtime/port-finder.js +24 -12
- package/node_modules/@undefineds.co/extension-sdk/dist/react/solid-auth-boundary.d.ts +20 -2
- package/node_modules/@undefineds.co/extension-sdk/dist/react/solid-auth-boundary.js +142 -125
- package/node_modules/@undefineds.co/shared-ui/dist/focus.d.ts +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/focus.js +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/index.d.ts +1 -0
- package/node_modules/@undefineds.co/shared-ui/dist/index.js +1 -0
- package/node_modules/@undefineds.co/shared-ui/dist/login/LoginModal.d.ts +2 -0
- package/node_modules/@undefineds.co/shared-ui/dist/login/LoginModal.js +2 -0
- package/node_modules/@undefineds.co/shared-ui/dist/login/LoginView.d.ts +3 -0
- package/node_modules/@undefineds.co/shared-ui/dist/login/LoginView.js +3 -0
- package/node_modules/@undefineds.co/shared-ui/dist/login.d.ts +15 -0
- package/node_modules/@undefineds.co/shared-ui/dist/login.js +15 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/AccountSections.d.ts +141 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/AccountSections.js +67 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/ConsentView.d.ts +53 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/ConsentView.js +27 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/DeviceDialogs.d.ts +40 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/DeviceDialogs.js +33 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpChrome.d.ts +15 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpChrome.js +8 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpViews.d.ts +93 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpViews.js +88 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/NetworkPanel.d.ts +46 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/NetworkPanel.js +42 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignIn.d.ts +63 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignIn.js +65 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignInFrame.d.ts +31 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignInFrame.js +111 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/StorageBadge.d.ts +8 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/StorageBadge.js +7 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/XpodMark.d.ts +8 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/XpodMark.js +8 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/account-parts.d.ts +37 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/account-parts.js +33 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/copy.d.ts +156 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/copy.js +304 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/index.d.ts +20 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/index.js +18 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/parts.d.ts +69 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/parts.js +65 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/types.d.ts +14 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/types.js +1 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/webid-name.d.ts +5 -0
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/webid-name.js +14 -0
- package/node_modules/@undefineds.co/shared-ui/dist/storage-bootstrap.d.ts +3 -0
- package/node_modules/@undefineds.co/shared-ui/dist/storage-bootstrap.js +3 -0
- package/node_modules/@undefineds.co/shared-ui/dist/theme.css +168 -83
- package/node_modules/@undefineds.co/shared-ui/dist/webid-auth.d.ts +5 -0
- package/node_modules/@undefineds.co/shared-ui/dist/webid-auth.js +5 -0
- package/package.json +2 -2
- package/static/app/assets/main.css +1 -1
- package/static/app/assets/main.js +55 -15
- package/static/dashboard/assets/{AiConfigContext-B5QP7ow2.js → AiConfigContext-CZEW16so.js} +1 -1
- package/static/dashboard/assets/{AiConfigPage-C_TdlUjq.js → AiConfigPage-Cfp0fRX1.js} +1 -1
- package/static/dashboard/assets/{DocumentProcessingPanel-CormNOdI.js → DocumentProcessingPanel-DaaRCLp6.js} +1 -1
- package/static/dashboard/assets/{IndexLifecyclePanel-S9wNNyHO.js → IndexLifecyclePanel-BCz3jNM8.js} +1 -1
- package/static/dashboard/assets/{IndexSubjectPanel-CofZT1oE.js → IndexSubjectPanel-DVCVIt7V.js} +1 -1
- package/static/dashboard/assets/ModelAssignmentsPanel-DxauxtEY.js +1 -0
- package/static/dashboard/assets/{ModelsPage-DZ46VnUh.js → ModelsPage-B8F3AtZL.js} +3 -3
- package/static/dashboard/assets/{NetworkPage-TwbIWASf.js → NetworkPage-Cu7ty71x.js} +2 -2
- package/static/dashboard/assets/{PaneListHeader-BtVnyutC.js → PaneListHeader-BEAXSlD9.js} +1 -1
- package/static/dashboard/assets/{SearchIndexingPanel-BCq_YMOP.js → SearchIndexingPanel-DEr1EDDC.js} +1 -1
- package/static/dashboard/assets/{StatusSubjectPanel-DsUKTysU.js → StatusSubjectPanel-Cg92MGhO.js} +1 -1
- package/static/dashboard/assets/{StatusWorkspace-CaVJBRqI.js → StatusWorkspace-BmJSOF3z.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsPage-DRWfPjtu.js → SystemSettingsPage-rziu4Q3U.js} +1 -1
- package/static/dashboard/assets/SystemSettingsSubjectPanel-D16DGDNW.js +33 -0
- package/static/dashboard/assets/{XpodAiConnectionsPodStore-C9tHqutw.js → XpodAiConnectionsPodStore-FlZ0LEn0.js} +1 -1
- package/static/dashboard/assets/{activity-tgjewO88.js → activity-D55X-5L5.js} +1 -1
- package/static/dashboard/assets/{badge-Czun47II.js → badge-CRf1ISRJ.js} +1 -1
- package/static/dashboard/assets/{collection-runtime-DnYlU23-.js → collection-runtime-CfXMuwNc.js} +1 -1
- package/static/dashboard/assets/dashboard-B3kGI946.css +1 -0
- package/static/dashboard/assets/{dashboard-CF8SbVSR.js → dashboard-D4DWPaAy.js} +122 -122
- package/static/dashboard/assets/{dialog-D-Yc_lg-.js → dialog-EVyIyybL.js} +1 -1
- package/static/dashboard/assets/{download-vFuOkjCi.js → download-Et4aRDT2.js} +1 -1
- package/static/dashboard/assets/{external-link-Cg_VIecD.js → external-link-DT746o7t.js} +1 -1
- package/static/dashboard/assets/{index-IXCNeEwi.js → index-D2agcVRx.js} +3 -3
- package/static/dashboard/assets/{index-0au0WwkE.js → index-_wC13YGI.js} +1 -1
- package/static/dashboard/assets/{index-YDcVky3o.js → index-z6TnJzW6.js} +1 -1
- package/static/dashboard/assets/{key-round-9n1xgLbG.js → key-round-CHnogQ1D.js} +1 -1
- package/static/dashboard/assets/{rotate-ccw-DJ6s86DW.js → rotate-ccw-BNVDC4Zr.js} +1 -1
- package/static/dashboard/assets/{skeleton-Dg9HePtI.js → skeleton-BzsZekVf.js} +1 -1
- package/static/dashboard/assets/{waypoints-uxc_qOzk.js → waypoints-CLZA22UN.js} +1 -1
- package/static/dashboard/assets/{workspace-layout-BNtAXhPW.js → workspace-layout-urYcwAhS.js} +1 -1
- package/static/dashboard/dashboard.html +2 -2
- package/static/settings/assets/{AiConfigContext-y6ha7pGs.js → AiConfigContext-B2cVJFNu.js} +1 -1
- package/static/settings/assets/AiConfigPage-D_5jSPPF.js +1 -0
- package/static/settings/assets/{DocumentProcessingPanel-Oa_cxMcn.js → DocumentProcessingPanel-DodGlYIk.js} +1 -1
- package/static/settings/assets/{IndexLifecyclePanel-DlrnI0Kh.js → IndexLifecyclePanel-BtH-0GKv.js} +1 -1
- package/static/settings/assets/{IndexSubjectPanel-Dhsl0W32.js → IndexSubjectPanel-CqKhUcw2.js} +1 -1
- package/static/settings/assets/ModelAssignmentsPanel-Cam9V9BN.js +1 -0
- package/static/settings/assets/{ModelsPage-CuNW1hGX.js → ModelsPage-DWFic09l.js} +3 -3
- package/static/settings/assets/{NetworkPage-BBD2Lc_P.js → NetworkPage-CSwHoAWm.js} +2 -2
- package/static/settings/assets/{PaneListHeader-C81adSBX.js → PaneListHeader-270Z179Z.js} +1 -1
- package/static/settings/assets/{SearchIndexingPanel-Dc4QKWd0.js → SearchIndexingPanel-ATHKMDBQ.js} +1 -1
- package/static/settings/assets/{StatusSubjectPanel-DuxOvqzS.js → StatusSubjectPanel-DDWo3v3d.js} +1 -1
- package/static/settings/assets/StatusWorkspace-BYgqeCBM.js +1 -0
- package/static/settings/assets/SystemSettingsPage-BRaQAFWC.js +1 -0
- package/static/settings/assets/SystemSettingsSubjectPanel-Dc0roh9d.js +33 -0
- package/static/settings/assets/{XpodAiConnectionsPodStore-G0ClZksP.js → XpodAiConnectionsPodStore-OndzbigX.js} +2 -2
- package/static/settings/assets/{activity-DT8pzOea.js → activity-BAZEToJ3.js} +1 -1
- package/static/settings/assets/auth-callback-Bd3tvCOa.js +1 -0
- package/static/settings/assets/{badge-CvKRjSY2.js → badge-Cpol0LWF.js} +1 -1
- package/static/settings/assets/{collection-runtime-C6ZAp2cM.js → collection-runtime-B5vGx3gk.js} +1 -1
- package/static/settings/assets/{dialog-LFluK7Nx.js → dialog-_7AVvv5q.js} +1 -1
- package/static/settings/assets/{download-CZJeqUm1.js → download-DRAi-dnn.js} +1 -1
- package/static/settings/assets/{external-link-BsDft3Oe.js → external-link--Yq8inDb.js} +1 -1
- package/static/settings/assets/global-B3kGI946.css +1 -0
- package/static/settings/assets/{global-cmKEraT4.js → global-DMtP8ZF4.js} +111 -111
- package/static/settings/assets/{index-BiqSFOS1.js → index-C36H49PZ.js} +1 -1
- package/static/settings/assets/{index-XRgmPBKw.js → index-CQR3iePj.js} +1 -1
- package/static/settings/assets/{index-BMPlaRWG.js → index-DURnCfoQ.js} +1 -1
- package/static/settings/assets/{index-browser-B0slhJKc.js → index-browser-kAl2JmYB.js} +1 -1
- package/static/settings/assets/{key-round-D1XsWbN_.js → key-round-DzpWBVN9.js} +1 -1
- package/static/settings/assets/{rotate-ccw-CEe0P0fY.js → rotate-ccw-CtVsCcAx.js} +1 -1
- package/static/settings/assets/settings-DQtt6lql.js +1 -0
- package/static/settings/assets/{skeleton-DA404w6m.js → skeleton-R_ACks7d.js} +1 -1
- package/static/settings/assets/{waypoints-DJDWc4S9.js → waypoints-D-Qv_sME.js} +1 -1
- package/static/settings/assets/{workspace-layout-K38jT4OV.js → workspace-layout-BSMCQq35.js} +1 -1
- package/static/settings/auth-callback.html +3 -3
- package/static/settings/settings.html +3 -3
- package/static/dashboard/assets/ModelAssignmentsPanel-9tgOjj-y.js +0 -1
- package/static/dashboard/assets/SystemSettingsSubjectPanel-CgDP7Ii2.js +0 -33
- package/static/dashboard/assets/dashboard-DvuM3VTP.css +0 -1
- package/static/settings/assets/AiConfigPage-CIcIWdXA.js +0 -1
- package/static/settings/assets/ModelAssignmentsPanel-CHoiRZeL.js +0 -1
- package/static/settings/assets/StatusWorkspace-DeD3zi3G.js +0 -1
- package/static/settings/assets/SystemSettingsPage-8sHOaPb8.js +0 -1
- package/static/settings/assets/SystemSettingsSubjectPanel-B1JXut7S.js +0 -33
- package/static/settings/assets/auth-callback-1BlsOtMG.js +0 -1
- package/static/settings/assets/global-DvuM3VTP.css +0 -1
- package/static/settings/assets/settings-DfjkqEJ8.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as I,q as xe,r as d,U,j as e,C as k,a as C,b as S,d as P,e as R,B as g,
|
|
2
|
-
`)}function bt(){const t=xe(),[n,r]=d.useState(),[i,s]=d.useState([]),[o,l]=d.useState(),[x,u]=d.useState(),[y,h]=d.useState(!1),[D,T]=d.useState(!1),[B,E]=d.useState(!1),[$,F]=d.useState(!1),[a,m]=d.useState(),v=d.useRef(0),N=d.useRef(0),z=d.useRef(0),V=d.useRef(void 0),H=d.useRef(!0),K=typeof window>"u"?void 0:window.location.origin,w=K?`local-host:${K}`:void 0,A=globalThis.fetch;d.useEffect(()=>(H.current=!0,()=>{H.current=!1,v.current+=1,N.current+=1,z.current+=1}),[]);const W=d.useCallback((c,p)=>H.current&&v.current===c&&V.current===p,[]),G=d.useCallback((c,p)=>H.current&&N.current===c&&V.current===p,[]),J=d.useCallback((c,p)=>H.current&&z.current===c&&V.current===p,[]),_=d.useCallback(async()=>{const c=w;if(!c)return;const p=v.current+1;v.current=p,h(!0),u(void 0);try{const L=await Ue({fetchImpl:A});W(p,c)&&r(L)}catch{W(p,c)&&u("网络设置请求失败,请重试。")}finally{W(p,c)&&h(!1)}},[A,w,W]);d.useEffect(()=>{let c=!1;return V.current=w,v.current+=1,N.current+=1,z.current+=1,queueMicrotask(()=>{c||V.current!==w||(r(void 0),s([]),l(void 0),u(void 0),h(!1),T(!1),E(!1),w&&_())}),()=>{c=!0}},[w,_]);const ue=d.useCallback(async()=>{const c=w;if(!c)return;const p=N.current+1;N.current=p,T(!0),u(void 0);try{const L=await qe({fetchImpl:A});G(p,c)&&(s(L.checks),l(new Date),U({description:"诊断完成"}))}catch{G(p,c)&&u("网络诊断失败,请重试。")}finally{G(p,c)&&T(!1)}},[A,w,G]),me=d.useCallback(async()=>{const c=w;if(!c)return;const p=z.current+1;z.current=p,E(!0),u(void 0);try{await ze({fetchImpl:A}),J(p,c)&&(U({variant:"success",description:"证书续签成功"}),await _())}catch{J(p,c)&&u("证书续签失败,请重试。")}finally{J(p,c)&&E(!1)}},[A,w,J,_]),X=d.useCallback(async c=>{if(K){F(!0),u(void 0);try{const p=await Ve({fetchImpl:A,patch:c});r(L=>L&&{...L,configuration:p.configuration}),m(p.applyState),U({variant:"success",description:"Network configuration saved"})}catch{u("网络配置保存失败,请重试。")}finally{F(!1)}}},[A,K]),pe=d.useMemo(()=>[{key:"local",title:"本机",values:n?.addresses.local??[]},{key:"lan",title:"局域网",values:n?.addresses.lan??[]},{key:"public",title:"公网",values:n?.addresses.public??[]}],[n]),re=t.pathname.split("/").filter(Boolean).at(-1),b=ne.some(c=>c.path===re)?re:"overview";return e.jsx(ye,{mode:"auto",listHeader:e.jsx(ge,{title:"Network"}),list:e.jsx(Be,{}),mainHeader:e.jsx(Fe,{title:ne.find(c=>(c.path||"overview")===b)?.label??"Overview",loading:y,stale:y&&!!n,onRefresh:_}),main:e.jsxs("section",{className:"flex min-h-full flex-col gap-4 bg-background p-6",children:[x?e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:x}):null,(b==="overview"||b==="endpoints")&&e.jsx(Ze,{endpoint:n?.endpoint,loading:y&&!n}),b==="overview"&&e.jsx(Ke,{status:n}),(b==="overview"||b==="addresses")&&e.jsx(tt,{sections:pe,loading:y&&!n,diagnostics:i,checkedAt:o}),b==="overview"&&e.jsx(it,{status:n}),b==="domain-dns"&&e.jsxs(e.Fragment,{children:[e.jsx(at,{status:n}),e.jsx(Ge,{configuration:n?.configuration,saving:$,applyState:a,onSave:X})]}),b==="https"&&e.jsxs(e.Fragment,{children:[e.jsx(rt,{status:n}),e.jsx(Je,{configuration:n?.configuration,saving:$,applyState:a,onSave:X})]}),b==="tunnel-profiles"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{title:"Observed tunnel",label:"Tunnel",capability:n?.tunnel}),e.jsx(Xe,{configuration:n?.configuration,providers:n?.providers??[],ingress:n?.ingress,saving:$,applyState:a,onSave:X})]}),b==="p2p"&&e.jsx(Qe,{configuration:n?.configuration,saving:$,applyState:a,onSave:X}),(b==="overview"||b==="diagnostics"||b==="https")&&e.jsx(ot,{status:n,endpoint:n?.endpoint,diagnostics:i,diagnosing:D,renewing:B,onDiagnose:ue,onRenewCertificate:me})]}),className:"min-h-full"})}function Be(){const t=Ne();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Network sections","data-list-navigation":!0,children:ne.map(n=>{const r=n.icon,i=`/network${n.path?`/${n.path}`:""}`;return e.jsxs(fe,{to:i,onClick:()=>t.openMain(),onKeyDown:ve,className:({isActive:s})=>be(s,{compact:!1}),end:n.path==="",children:[e.jsx(r,{className:"h-4 w-4","aria-hidden":"true"}),n.label]},n.id)})})})}function Fe({title:t,loading:n,stale:r,onRefresh:i}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"text-sm font-semibold text-foreground",children:["Network · ",t]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground","aria-live":"polite",children:r?"Refreshing · showing previous snapshot":"接入点、DNS、TLS、隧道与连通性诊断"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:n,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"刷新"]})})]})}function Ke({status:t}){const n=t?.addresses.public[0]??t?.addresses.lan[0]??t?.addresses.local[0]??t?.endpoint,r=t?!t.dns.supported||t.dns.status==="unsupported"?"Configure Domain & DNS, then recheck observed DNS.":!t.tls.supported||!["valid","active","ready"].includes(t.tls.status)?"Review HTTPS configuration and certificate renewal evidence.":"No connectivity action is currently required.":"Refresh network status.",i=t?.tunnel.supported===!0;return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Preferred access path"}),e.jsx(P,{children:"First address this runtime has configured, in public → LAN → local order"})]}),e.jsxs(R,{className:"space-y-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium",children:n??"Not configured"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[e.jsxs(M,{variant:"outline",children:["Local ",t?.addresses.local.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["LAN ",t?.addresses.lan.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["Public ",t?.addresses.public.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["Tunnel ",i?t?.tunnel.status??"unknown":"not observed"]})]}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Configured addresses are not probe results; reachability is reported per route."}),e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsx("div",{className:"font-medium",children:"Next action"}),e.jsx("div",{className:"mt-1 text-muted-foreground",children:r})]})]})]})}function We({title:t,label:n,capability:r,extra:i}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Observed runtime state"})]}),e.jsx(R,{children:e.jsx(q,{label:n,capability:r,extra:i})})]})}function Z({title:t}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Desired configuration"})]}),e.jsxs(R,{className:"text-sm text-muted-foreground",children:["This runtime does not report a configurable ",t," capability."]})]})}function Ge({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.domainDns),[l,x]=d.useState("");return d.useEffect(()=>{let u=!1;return queueMicrotask(()=>{u||o(t?.domainDns)}),()=>{u=!0}},[t]),s?e.jsxs(ee,{title:"Saved configuration",applyState:r,children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(j,{name:"domain",label:"Domain",value:s.domain,onChange:u=>o({...s,domain:u})}),e.jsx(j,{name:"provider",label:"DNS provider",value:s.provider,onChange:u=>o({...s,provider:u})}),e.jsx(ce,{name:"recordTtl",label:"Record TTL (seconds)",value:s.recordTtl,min:30,max:86400,onChange:u=>o({...s,recordTtl:u})}),e.jsx(j,{name:"dnsCredential",label:s.credentialConfigured?"Replace credential (configured)":"Credential",value:l,type:"password",onChange:x})]}),e.jsx(ae,{label:"Enable DDNS",checked:s.ddnsEnabled,onChange:u=>o({...s,ddnsEnabled:u})}),e.jsx(te,{label:"Save DNS configuration",saving:n,onClick:()=>i({domainDns:{domain:s.domain,ddnsEnabled:s.ddnsEnabled,provider:s.provider,recordTtl:s.recordTtl,...l?{credential:l}:{}}})})]}):e.jsx(Z,{title:"Domain & DNS"})}function Je({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.https);return d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||o(t?.https)}),()=>{l=!0}},[t]),s?e.jsxs(ee,{title:"Saved configuration",applyState:r,children:[e.jsx(ae,{label:"Enable HTTPS",checked:s.enabled,onChange:l=>o({...s,enabled:l})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(j,{name:"acmeEmail",label:"ACME email",value:s.acmeEmail,onChange:l=>o({...s,acmeEmail:l})}),e.jsx(j,{name:"acmeDomains",label:"Certificate domains",value:s.domains.join(", "),onChange:l=>o({...s,domains:l.split(",").map(x=>x.trim()).filter(Boolean)})}),e.jsx(j,{name:"certificatePath",label:"Certificate path",value:s.certificatePath??"",onChange:l=>o({...s,certificatePath:l})}),e.jsx(j,{name:"certificateKeyPath",label:"Private-key path",value:s.certificateKeyPath??"",onChange:l=>o({...s,certificateKeyPath:l})}),e.jsx(ce,{name:"renewBeforeDays",label:"Renew before (days)",value:s.renewBeforeDays,min:1,max:90,onChange:l=>o({...s,renewBeforeDays:l})})]}),e.jsx(te,{label:"Save HTTPS configuration",saving:n,onClick:()=>i({https:s})})]}):e.jsx(Z,{title:"HTTPS"})}function Xe({configuration:t,providers:n,ingress:r,saving:i,applyState:s,onSave:o}){const[l,x]=d.useState(t?.tunnelProfiles.activeProfileId??""),[u,y]=d.useState(t?.tunnelProfiles.profiles??[]),[h,D]=d.useState({});if(d.useEffect(()=>{let a=!1;return queueMicrotask(()=>{a||(x(t?.tunnelProfiles.activeProfileId??""),y(t?.tunnelProfiles.profiles??[]),D({}))}),()=>{a=!0}},[t]),!t)return e.jsx(Z,{title:"Tunnel Profiles"});const T=(a,m)=>y(v=>v.map(N=>N.id===a?{...N,...m}:N)),B=n.filter(a=>a.runtimeSupported),E=a=>n.find(m=>m.id===a),$=()=>{const a=`tunnel-${Date.now()}`,m=B[0]?.id??"ngrok";y(v=>[...v,{id:a,provider:m,label:"New tunnel",credentialConfigured:!1,parameters:{}}])},F=a=>{y(m=>m.filter(v=>v.id!==a)),l===a&&x("none")};return e.jsxs(ee,{title:"Saved tunnel profiles",applyState:s,children:[e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Active profile",e.jsxs("select",{value:l||"none",onChange:a=>x(a.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"none",children:"None"}),u.map(a=>e.jsxs("option",{value:a.id,children:[a.label," · ",a.provider]},a.id))]})]}),e.jsx("div",{className:"space-y-3",children:u.map(a=>e.jsxs("div",{className:"space-y-3 rounded-md border border-border p-3 text-sm",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(j,{name:`tunnel-label-${a.id}`,label:"Label",value:a.label,onChange:m=>T(a.id,{label:m})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Provider",e.jsx("select",{value:a.provider,onChange:m=>T(a.id,{provider:m.target.value,parameters:{}}),className:"block h-10 w-full rounded-md border border-input bg-background px-3",children:B.map(m=>e.jsx("option",{value:m.id,children:m.label},m.id))})]}),E(a.provider)?.endpointSource==="declared"?e.jsx(j,{name:`tunnel-url-${a.id}`,label:"Public endpoint (declared)",value:a.publicUrl??"",onChange:m=>T(a.id,{publicUrl:m})}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"The provider reports its public endpoint; there is nothing to type here."}),e.jsx(j,{name:`tunnel-credential-${a.id}`,label:a.credentialConfigured?"Replace credential (configured)":"Credential",type:"password",value:h[a.id]??"",onChange:m=>D(v=>({...v,[a.id]:m}))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer font-medium",children:"Provider-specific parameters"}),e.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:(E(a.provider)?.parameterFields??[]).map(({key:m,label:v})=>e.jsx(j,{name:`tunnel-${m}-${a.id}`,label:v,value:a.parameters?.[m]??"",onChange:N=>T(a.id,{parameters:{...a.parameters,[m]:N}})},m))})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[l===a.id?"Active after restart":"Inactive"," · credential ",a.credentialConfigured?"configured":"missing"]}),e.jsx(g,{type:"button",size:"sm",variant:"ghost",onClick:()=>F(a.id),children:"Remove"})]})]},a.id))}),e.jsx(g,{type:"button",size:"sm",variant:"outline",onClick:$,children:"Add tunnel profile"}),e.jsx(Ye,{ingress:r,descriptor:E(u.find(a=>a.id===l)?.provider??"")}),e.jsx(te,{label:"Save tunnel profiles",saving:i,onClick:()=>o({tunnelProfiles:{activeProfileId:l,profiles:u.map(a=>({id:a.id,provider:a.provider,label:a.label,publicUrl:a.publicUrl,parameters:a.parameters,...h[a.id]?{credential:h[a.id]}:{}}))}})})]})}function Ye({ingress:t,descriptor:n}){if(!t||n?.originOwner!=="console")return null;const r=async()=>{await window.navigator.clipboard.writeText(t.originUrl),U({description:"Tunnel origin copied"})};return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3","data-testid":"ingress-origin",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Tunnel origin (paste into the provider console)"}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-all font-mono text-sm",children:t.originUrl}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Set the tunnel's local port / service to this address, not the Gateway port: this is the entry that never treats a tunnelled caller as local."})]}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":"Copy tunnel origin",onClick:()=>{r()},children:e.jsx(se,{className:"h-4 w-4","aria-hidden":"true"})}),n.consoleUrl?e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${n.label} console`,onClick:()=>window.open(n.consoleUrl,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})}):null]})]})]})}function Qe({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.p2p);return d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||o(t?.p2p)}),()=>{l=!0}},[t]),s?e.jsxs(ee,{title:"Saved P2P configuration",applyState:r,children:[e.jsx(ae,{label:"Enable P2P fallback",checked:s.enabled,onChange:l=>o({...s,enabled:l})}),e.jsx(j,{name:"signalService",label:"Signal service",value:s.signalService,onChange:l=>o({...s,signalService:l})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Fallback policy",e.jsxs("select",{value:s.fallbackPolicy,onChange:l=>o({...s,fallbackPolicy:l.target.value}),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"when-direct-unavailable",children:"When direct is unavailable"}),e.jsx("option",{value:"prefer-p2p",children:"Prefer P2P"})]})]}),e.jsx(te,{label:"Save P2P configuration",saving:n,onClick:()=>i({p2p:s})})]}):e.jsx(Z,{title:"P2P"})}function ee({title:t,applyState:n,children:r}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Desired configuration · not presented as observed until verified"})]}),e.jsxs(R,{className:"space-y-4",children:[n==="restart-required"?e.jsx("div",{role:"status",className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-200",children:"Saved · restart required"}):null,r]})]})}function j({name:t,label:n,value:r,type:i="text",onChange:s}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[n,e.jsx("input",{name:t,type:i,value:r,onChange:o=>s(o.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ce({name:t,label:n,value:r,min:i,max:s,onChange:o}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[n,e.jsx("input",{name:t,type:"number",value:r,min:i,max:s,onChange:l=>o(l.target.valueAsNumber),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ae({label:t,checked:n,onChange:r}){return e.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:[t,e.jsx("input",{type:"checkbox",checked:n,onChange:i=>r(i.target.checked)})]})}function te({label:t,saving:n,onClick:r}){return e.jsx("div",{className:"flex justify-end",children:e.jsx(g,{type:"button",onClick:r,disabled:n,children:n?"Saving…":t})})}function Ze({endpoint:t,loading:n}){const r=[{label:"Canonical URL",value:t},{label:"API endpoint",value:t?et(t,"/api/"):void 0}],i=async(s,o)=>{await window.navigator.clipboard.writeText(o),U({description:`${s} copied`})};return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4","aria-hidden":"true"}),"接入点"]}),e.jsx(P,{children:n?"正在解析接入点":"Observed endpoints · Currently effective route is the canonical URL"})]}),e.jsx(R,{className:"space-y-3",children:r.map(({label:s,value:o})=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s}),e.jsx("div",{className:"mt-1 break-words text-sm text-foreground",children:o||"Unavailable"})]}),o?e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Copy ${s}`,onClick:()=>{i(s,o)},children:e.jsx(se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${s}`,onClick:()=>window.open(o,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})})]}):null]},s))})]})}function et(t,n){try{return new URL(n,t).toString()}catch{return t}}function tt({sections:t,loading:n,diagnostics:r,checkedAt:i}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(Oe,{className:"h-4 w-4","aria-hidden":"true"}),"网络地址"]}),e.jsx(P,{children:n?"正在刷新地址":"由运行时网络能力上报"})]}),e.jsx(R,{className:"space-y-4",children:t.map(s=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s.title}),s.values.length>0?e.jsx("div",{className:"mt-1 space-y-1",children:s.values.map(o=>e.jsx(nt,{scope:s.key,value:o,diagnostics:r,checkedAt:i},o))}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"未提供"})]},s.key))})]})}function nt({scope:t,value:n,diagnostics:r,checkedAt:i}){const s=st(n),o=r.find(l=>l.id==="address-configuration");return e.jsxs("div",{className:"rounded-md border border-border p-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium text-foreground",children:n}),e.jsxs("dl",{className:"mt-2 grid gap-x-4 gap-y-1 text-xs sm:grid-cols-2",children:[e.jsx(f,{label:"Interface",value:t==="local"?"Loopback":t==="lan"?"LAN interface (name not reported)":"Public route"}),e.jsx(f,{label:"IP version",value:s.ipVersion}),e.jsx(f,{label:"Port",value:s.port}),e.jsx(f,{label:"Configured",value:o?o.status==="ok"?"Yes":"No":"Not checked"}),e.jsx(f,{label:"Reachability",value:"Not probed"}),e.jsx(f,{label:"Configuration checked",value:o?.checkedAt?O(o.checkedAt):i?i.toLocaleString():"Not checked"})]})]})}function f({label:t,value:n}){return e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:t}),e.jsx("dd",{className:"text-right text-foreground",children:n})]})}function st(t){try{const n=new URL(t),r=n.hostname.replace(/^\[|\]$/g,"");return{ipVersion:r.includes(":")?"IPv6":/^\d{1,3}(?:\.\d{1,3}){3}$/.test(r)?"IPv4":"Resolved hostname",port:n.port||(n.protocol==="https:"?"443":n.protocol==="http:"?"80":"Not reported")}}catch{return{ipVersion:"Not reported",port:"Not reported"}}}function at({status:t}){const n=t?.configuration?.domainDns,r=(t?.addresses.public??[]).map(i=>{try{return new URL(i).hostname}catch{return i}});return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Observed DNS"}),e.jsx(P,{children:"Observed state is kept separate from desired DNS policy."})]}),e.jsxs(R,{className:"space-y-3",children:[e.jsx(q,{label:"Runtime status",capability:t?.dns}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(f,{label:"Observed hostnames",value:r.join(", ")||"Not reported"}),e.jsx(f,{label:"Expected domain",value:n?.domain||"Not configured"}),e.jsx(f,{label:"Expected value",value:t?.addresses.public[0]||"Not reported"}),e.jsx(f,{label:"Provider",value:n?.provider||"Not configured"})]})]})]})}function rt({status:t}){const n=t?.configuration?.https;return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Observed HTTPS"}),e.jsx(P,{children:"Certificate evidence reported by the active runtime."})]}),e.jsxs(R,{className:"space-y-3",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`Expires ${O(t.tls.expiresAt)}`:void 0}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(f,{label:"Certificate domains",value:t?.tls.domains?.join(", ")||n?.domains.join(", ")||"Not reported"}),e.jsx(f,{label:"Issuer",value:t?.tls.issuer||"Not reported by runtime"}),e.jsx(f,{label:"Validity",value:t?.tls.validFrom?`${O(t.tls.validFrom)} — ${t.tls.expiresAt?O(t.tls.expiresAt):"open"}`:t?.tls.status??"Not reported"}),e.jsx(f,{label:"Expiry",value:t?.tls.expiresAt?O(t.tls.expiresAt):"Not reported"}),e.jsx(f,{label:"Renewal status",value:t?.tls.renewalStatus||(t?.actions.renewCertificate?"Renewal available":"Renewal unavailable")}),e.jsx(f,{label:"Renewal policy",value:n?`${n.renewBeforeDays} days before expiry`:"Not configured"})]})]})]})}function it({status:t}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(ie,{className:"h-4 w-4","aria-hidden":"true"}),"网络能力"]}),e.jsx(P,{children:"服务端声明的网络支持"})]}),e.jsxs(R,{className:"grid gap-3 text-sm",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`到期时间 ${O(t.tls.expiresAt)}`:void 0}),e.jsx(q,{label:"DNS",capability:t?.dns}),e.jsx(q,{label:"Tunnel",capability:t?.tunnel})]})]})}function ot({status:t,endpoint:n,diagnostics:r,diagnosing:i,renewing:s,onDiagnose:o,onRenewCertificate:l}){const x=r.length>0?_e({generatedAt:new Date().toISOString(),endpoint:n,checks:r}):void 0,u=async()=>{x&&(await window.navigator.clipboard.writeText(x),U({description:"Diagnostic report copied"}))},y=()=>{if(!x)return;const h=URL.createObjectURL(new Blob([x],{type:"text/plain;charset=utf-8"})),D=document.createElement("a");D.href=h,D.download=`xpod-network-diagnostics-${new Date().toISOString().replace(/[:.]/g,"-")}.txt`,D.click(),URL.revokeObjectURL(h)};return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(oe,{className:"h-4 w-4","aria-hidden":"true"}),"操作"]}),e.jsx(P,{children:"仅显示网络能力允许的操作"})]}),e.jsxs(R,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t?.actions.diagnose?e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:o,disabled:i,children:[e.jsx($e,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"连通性诊断"]}):null,t?.actions.renewCertificate?e.jsxs(g,{type:"button",size:"sm",variant:"subtle",onClick:l,disabled:s,children:[e.jsx(we,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"续签证书"]}):null,e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:()=>{u()},disabled:!x,children:[e.jsx(se,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Copy diagnostics"]}),e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:y,disabled:!x,children:[e.jsx(ke,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Export diagnostics"]})]}),r.length>0?e.jsx("div",{className:"space-y-2",children:r.map(h=>e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:h.label}),e.jsx(M,{variant:h.status==="ok"?"secondary":"outline",children:h.status})]}),h.detail?e.jsx("div",{className:"mt-1 break-words text-xs text-muted-foreground",children:h.detail}):null]},h.id))}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"尚未运行过诊断。"})]})]})}function q({label:t,capability:n,extra:r}){const i=n?.supported===!0;return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:i?t:`${t} 不支持`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[n?.status??"读取中",n?.detail?` · ${n.detail}`:""]})]}),e.jsx(M,{variant:i?"secondary":"outline",children:i?"支持":"不支持"})]}),r?e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r}):null]})}function O(t){if(!t)return"暂无记录";const n=new Date(t);return Number.isNaN(n.getTime())?"暂无记录":n.toLocaleString()}export{bt as default};
|
|
1
|
+
import{c as I,q as xe,r as d,W as U,j as e,C as k,a as C,b as S,d as P,e as R,B as g,Y as se,R as he,N as fe,s as ve,t as be}from"./dashboard-D4DWPaAy.js";import{P as ge}from"./PaneListHeader-BEAXSlD9.js";import{N as ie,W as je}from"./waypoints-CLZA22UN.js";import{A as oe}from"./activity-D55X-5L5.js";import{T as ye,u as Ne}from"./workspace-layout-urYcwAhS.js";import{E as le}from"./external-link-DT746o7t.js";import{B as M}from"./badge-CRf1ISRJ.js";import{R as we}from"./rotate-ccw-BNVDC4Zr.js";import{D as ke}from"./download-Et4aRDT2.js";const Ce=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],Se=I("cable",Ce);const Pe=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],de=I("earth",Pe);const Re=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],De=I("lock-keyhole",Re);const Te=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ae=I("radio",Te);const Ee=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],Le=I("route",Ee);const Ie=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$e=I("shield-check",Ie);const Me=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Oe=I("wifi",Me);async function Ue({fetchImpl:t}){return Q(t,X("/api/network/settings/status"),{method:"GET",credentials:"include",headers:{accept:"application/json"}})}async function qe({fetchImpl:t}){return Q(t,X("/api/network/settings/diagnose"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function ze({fetchImpl:t}){await Q(t,X("/api/network/settings/certificate/renew"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function Ve({podUrl:t,fetchImpl:n,patch:r}){return Q(n,He("/api/network/settings/configuration",t),{method:"PUT",credentials:"include",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(r)})}function X(t){const n=typeof window>"u"?"http://localhost":window.location.origin;return new URL(t,n).toString()}function He(t,n){return n?new URL(t,n).toString():X(t)}async function Q(t,n,r){const i=await t(n,r);if(!i.ok)throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");if(!i.headers.get("content-type")?.includes("application/json"))throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");return await i.json()}const ne=[{id:"overview",label:"Overview",path:"",icon:ie},{id:"endpoints",label:"Endpoints",path:"endpoints",icon:Se},{id:"addresses",label:"Addresses",path:"addresses",icon:de},{id:"domain-dns",label:"Domain & DNS",path:"domain-dns",icon:Le},{id:"https",label:"HTTPS",path:"https",icon:De},{id:"tunnel-profiles",label:"Tunnel Profiles",path:"tunnel-profiles",icon:je},{id:"p2p",label:"P2P",path:"p2p",icon:Ae},{id:"diagnostics",label:"Diagnostics",path:"diagnostics",icon:oe}];function _e(t){const n=["Xpod Network Diagnostics",`Generated: ${t.generatedAt}`,`Canonical URL: ${t.endpoint??"Unavailable"}`],r=t.checks.flatMap(i=>["",`[${i.status.toUpperCase()}] ${i.label}`,...i.detail?[i.detail]:[]]);return[...n,...r].join(`
|
|
2
|
+
`)}function bt(){const t=xe(),[n,r]=d.useState(),[i,s]=d.useState([]),[o,l]=d.useState(),[x,u]=d.useState(),[y,h]=d.useState(!1),[D,T]=d.useState(!1),[B,E]=d.useState(!1),[$,F]=d.useState(!1),[a,m]=d.useState(),v=d.useRef(0),N=d.useRef(0),z=d.useRef(0),V=d.useRef(void 0),H=d.useRef(!0),K=typeof window>"u"?void 0:window.location.origin,w=K?`local-host:${K}`:void 0,A=globalThis.fetch;d.useEffect(()=>(H.current=!0,()=>{H.current=!1,v.current+=1,N.current+=1,z.current+=1}),[]);const W=d.useCallback((c,p)=>H.current&&v.current===c&&V.current===p,[]),G=d.useCallback((c,p)=>H.current&&N.current===c&&V.current===p,[]),J=d.useCallback((c,p)=>H.current&&z.current===c&&V.current===p,[]),_=d.useCallback(async()=>{const c=w;if(!c)return;const p=v.current+1;v.current=p,h(!0),u(void 0);try{const L=await Ue({fetchImpl:A});W(p,c)&&r(L)}catch{W(p,c)&&u("网络设置请求失败,请重试。")}finally{W(p,c)&&h(!1)}},[A,w,W]);d.useEffect(()=>{let c=!1;return V.current=w,v.current+=1,N.current+=1,z.current+=1,queueMicrotask(()=>{c||V.current!==w||(r(void 0),s([]),l(void 0),u(void 0),h(!1),T(!1),E(!1),w&&_())}),()=>{c=!0}},[w,_]);const ue=d.useCallback(async()=>{const c=w;if(!c)return;const p=N.current+1;N.current=p,T(!0),u(void 0);try{const L=await qe({fetchImpl:A});G(p,c)&&(s(L.checks),l(new Date),U({description:"诊断完成"}))}catch{G(p,c)&&u("网络诊断失败,请重试。")}finally{G(p,c)&&T(!1)}},[A,w,G]),me=d.useCallback(async()=>{const c=w;if(!c)return;const p=z.current+1;z.current=p,E(!0),u(void 0);try{await ze({fetchImpl:A}),J(p,c)&&(U({variant:"success",description:"证书续签成功"}),await _())}catch{J(p,c)&&u("证书续签失败,请重试。")}finally{J(p,c)&&E(!1)}},[A,w,J,_]),Y=d.useCallback(async c=>{if(K){F(!0),u(void 0);try{const p=await Ve({fetchImpl:A,patch:c});r(L=>L&&{...L,configuration:p.configuration}),m(p.applyState),U({variant:"success",description:"Network configuration saved"})}catch{u("网络配置保存失败,请重试。")}finally{F(!1)}}},[A,K]),pe=d.useMemo(()=>[{key:"local",title:"本机",values:n?.addresses.local??[]},{key:"lan",title:"局域网",values:n?.addresses.lan??[]},{key:"public",title:"公网",values:n?.addresses.public??[]}],[n]),re=t.pathname.split("/").filter(Boolean).at(-1),b=ne.some(c=>c.path===re)?re:"overview";return e.jsx(ye,{mode:"auto",listHeader:e.jsx(ge,{title:"Network"}),list:e.jsx(Be,{}),mainHeader:e.jsx(Fe,{title:ne.find(c=>(c.path||"overview")===b)?.label??"Overview",loading:y,stale:y&&!!n,onRefresh:_}),main:e.jsxs("section",{className:"flex min-h-full flex-col gap-4 bg-background p-6",children:[x?e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:x}):null,(b==="overview"||b==="endpoints")&&e.jsx(Ze,{endpoint:n?.endpoint,loading:y&&!n}),b==="overview"&&e.jsx(Ke,{status:n}),(b==="overview"||b==="addresses")&&e.jsx(tt,{sections:pe,loading:y&&!n,diagnostics:i,checkedAt:o}),b==="overview"&&e.jsx(it,{status:n}),b==="domain-dns"&&e.jsxs(e.Fragment,{children:[e.jsx(at,{status:n}),e.jsx(Ge,{configuration:n?.configuration,saving:$,applyState:a,onSave:Y})]}),b==="https"&&e.jsxs(e.Fragment,{children:[e.jsx(rt,{status:n}),e.jsx(Je,{configuration:n?.configuration,saving:$,applyState:a,onSave:Y})]}),b==="tunnel-profiles"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{title:"Observed tunnel",label:"Tunnel",capability:n?.tunnel}),e.jsx(Ye,{configuration:n?.configuration,providers:n?.providers??[],ingress:n?.ingress,saving:$,applyState:a,onSave:Y})]}),b==="p2p"&&e.jsx(Qe,{configuration:n?.configuration,saving:$,applyState:a,onSave:Y}),(b==="overview"||b==="diagnostics"||b==="https")&&e.jsx(ot,{status:n,endpoint:n?.endpoint,diagnostics:i,diagnosing:D,renewing:B,onDiagnose:ue,onRenewCertificate:me})]}),className:"min-h-full"})}function Be(){const t=Ne();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Network sections","data-list-navigation":!0,children:ne.map(n=>{const r=n.icon,i=`/network${n.path?`/${n.path}`:""}`;return e.jsxs(fe,{to:i,onClick:()=>t.openMain(),onKeyDown:ve,className:({isActive:s})=>be(s,{compact:!1}),end:n.path==="",children:[e.jsx(r,{className:"h-4 w-4","aria-hidden":"true"}),n.label]},n.id)})})})}function Fe({title:t,loading:n,stale:r,onRefresh:i}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"text-sm font-semibold text-foreground",children:["Network · ",t]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground","aria-live":"polite",children:r?"Refreshing · showing previous snapshot":"接入点、DNS、TLS、隧道与连通性诊断"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:n,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"刷新"]})})]})}function Ke({status:t}){const n=t?.addresses.public[0]??t?.addresses.lan[0]??t?.addresses.local[0]??t?.endpoint,r=t?!t.dns.supported||t.dns.status==="unsupported"?"Configure Domain & DNS, then recheck observed DNS.":!t.tls.supported||!["valid","active","ready"].includes(t.tls.status)?"Review HTTPS configuration and certificate renewal evidence.":"No connectivity action is currently required.":"Refresh network status.",i=t?.tunnel.supported===!0;return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Preferred access path"}),e.jsx(P,{children:"First address this runtime has configured, in public → LAN → local order"})]}),e.jsxs(R,{className:"space-y-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium",children:n??"Not configured"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[e.jsxs(M,{variant:"outline",children:["Local ",t?.addresses.local.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["LAN ",t?.addresses.lan.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["Public ",t?.addresses.public.length?"configured":"not configured"]}),e.jsxs(M,{variant:"outline",children:["Tunnel ",i?t?.tunnel.status??"unknown":"not observed"]})]}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Configured addresses are not probe results; reachability is reported per route."}),e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsx("div",{className:"font-medium",children:"Next action"}),e.jsx("div",{className:"mt-1 text-muted-foreground",children:r})]})]})]})}function We({title:t,label:n,capability:r,extra:i}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Observed runtime state"})]}),e.jsx(R,{children:e.jsx(q,{label:n,capability:r,extra:i})})]})}function Z({title:t}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Desired configuration"})]}),e.jsxs(R,{className:"text-sm text-muted-foreground",children:["This runtime does not report a configurable ",t," capability."]})]})}function Ge({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.domainDns),[l,x]=d.useState("");return d.useEffect(()=>{let u=!1;return queueMicrotask(()=>{u||o(t?.domainDns)}),()=>{u=!0}},[t]),s?e.jsxs(ee,{title:"Saved configuration",applyState:r,children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(j,{name:"domain",label:"Domain",value:s.domain,onChange:u=>o({...s,domain:u})}),e.jsx(j,{name:"provider",label:"DNS provider",value:s.provider,onChange:u=>o({...s,provider:u})}),e.jsx(ce,{name:"recordTtl",label:"Record TTL (seconds)",value:s.recordTtl,min:30,max:86400,onChange:u=>o({...s,recordTtl:u})}),e.jsx(j,{name:"dnsCredential",label:s.credentialConfigured?"Replace credential (configured)":"Credential",value:l,type:"password",onChange:x})]}),e.jsx(ae,{label:"Enable DDNS",checked:s.ddnsEnabled,onChange:u=>o({...s,ddnsEnabled:u})}),e.jsx(te,{label:"Save DNS configuration",saving:n,onClick:()=>i({domainDns:{domain:s.domain,ddnsEnabled:s.ddnsEnabled,provider:s.provider,recordTtl:s.recordTtl,...l?{credential:l}:{}}})})]}):e.jsx(Z,{title:"Domain & DNS"})}function Je({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.https);return d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||o(t?.https)}),()=>{l=!0}},[t]),s?e.jsxs(ee,{title:"Saved configuration",applyState:r,children:[e.jsx(ae,{label:"Enable HTTPS",checked:s.enabled,onChange:l=>o({...s,enabled:l})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(j,{name:"acmeEmail",label:"ACME email",value:s.acmeEmail,onChange:l=>o({...s,acmeEmail:l})}),e.jsx(j,{name:"acmeDomains",label:"Certificate domains",value:s.domains.join(", "),onChange:l=>o({...s,domains:l.split(",").map(x=>x.trim()).filter(Boolean)})}),e.jsx(j,{name:"certificatePath",label:"Certificate path",value:s.certificatePath??"",onChange:l=>o({...s,certificatePath:l})}),e.jsx(j,{name:"certificateKeyPath",label:"Private-key path",value:s.certificateKeyPath??"",onChange:l=>o({...s,certificateKeyPath:l})}),e.jsx(ce,{name:"renewBeforeDays",label:"Renew before (days)",value:s.renewBeforeDays,min:1,max:90,onChange:l=>o({...s,renewBeforeDays:l})})]}),e.jsx(te,{label:"Save HTTPS configuration",saving:n,onClick:()=>i({https:s})})]}):e.jsx(Z,{title:"HTTPS"})}function Ye({configuration:t,providers:n,ingress:r,saving:i,applyState:s,onSave:o}){const[l,x]=d.useState(t?.tunnelProfiles.activeProfileId??""),[u,y]=d.useState(t?.tunnelProfiles.profiles??[]),[h,D]=d.useState({});if(d.useEffect(()=>{let a=!1;return queueMicrotask(()=>{a||(x(t?.tunnelProfiles.activeProfileId??""),y(t?.tunnelProfiles.profiles??[]),D({}))}),()=>{a=!0}},[t]),!t)return e.jsx(Z,{title:"Tunnel Profiles"});const T=(a,m)=>y(v=>v.map(N=>N.id===a?{...N,...m}:N)),B=n.filter(a=>a.runtimeSupported),E=a=>n.find(m=>m.id===a),$=()=>{const a=`tunnel-${Date.now()}`,m=B[0]?.id??"ngrok";y(v=>[...v,{id:a,provider:m,label:"New tunnel",credentialConfigured:!1,parameters:{}}])},F=a=>{y(m=>m.filter(v=>v.id!==a)),l===a&&x("none")};return e.jsxs(ee,{title:"Saved tunnel profiles",applyState:s,children:[e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Active profile",e.jsxs("select",{value:l||"none",onChange:a=>x(a.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"none",children:"None"}),u.map(a=>e.jsxs("option",{value:a.id,children:[a.label," · ",a.provider]},a.id))]})]}),e.jsx("div",{className:"space-y-3",children:u.map(a=>e.jsxs("div",{className:"space-y-3 rounded-md border border-border p-3 text-sm",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(j,{name:`tunnel-label-${a.id}`,label:"Label",value:a.label,onChange:m=>T(a.id,{label:m})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Provider",e.jsx("select",{value:a.provider,onChange:m=>T(a.id,{provider:m.target.value,parameters:{}}),className:"block h-10 w-full rounded-md border border-input bg-background px-3",children:B.map(m=>e.jsx("option",{value:m.id,children:m.label},m.id))})]}),E(a.provider)?.endpointSource==="declared"?e.jsx(j,{name:`tunnel-url-${a.id}`,label:"Public endpoint (declared)",value:a.publicUrl??"",onChange:m=>T(a.id,{publicUrl:m})}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"The provider reports its public endpoint; there is nothing to type here."}),e.jsx(j,{name:`tunnel-credential-${a.id}`,label:a.credentialConfigured?"Replace credential (configured)":"Credential",type:"password",value:h[a.id]??"",onChange:m=>D(v=>({...v,[a.id]:m}))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer font-medium",children:"Provider-specific parameters"}),e.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:(E(a.provider)?.parameterFields??[]).map(({key:m,label:v})=>e.jsx(j,{name:`tunnel-${m}-${a.id}`,label:v,value:a.parameters?.[m]??"",onChange:N=>T(a.id,{parameters:{...a.parameters,[m]:N}})},m))})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[l===a.id?"Active after restart":"Inactive"," · credential ",a.credentialConfigured?"configured":"missing"]}),e.jsx(g,{type:"button",size:"sm",variant:"ghost",onClick:()=>F(a.id),children:"Remove"})]})]},a.id))}),e.jsx(g,{type:"button",size:"sm",variant:"outline",onClick:$,children:"Add tunnel profile"}),e.jsx(Xe,{ingress:r,descriptor:E(u.find(a=>a.id===l)?.provider??"")}),e.jsx(te,{label:"Save tunnel profiles",saving:i,onClick:()=>o({tunnelProfiles:{activeProfileId:l,profiles:u.map(a=>({id:a.id,provider:a.provider,label:a.label,publicUrl:a.publicUrl,parameters:a.parameters,...h[a.id]?{credential:h[a.id]}:{}}))}})})]})}function Xe({ingress:t,descriptor:n}){if(!t||n?.originOwner!=="console")return null;const r=async()=>{await window.navigator.clipboard.writeText(t.originUrl),U({description:"Tunnel origin copied"})};return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3","data-testid":"ingress-origin",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Tunnel origin (paste into the provider console)"}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-all font-mono text-sm",children:t.originUrl}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Set the tunnel's local port / service to this address, not the Gateway port: this is the entry that never treats a tunnelled caller as local."})]}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":"Copy tunnel origin",onClick:()=>{r()},children:e.jsx(se,{className:"h-4 w-4","aria-hidden":"true"})}),n.consoleUrl?e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${n.label} console`,onClick:()=>window.open(n.consoleUrl,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})}):null]})]})]})}function Qe({configuration:t,saving:n,applyState:r,onSave:i}){const[s,o]=d.useState(t?.p2p);return d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||o(t?.p2p)}),()=>{l=!0}},[t]),s?e.jsxs(ee,{title:"Saved P2P configuration",applyState:r,children:[e.jsx(ae,{label:"Enable P2P fallback",checked:s.enabled,onChange:l=>o({...s,enabled:l})}),e.jsx(j,{name:"signalService",label:"Signal service",value:s.signalService,onChange:l=>o({...s,signalService:l})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Fallback policy",e.jsxs("select",{value:s.fallbackPolicy,onChange:l=>o({...s,fallbackPolicy:l.target.value}),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"when-direct-unavailable",children:"When direct is unavailable"}),e.jsx("option",{value:"prefer-p2p",children:"Prefer P2P"})]})]}),e.jsx(te,{label:"Save P2P configuration",saving:n,onClick:()=>i({p2p:s})})]}):e.jsx(Z,{title:"P2P"})}function ee({title:t,applyState:n,children:r}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:t}),e.jsx(P,{children:"Desired configuration · not presented as observed until verified"})]}),e.jsxs(R,{className:"space-y-4",children:[n==="restart-required"?e.jsx("div",{role:"status",className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-200",children:"Saved · restart required"}):null,r]})]})}function j({name:t,label:n,value:r,type:i="text",onChange:s}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[n,e.jsx("input",{name:t,type:i,value:r,onChange:o=>s(o.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ce({name:t,label:n,value:r,min:i,max:s,onChange:o}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[n,e.jsx("input",{name:t,type:"number",value:r,min:i,max:s,onChange:l=>o(l.target.valueAsNumber),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ae({label:t,checked:n,onChange:r}){return e.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:[t,e.jsx("input",{type:"checkbox",checked:n,onChange:i=>r(i.target.checked)})]})}function te({label:t,saving:n,onClick:r}){return e.jsx("div",{className:"flex justify-end",children:e.jsx(g,{type:"button",onClick:r,disabled:n,children:n?"Saving…":t})})}function Ze({endpoint:t,loading:n}){const r=[{label:"Canonical URL",value:t},{label:"API endpoint",value:t?et(t,"/api/"):void 0}],i=async(s,o)=>{await window.navigator.clipboard.writeText(o),U({description:`${s} copied`})};return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4","aria-hidden":"true"}),"接入点"]}),e.jsx(P,{children:n?"正在解析接入点":"Observed endpoints · Currently effective route is the canonical URL"})]}),e.jsx(R,{className:"space-y-3",children:r.map(({label:s,value:o})=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s}),e.jsx("div",{className:"mt-1 break-words text-sm text-foreground",children:o||"Unavailable"})]}),o?e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Copy ${s}`,onClick:()=>{i(s,o)},children:e.jsx(se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsx(g,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${s}`,onClick:()=>window.open(o,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})})]}):null]},s))})]})}function et(t,n){try{return new URL(n,t).toString()}catch{return t}}function tt({sections:t,loading:n,diagnostics:r,checkedAt:i}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(Oe,{className:"h-4 w-4","aria-hidden":"true"}),"网络地址"]}),e.jsx(P,{children:n?"正在刷新地址":"由运行时网络能力上报"})]}),e.jsx(R,{className:"space-y-4",children:t.map(s=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s.title}),s.values.length>0?e.jsx("div",{className:"mt-1 space-y-1",children:s.values.map(o=>e.jsx(nt,{scope:s.key,value:o,diagnostics:r,checkedAt:i},o))}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"未提供"})]},s.key))})]})}function nt({scope:t,value:n,diagnostics:r,checkedAt:i}){const s=st(n),o=r.find(l=>l.id==="address-configuration");return e.jsxs("div",{className:"rounded-md border border-border p-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium text-foreground",children:n}),e.jsxs("dl",{className:"mt-2 grid gap-x-4 gap-y-1 text-xs sm:grid-cols-2",children:[e.jsx(f,{label:"Interface",value:t==="local"?"Loopback":t==="lan"?"LAN interface (name not reported)":"Public route"}),e.jsx(f,{label:"IP version",value:s.ipVersion}),e.jsx(f,{label:"Port",value:s.port}),e.jsx(f,{label:"Configured",value:o?o.status==="ok"?"Yes":"No":"Not checked"}),e.jsx(f,{label:"Reachability",value:"Not probed"}),e.jsx(f,{label:"Configuration checked",value:o?.checkedAt?O(o.checkedAt):i?i.toLocaleString():"Not checked"})]})]})}function f({label:t,value:n}){return e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:t}),e.jsx("dd",{className:"text-right text-foreground",children:n})]})}function st(t){try{const n=new URL(t),r=n.hostname.replace(/^\[|\]$/g,"");return{ipVersion:r.includes(":")?"IPv6":/^\d{1,3}(?:\.\d{1,3}){3}$/.test(r)?"IPv4":"Resolved hostname",port:n.port||(n.protocol==="https:"?"443":n.protocol==="http:"?"80":"Not reported")}}catch{return{ipVersion:"Not reported",port:"Not reported"}}}function at({status:t}){const n=t?.configuration?.domainDns,r=(t?.addresses.public??[]).map(i=>{try{return new URL(i).hostname}catch{return i}});return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Observed DNS"}),e.jsx(P,{children:"Observed state is kept separate from desired DNS policy."})]}),e.jsxs(R,{className:"space-y-3",children:[e.jsx(q,{label:"Runtime status",capability:t?.dns}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(f,{label:"Observed hostnames",value:r.join(", ")||"Not reported"}),e.jsx(f,{label:"Expected domain",value:n?.domain||"Not configured"}),e.jsx(f,{label:"Expected value",value:t?.addresses.public[0]||"Not reported"}),e.jsx(f,{label:"Provider",value:n?.provider||"Not configured"})]})]})]})}function rt({status:t}){const n=t?.configuration?.https;return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsx(S,{className:"text-base",children:"Observed HTTPS"}),e.jsx(P,{children:"Certificate evidence reported by the active runtime."})]}),e.jsxs(R,{className:"space-y-3",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`Expires ${O(t.tls.expiresAt)}`:void 0}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(f,{label:"Certificate domains",value:t?.tls.domains?.join(", ")||n?.domains.join(", ")||"Not reported"}),e.jsx(f,{label:"Issuer",value:t?.tls.issuer||"Not reported by runtime"}),e.jsx(f,{label:"Validity",value:t?.tls.validFrom?`${O(t.tls.validFrom)} — ${t.tls.expiresAt?O(t.tls.expiresAt):"open"}`:t?.tls.status??"Not reported"}),e.jsx(f,{label:"Expiry",value:t?.tls.expiresAt?O(t.tls.expiresAt):"Not reported"}),e.jsx(f,{label:"Renewal status",value:t?.tls.renewalStatus||(t?.actions.renewCertificate?"Renewal available":"Renewal unavailable")}),e.jsx(f,{label:"Renewal policy",value:n?`${n.renewBeforeDays} days before expiry`:"Not configured"})]})]})]})}function it({status:t}){return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(ie,{className:"h-4 w-4","aria-hidden":"true"}),"网络能力"]}),e.jsx(P,{children:"服务端声明的网络支持"})]}),e.jsxs(R,{className:"grid gap-3 text-sm",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`到期时间 ${O(t.tls.expiresAt)}`:void 0}),e.jsx(q,{label:"DNS",capability:t?.dns}),e.jsx(q,{label:"Tunnel",capability:t?.tunnel})]})]})}function ot({status:t,endpoint:n,diagnostics:r,diagnosing:i,renewing:s,onDiagnose:o,onRenewCertificate:l}){const x=r.length>0?_e({generatedAt:new Date().toISOString(),endpoint:n,checks:r}):void 0,u=async()=>{x&&(await window.navigator.clipboard.writeText(x),U({description:"Diagnostic report copied"}))},y=()=>{if(!x)return;const h=URL.createObjectURL(new Blob([x],{type:"text/plain;charset=utf-8"})),D=document.createElement("a");D.href=h,D.download=`xpod-network-diagnostics-${new Date().toISOString().replace(/[:.]/g,"-")}.txt`,D.click(),URL.revokeObjectURL(h)};return e.jsxs(k,{children:[e.jsxs(C,{children:[e.jsxs(S,{className:"flex items-center gap-2 text-base",children:[e.jsx(oe,{className:"h-4 w-4","aria-hidden":"true"}),"操作"]}),e.jsx(P,{children:"仅显示网络能力允许的操作"})]}),e.jsxs(R,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t?.actions.diagnose?e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:o,disabled:i,children:[e.jsx($e,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"连通性诊断"]}):null,t?.actions.renewCertificate?e.jsxs(g,{type:"button",size:"sm",variant:"subtle",onClick:l,disabled:s,children:[e.jsx(we,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"续签证书"]}):null,e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:()=>{u()},disabled:!x,children:[e.jsx(se,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Copy diagnostics"]}),e.jsxs(g,{type:"button",size:"sm",variant:"outline",onClick:y,disabled:!x,children:[e.jsx(ke,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Export diagnostics"]})]}),r.length>0?e.jsx("div",{className:"space-y-2",children:r.map(h=>e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:h.label}),e.jsx(M,{variant:h.status==="ok"?"secondary":"outline",children:h.status})]}),h.detail?e.jsx("div",{className:"mt-1 break-words text-xs text-muted-foreground",children:h.detail}):null]},h.id))}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"尚未运行过诊断。"})]})]})}function q({label:t,capability:n,extra:r}){const i=n?.supported===!0;return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:i?t:`${t} 不支持`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[n?.status??"读取中",n?.detail?` · ${n.detail}`:""]})]}),e.jsx(M,{variant:i?"secondary":"outline",children:i?"支持":"不支持"})]}),r?e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r}):null]})}function O(t){if(!t)return"暂无记录";const n=new Date(t);return Number.isNaN(n.getTime())?"暂无记录":n.toLocaleString()}export{bt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./dashboard-
|
|
1
|
+
import{j as t}from"./dashboard-D4DWPaAy.js";function s({title:e}){return t.jsx("div",{className:"flex h-full items-center px-4 text-sm font-semibold text-foreground",children:e})}export{s as P};
|
package/static/dashboard/assets/{SearchIndexingPanel-BCq_YMOP.js → SearchIndexingPanel-DEr1EDDC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as g,j as n}from"./dashboard-
|
|
1
|
+
import{r as g,j as n}from"./dashboard-D4DWPaAy.js";import{i as p,A as f}from"./ModelAssignmentsPanel-DxauxtEY.js";import{u as k}from"./AiConfigContext-CZEW16so.js";import"./dialog-EVyIyybL.js";import"./index-D2agcVRx.js";import"./ai-connections-Dr4-rSzX.js";import"./XpodAiConnectionsPodStore-FlZ0LEn0.js";import"@comunica/query-sparql-solid";function w(){const{config:r,capabilities:d,save:o,rebuild:c,saveAndRebuild:i,saving:l,rebuilding:s}=k(),[e,a]=g.useState(r?.searchIndexing);if(g.useEffect(()=>{let t=!1;return queueMicrotask(()=>{t||a(r?.searchIndexing)}),()=>{t=!0}},[r]),!e)return null;const u=async t=>{t.preventDefault(),await o({searchIndexing:e})},x=e.ftsEnabled&&e.vectorEnabled?"all":e.vectorEnabled?"vector":"fts",b=d?.rebuildTargets?.includes(x)===!0,m=p(e,r?.searchIndexing);return n.jsxs(f,{title:"Search & Indexing",description:"Choose which derived search indexes Xpod maintains for this Pod.",onSubmit:u,onRestore:()=>o({searchIndexing:{ftsEnabled:!0,vectorEnabled:!0,progressiveIndexingEnabled:!0,textBackend:"auto",vectorBackend:"auto"}}),saving:l||s,dirty:m,footerActions:n.jsx("button",{type:"button",disabled:!b||l||s,onClick:()=>m?i({searchIndexing:e},x):c(x),className:"h-9 rounded-md border border-input px-3 text-sm font-medium disabled:opacity-50",children:s?"Scheduling…":m&&b?"Save and schedule rebuild":b?"Schedule rebuild":"Rebuild unavailable on this runtime"}),children:[n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsx(h,{title:"Full-text Search",enabled:e.ftsEnabled,onEnabled:t=>a({...e,ftsEnabled:t}),backend:e.textBackend,onBackend:t=>a({...e,textBackend:t}),backends:[["auto","Auto"],...(d?.textBackends??[]).map(t=>[t,t==="fts5"?"FTS5":"PostgreSQL FTS"])]}),n.jsx(h,{title:"Vector Search",enabled:e.vectorEnabled,onEnabled:t=>a({...e,vectorEnabled:t}),backend:e.vectorBackend,onBackend:t=>a({...e,vectorBackend:t}),backends:[["auto","Auto"],...(d?.vectorBackends??[]).map(t=>[t,t==="vec"?"VEC":"pgvector"])]})]}),n.jsxs("label",{className:"flex items-start justify-between gap-4 rounded-xl border border-border p-4",children:[n.jsxs("span",{children:[n.jsx("span",{className:"block text-sm font-medium",children:"Progressive indexing"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Expand coverage as content becomes relevant instead of embedding everything eagerly."})]}),n.jsx("input",{name:"progressiveIndexingEnabled",type:"checkbox",checked:e.progressiveIndexingEnabled,onChange:t=>a({...e,progressiveIndexingEnabled:t.target.checked}),className:"mt-1 h-4 w-4 rounded border-input"})]})]})}function h({title:r,enabled:d,onEnabled:o,backend:c,onBackend:i,backends:l}){const s=l.filter(([a])=>a!=="auto"),e=v(c);return n.jsxs("section",{className:"rounded-xl border border-border p-4",children:[n.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm font-medium",children:[r,n.jsx("input",{type:"checkbox",checked:d,onChange:a=>o(a.target.checked),className:"h-4 w-4 rounded border-input"})]}),n.jsxs("label",{className:"mt-4 flex items-center justify-between gap-3 text-xs font-medium text-muted-foreground",children:["Choose backend manually",n.jsx("input",{type:"checkbox",checked:e,disabled:s.length===0,onChange:a=>i(a.target.checked?s[0]?.[0]??"auto":"auto"),className:"h-4 w-4 rounded border-input"})]}),e?n.jsxs("label",{className:"mt-3 block space-y-2 text-xs font-medium text-muted-foreground",children:["Backend",n.jsx("select",{value:c,onChange:a=>i(a.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground",children:s.map(([a,u])=>n.jsx("option",{value:a,children:u},a))})]}):n.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Auto selects the runtime-supported backend."})]})}function v(r){return r!=="auto"}export{w as SearchIndexingPanel,v as isManualBackendSelection};
|
package/static/dashboard/assets/{StatusSubjectPanel-DsUKTysU.js → StatusSubjectPanel-Cg92MGhO.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as L,r as o,j as e,B as N,R as T,C as l,a as u,b as h,d as f,e as m}from"./dashboard-
|
|
1
|
+
import{c as L,r as o,j as e,B as N,R as T,C as l,a as u,b as h,d as f,e as m}from"./dashboard-D4DWPaAy.js";import{f as D,a as M,t as _,r as O}from"./admin-C6qCRFiY.js";import{E as q}from"./external-link-DT746o7t.js";const G=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],U=L("rotate-cw",G);function Q({serviceId:t,title:r}){const[s,d]=o.useState(),[g,R]=o.useState(),[j,k]=o.useState([]),[v,p]=o.useState(),[b,S]=o.useState(!0),[y,w]=o.useState(!1),[C,$]=o.useState(),c=o.useCallback(async a=>{S(!0);try{const[n,A]=await Promise.all([D({signal:a}),M({source:t,level:"error",limit:5})]);d(t==="gateway"?{name:"gateway",status:"running",pid:n.adminData?.pid,uptime:n.adminData?.uptime?n.adminData.uptime*1e3:void 0,restartCount:0}:n.servicesData?.find(E=>E.name===t)),R(n.configData??void 0),k(A),$(n.checkedAt),p(void 0)}catch(n){n instanceof DOMException&&n.name==="AbortError"||p("Service status could not be loaded. The previous snapshot is retained.")}finally{S(!1)}},[t]);o.useEffect(()=>{const a=new AbortController;let n=!0;return Promise.resolve().then(()=>{n&&c(a.signal)}),()=>{n=!1,a.abort()}},[c]);const x=o.useMemo(()=>X(t,g),[g,t]),P=async()=>{const a=t==="gateway"?"the whole Xpod runtime":`${r} only`;if(!window.confirm(`Restart ${a}? Active requests may be interrupted.`))return;w(!0);const n=t==="gateway"?await _():await O(t);w(!1),n?setTimeout(()=>{c()},750):p(`Restart request for ${r} was not accepted by this runtime.`)};return e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{"aria-live":"polite",className:"text-xs text-muted-foreground",children:b?"Refreshing service evidence…":C?`Checked ${C.toLocaleString()}`:"Not checked"}),e.jsxs(N,{type:"button",size:"sm",variant:"outline",onClick:()=>{c()},disabled:b,children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),v&&e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:v}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:r}),e.jsx(f,{children:"Observed state, endpoint, health evidence, dependencies, and explicitly scoped lifecycle action."})]}),e.jsxs(m,{className:"grid gap-3 text-sm sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(i,{label:"State",value:s?.status??"Unknown"}),e.jsx(i,{label:"PID",value:s?.pid?.toString()??"Not reported"}),e.jsx(i,{label:"Uptime",value:s?.uptime?z(s.uptime):"Not reported"}),e.jsx(i,{label:"Restart count",value:s?.restartCount?.toString()??"Not reported"}),e.jsx(i,{label:"Internal endpoint",value:x.endpoint}),e.jsx(i,{label:"Health check",value:x.healthCheck})]})]}),e.jsxs(l,{children:[e.jsx(u,{children:e.jsx(h,{children:"Dependencies"})}),e.jsx(m,{className:"grid gap-3 text-sm sm:grid-cols-2",children:x.dependencies.map(a=>e.jsx(i,{label:a,value:B(a,t,s)},a))})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Recent errors"}),e.jsxs(f,{children:["Latest supervisor errors scoped to ",r,"."]})]}),e.jsxs(m,{className:"space-y-2",children:[j.length?j.map(a=>e.jsxs("div",{className:"rounded-lg border border-border p-3 text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(a.timestamp).toLocaleString()}),e.jsx("div",{className:"mt-1 break-words",children:a.message})]},`${a.timestamp}-${a.message}`)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent errors reported."}),e.jsxs("a",{className:"inline-flex items-center text-sm font-medium text-primary hover:underline",href:`/status/logs?source=${t}`,children:[e.jsx(q,{className:"mr-1.5 h-4 w-4"}),"Open related logs"]})]})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Lifecycle"}),e.jsx(f,{children:t==="gateway"?"Gateway is the parent process, so this action restarts the whole Xpod runtime.":`This action restarts ${r} only; dependent requests may briefly fail.`})]}),e.jsx(m,{children:e.jsxs(N,{type:"button",variant:"destructive",onClick:()=>{P()},disabled:y,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),y?"Restarting…":t==="gateway"?"Restart Xpod runtime…":`Restart ${r}…`]})})]})]})}function X(t,r){const s=r?.env??{};return t==="gateway"?{endpoint:window.location.origin,healthCheck:"GET /service/status",dependencies:["Solid Server","API Server"]}:t==="css"?{endpoint:s.CSS_PORT?`http://127.0.0.1:${s.CSS_PORT}`:"Internal endpoint not reported",healthCheck:"TCP readiness + Solid root request",dependencies:["Authority storage","Identity service"]}:{endpoint:s.API_INTERNAL_URL||(s.API_PORT?`http://127.0.0.1:${s.API_PORT}`:"Internal endpoint not reported"),healthCheck:"GET /health",dependencies:["Solid Server","Configuration store"]}}function B(t,r,s){return s?s.status!=="running"?`${H(r)} is ${s.status}; dependency health is not implied`:`${t} required; direct probe evidence is not reported by this runtime`:"Not reported"}function H(t){return t==="gateway"?"Gateway":t==="css"?"Solid Server":"API Server"}function i({label:t,value:r}){return e.jsxs("div",{className:"rounded-lg border border-border p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:t}),e.jsx("div",{className:"mt-1 break-all font-medium",children:r})]})}function z(t){const r=Math.floor(t/1e3),s=Math.floor(r/3600),d=Math.floor(r%3600/60);return s?`${s}h ${d}m`:`${d}m ${r%60}s`}export{Q as ServiceStatusPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r,D as l,S as x,
|
|
1
|
+
import{c as r,D as l,S as x,G as h,q as y,j as a,O as v,N as p,s as m,t as k}from"./dashboard-D4DWPaAy.js";import{A as u}from"./activity-D55X-5L5.js";import{W as f,N as w}from"./waypoints-CLZA22UN.js";import{P as g}from"./PaneListHeader-BEAXSlD9.js";import{T as N,u as j}from"./workspace-layout-urYcwAhS.js";const b=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],S=r("boxes",b);const I=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],M=r("braces",I);const L=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],_=r("hard-drive",L);const z=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],d=r("scroll-text",z);const D=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],H=r("server",D);const q=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],O=r("timer",q);function s(i,t,e,n,o){return{id:i,label:t,path:e,href:`/status/${e}`,end:!0,group:n,icon:o}}const c=[s("overview","Overview","overview","Overview",u),s("gateway","Gateway","services/gateway","Services",f),s("solid-server","Solid Server","services/solid-server","Services",l),s("api-server","API Server","services/api-server","Services",H),s("logs","Logs","logs","Diagnostics",d),s("index-overview","Index Overview","index","Index",S),s("rdf","RDF","index/rdf","Index",M),s("fts","FTS","index/fts","Index",d),s("vector","Vector","index/vector","Index",x),s("retrieval-points","Retrieval Points","index/retrieval-points","Index",w),s("cache","Cache","index/cache","Index",_),s("slow-queries","Slow Queries","index/slow-queries","Index",O),s("benchmark","Benchmark","index/benchmark","Index",h)],V=["Overview","Services","Diagnostics","Index"];function C(){const i=y(),t=[...c].sort((e,n)=>n.path.length-e.path.length).find(e=>i.pathname.endsWith(e.path))??c[0];return a.jsx(N,{mode:"auto",listHeader:a.jsx(g,{title:"Status"}),list:a.jsx(A,{}),mainHeader:a.jsx("div",{className:"flex h-full items-center px-4",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"text-sm font-semibold",children:["Status · ",t.label]}),a.jsx("div",{className:"text-xs text-muted-foreground",children:"Observed state and operational evidence"})]})}),main:a.jsx("section",{className:"min-h-full bg-background",children:a.jsx(v,{})}),className:"min-h-full"})}function A(){const i=j();return a.jsx("aside",{"data-list-navigation":!0,className:"h-full overflow-y-auto border-r border-border bg-muted/20 py-2",children:V.map(t=>a.jsxs("section",{className:"mb-3",children:[a.jsx("h2",{className:"px-5 py-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:t}),c.filter(e=>e.group===t).map(e=>{const n=e.icon;return a.jsxs(p,{to:e.path,end:e.end,onKeyDown:m,onClick:()=>i.openMain(),className:({isActive:o})=>k(o,{compact:!1}),children:[a.jsx(n,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),e.label]},e.id)})]},t))})}export{C as default};
|
package/static/dashboard/assets/{SystemSettingsPage-DRWfPjtu.js → SystemSettingsPage-rziu4Q3U.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as l,D as h,q as u,r as c,j as e,O as x,N as b,s as y,t as g}from"./dashboard-
|
|
1
|
+
import{c as l,D as h,q as u,r as c,j as e,O as x,N as b,s as y,t as g}from"./dashboard-D4DWPaAy.js";import{K as f}from"./key-round-CHnogQ1D.js";import{b as v,c as k}from"./admin-C6qCRFiY.js";import{p as j}from"./settings-projection-CUkyprDQ.js";import{P as N}from"./PaneListHeader-BEAXSlD9.js";import{T as S,u as w}from"./workspace-layout-urYcwAhS.js";const M=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],P=l("box",M);const L=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],C=l("cloud",L);const A=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],_=l("server-cog",A);const D=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],H=l("wrench",D),I=[{scope:"account",label:"Account",description:"Your Pod and its session.",items:[{id:"pod",label:"Pod",path:"pod",description:"Current Pod identity and data boundary.",icon:P},{id:"identity-access",label:"Identity & Access",path:"identity-access",description:"Session, WebID, and account access.",icon:f}]},{scope:"node",label:"This node",description:"Shared by every Pod on this machine.",items:[{id:"storage",label:"Storage",path:"storage",description:"Authority storage backend and limits.",icon:h},{id:"runtime",label:"Runtime",path:"runtime",description:"Low-frequency runtime configuration.",icon:_},{id:"cloud",label:"Cloud",path:"cloud",description:"Cloud coordination settings when supported.",icon:C},{id:"advanced",label:"Advanced",path:"advanced",description:"Expert and compatibility controls.",icon:H}]}];function T(){const r=u(),[n,s]=c.useState(!1);c.useEffect(()=>{let t=!1;return Promise.all([v(),k()]).then(([d,p])=>{t||s(j({registered:d?.registered===!0,managed:d?.managed===!0,domainAllocated:p?.allocated===!0}).cloud)}),()=>{t=!0}},[]);const a=c.useMemo(()=>I.map(t=>({...t,items:t.items.filter(d=>d.id!=="cloud"||n)})).filter(t=>t.items.length>0),[n]),o=c.useMemo(()=>a.flatMap(t=>t.items),[a]),i=o.find(t=>r.pathname.endsWith(`/${t.path}`))??o[0],m=a.find(t=>t.items.includes(i))?.scope;return e.jsx(S,{mode:"auto",listHeader:e.jsx(N,{title:"Settings"}),list:e.jsx(z,{groups:a}),mainHeader:e.jsx("div",{className:"flex h-full items-center px-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-sm font-semibold",children:["Settings · ",i.label]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i.description}),m==="node"?e.jsx("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:"Applies to every Pod on this machine."}):null]})}),main:e.jsx("section",{className:"min-h-full bg-background",children:e.jsx(x,{})}),className:"min-h-full"})}function z({groups:r}){const n=w();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Settings sections","data-list-navigation":!0,children:r.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"px-4 pb-1 pt-3",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s.label}),e.jsx("div",{className:"text-xs leading-4 text-muted-foreground",children:s.description})]}),s.items.map(a=>{const o=a.icon;return e.jsxs(b,{to:a.path,"aria-label":a.label,onKeyDown:y,onClick:()=>n.openMain(),className:({isActive:i})=>g(i,{compact:!1}),children:[e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:a.label}),e.jsx("span",{className:"block text-xs leading-4 text-muted-foreground",children:a.description})]})]},a.id)})]},s.scope))})})}export{T as default};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{x as Ne,y as X,z as Re,A as O,E as Ve,F as ae,H as Je,I as fe,J as Qe,K as Ye,L as Ze,M as et,Q as tt,o as nt,r as d,j as s,B as S,R as rt,C as st,a as ot,b as at,d as ct,e as it,T as dt,U as je,V as lt}from"./dashboard-D4DWPaAy.js";import{d as ut,e as ft,b as ht,c as pt,h as mt,i as gt,t as wt,u as bt}from"./admin-C6qCRFiY.js";import{a as yt}from"./settings-projection-CUkyprDQ.js";import{A as vt,a as he}from"./ai-connections-Dr4-rSzX.js";import{R as xt}from"./rotate-ccw-BNVDC4Zr.js";import{S as pe}from"./skeleton-BzsZekVf.js";import{E as At}from"./external-link-DT746o7t.js";class A extends Error{code;constructor(t,n){super(n),this.name="AccountStorageBindingsError",this.code=t}}async function Ct(e){const t=St(e.origin),n=e.controls?.account?.bindings;if(typeof n!="string"||n.trim()==="")throw new A("missing-control","Account storage bindings control is unavailable");const r=e.fetchImpl??fetch,o=Nt(n,t),a=o.origin===t?o.href:await Ne(o.href,r,e.trustedAccountIndex);if(!a)throw new A("cross-origin","Account storage bindings control is not hosted by this Xpod");const c=X({Accept:"application/json",...e.headers});let i;try{i=await r(a,{headers:c,credentials:"include"})}catch(u){throw new A("request-failed",u instanceof Error?u.message:"Failed to load Account storage bindings")}if(i.status===401||i.status===403)throw new A("forbidden","Account storage bindings require an authenticated Account");if(!i.ok)throw new A("request-failed",`Account storage bindings request failed (${i.status})`);let l;try{l=await i.json()}catch{throw new A("invalid-response","Account storage bindings response is not valid JSON")}return It(l,o.origin,Et(o,e.trustedAccountIndex,t))}function It(e,t,n=!1){if(!me(e)||!Array.isArray(e.bindings))throw new A("invalid-response","Account storage bindings response is malformed");const r=[],o=new Set;for(const a of e.bindings){if(!me(a)||typeof a.webId!="string"||typeof a.storageUrl!="string")throw new A("invalid-response","Account storage binding row is malformed");const c=Rt(a.webId),i=jt(a.storageUrl,n?void 0:t);if(!c||!i)throw new A("cross-origin","Account storage binding is outside the trusted storage scope");const l={webId:c,storageUrl:i,...typeof a.label=="string"?{label:a.label}:{}},u=`${l.webId}
|
|
2
|
+
${l.storageUrl}`;o.has(u)||(o.add(u),r.push(l))}return r}function St(e){try{return new URL(e??(typeof window>"u"?"http://localhost":window.location.origin)).origin}catch{throw new A("cross-origin","Current Xpod origin is invalid")}}function Nt(e,t){try{const n=new URL(e,t);if(!["http:","https:"].includes(n.protocol)||n.username||n.password||n.hash)throw new Error("unsafe control URL");return n}catch{throw new A("cross-origin","Account storage bindings control is not a valid URL")}}function Rt(e){if(!Re(e))try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password?void 0:e}catch{return}}function jt(e,t){try{const n=new URL(e.trim());return t!==void 0&&n.origin!==t||!["http:","https:"].includes(n.protocol)||n.username||n.password||n.search||n.hash?void 0:(n.pathname=n.pathname.endsWith("/")?n.pathname:`${n.pathname}/`,n.href)}catch{return}}function Et(e,t,n){if(!t)return!1;try{const r=new URL(t,n);return r.pathname.startsWith("/.account/")&&e.origin===r.origin&&e.pathname.startsWith("/.account/")}catch{return!1}}function me(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function J(e){return typeof e=="object"&&e!==null}function _t(e){return J(e)&&typeof e.message=="string"?e.message:""}const ge="co.undefineds.ai-connections",Ut={providerCredentials:"settings/credentials.ttl",providerDefinitions:"settings/providers/__service_access__.ttl",gatewayAccessKeys:".data/ai/gateway/access-keys.ttl",quotaSnapshots:".data/ai/gateway/quota.ttl"},Pt=new Set(vt);function we(e,t){if(!K(e))throw new Error("invalid_descriptor");if(e.appletId!==ge)throw new Error("invalid_applet_id");const n=e.service;if(!K(n)||typeof n.webId!="string"||typeof n.label!="string"||!Wt(n.webId))throw new Error("invalid_service");if(!Array.isArray(e.resources)||e.resources.length===0)throw new Error("invalid_empty_resources");const r=Ft(t),o=new Set,a=e.resources.map(c=>kt(c,r,o));return{appletId:ge,service:{webId:n.webId,label:n.label},resources:a}}function kt(e,t,n){if(!K(e)||typeof e.id!="string"||typeof e.url!="string"||e.mediaType!=="text/turtle"||!K(e.access))throw new Error("invalid_resource");const r=Tt(e.id,t);if(!r||n.has(e.id))throw new Error("invalid_resource");Ot(e.url);let o;try{o=new URL(e.url)}catch{throw new Error("invalid_resource")}if(!Mt(o,t))throw new Error("invalid_resource");if(o.href!==r)throw new Error("invalid_resource");return n.add(e.id),{id:e.id,url:o.href,mediaType:"text/turtle",access:Dt(e.access)}}function Tt(e,t){const n=Ut[e];if(n)return new URL(n,t).href;const r=e.startsWith("providerDocument:")?e.slice(17):void 0;if(r&&Pt.has(r))return new URL(`settings/providers/${r}.ttl`,t).href}function Ot(e){if(/%(?![0-9a-fA-F]{2})/.test(e)||/%(?:2f|5c)/i.test(e)||e.includes("\\"))throw new Error("invalid_resource");const t=Lt(e);if(be(t))throw new Error("invalid_resource");try{const n=decodeURIComponent(t);if(n.includes("\\")||be(n))throw new Error("invalid_resource")}catch{throw new Error("invalid_resource")}}function Lt(e){const t=e.split("#",1)[0]??e;return(t.split("?",1)[0]??t).replace(/^[a-z][a-z0-9+.-]*:\/\/[^/\\?#]*/i,"")}function be(e){return e.split("/").some(t=>t==="."||t==="..")}function Dt(e){if(Object.keys(e).some(n=>n!=="read"&&n!=="append"&&n!=="write")||e.read!==!0||e.append!==!0||e.write!==!0)throw new Error("invalid_resource");return{read:!0,append:!0,write:!0}}function Ft(e){const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("invalid_current_pod");return t.pathname.endsWith("/")||(t.pathname=`${t.pathname}/`),t}function Mt(e,t){return(e.protocol==="http:"||e.protocol==="https:")&&e.origin===t.origin&&e.pathname.startsWith(t.pathname)}function Wt(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function K(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}const Bt=3,$t=63,Gt=/^[a-z0-9-]+$/;function ce(e){return e.trim().toLowerCase()}function Ee(e){const t=ce(e);if(!t)return O.usernameRequired;if(t.length<Bt||t.length>$t)return O.usernameLength;if(!Gt.test(t))return O.usernameCharset;if(t.startsWith("-")||t.endsWith("-"))return O.usernameHyphen}const zt="已有 Pod 的身份绑定尚未确认。请重试读取绑定或返回账号,不需要重新创建 Pod。",Ht="暂时无法确认已有 Pod,请重试读取或返回账号。";class _ extends Error{code;constructor(t){super(t==="binding-missing"?zt:t==="inventory-unavailable"?Ht:"账号已切换,请返回当前账号重新操作。"),this.name="FirstPodReadinessError",this.code=t}}function Xt(e){const t=fe(),n=Qe(t,{...e.headers}),r=new Headers(n).get("Authorization"),o=()=>{try{e.assertCurrentAccount?.()}catch{throw new _("account-changed")}if(fe()!==t||r?.startsWith("CSS-Account-Token ")&&r!==(t?`CSS-Account-Token ${t}`:void 0))throw new _("account-changed")},a=e.fetchImpl??fetch;return{headers:n,assertCurrentAccount:o,fetch:async(i,l)=>{o();const u=await a(i,l);try{o()}catch(x){throw u.body?.cancel().catch(()=>{}),x}const b=async x=>{o();const U=await x();return o(),U},y=u.json.bind(u),v=u.text.bind(u);return u.json=()=>b(y),u.text=()=>b(v),u}}}async function qt(e,t,n,r){r.assertCurrentAccount();let o;try{const i=await e(ae(t),{headers:{...r.headers,Accept:"application/json"},credentials:"include"});if(!i.ok)throw new _("inventory-unavailable");o=await i.json()}catch{throw r.assertCurrentAccount(),new _("inventory-unavailable")}if(r.assertCurrentAccount(),!se(o)||!se(o.pods))throw new _("inventory-unavailable");const a=Object.entries(o.pods);if(a.some(([i,l])=>!Pe(i)||typeof l!="string"||!l))throw new _("inventory-unavailable");const c=Ye(n);if(a.some(([i])=>!c||Ze(i,c.storageRoot)))throw new _("binding-missing")}function Kt(e){for(const t of e){if(!t)continue;const n=tn(t);if(!n)continue;const r=ce(n).replace(/[^a-z0-9-]/gu,"-").replace(/-+/gu,"-").replace(/^-+|-+$/gu,"");if(r&&!Ee(r))return r}return""}async function Vt(e){const t=Xt(e),n=t.fetch,r=ce(e.username),o=Ee(r);if(o)throw new Error(o);const a=await Ve(e.provisionCode),c=await Ne(e.createPodUrl,n,e.trustedAccountIndex);if(!c)throw new Error("Pod creation control is not hosted by this Xpod");await qt(n,c,a,t);const i=await Zt(n,r,a);t.assertCurrentAccount();const l=await n(ae(c),{method:"POST",headers:{...t.headers,Accept:"application/json","Content-Type":"application/json"},credentials:"include",body:JSON.stringify(Je(r,i?.provisionCode??a,i?.provisionReceipt))});if(t.assertCurrentAccount(),!l.ok){const v=await Yt(l);throw l.status===409||_e(v)?new Error(O.podNameTaken):new Error(v||"Failed to create Pod")}const u=await l.json().catch(V);t.assertCurrentAccount();const b=en(u);if(!e.pickWebIdUrl)return b;const y=await Jt({fetchImpl:n,headers:t.headers,maxAttempts:e.maxAttempts,pickWebIdUrl:e.pickWebIdUrl,pollIntervalMs:e.pollIntervalMs});return t.assertCurrentAccount(),y.length>0?y:b}async function Jt(e){const t=e.fetchImpl??fetch,n=Math.max(1,e.maxAttempts??30),r=Math.max(0,e.pollIntervalMs??500);for(let o=0;o<n;o+=1){const a=await Qt(t,e.pickWebIdUrl,e.headers);if(a.length>0)return a;o<n-1&&r>0&&await new Promise(c=>setTimeout(c,r))}return[]}function V(e){if(e instanceof _)throw e}async function Qt(e,t,n){const r=await e(ae(t),{headers:n,credentials:"include"}).catch(V);if(!r?.ok)return[];const o=await r.json().catch(V);if(!Array.isArray(o?.entries))return[];const a=new Set,c=[];for(const i of o.entries){if(!se(i)||typeof i.webId!="string"||typeof i.storageUrl!="string")continue;const l=Ue(i.webId,i.storageUrl);if(!l)continue;const u=`${l.webId}
|
|
3
|
+
${l.storageUrl}`;a.has(u)||(a.add(u),c.push(l))}return c}async function Yt(e){const t=await e.text?.().catch(V);if(t)try{const n=JSON.parse(t);return typeof n.message=="string"?n.message:typeof n.error=="string"?n.error:t}catch{return t}}function _e(e){return e?/already (?:is )?(?:a )?resource/iu.test(e)||/already taken/iu.test(e)||/already exists/iu.test(e):!1}async function Zt(e,t,n){try{return await et(e,t,n)}catch(r){const o=r instanceof Error?r.message:String(r);throw _e(o)?new Error(O.podNameTaken):r}}function en(e){if(typeof e?.podUrl!="string")return[];const t=Pe(e.podUrl);if(!t)return[];const n=new Set;if(typeof e.webId=="string"&&e.webId.length>0&&n.add(e.webId),Array.isArray(e.webIds))for(const r of e.webIds)typeof r=="string"&&r.length>0&&n.add(r);return Array.from(n).map(r=>Ue(r,t)).filter(r=>!!r)}function tn(e){try{return new URL(e).pathname.split("/").filter(Boolean)[0]}catch{return e.includes("@")?e.split("@",1)[0]:e}}function Ue(e,t){if(!Re(e))try{const n=new URL(e),r=new URL(t);return!["http:","https:"].includes(n.protocol)||!["http:","https:"].includes(r.protocol)?void 0:(r.pathname=r.pathname.endsWith("/")?r.pathname:`${r.pathname}/`,{webId:e,storageUrl:r.href})}catch{return}}function Pe(e){try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password||t.hash||t.search?void 0:(t.pathname=t.pathname.endsWith("/")?t.pathname:`${t.pathname}/`,t.href)}catch{return}}function se(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function nn(e,t){if(e)try{return new URL(new URL(e).pathname,t).toString()}catch{return}}const rn="http://www.w3.org/ns/solid/acp#",sn="http://www.w3.org/ns/auth/acl#";function ye(e,{ownerWebId:t,serviceWebId:n},r=!0){const o=r?`
|
|
4
|
+
<#serviceAccess>
|
|
5
|
+
a acp:AccessControl;
|
|
6
|
+
acp:apply [
|
|
7
|
+
a acp:Policy;
|
|
8
|
+
acp:allow acl:Read, acl:Write;
|
|
9
|
+
acp:anyOf [
|
|
10
|
+
a acp:Matcher;
|
|
11
|
+
acp:agent <${n}>
|
|
12
|
+
]
|
|
13
|
+
].
|
|
14
|
+
`:"",a=r?"<#ownerAccess>, <#serviceAccess>":"<#ownerAccess>";return`@prefix acl: <${sn}>.
|
|
15
|
+
@prefix acp: <${rn}>.
|
|
16
|
+
|
|
17
|
+
<#managed>
|
|
18
|
+
a acp:AccessControlResource;
|
|
19
|
+
acp:resource <${e}>;
|
|
20
|
+
acp:accessControl ${a};
|
|
21
|
+
acp:memberAccessControl ${a}.
|
|
22
|
+
|
|
23
|
+
<#ownerAccess>
|
|
24
|
+
a acp:AccessControl;
|
|
25
|
+
acp:apply [
|
|
26
|
+
a acp:Policy;
|
|
27
|
+
acp:allow acl:Read, acl:Write, acl:Control;
|
|
28
|
+
acp:anyOf [
|
|
29
|
+
a acp:Matcher;
|
|
30
|
+
acp:agent <${t}>
|
|
31
|
+
]
|
|
32
|
+
].
|
|
33
|
+
${o}`}function on(e){const t=new URL(e);return t.pathname.endsWith("/")||(t.pathname=t.pathname.slice(0,t.pathname.lastIndexOf("/")+1)),t.toString()}function ne(e){return new URL(".acr",e).toString()}function re(e){return[...new Set(e.resources.map(t=>on(t.url)))]}async function ve(e,t,n){const r=await e(t,{method:"PUT",headers:{"content-type":"text/turtle"},body:n});if(!r.ok)throw await r.arrayBuffer().catch(()=>{}),new Error(`service_acr_write_failed:${r.status}`)}function H(e,t,n){return{status:t?"granted":"missing",resources:e.resources}}function xe(e){const t=()=>{if(!e.ownerWebId)throw new Error("service_acr_owner_missing");return e.ownerWebId};return{async ensureAgentAccess(n){const r=t();for(const o of re(n))await ve(e.authenticatedFetch,ne(o),ye(o,{ownerWebId:r,serviceWebId:n.service.webId}));return{status:"granted",resources:n.resources}},async inspectAgentAccess(n){try{for(const r of re(n)){const o=await e.authenticatedFetch(ne(r),{headers:{accept:"text/turtle"}});if(!o.ok)return await o.arrayBuffer().catch(()=>{}),H(n,!1);const a=await o.text();if(!a.includes(`<${n.service.webId}>`)||!a.includes("acp:AccessControlResource"))return H(n,!1)}return H(n,!0)}catch{return H(n,!1)}},async revokeAgentAccess(n){const r=t();for(const o of re(n))await ve(e.authenticatedFetch,ne(o),ye(o,{ownerWebId:r,serviceWebId:n.service.webId},!1));return{status:"missing",resources:n.resources}}}}const Ae=600*1e3,B=2048,N="xpod.safe-continuation.consent.v2",q="xpod.safe-continuation.management.v2",an=/^\/\.account\/interaction\/([^/?#]+)$/u,cn=/^\/\.account\/(?:interaction\/[^/?#]+\/)?account\/([^/?#]+)\//u;function Q(){if(!(typeof window>"u"))try{return window.location.origin}catch{return}}function ke(){if(!(typeof window>"u"))try{return window.sessionStorage}catch{return}}function oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Y(e){return typeof e=="string"&&e.length>0&&e.length<=B}function $(e){return Y(e)&&e===e.trim()}function Ce(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Te(e){return Y(e)&&an.test(e)}function dn(e){if(typeof e!="string"||!e||e.length>B)return;const t=ln(e);if(t)return t;if(/^[^/?#:]+$/u.test(e)&&e===e.trim())return e}function ln(e){if(typeof e!="string"||!e||e.length>B)return;let t;try{t=new URL(e,Q()??"http://localhost")}catch{return}if(!["http:","https:"].includes(t.protocol)||t.username||t.password)return;const n=cn.exec(t.pathname);return n?n[1]:void 0}function Ie(e,t){const n=e?.account,r=[t?.id,n?.id,n?.logout,n?.clientCredentials,n?.bindings,n?.pod].map(dn).filter(c=>!!c);if(r.length===0)return;const[o,...a]=r;return a.every(c=>c===o)?o:void 0}function Oe(e,t=Q()){if(!t||typeof e!="string"||!e||e.length>B)return!1;let n;try{n=new URL(e,t)}catch{return!1}return n.origin===t&&!n.username&&!n.password&&n.pathname.startsWith("/.account/")}function Le(e,t,n=Q()){if(!n||!Te(e)||typeof t!="string"||!t||t.length>B)return!1;let r;try{r=new URL(t,n)}catch{return!1}return r.origin===n&&!r.username&&!r.password&&r.pathname===`${e}/oidc/consent/`&&r.search===""&&r.hash===""}function un(e){const t=ke();if(!t)return null;try{return t.getItem(e)}catch{return null}}function Z(e){const t=un(e);if(t===null)return;let n;try{n=JSON.parse(t)}catch{return}return oe(n)?n:void 0}function R(e){const t=ke();if(t)try{t.removeItem(e)}catch{}}function De(e){const{createdAt:t,expiresAt:n}=e;if(!Ce(t)||!Ce(n))return!1;const r=Date.now();if(t>r)return!1;const o=n-t;return o<=0||o>Ae||n>t+Ae?!1:n>r}function Fe(e,t){return e.accountId===t.accountId&&e.interaction===t.interaction&&e.returnTo===t.returnTo&&e.createdAt===t.createdAt&&e.expiresAt===t.expiresAt}function ie(e){if(!e||e.kind!=="consent")return null;const{accountId:t,interaction:n,returnTo:r}=e;return!$(t)||!Te(n)||!Y(r)||!De(e)||!Le(n,r)?null:{kind:"consent",accountId:t,interaction:n,returnTo:r,createdAt:e.createdAt,expiresAt:e.expiresAt}}function fn(e){if(!e||e.kind!=="management")return null;const{accountId:t,returnTo:n}=e;return!$(t)||!Y(n)||!De(e)||!Oe(n)?null:{kind:"management",accountId:t,returnTo:n,createdAt:e.createdAt,expiresAt:e.expiresAt}}function Se(){R(N)}function Me(e){const t=e?.accountId;if(!$(t))return R(q),null;const n=fn(Z(q));return!n||n.accountId!==t?(R(q),null):n}function hn(e){const t=Me(e);return R(q),t}function pn(e){const t=e?.accountId;if(!$(t))return R(N),null;const n=ie(Z(N));return!n||n.accountId!==t?(R(N),null):n}function mn(e,t,n={}){const r=t?.accountId;if(!$(r))return R(N),null;const o=ie(Z(N));if(!o||o.accountId!==r||!Fe(o,e))return R(N),null;try{n.assertCurrent?.()}catch{return null}return R(N),o}async function We(e,t={}){const n=t.origin??Q();if(!n||!Le(e.interaction,e.returnTo,n))return!1;const r=t.fetch??(typeof fetch=="function"?fetch:void 0);if(!r)return!1;const o=new URL(e.returnTo,n).href;let a;try{t.assertCurrent?.(),a=await r(o,{method:"GET",credentials:"include",redirect:"manual",headers:{accept:"application/json",...t.headers??{}}})}catch{return!1}try{t.assertCurrent?.()}catch{return!1}if(a.redirected===!0||typeof a.status=="number"&&a.status>=300&&a.status<400||!a.ok||typeof a.url=="string"&&a.url&&a.url!==o)return!1;const c=await a.json().catch(()=>{});if(!oe(c))return!1;const i=c.client;return oe(i)&&(typeof i.client_id=="string"||typeof i.client_name=="string")}async function gn(e,t={}){const n=pn(e);if(!n)return null;const r=await We(n,t),o=ie(Z(N));if(!r||!o||o.accountId!==e.accountId||!Fe(o,n))return R(N),null;try{t.assertCurrent?.()}catch{return null}return o}function wn(e,t){return e?.oidc?.cancel||`${t}oidc/cancel`}async function bn(e){const t=e.fetchImpl??fetch,n=e.timeoutMs??15e3,r=n>0?new AbortController:null;let o;r&&(o=setTimeout(()=>r.abort(),n));try{const a=await t(e.cancelUrl,{method:"POST",headers:e.headers,credentials:"include",body:JSON.stringify({}),signal:r?.signal});return await yn(a)}catch(a){throw xn(a,"AbortError")?new Error("Authorization cancellation timed out. Please close this tab and retry login."):a}finally{o&&clearTimeout(o)}}async function yn(e){const t=await e.json().catch(()=>null);if(!e.ok)throw vn(t,_t(t)||`Authorization cancellation failed (${e.status}).`);const n=J(t)&&typeof t.location=="string"?t.location.trim():"",r=e.headers.get("Location")?.trim()||"",o=n||r;if(!o)throw new Error("Authorization cancellation did not return a redirect URL.");return o}function vn(e,t){return J(e)&&(e.errorCode==="E0002"||e.message==="Invalid OIDC interaction"||e.message==="This action can only be performed as part of an OIDC authentication flow.")?new Error(tt.expiredInteraction):new Error(t)}function xn(e,t){return J(e)&&e.name===t}function An(e,t,n){const r=wn(t,n);let o="/oidc/cancel/";try{const a=new URL(r,window.location.origin);if(a.origin===window.location.origin){const c=a.pathname.replace(/^\/\.account/u,"");c.startsWith("/")&&(o=c.endsWith("/")?c:`${c}/`)}}catch{}return`${e}${o}`}function Mn({kind:e}){const t=nt(),[n,r]=d.useState(null),[o,a]=d.useState(null),[c,i]=d.useState(null),[l,u]=d.useState(null),[b,y]=d.useState(!0),[v,x]=d.useState(""),[U,m]=d.useState(""),j=d.useCallback(async()=>{y(!0),x("");try{const[g,p,C,P]=await Promise.all([ut(),ft(),ht(),pt()]);if(!g||!p)throw new Error("unavailable");r(g),a(p),i(C),u(await mt(gt(p.env,P,g.env.CSS_BASE_URL??"")))}catch{x("Settings evidence could not be loaded.")}finally{y(!1)}},[]);d.useEffect(()=>{let g=!1;return queueMicrotask(()=>{g||j()}),()=>{g=!0}},[j]);const E=async g=>{if(x(""),!await bt(g)){x("Configuration could not be saved.");return}a(p=>p&&{...p,env:{...p.env,...g}}),m("Saved · restart required")},D=_n[e];return s.jsxs("div",{className:"space-y-4 p-6",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(S,{type:"button",size:"sm",variant:"outline",onClick:j,disabled:b,children:[s.jsx(rt,{className:"mr-2 h-4 w-4"}),"Refresh"]})}),v?s.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:v}):null,U?s.jsxs("div",{role:"status",className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-200",children:[s.jsx("span",{children:U}),s.jsxs(S,{type:"button",size:"sm",variant:"outline",onClick:()=>{wt()},children:[s.jsx(xt,{className:"mr-2 h-4 w-4"}),"Restart Xpod"]})]}):null,s.jsxs(st,{children:[s.jsxs(ot,{children:[s.jsx(at,{children:D}),s.jsx(ct,{children:Un[e]})]}),s.jsx(it,{className:"space-y-4",children:b&&!o?s.jsx("div",{role:"status","aria-label":"Loading settings",className:"grid gap-3 sm:grid-cols-2","aria-live":"polite",children:[0,1,2,3].map(g=>s.jsxs("div",{className:"rounded-lg border border-border p-3","aria-hidden":"true",children:[s.jsx(pe,{className:"h-3 w-24"}),s.jsx(pe,{className:"mt-2 h-5 w-36"})]},g))}):s.jsx(In,{kind:e,runtime:t,admin:n,configuration:o,provision:c,publicRoute:l,save:E})})]})]})}function Cn({runtime:e,publicRoute:t}){const n=dt(),[r,o]=d.useState(null),[a,c]=d.useState(""),[i,l]=d.useState(""),[u,b]=d.useState(!1),[y,v]=d.useState(""),[x,U]=d.useState(""),[m,j]=d.useState(null),[E,D]=d.useState(null),[g,p]=d.useState(""),[C,P]=d.useState(!1),G=d.useRef(void 0),ee=d.useRef(void 0),I=n.controls,F=n.idpIndex,k=Ie(I,n.identity),le=n.bindAccountCapability,te=d.useCallback(async()=>{c("");try{o(await Ct({controls:I,origin:window.location.origin,trustedAccountIndex:F}))}catch{o(null),c("暂时无法读取存储绑定,请重试。")}},[I,F]);d.useEffect(()=>{let f=!1;return queueMicrotask(()=>{f||te()}),()=>{f=!0}},[te]),d.useEffect(()=>{if(G.current=void 0,ee.current=void 0,!k)return;let f=!1;const h=le?.();return(async()=>{let w=null;try{w=await gn({accountId:k},{assertCurrent:h})}catch{w=null}if(f)return;G.current=w?h:void 0;const M=w?null:Me({accountId:k});ee.current=M?h:void 0,j(w),D(M)})(),()=>{f=!0}},[k,le]);const T=d.useCallback((f,h)=>{const w=Ie(I,n.identity);if(!h||w!==f)return null;try{h()}catch{return null}return h},[n.identity,I]),$e=d.useCallback(async()=>{if(!m||C)return;const f=T(m.accountId,G.current);if(!f){j(null),p("这个授权任务已失效,请回到应用重新发起。");return}P(!0),p("");try{const w=await We(m,{headers:X({Accept:"application/json"}),assertCurrent:f})?mn(m,{accountId:m.accountId},{assertCurrent:f}):null;if(!w){Se(),j(null),p("这个授权任务已失效,请回到应用重新发起。"),P(!1);return}window.location.assign(w.returnTo)}catch{j(null),p("这个授权任务已失效,请回到应用重新发起。"),P(!1)}},[T,m,C]),Ge=d.useCallback(async()=>{if(!m||C)return;const f=T(m.accountId,G.current);if(!f){j(null),p("这个授权任务已失效,请回到应用重新发起。");return}P(!0),p("");try{const h=await bn({cancelUrl:An(m.interaction,I,F),headers:X({"Content-Type":"application/json",Accept:"application/json"})});f(),Se(),window.location.assign(h)}catch{p("取消授权失败,请重试。"),P(!1)}},[T,m,I,F,C]),ze=d.useCallback(()=>{if(!E||C)return;if(!T(E.accountId,ee.current)){D(null);return}const h=hn({accountId:E.accountId});if(!h||!Oe(h.returnTo)){D(null);return}window.location.assign(h.returnTo)},[T,E,C]),ue=d.useMemo(()=>Kt([e.webId,n.identity?.username,I?.account?.username]),[e.webId,n.identity?.username,I?.account?.username]),He=async f=>{f.preventDefault();const h=I?.account?.pod,w=(i.trim()||ue||"").trim();if(!u){if(!h){v("当前部署没有公布创建存储空间的入口。");return}if(!w){v("无法从当前账号推断 Pod 名称,请手动填写。");return}b(!0),v(""),U("");try{await Vt({assertCurrentAccount:n.bindAccountCapability?.(),createPodUrl:h,headers:X(),provisionCode:await lt(),trustedAccountIndex:F,username:w}),l(""),U("存储空间已创建。"),await te()}catch(M){v(M instanceof Error?M.message:"无法创建存储空间,请重试。")}finally{b(!1)}}},z=nn(e.podUrl,window.location.origin),Xe=[{label:"Pod name",value:Be(e.podUrl)},{label:"Pod URL",value:z??"Not discovered"},{label:"Public route",value:En(t),detail:t?.detail??"Not checked by this runtime"},{label:"Session",value:e.state.status}],qe=m&&m.accountId===k?m:null,Ke=E&&E.accountId===k?E:null;return s.jsxs(s.Fragment,{children:[qe?s.jsxs("div",{role:"status","data-testid":"consent-resume-banner",className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-primary/30 bg-primary/10 p-3",children:[s.jsxs("div",{className:"text-sm",children:[s.jsx("div",{className:"font-medium text-foreground",children:"有应用正在等待你的授权"}),s.jsx("div",{className:"text-xs text-muted-foreground",children:"完成这里的操作后可以回到原来的授权继续。"})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(S,{type:"button",disabled:C,onClick:$e,children:"回到授权"}),s.jsx(S,{type:"button",variant:"outline",disabled:C,onClick:()=>{Ge()},children:"取消授权"})]})]}):Ke?s.jsxs("div",{role:"status","data-testid":"management-resume-banner",className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border bg-muted/40 p-3",children:[s.jsx("div",{className:"text-sm font-medium text-foreground",children:"完成管理后可以回到账号页。"}),s.jsx(S,{type:"button",variant:"outline",onClick:ze,children:"返回账号"})]}):null,g?s.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:g}):null,s.jsx(L,{rows:Xe}),s.jsxs(S,{type:"button",variant:"outline",disabled:!z,onClick:()=>z&&window.open(z,"_blank","noopener,noreferrer"),children:[s.jsx(At,{className:"mr-2 h-4 w-4"}),"Open Pod"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-sm font-medium",children:"属于当前账号的存储空间"}),a?s.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:a}):null,r===null&&!a?s.jsx("div",{role:"status",className:"text-sm text-muted-foreground",children:"正在读取…"}):null,r?.length===0?s.jsx("div",{role:"status",className:"rounded-lg border border-border p-3 text-sm text-muted-foreground",children:"这个账号还没有任何存储空间。创建后即可用它授权应用访问。"}):null,r&&r.length>0?s.jsx("ul",{className:"space-y-2",children:r.map(f=>s.jsxs("li",{className:"rounded-lg border border-border p-3 text-sm",children:[s.jsx("div",{className:"break-all font-medium",children:f.storageUrl}),s.jsx("div",{className:"mt-1 break-all text-xs text-muted-foreground",children:f.webId})]},`${f.webId}|${f.storageUrl}`))}):null]}),s.jsxs("form",{onSubmit:He,className:"space-y-2 rounded-lg border border-border p-3",children:[s.jsx("label",{className:"block text-sm font-medium",htmlFor:"pod-management-name",children:"创建存储空间"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"创建是一次显式操作:不会因为登录或授权而自动发生。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(je,{id:"pod-management-name",className:"h-10 min-w-48 flex-1",value:i,placeholder:ue||"my-pod",disabled:u,onChange:f=>l(f.currentTarget.value)}),s.jsx(S,{type:"submit",disabled:u,children:u?"正在创建…":"创建"})]}),y?s.jsx("div",{role:"alert",className:"text-sm text-destructive",children:y}):null,x?s.jsx("div",{role:"status",className:"text-sm text-muted-foreground",children:x}):null]})]})}function In({kind:e,runtime:t,admin:n,configuration:r,provision:o,publicRoute:a,save:c}){const i=r?.env??{};return e==="pod"?s.jsx(Cn,{runtime:t,publicRoute:a}):e==="identity-access"?s.jsx(Sn,{runtime:t}):e==="storage"?s.jsxs(s.Fragment,{children:[s.jsx(L,{rows:yt(i,r?.secrets)}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Measured storage and bandwidth are intentionally shown in Status → Usage, not here. Storage migration is unavailable because this runtime does not report a migration capability."})]}):e==="runtime"?s.jsx(Nn,{env:i,admin:n,save:c}):e==="cloud"?s.jsx(Rn,{env:i,provision:o,save:c}):s.jsx(jn,{env:i,save:c})}function Sn({runtime:e}){const[t,n]=d.useState("checking"),[r,o]=d.useState(!1),a=d.useCallback(async()=>{if(!e.webId||!e.podUrl||e.state.status!=="authenticated"){n("unavailable");return}n("checking");try{const l=he({webId:e.webId,podUrl:e.podUrl,authenticatedFetch:e.fetch}),u=we(await l.getServiceAccess(),e.podUrl),y=await xe({authenticatedFetch:e.fetch,ownerWebId:e.webId}).inspectAgentAccess(u);n(y.status==="granted"?"granted":"missing")}catch{n("error")}},[e.fetch,e.podUrl,e.state.status,e.webId]);d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||a()}),()=>{l=!0}},[a]);const c=async()=>{if(!(!e.webId||!e.podUrl||!window.confirm("Revoke AI Gateway service access to Xpod settings resources? Provider credentials remain stored but the service can no longer use them."))){o(!0);try{const l=he({webId:e.webId,podUrl:e.podUrl,authenticatedFetch:e.fetch}),u=we(await l.getServiceAccess(),e.podUrl);await xe({authenticatedFetch:e.fetch,ownerWebId:e.webId}).revokeAgentAccess(u),n("missing")}catch{n("error")}finally{o(!1)}}},i=t==="granted"?"Granted":t==="missing"?"Not granted":t==="checking"?"Checking…":t==="unavailable"?"Unavailable while signed out":"Could not inspect";return s.jsxs(s.Fragment,{children:[s.jsx(L,{rows:[{label:"WebID",value:e.webId??"Signed out"},{label:"OIDC issuer",value:e.issuer??"Not reported"},{label:"Current account",value:e.webId?Be(e.webId):"Signed out"},{label:"Session",value:e.state.status},{label:"ACP / ACR",value:t==="error"?"Capability unavailable or permission denied":"Managed ACR capability available"},{label:"AI Gateway service access",value:i,detail:"Inspected from the managed ACRs for declared settings resources"}]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(S,{type:"button",variant:"outline",onClick:()=>{a()},disabled:t==="checking",children:"Recheck access"}),s.jsx(S,{type:"button",variant:"destructive",onClick:()=>{c()},disabled:t!=="granted"||r,children:r?"Revoking…":"Revoke service access"})]})]})}function Nn({env:e,admin:t,save:n}){const r=e.CSS_BASE_URL??t?.env.CSS_BASE_URL??"",[o,a]=d.useState(r),[c,i]=d.useState(e.CSS_ROOT_FILE_PATH??"");return d.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||(a(r),i(e.CSS_ROOT_FILE_PATH??""))}),()=>{l=!0}},[e,r]),s.jsxs("div",{className:"space-y-4",children:[s.jsx(L,{rows:[{label:"Edition",value:t?.env.XPOD_EDITION??e.XPOD_EDITION??"local"},{label:"Configuration source",value:".env.local / runtime bootstrap"},{label:"Service startup",value:"Gateway supervises Solid Server and API Server"},{label:"Automatic restart",value:"Enabled for managed child services"}]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsx(W,{label:"Base URL",value:o,onChange:a}),s.jsx(W,{label:"Data directory",value:c,onChange:i})]}),s.jsx(de,{onClick:()=>n({CSS_BASE_URL:o,CSS_ROOT_FILE_PATH:c})})]})}function Rn({env:e,provision:t,save:n}){const[r,o]=d.useState(e.XPOD_CLOUD_API_ENDPOINT??""),[a,c]=d.useState(e.XPOD_NODE_ID??""),[i,l]=d.useState(e.XPOD_SP_DOMAIN??"");return d.useEffect(()=>{let u=!1;return queueMicrotask(()=>{u||(o(e.XPOD_CLOUD_API_ENDPOINT??""),c(e.XPOD_NODE_ID??""),l(e.XPOD_SP_DOMAIN??""))}),()=>{u=!0}},[e]),s.jsxs("div",{className:"space-y-4",children:[s.jsx(L,{rows:[{label:"Node registration",value:t?.registered?"Registered":"Not registered",detail:t?.nodeId??"Node ID not reported"},{label:"Cluster coordination",value:t?.cloudUrl??"Not configured",detail:t?.managed?"This node is cluster-managed":"Not cluster-managed"},{label:"Service-provider domain",value:t?.serviceProviderDomain??"Not allocated"}]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsx(W,{label:"Cloud endpoint",value:r,onChange:o}),s.jsx(W,{label:"Node ID",value:a,onChange:c}),s.jsx(W,{label:"Service-provider domain",value:i,onChange:l})]}),s.jsx(de,{onClick:()=>n({XPOD_CLOUD_API_ENDPOINT:r,XPOD_NODE_ID:a,XPOD_SP_DOMAIN:i})})]})}function jn({env:e,save:t}){const[n,r]=d.useState(e.CSS_LOGGING_LEVEL??"info"),[o,a]=d.useState(e.CSS_SHOW_STACK_TRACE==="true");return d.useEffect(()=>{let c=!1;return queueMicrotask(()=>{c||(r(e.CSS_LOGGING_LEVEL??"info"),a(e.CSS_SHOW_STACK_TRACE==="true"))}),()=>{c=!0}},[e]),s.jsxs("div",{className:"space-y-4",children:[s.jsx(L,{rows:[{label:"Log retention",value:"30 days",detail:"Runtime logging profile"},{label:"Configuration provenance",value:".env.local allowlist"},{label:"Restart requirement",value:"Required after save"}]}),s.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Logging level",s.jsxs("select",{value:n,onChange:c=>r(c.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-xs",children:[s.jsx("option",{children:"debug"}),s.jsx("option",{children:"info"}),s.jsx("option",{children:"warn"}),s.jsx("option",{children:"error"})]})]}),s.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:["Show stack traces",s.jsx("input",{type:"checkbox",checked:o,onChange:c=>a(c.target.checked)})]}),s.jsx(de,{onClick:()=>t({CSS_LOGGING_LEVEL:n,CSS_SHOW_STACK_TRACE:String(o)})})]})}function L({rows:e}){return s.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:e.map(t=>s.jsxs("div",{className:"rounded-lg border border-border p-3",children:[s.jsx("div",{className:"text-xs text-muted-foreground",children:t.label}),s.jsx("div",{className:"mt-1 break-all text-sm font-medium",children:t.value}),t.detail?s.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.detail}):null]},t.label))})}function W({label:e,value:t,onChange:n}){return s.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[e,s.jsx(je,{value:t,onChange:r=>n(r.target.value)})]})}function de({onClick:e}){return s.jsx("div",{className:"flex justify-end",children:s.jsx(S,{type:"button",onClick:e,children:"Save configuration"})})}function Be(e){if(!e)return"Not discovered";try{return new URL(e).pathname.split("/").filter(Boolean).at(-1)||new URL(e).hostname}catch{return e}}function En(e){return e?e.status==="pass"?"Reachable":e.status==="fail"?"Not reachable":"Not verified":"Not checked"}const _n={pod:"Pod","identity-access":"Identity & Access",storage:"Storage",runtime:"Runtime",cloud:"Cloud",advanced:"Advanced"},Un={pod:"Current Pod identity and authority boundary.","identity-access":"Session, account, and app/service access.",storage:"Authority storage backends and health configuration.",runtime:"Edition, startup, paths, and restart behavior.",cloud:"Node registration and cluster coordination.",advanced:"Bounded logging and runtime compatibility controls."};export{Mn as PodSettingsSubjectPanel};
|