nextcloud/dist/federatedfilesharing-init-files.mjs
nextcloud-command b812040314 chore(assets): Recompile assets
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2026-02-15 12:39:59 +00:00

2 lines
3.8 KiB
JavaScript

import{c as d,i as _}from"./index-ClUK5nWL.chunk.mjs";import{b as y,a as f}from"./index-C1xmmKTZ-B_lLl9Ld.chunk.mjs";import{s as b}from"./index-6_gsQFyp.chunk.mjs";import{a as R,l as v}from"./index-Ma7sfat2.chunk.mjs";import{t}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import{g as m}from"./createElementId-DhjFt1I9-CRJVCjcq.chunk.mjs";import{N as D,s as S}from"./index-DeDXQtUD.chunk.mjs";import{N as O}from"./NcPasswordField-uaMO2pdt-Bb_nZP1o.chunk.mjs";import{b as k,c as u,o as h,w as F,k as C,l as P,t as q,u as i,n as x,r as N,p as E}from"./runtime-dom.esm-bundler-nUg13ekW.chunk.mjs";import{l as M}from"./logger-Cp6RU9KJ.chunk.mjs";import"./index-sH3U_332.chunk.mjs";import"./NcNoteCard-Cok_4Fld-BLQT242e.chunk.mjs";import"./logger-D3RVzcfQ-B4GxPQ5t.chunk.mjs";import"./mdi-DK5BPbEO.chunk.mjs";import"./NcInputField-o5OFv3z6-DGXgkff4.chunk.mjs";const T=k({__name:"RemoteShareDialog",props:{name:{},owner:{},remote:{},passwordRequired:{type:Boolean}},emits:["close"],setup(e,{emit:r}){const s=e,a=r,o=N(""),n=E(()=>[{label:t("federatedfilesharing","Cancel"),callback:()=>a("close",!1)},{label:t("federatedfilesharing","Add remote share"),type:s.passwordRequired?"submit":void 0,variant:"primary",callback:()=>a("close",!0,o.value)}]);return(p,l)=>(h(),u(i(D),{buttons:n.value,isForm:e.passwordRequired,name:i(t)("federatedfilesharing","Remote share"),onSubmit:l[1]||(l[1]=w=>a("close",!0,o.value))},{default:F(()=>[C("p",null,q(i(t)("federatedfilesharing","Do you want to add the remote share {name} from {owner}@{remote}?",{name:e.name,owner:e.owner,remote:e.remote})),1),e.passwordRequired?(h(),u(i(O),{key:0,modelValue:o.value,"onUpdate:modelValue":l[0]||(l[0]=w=>o.value=w),class:x(p.$style.remoteShareDialog__password),label:i(t)("federatedfilesharing","Remote share password")},null,8,["modelValue","class","label"])):P("",!0)]),_:1},8,["buttons","isForm","name"]))}}),U="_remoteShareDialog__password_1ccpy_2",V={remoteShareDialog__password:U},$={$style:V},j=R(T,[["__cssModules",$]]);async function I(e,r,s,a=!1){const[o,n]=await S(j,{name:e,owner:r,remote:s,passwordRequired:a});if(a&&o)return n;if(!o)throw new Error("Dialog was cancelled")}window.addEventListener("DOMContentLoaded",()=>{L(),v("federatedfilesharing","notificationsEnabled",!0)!==!0&&A(),b("notifications:action:executed",({action:e,notification:r})=>{r.app==="files_sharing"&&r.object_type==="remote_share"&&e.type==="POST"&&c()})});function c(){if(!window?.OCP?.Files?.Router?.goToRoute){window.location.reload();return}window.OCP.Files.Router.goToRoute(null,{...window.OCP.Files.Router.params,fileid:void 0},{...window.OCP.Files.Router.query,dir:"/",openfile:void 0})}function L(){const e=window.OC.Util.History.parseUrlQuery();if(e.remote&&e.token&&e.name){const r=(s,a)=>{s!==!1&&d.post(m("apps/federatedfilesharing/askForFederatedShare"),{remote:a.remote,token:a.token,owner:a.owner,ownerDisplayName:a.ownerDisplayName||a.owner,name:a.name,password:a.password||""}).then(({data:o})=>{Object.hasOwn(o,"legacyMount")?c():y(o.message)}).catch(o=>{M.error("Error while processing incoming share",{error:o}),_(o)&&o.response.data.message?f(o.response.data.message):f(t("federatedfilesharing","Incoming share could not be processed"))})};location.hash="",e.passwordProtected=parseInt(e.protected,10)===1,g(e,e.passwordProtected,r)}}async function A(){const{data:e}=await d.get(m("/apps/files_sharing/api/externalShares"));for(let r=0;r<e.length;++r)g(e[r],!1,function(s,a){s===!1?d.delete(m("/apps/files_sharing/api/externalShares/"+a.id)):d.post(m("/apps/files_sharing/api/externalShares"),{id:a.id}).then(()=>c())})}function g(e,r,s){const a=e.ownerDisplayName||e.owner,o=e.name,n=e.remote.replace(/^https?:\/\//,"").replace(/\/$/,"");I(o,a,n,r).then(p=>s(!0,{...e,password:p})).catch(()=>s(!1,e))}
//# sourceMappingURL=federatedfilesharing-init-files.mjs.map