2 lines
7.5 KiB
JavaScript
2 lines
7.5 KiB
JavaScript
import{d as I,z as j,o as A,B as F,c as n,a as t,F as x,P as g,E as v,N as z,G as w,h as D,i as H,U as E,x as R,r as p,j as T,f as a,D as l,J as b,q as r}from"./index-DnbYEqLr.js";import{f as y}from"./filebrowser-client-DRXM9PC4.js";const $={class:"pb-6"},O={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},q=["onClick"],G={class:"flex items-center gap-4 mb-4"},J=["d"],U={class:"flex-1 min-w-0"},Y={class:"text-lg font-semibold text-white mb-0.5 truncate"},K={class:"text-xs text-white/50"},Q={class:"flex items-center gap-2 text-xs"},W={key:0,class:"text-white/30"},X={key:1,class:"text-white/30 animate-pulse"},Z={key:2,class:"text-white/30"},ee=["onClick"],te={class:"flex items-center gap-4 mb-4"},se={class:"flex-1 min-w-0"},oe={class:"text-lg font-semibold text-white mb-0.5 truncate"},ne={class:"text-xs text-white/50 truncate"},re={class:"flex items-center gap-2 text-xs"},ie={key:0,class:"glass-card p-8 mt-6 text-center"},de=I({__name:"Cloud",setup(le){const h=R(),C=j(),c=p({}),f=p(!1),d=p([]),m=p(!0),B={immich:["immich_server","immich-server"],nextcloud:["nextcloud-aio","nextcloud-server"]};function u(o){const s=C.packages;if(s[o]?.state==="running")return!0;const e=B[o];if(e){for(const i of e)if(s[i]?.state==="running")return!0}return!1}const k=T(()=>u("filebrowser")),_=[{id:"photos",name:"Photos & Videos",description:"Auto-backup & browse your media",appId:"filebrowser",appLabel:"File Browser",iconPaths:["M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"],iconBg:"bg-blue-500/15",iconColor:"text-blue-400"},{id:"music",name:"Music",description:"Your music collection",appId:"filebrowser",appLabel:"File Browser",iconPaths:["M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"],iconBg:"bg-orange-500/15",iconColor:"text-orange-400"},{id:"documents",name:"Documents",description:"Files, docs & spreadsheets",appId:"filebrowser",appLabel:"File Browser",iconPaths:["M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"],iconBg:"bg-green-500/15",iconColor:"text-green-400"},{id:"files",name:"All Files",description:"Browse your server file system",appId:"filebrowser",appLabel:"File Browser",iconPaths:["M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"],iconBg:"bg-white/10",iconColor:"text-white/70"}],M={photos:"/Photos",music:"/Music",documents:"/Documents",files:"/"};async function L(){if(k.value){f.value=!0;try{if(!await y.login())return;for(const s of _){const e=M[s.id];if(e)try{const i=await y.listDirectory(e);c.value[s.id]=i.length}catch{c.value[s.id]=0}}}catch{}finally{f.value=!1}}}A(()=>{L(),P()});async function P(){m.value=!0;try{const o=await F.federationListNodes();d.value=o?.nodes??[]}catch{d.value=[]}finally{m.value=!1}}function N(o){return o.length<=24?o:o.slice(0,16)+"..."+o.slice(-8)}function S(o){h.push({name:"cloud-folder",params:{folderId:o.id}})}return(o,s)=>(r(),n("div",$,[t("div",O,[(r(),n(x,null,g(_,e=>t("div",{key:e.id,"data-controller-container":"",tabindex:"0",class:"glass-card p-6 cursor-pointer transition-all hover:-translate-y-1 hover:bg-white/10",onClick:i=>S(e)},[t("div",G,[t("div",{class:a(["flex-shrink-0 w-12 h-12 rounded-xl flex items-center justify-center",e.iconBg])},[(r(),n("svg",{class:a(["w-7 h-7",e.iconColor]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[(r(!0),n(x,null,g(e.iconPaths,(i,V)=>(r(),n("path",{key:V,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:i},null,8,J))),128))],2))],2),t("div",U,[t("h3",Y,l(e.name),1),t("p",K,l(e.description),1)]),s[1]||(s[1]=t("svg",{class:"w-5 h-5 text-white/30",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1))]),t("div",Q,[t("span",{class:a(["inline-flex items-center gap-1.5 px-2 py-1 rounded-full",u(e.appId)?"bg-green-500/15 text-green-400":"bg-white/5 text-white/40"])},[t("span",{class:a(["w-1.5 h-1.5 rounded-full",u(e.appId)?"bg-green-400":"bg-white/30"])},null,2),b(" "+l(e.appLabel),1)],2),u(e.appId)?f.value?(r(),n("span",X,"Loading...")):c.value[e.id]!==void 0?(r(),n("span",Z,l(c.value[e.id])+" items",1)):w("",!0):(r(),n("span",W,"Not installed"))])],8,q)),64)),(r(!0),n(x,null,g(d.value,e=>(r(),n("div",{key:e.did,"data-controller-container":"",tabindex:"0",class:"glass-card p-6 cursor-pointer transition-all hover:-translate-y-1 hover:bg-white/10",onClick:i=>v(h).push({name:"peer-files",params:{peerId:e.onion}})},[t("div",te,[s[2]||(s[2]=t("div",{class:"flex-shrink-0 w-12 h-12 rounded-xl flex items-center justify-center bg-purple-500/15"},[t("svg",{class:"w-7 h-7 text-purple-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2"})])],-1)),t("div",se,[t("h3",oe,l(e.name||N(e.did)),1),t("p",ne,l(e.onion),1)]),s[3]||(s[3]=t("svg",{class:"w-5 h-5 text-white/30",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1))]),t("div",re,[t("span",{class:a(["inline-flex items-center gap-1.5 px-2 py-1 rounded-full",e.trust_level==="trusted"?"bg-green-500/15 text-green-400":"bg-purple-500/15 text-purple-400"])},[t("span",{class:a(["w-1.5 h-1.5 rounded-full",e.trust_level==="trusted"?"bg-green-400":"bg-purple-400"])},null,2),b(" "+l(e.trust_level),1)],2),s[4]||(s[4]=t("span",{class:"text-white/30"},"Peer Node",-1))])],8,ee))),128)),!m.value&&d.value.length===0?(r(),n("div",{key:0,"data-controller-container":"",tabindex:"0",class:"glass-card p-6 cursor-pointer transition-all hover:-translate-y-1 hover:bg-white/10",onClick:s[0]||(s[0]=e=>v(h).push("/dashboard/server/federation"))},[...s[5]||(s[5]=[z('<div class="flex items-center gap-4 mb-4"><div class="flex-shrink-0 w-12 h-12 rounded-xl flex items-center justify-center bg-purple-500/15"><svg class="w-7 h-7 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"></path></svg></div><div class="flex-1 min-w-0"><h3 class="text-lg font-semibold text-white mb-0.5 truncate">Peer Files</h3><p class="text-xs text-white/50">Set up federation to share files with peers</p></div><svg class="w-5 h-5 text-white/30" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></div><div class="flex items-center gap-2 text-xs"><span class="inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-white/5 text-white/40"><span class="w-1.5 h-1.5 rounded-full bg-white/30"></span> No peers yet </span></div>',2)])])):w("",!0)]),k.value?w("",!0):(r(),n("div",ie,[s[7]||(s[7]=t("p",{class:"text-white/60 mb-3"},"Install File Browser from the App Store to get started with your cloud storage.",-1)),D(v(E),{to:"/dashboard/marketplace",class:"glass-button inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-sm font-medium"},{default:H(()=>[...s[6]||(s[6]=[b(" Open App Store ",-1)])]),_:1})]))]))}});export{de as default};
|