2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
import{d as w,y,o as R,c as h,a as e,D as t,E as o,G as x,f as g,r as c,j as C,x as j,q as m}from"./index-DnbYEqLr.js";const S={class:"min-h-screen bg-black flex items-center justify-center p-6"},T={class:"glass-card p-8 w-full max-w-lg"},U={class:"text-center mb-6"},q={class:"text-2xl font-bold text-white mb-1"},D={class:"text-sm text-white/50"},A={class:"bg-white/5 rounded-lg p-4 mb-4"},B={class:"text-xs text-white/50 mb-1"},I={class:"text-lg font-mono text-white font-medium"},L={key:0,class:"text-xs text-white/40 mt-1"},N={key:0,class:"bg-white/5 rounded-lg p-4 mb-4 flex flex-col items-center"},$={class:"text-xs text-white/50 mb-2"},z={class:"bg-white p-3 rounded-lg inline-block"},E=["src"],F={class:"space-y-2 mb-6"},M={class:"flex items-center justify-between bg-white/5 rounded-lg p-3"},O={class:"text-sm text-white/70"},P={class:"flex items-center gap-2"},V={class:"flex items-center justify-between bg-white/5 rounded-lg p-3"},G={class:"text-sm text-white/70"},H={class:"text-sm text-white font-medium"},J={class:"flex items-center justify-between bg-white/5 rounded-lg p-3"},K={class:"text-sm text-white/70"},Q={class:"text-sm text-white font-medium"},W={class:"flex gap-3"},X={class:"text-center mt-4"},Y={class:"text-xs text-white/30"},te=w({__name:"KioskRecovery",setup(Z){const p=j(),{t:s}=y(),n=c(""),a=c(!1),d=c("—"),r=c("—"),_=c("—"),f=C(()=>{if(!n.value)return"";const i=`http://${n.value}`;return`https://api.qrserver.com/v1/create-qr-code/?size=128x128&data=${encodeURIComponent(i)}`});async function v(){_.value=new Date().toLocaleTimeString(),n.value=window.location.hostname!=="localhost"?window.location.hostname:"127.0.0.1";try{const i=await fetch("/health",{signal:AbortSignal.timeout(5e3)});a.value=i.ok}catch{a.value=!1}if(a.value)try{const l=await(await fetch("/rpc/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"system.stats"}),signal:AbortSignal.timeout(5e3)})).json();if(l.result){const u=l.result.disk;if(u){const b=(u.used/u.total*100).toFixed(0);r.value=`${b}% used`}d.value=String(l.result.containers?.running??"—")}}catch{d.value="—",r.value="—"}}function k(){p.push("/login")}return R(()=>{v()}),(i,l)=>(m(),h("div",S,[e("div",T,[e("div",U,[e("h1",q,t(o(s)("kioskRecovery.title")),1),e("p",D,t(o(s)("kioskRecovery.subtitle")),1)]),e("div",A,[e("div",B,t(o(s)("kioskRecovery.serverAddress")),1),e("div",I,t(n.value||o(s)("common.loading")),1),n.value?(m(),h("div",L,t(o(s)("kioskRecovery.webUi",{address:n.value})),1)):x("",!0)]),n.value?(m(),h("div",N,[e("div",$,t(o(s)("kioskRecovery.scanForMobile")),1),e("div",z,[e("img",{src:f.value,alt:"QR Code",class:"w-32 h-32"},null,8,E)])])):x("",!0),e("div",F,[e("div",M,[e("span",O,t(o(s)("kioskRecovery.backend")),1),e("div",P,[e("div",{class:g(["w-2 h-2 rounded-full",a.value?"bg-green-400":"bg-red-400"])},null,2),e("span",{class:g(["text-sm",a.value?"text-green-400":"text-red-400"])},t(a.value?o(s)("common.healthy"):o(s)("kioskRecovery.unreachable")),3)])]),e("div",V,[e("span",G,t(o(s)("kioskRecovery.containers")),1),e("span",H,t(d.value),1)]),e("div",J,[e("span",K,t(o(s)("monitoring.diskUsage")),1),e("span",Q,t(r.value),1)])]),e("div",W,[e("button",{onClick:v,class:"glass-button px-4 py-2 rounded-lg text-sm flex-1"},t(o(s)("common.refresh")),1),e("button",{onClick:k,class:"glass-button px-4 py-2 rounded-lg text-sm flex-1 bg-orange-500/20 border-orange-500/30"},t(o(s)("kioskRecovery.goToLogin")),1)]),e("div",X,[e("p",Y,t(o(s)("kioskRecovery.lastChecked",{time:_.value})),1)])])]))}});export{te as default};
|