Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ addPasswordConfirmationInterceptors(axios)
async function setCredentials(node: INode, login: string, password: string): Promise<null | true> {
const configResponse = await axios.request({
method: 'PUT',
url: generateUrl('apps/files_external/userglobalstorages/{id}', { id: node.attributes.id }),
url: generateUrl('apps/files_external/userglobalstorages/{id}', { id: node.id }),
confirmPassword: PwdConfirmationMode.Strict,
data: {
backendOptions: { user: login, password },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const action: IFileAction = {

let config: IStorage | undefined
try {
const { data } = await getStatus(node.attributes.id, node.attributes.scope === 'system')
const { data } = await getStatus(node.id, node.attributes.scope === 'system')
config = data
node.attributes.config = config
emit('files:node:updated', node)
Expand Down
2 changes: 1 addition & 1 deletion dist/files_external-init.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/CredentialsDialog-BwuMsqpU.chunk.mjs'),window.OC.filePath('', '', 'dist/translation-DoG5ZELJ-Bni_xMHF.chunk.mjs'),window.OC.filePath('', '', 'dist/index-Bndk0DrU.chunk.mjs'),window.OC.filePath('', '', 'dist/index-BrC2bLMO.chunk.mjs'),window.OC.filePath('', '', 'dist/runtime-dom.esm-bundler-CU8rrbZA.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-DhjFt1I9-C_WKCRq3.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-DhjFt1I9-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/logger-D3RVzcfQ-CklyzrxW.chunk.mjs'),window.OC.filePath('', '', 'dist/logger-D3RVzcfQ-R3us1MM8.chunk.css'),window.OC.filePath('', '', 'dist/mdi-Bm11w6Fn.chunk.mjs'),window.OC.filePath('', '', 'dist/mdi-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/index-CySLkPBX.chunk.css'),window.OC.filePath('', '', 'dist/NcNoteCard-Cok_4Fld-C71YD40i.chunk.mjs'),window.OC.filePath('', '', 'dist/NcNoteCard-Cok_4Fld-Jq77EThs.chunk.css'),window.OC.filePath('', '', 'dist/NcPasswordField-uaMO2pdt-Bi58_jEx.chunk.mjs'),window.OC.filePath('', '', 'dist/index-BT4ljBnH.chunk.mjs'),window.OC.filePath('', '', 'dist/string_decoder-BO00msnV.chunk.mjs'),window.OC.filePath('', '', 'dist/index-DCpg1aui.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-o5OFv3z6-DJtp_yB7.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-o5OFv3z6-BYlw6Xsd.chunk.css'),window.OC.filePath('', '', 'dist/NcPasswordField-uaMO2pdt-DxPSRxK-.chunk.css'),window.OC.filePath('', '', 'dist/TrashCanOutline-B5FsJrKA.chunk.mjs')])))=>i.map(i=>d[i]);
import{D as x,g as C,V as E,C as p,b as c}from"./index-CuwFxdv0.chunk.mjs";import{_ as V,l as M}from"./index-DCpg1aui.chunk.mjs";import{t as s}from"./translation-DoG5ZELJ-Bni_xMHF.chunk.mjs";import{c as l}from"./index-BT4ljBnH.chunk.mjs";import{d as w,a as h,s as L,e as S}from"./index-JpgrUA2Z-BYgeawUc.chunk.mjs";import{e as _,a as u}from"./index-Bndk0DrU.chunk.mjs";import{a as T,P as A}from"./index-CLPHpMLr.chunk.mjs";import{g as m,b as N,i as b}from"./createElementId-DhjFt1I9-C_WKCRq3.chunk.mjs";import{s as P}from"./index-BrC2bLMO.chunk.mjs";import{S as a}from"./types-DSMBPDbS.chunk.mjs";import{F as k,b as y,P as d}from"./public-Sa--me8z.chunk.mjs";import{a as D}from"./runtime-dom.esm-bundler-CU8rrbZA.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";import"./NcNoteCard-Cok_4Fld-C71YD40i.chunk.mjs";import"./logger-D3RVzcfQ-CklyzrxW.chunk.mjs";import"./NcPasswordField-uaMO2pdt-Bi58_jEx.chunk.mjs";import"./NcInputField-o5OFv3z6-DJtp_yB7.chunk.mjs";import"./mdi-Bm11w6Fn.chunk.mjs";const I='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-folder-network-outline" viewBox="0 0 24 24"><path d="M15 20C15 19.45 14.55 19 14 19H13V17H19C20.11 17 21 16.11 21 15V7C21 5.9 20.11 5 19 5H13L11 3H5C3.9 3 3 3.9 3 5V15C3 16.11 3.9 17 5 17H11V19H10C9.45 19 9 19.45 9 20H2V22H9C9 22.55 9.45 23 10 23H14C14.55 23 15 22.55 15 22H22V20H15M5 15V7H19V15H5Z" /></svg>',O='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-login" viewBox="0 0 24 24"><path d="M11 7L9.6 8.4L12.2 11H2V13H12.2L9.6 15.6L11 17L16 12L11 7M20 19H12V21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3H12V5H20V19Z" /></svg>';function v(e){return e.status===void 0||e.status===a.Success?!1:e.userProvided||e.authMechanism==="password::global::user"}function H(e){if(e.type===k.File)return!1;const t=e.attributes;return!t.scope||!t.backend?!1:t.scope==="personal"||t.scope==="system"}T(l);async function R(e,t,n){const r=(await l.request({method:"PUT",url:m("apps/files_external/userglobalstorages/{id}",{id:e.attributes.id}),confirmPassword:A.Strict,data:{backendOptions:{user:t,password:n}}})).data;return r.status!==a.Success?(h(s("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:r?.statusMessage||""})),null):(w(s("files_external","New configuration successfully saved")),e.attributes.config=r,_("files:node:updated",e),!0)}const F="credentials-external-storage",U={id:F,displayName:()=>s("files","Enter missing credentials"),iconSvgInline:()=>O,enabled:({nodes:e})=>{if(e.length!==1||!e[0])return!1;const t=e[0];if(!H(t))return!1;const n=t.attributes?.config||{};return!!v(n)},async exec({nodes:e}){const{login:t,password:n}=await P(D(()=>V(()=>import("./CredentialsDialog-BwuMsqpU.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url)))??{};if(t&&n)try{await R(e[0],t,n),w(s("files_external","Credentials successfully set"))}catch(r){h(s("files_external","Error while setting credentials: {error}",{error:r.message}))}return null},order:-1e3,default:x.DEFAULT,inline:()=>!0},$='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-alert-circle" viewBox="0 0 24 24"><path d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" /></svg>',o=`/files/${u()?.uid}`;function B(e){const t=(e.path+"/"+e.name).replace(/^\//gm,"");return new y({id:e.id,source:b("dav"+o+"/"+t),root:o,owner:u()?.uid||null,permissions:e.config.status!==a.Success?d.NONE:e?.permissions||d.READ,attributes:{displayName:t,...e}})}async function Z(){const e=(await l.get(N("apps/files_external/api/v1/mounts"))).data.ocs.data.map(B);return{folder:new y({id:0,source:b("dav"+o),root:o,owner:u()?.uid||null,permissions:d.READ}),contents:e}}function j(e,t=!0){const n=t?"userglobalstorages":"userstorages";return l.get(m(`apps/files_external/${n}/${e}?testOnly=false`))}const q={id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:({nodes:e})=>e.every(t=>H(t)===!0),exec:async()=>null,async renderInline({nodes:e}){if(e.length!==1||!e[0])return null;const t=e[0],n=document.createElement("span");n.className="files-list__row-status",n.innerHTML=s("files_external","Checking storage …");let r;try{const{data:i}=await j(t.attributes.id,t.attributes.scope==="system");if(r=i,t.attributes.config=r,_("files:node:updated",t),r.status!==a.Success)throw new Error(r?.statusMessage||s("files_external","There was an error with this external storage."));n.remove()}catch(i){i.response&&!r&&L(s("files_external","We were unable to check the external storage {basename}",{basename:t.basename})),n.innerHTML="";const f=r?v(r):!1,g=document.createElement("span");g.classList.add(`files-list__row-status--${f?"warning":"error"}`),f||(n.innerHTML=$,n.title=i.message),n.prepend(g)}return n},order:10},W={id:"open-in-files-external-storage",displayName:({nodes:e})=>(e?.[0]?.attributes?.config||{status:a.Indeterminate}).status!==a.Success?s("files_external","Examine this faulty external storage configuration"):s("files","Open in Files"),iconSvgInline:()=>"",enabled:({view:e})=>e.id==="extstoragemounts",async exec({nodes:e}){if(e[0]?.attributes?.config?.status!==a.Success){if(await S({name:s("files_external","External mount error"),text:s("files_external","There was an error with this external storage. Do you want to review this mount point config in the settings page?"),labelConfirm:s("files_external","Open settings"),labelReject:s("files_external","Ignore")})===!0){const t=u()?.isAdmin?"admin":"user";window.location.href=m(`/settings/${t}/externalstorages`)}return null}return window.OCP.Files.Router.goToRoute(null,{view:"files"},{dir:e[0].path}),null},order:-1e3,default:x.HIDDEN},Y=M("files_external","allowUserMounting",!1),z=C();z.register(new E({id:"extstoragemounts",name:s("files_external","External storage"),caption:s("files_external","List of external storage."),emptyCaption:Y?s("files_external","There is no external storage configured. You can configure them in your Personal settings."):s("files_external","There is no external storage configured and you don't have the permission to configure them."),emptyTitle:s("files_external","No external storage"),icon:I,order:30,columns:[new p({id:"storage-type",title:s("files_external","Storage type"),render(e){const t=e.attributes?.backend||s("files_external","Unknown"),n=document.createElement("span");return n.textContent=t,n}}),new p({id:"scope",title:s("files_external","Scope"),render(e){const t=document.createElement("span");let n=s("files_external","Personal");return e.attributes?.scope==="system"&&(n=s("files_external","System")),t.textContent=n,t}})],getContents:Z})),c(U),c(q),c(W);
import{D as x,g as C,V as E,C as p,b as u}from"./index-CuwFxdv0.chunk.mjs";import{_ as V,l as M}from"./index-DCpg1aui.chunk.mjs";import{t as s}from"./translation-DoG5ZELJ-Bni_xMHF.chunk.mjs";import{c as l}from"./index-BT4ljBnH.chunk.mjs";import{d as w,a as h,s as L,e as S}from"./index-JpgrUA2Z-BYgeawUc.chunk.mjs";import{e as _,a as c}from"./index-Bndk0DrU.chunk.mjs";import{a as T,P as A}from"./index-CLPHpMLr.chunk.mjs";import{g as m,b as N,i as y}from"./createElementId-DhjFt1I9-C_WKCRq3.chunk.mjs";import{s as P}from"./index-BrC2bLMO.chunk.mjs";import{S as a}from"./types-DSMBPDbS.chunk.mjs";import{F as k,b,P as d}from"./public-Sa--me8z.chunk.mjs";import{a as D}from"./runtime-dom.esm-bundler-CU8rrbZA.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";import"./NcNoteCard-Cok_4Fld-C71YD40i.chunk.mjs";import"./logger-D3RVzcfQ-CklyzrxW.chunk.mjs";import"./NcPasswordField-uaMO2pdt-Bi58_jEx.chunk.mjs";import"./NcInputField-o5OFv3z6-DJtp_yB7.chunk.mjs";import"./mdi-Bm11w6Fn.chunk.mjs";const I='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-folder-network-outline" viewBox="0 0 24 24"><path d="M15 20C15 19.45 14.55 19 14 19H13V17H19C20.11 17 21 16.11 21 15V7C21 5.9 20.11 5 19 5H13L11 3H5C3.9 3 3 3.9 3 5V15C3 16.11 3.9 17 5 17H11V19H10C9.45 19 9 19.45 9 20H2V22H9C9 22.55 9.45 23 10 23H14C14.55 23 15 22.55 15 22H22V20H15M5 15V7H19V15H5Z" /></svg>',O='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-login" viewBox="0 0 24 24"><path d="M11 7L9.6 8.4L12.2 11H2V13H12.2L9.6 15.6L11 17L16 12L11 7M20 19H12V21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3H12V5H20V19Z" /></svg>';function v(e){return e.status===void 0||e.status===a.Success?!1:e.userProvided||e.authMechanism==="password::global::user"}function H(e){if(e.type===k.File)return!1;const t=e.attributes;return!t.scope||!t.backend?!1:t.scope==="personal"||t.scope==="system"}T(l);async function R(e,t,n){const r=(await l.request({method:"PUT",url:m("apps/files_external/userglobalstorages/{id}",{id:e.id}),confirmPassword:A.Strict,data:{backendOptions:{user:t,password:n}}})).data;return r.status!==a.Success?(h(s("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:r?.statusMessage||""})),null):(w(s("files_external","New configuration successfully saved")),e.attributes.config=r,_("files:node:updated",e),!0)}const F="credentials-external-storage",U={id:F,displayName:()=>s("files","Enter missing credentials"),iconSvgInline:()=>O,enabled:({nodes:e})=>{if(e.length!==1||!e[0])return!1;const t=e[0];if(!H(t))return!1;const n=t.attributes?.config||{};return!!v(n)},async exec({nodes:e}){const{login:t,password:n}=await P(D(()=>V(()=>import("./CredentialsDialog-BwuMsqpU.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url)))??{};if(t&&n)try{await R(e[0],t,n),w(s("files_external","Credentials successfully set"))}catch(r){h(s("files_external","Error while setting credentials: {error}",{error:r.message}))}return null},order:-1e3,default:x.DEFAULT,inline:()=>!0},$='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-alert-circle" viewBox="0 0 24 24"><path d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" /></svg>',o=`/files/${c()?.uid}`;function B(e){const t=(e.path+"/"+e.name).replace(/^\//gm,"");return new b({id:e.id,source:y("dav"+o+"/"+t),root:o,owner:c()?.uid||null,permissions:e.config.status!==a.Success?d.NONE:e?.permissions||d.READ,attributes:{displayName:t,...e}})}async function Z(){const e=(await l.get(N("apps/files_external/api/v1/mounts"))).data.ocs.data.map(B);return{folder:new b({id:0,source:y("dav"+o),root:o,owner:c()?.uid||null,permissions:d.READ}),contents:e}}function j(e,t=!0){const n=t?"userglobalstorages":"userstorages";return l.get(m(`apps/files_external/${n}/${e}?testOnly=false`))}const q={id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:({nodes:e})=>e.every(t=>H(t)===!0),exec:async()=>null,async renderInline({nodes:e}){if(e.length!==1||!e[0])return null;const t=e[0],n=document.createElement("span");n.className="files-list__row-status",n.innerHTML=s("files_external","Checking storage …");let r;try{const{data:i}=await j(t.id,t.attributes.scope==="system");if(r=i,t.attributes.config=r,_("files:node:updated",t),r.status!==a.Success)throw new Error(r?.statusMessage||s("files_external","There was an error with this external storage."));n.remove()}catch(i){i.response&&!r&&L(s("files_external","We were unable to check the external storage {basename}",{basename:t.basename})),n.innerHTML="";const f=r?v(r):!1,g=document.createElement("span");g.classList.add(`files-list__row-status--${f?"warning":"error"}`),f||(n.innerHTML=$,n.title=i.message),n.prepend(g)}return n},order:10},W={id:"open-in-files-external-storage",displayName:({nodes:e})=>(e?.[0]?.attributes?.config||{status:a.Indeterminate}).status!==a.Success?s("files_external","Examine this faulty external storage configuration"):s("files","Open in Files"),iconSvgInline:()=>"",enabled:({view:e})=>e.id==="extstoragemounts",async exec({nodes:e}){if(e[0]?.attributes?.config?.status!==a.Success){if(await S({name:s("files_external","External mount error"),text:s("files_external","There was an error with this external storage. Do you want to review this mount point config in the settings page?"),labelConfirm:s("files_external","Open settings"),labelReject:s("files_external","Ignore")})===!0){const t=c()?.isAdmin?"admin":"user";window.location.href=m(`/settings/${t}/externalstorages`)}return null}return window.OCP.Files.Router.goToRoute(null,{view:"files"},{dir:e[0].path}),null},order:-1e3,default:x.HIDDEN},Y=M("files_external","allowUserMounting",!1),z=C();z.register(new E({id:"extstoragemounts",name:s("files_external","External storage"),caption:s("files_external","List of external storage."),emptyCaption:Y?s("files_external","There is no external storage configured. You can configure them in your Personal settings."):s("files_external","There is no external storage configured and you don't have the permission to configure them."),emptyTitle:s("files_external","No external storage"),icon:I,order:30,columns:[new p({id:"storage-type",title:s("files_external","Storage type"),render(e){const t=e.attributes?.backend||s("files_external","Unknown"),n=document.createElement("span");return n.textContent=t,n}}),new p({id:"scope",title:s("files_external","Scope"),render(e){const t=document.createElement("span");let n=s("files_external","Personal");return e.attributes?.scope==="system"&&(n=s("files_external","System")),t.textContent=n,t}})],getContents:Z})),u(U),u(q),u(W);
//# sourceMappingURL=files_external-init.mjs.map
Loading
Loading