12 |
- (()=>{"use strict";var e,t,n,r={26436:(e,t,n)=>{var r,s=n(32981),a=n(53334),o=n(49584),i=n(63814),l=n(85168),c=n(65043),u=n(85471);!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.INDETERMINATE=2]="INDETERMINATE",e[e.INCOMPLETE_CONF=3]="INCOMPLETE_CONF",e[e.UNAUTHORIZED=4]="UNAUTHORIZED",e[e.TIMEOUT=5]="TIMEOUT",e[e.NETWORK_ERROR=6]="NETWORK_ERROR"}(r||(r={}));const d=function(e){return!(!e.status||e.status===r.SUCCESS)&&(e.userProvided||"password::global::user"===e.authMechanism)},p=function(e){if(e.type===o.pt.File)return!1;const t=e.attributes;return!(!t.scope||!t.backend||"personal"!==t.scope&&"system"!==t.scope)},A=new o.hY({id:"credentials-external-storage",displayName:()=>(0,a.Tl)("files","Enter missing credentials"),iconSvgInline:()=>'<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>',enabled:e=>{var t;if(1!==e.length)return!1;const n=e[0];if(!p(n))return!1;const r=(null===(t=n.attributes)||void 0===t?void 0:t.config)||{};return!!d(r)},async exec(e){const t=await fetch((0,i.KT)("/apps/files_external/api/v1/auth"),{headers:new Headers({Accept:"application/json"}),credentials:"include"}),n=await(null==t?void 0:t.json())||{};if(n.ocs.data.user&&n.ocs.data.password){const t=(await c.Ay.put((0,i.Jv)("apps/files_external/userglobalstorages/{id}",e.attributes),{backendOptions:n.ocs.data})).data;if(t.status!==r.SUCCESS)return(0,l.Qg)((0,a.Tl)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:(null==t?void 0:t.statusMessage)||""})),null;(0,l.Te)((0,a.Tl)("files_external","New configuration successfully saved")),u.Ay.set(e.attributes,"config",t)}return null},order:-1e3,default:o.m9.DEFAULT,inline:()=>!0});var g=n(85072),f=n.n(g),v=n(97825),h=n.n(v),m=n(77659),w=n.n(m),C=n(55056),b=n.n(C),x=n(10540),y=n.n(x),E=n(41113),T=n.n(E),_=n(64755),S={};S.styleTagTransform=T(),S.setAttributes=b(),S.insert=w().bind(null,"head"),S.domAPI=h(),S.insertStyleElement=y(),f()(_.A,S),_.A&&_.A.locals&&_.A.locals;var O,N=n(21777);const H="/files/".concat(null===(O=(0,N.HW)())||void 0===O?void 0:O.uid),k=e=>{var t;const n=(e.path+"/"+e.name).replace(/^\//gm,"");return new o.vd({id:e.id,source:(0,i.dC)("dav"+H+"/"+n),root:H,owner:(null===(t=(0,N.HW)())||void 0===t?void 0:t.uid)||null,permissions:e.config.status!==r.SUCCESS?o.aX.NONE:(null==e?void 0:e.permissions)||o.aX.READ,attributes:{displayName:n,...e}})},R=new o.hY({id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:e=>e.every((e=>!0===p(e))),exec:async()=>null,async renderInline(e){let t=null;try{const s=await function(e){const t=arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?"userstorages":"userglobalstorages";return c.Ay.get((0,i.Jv)("apps/files_external/".concat(t,"/").concat(e,"?testOnly=false")))}(e.attributes.id,"system"===e.attributes.scope);var n;if(t=s.data,u.Ay.set(e.attributes,"config",t),t.status!==r.SUCCESS)throw new Error((null===(n=t)||void 0===n?void 0:n.statusMessage)||(0,a.Tl)("files_external","There was an error with this external storage."));return null}catch(n){if(n.response&&!t)return(0,l.I9)((0,a.Tl)("files_external","We were unable to check the external storage {basename}",{basename:e.basename})),null;const r=d(t),s=document.createElement("span");s.classList.add("files-list__row-status--".concat(r?"warning":"error"));const o=document.createElement("span");return o.className="files-list__row-status",r||(o.innerHTML='<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.title=n.message),o.prepend(s),o}},order:10}),I=new o.hY({id:"open-in-files-external-storage",displayName:e=>{var t;return((null==e||null===(t=e[0])||void 0===t||null===(t=t.attributes)||void 0===t?void 0:t.config)||{status:r.INDETERMINATE}).status!==r.SUCCESS?(0,a.Tl)("files_external","Examine this faulty external storage configuration"):(0,a.Tl)("files","Open in Files")},iconSvgInline:()=>"",enabled:(e,t)=>"extstoragemounts"===t.id,async exec(e){const t=e.attributes.config;return(null==t?void 0:t.status)!==r.SUCCESS?(window.OC.dialogs.confirm((0,a.Tl)("files_external","There was an error with this external storage. Do you want to review this mount point config in the settings page?"),(0,a.Tl)("files_external","External mount error"),(t=>{if(!0===t){const t="personal"===e.attributes.scope?"user":"admin";window.location.href=(0,i.Jv)("/settings/".concat(t,"/externalstorages"))}})),null):(window.OCP.Files.Router.goToRoute(null,{view:"files"},{dir:e.path}),null)},order:-1e3,default:o.m9.HIDDEN}),M=(0,s.C)("files_external","allowUserMounting",!1);(0,o.bh)().register(new o.Ss({id:"extstoragemounts",name:(0,a.Tl)("files_external","External storage"),caption:(0,a.Tl)("files_external","List of external storage."),emptyCaption:M?(0,a.Tl)("files_external","There is no external storage configured. You can configure them in your Personal settings."):(0,a.Tl)("files_external","There is no external storage configured and you don't have the permission to configure them."),emptyTitle:(0,a.Tl)("files_external","No external storage"),icon:'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-folder-network" viewBox="0 0 24 24"><path d="M3,15V5A2,2 0 0,1 5,3H11L13,5H19A2,2 0 0,1 21,7V15A2,2 0 0,1 19,17H13V19H14A1,1 0 0,1 15,20H22V22H15A1,1 0 0,1 14,23H10A1,1 0 0,1 9,22H2V20H9A1,1 0 0,1 10,19H11V17H5A2,2 0 0,1 3,15Z" /></svg>',order:30,columns:[new o.VP({id:"storage-type",title:(0,a.Tl)("files_external","Storage type"),render(e){var t;const n=(null===(t=e.attributes)||void 0===t?void 0:t.backend)||(0,a.Tl)("files_external","Unknown"),r=document.createElement("span");return r.textContent=n,r}}),new o.VP({id:"scope",title:(0,a.Tl)("files_external","Scope"),render(e){var t;const n=document.createElement("span");let r=(0,a.Tl)("files_external","Personal");return"system"===(null===(t=e.attributes)||void 0===t?void 0:t.scope)&&(r=(0,a.Tl)("files_external","System")),n.textContent=r,n}})],getContents:async()=>{var e;const t=(await c.Ay.get((0,i.KT)("apps/files_external/api/v1/mounts"))).data.ocs.data.map(k);return{folder:new o.vd({id:0,source:(0,i.dC)("dav"+H),root:H,owner:(null===(e=(0,N.HW)())||void 0===e?void 0:e.uid)||null,permissions:o.aX.READ}),contents:t}}})),(0,o.Gg)(A),(0,o.Gg)(R),(0,o.Gg)(I)},64755:(e,t,n)=>{n.d(t,{A:()=>i});var r=n(71354),s=n.n(r),a=n(76314),o=n.n(a)()(s());o.push([e.id,"/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */.files-list__row-status{display:flex;width:44px;justify-content:center;align-items:center;height:100%}.files-list__row-status svg{width:24px;height:24px}.files-list__row-status svg path{fill:currentColor}.files-list__row-status--error,.files-list__row-status--warning{position:absolute;display:block;top:0;left:0;right:0;bottom:0;opacity:.1;z-index:-1}.files-list__row-status--error{background:var(--color-error)}.files-list__row-status--warning{background:var(--color-warning)}","",{version:3,sources:["webpack://./apps/files_external/src/css/fileEntryStatus.scss"],names:[],mappings:"AAAA;;;EAAA,CAIA,wBACC,YAAA,CACA,UAAA,CACA,sBAAA,CACA,kBAAA,CACA,WAAA,CAEA,4BACC,UAAA,CACA,WAAA,CAEA,iCACC,iBAAA,CAIF,gEAEC,iBAAA,CACA,aAAA,CACA,KAAA,CACA,MAAA,CACA,OAAA,CACA,QAAA,CACA,UAAA,CACA,UAAA,CAGD,+BACC,6BAAA,CAGD,iCACC,+BAAA",sourcesContent:["/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n.files-list__row-status {\n\tdisplay: flex;\n\twidth: 44px;\n\tjustify-content: center;\n\talign-items: center;\n\theight: 100%;\n\n\tsvg {\n\t\twidth: 24px;\n\t\theight: 24px;\n\n\t\tpath {\n\t\t\tfill: currentColor;\n\t\t}\n\t}\n\n\t&--error,\n\t&--warning {\n\t\tposition: absolute;\n\t\tdisplay: block;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\topacity: .1;\n\t\tz-index: -1;\n\t}\n\n\t&--error {\n\t\tbackground: var(--color-error);\n\t}\n\n\t&--warning {\n\t\tbackground: var(--color-warning);\n\t}\n}\n"],sourceRoot:""}]);const i=o}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={id:e,loaded:!1,exports:{}};return r[e].call(n.exports,n,n.exports,a),n.loaded=!0,n.exports}a.m=r,e=[],a.O=(t,n,r,s)=>{if(!n){var o=1/0;for(u=0;u<e.length;u++){n=e[u][0],r=e[u][1],s=e[u][2];for(var i=!0,l=0;l<n.length;l++)(!1&s||o>=s)&&Object.keys(a.O).every((e=>a.O[e](n[l])))?n.splice(l--,1):(i=!1,s<o&&(o=s));if(i){e.splice(u--,1);var c=r();void 0!==c&&(t=c)}}return t}s=s||0;for(var u=e.length;u>0&&e[u-1][2]>s;u--)e[u]=e[u-1];e[u]=[n,r,s]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,n)=>(a.f[n](e,t),t)),[])),a.u=e=>e+"-"+e+".js?v="+{4254:"5c2324570f66dff0c8a1",9480:"f3ebcf41e93bbd8cd678"}[e],a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="nextcloud:",a.l=(e,r,s,o)=>{if(t[e])t[e].push(r);else{var i,l;if(void 0!==s)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==n+s){i=d;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack",n+s),i.src=e),t[e]=[r];var p=(n,r)=>{i.onerror=i.onload=null,clearTimeout(A);var s=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),s&&s.forEach((e=>e(r))),n)return n(r)},A=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),a.j=1873,(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{a.b=document.baseURI||self.location.href;var e={1873:0};a.f.j=(t,n)=>{var r=a.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var s=new Promise(((n,s)=>r=e[t]=[n,s]));n.push(r[2]=s);var o=a.p+a.u(t),i=new Error;a.l(o,(n=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+s+": "+o+")",i.name="ChunkLoadError",i.type=s,i.request=o,r[1](i)}}),"chunk-"+t,t)}},a.O.j=t=>0===e[t];var t=(t,n)=>{var r,s,o=n[0],i=n[1],l=n[2],c=0;if(o.some((t=>0!==e[t]))){for(r in i)a.o(i,r)&&(a.m[r]=i[r]);if(l)var u=l(a)}for(t&&t(n);c<o.length;c++)s=o[c],a.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return a.O(u)},n=self.webpackChunknextcloud=self.webpackChunknextcloud||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),a.nc=void 0;var o=a.O(void 0,[4208],(()=>a(26436)));o=a.O(o)})();
- //# sourceMappingURL=files_external-init.js.map?v=fe368808d3d95410e05b
|