nextcloud-server/dist/files_external-init.js

2 lines
12 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

(()=>{var e,t,n,r={15340:()=>{},47790:()=>{},51069:()=>{},61876:(e,t,n)=>{"use strict";var r,s=n(35810),a=n(81222),i=n(53334),o=n(19051),l=n(85168),c=n(12555),u=n(63814),d=n(98469),f=n(85471);function p(e){return!(!e.status||e.status===r.SUCCESS)&&(e.userProvided||"password::global::user"===e.authMechanism)}function A(e){if(e.type===s.pt.File)return!1;const t=e.attributes;return!(!t.scope||!t.backend||"personal"!==t.scope&&"system"!==t.scope)}!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={})),(0,c.IF)(o.Ay);const g=new s.hY({id:"credentials-external-storage",displayName:()=>(0,i.t)("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=>{if(1!==e.length)return!1;const t=e[0];return!!A(t)&&!!p(t.attributes?.config||{})},async exec(e){const{login:t,password:s}=await new Promise(e=>(0,d.S)((0,f.$V)(()=>Promise.all([n.e(4208),n.e(4139)]).then(n.bind(n,84139))),{},t=>{e(t)}));if(t&&s)try{await async function(e,t,n){const s=(await o.Ay.request({method:"PUT",url:(0,u.Jv)("apps/files_external/userglobalstorages/{id}",{id:e.attributes.id}),confirmPassword:c.mH.Strict,data:{backendOptions:{user:t,password:n}}})).data;return s.status!==r.SUCCESS?((0,l.Qg)((0,i.t)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:s?.statusMessage||""})),null):((0,l.Te)((0,i.t)("files_external","New configuration successfully saved")),f.Ay.set(e.attributes,"config",s),!0)}(e,t,s),(0,l.Te)((0,i.t)("files_external","Credentials successfully set"))}catch(e){(0,l.Qg)((0,i.t)("files_external","Error while setting credentials: {error}",{error:e.message}))}return null},order:-1e3,default:s.m9.DEFAULT,inline:()=>!0});var m=n(21777);const h=`/files/${(0,m.HW)()?.uid}`;function w(e){const t=(e.path+"/"+e.name).replace(/^\//gm,"");return new s.vd({id:e.id,source:(0,u.dC)("dav"+h+"/"+t),root:h,owner:(0,m.HW)()?.uid||null,permissions:e.config.status!==r.SUCCESS?s.aX.NONE:e?.permissions||s.aX.READ,attributes:{displayName:t,...e}})}var C=n(85072),b=n.n(C),v=n(97825),x=n.n(v),y=n(77659),E=n.n(y),T=n(55056),_=n.n(T),S=n(10540),H=n.n(S),O=n(41113),N=n.n(O),k=n(64755),P={};P.styleTagTransform=N(),P.setAttributes=_(),P.insert=E().bind(null,"head"),P.domAPI=x(),P.insertStyleElement=H(),b()(k.A,P),k.A&&k.A.locals&&k.A.locals;const I=new s.hY({id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:e=>e.every(e=>!0===A(e)),exec:async()=>null,async renderInline(e){const t=document.createElement("span");t.className="files-list__row-status",t.innerHTML=(0,i.Tl)("files_external","Checking storage …");let n=null;return function(e,t=!0){const n=t?"userglobalstorages":"userstorages";return o.Ay.get((0,u.Jv)(`apps/files_external/${n}/${e}?testOnly=false`))}(e.attributes.id,"system"===e.attributes.scope).then(s=>{if(n=s.data,f.Ay.set(e.attributes,"config",n),n.status!==r.SUCCESS)throw new Error(n?.statusMessage||(0,i.Tl)("files_external","There was an error with this external storage."));t.remove()}).catch(r=>{r.response&&!n&&(0,l.I9)((0,i.Tl)("files_external","We were unable to check the external storage {basename}",{basename:e.basename})),t.innerHTML="";const s=!!n&&p(n),a=document.createElement("span");a.classList.add("files-list__row-status--"+(s?"warning":"error")),s||(t.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>',t.title=r.message),t.prepend(a)}),t},order:10}),M=new s.hY({id:"open-in-files-external-storage",displayName:e=>(e?.[0]?.attributes?.config||{status:r.INDETERMINATE}).status!==r.SUCCESS?(0,i.Tl)("files_external","Examine this faulty external storage configuration"):(0,i.Tl)("files","Open in Files"),iconSvgInline:()=>"",enabled:(e,t)=>"extstoragemounts"===t.id,async exec(e){const t=e.attributes.config;return t?.status!==r.SUCCESS?(window.OC.dialogs.confirm((0,i.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,i.Tl)("files_external","External mount error"),e=>{if(!0===e){const e=(0,m.HW)()?.isAdmin?"admin":"user";window.location.href=(0,u.Jv)(`/settings/${e}/externalstorages`)}}),null):(window.OCP.Files.Router.goToRoute(null,{view:"files"},{dir:e.path}),null)},order:-1e3,default:s.m9.HIDDEN}),R=(0,a.C)("files_external","allowUserMounting",!1);(0,s.bh)().register(new s.Ss({id:"extstoragemounts",name:(0,i.Tl)("files_external","External storage"),caption:(0,i.Tl)("files_external","List of external storage."),emptyCaption:R?(0,i.Tl)("files_external","There is no external storage configured. You can configure them in your Personal settings."):(0,i.Tl)("files_external","There is no external storage configured and you don't have the permission to configure them."),emptyTitle:(0,i.Tl)("files_external","No external storage"),icon:'<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>',order:30,columns:[new s.VP({id:"storage-type",title:(0,i.Tl)("files_external","Storage type"),render(e){const t=e.attributes?.backend||(0,i.Tl)("files_external","Unknown"),n=document.createElement("span");return n.textContent=t,n}}),new s.VP({id:"scope",title:(0,i.Tl)("files_external","Scope"),render(e){const t=document.createElement("span");let n=(0,i.Tl)("files_external","Personal");return"system"===e.attributes?.scope&&(n=(0,i.Tl)("files_external","System")),t.textContent=n,t}})],getContents:async function(){const e=(await o.Ay.get((0,u.KT)("apps/files_external/api/v1/mounts"))).data.ocs.data.map(w);return{folder:new s.vd({id:0,source:(0,u.dC)("dav"+h),root:h,owner:(0,m.HW)()?.uid||null,permissions:s.aX.READ}),contents:e}}})),(0,s.Gg)(g),(0,s.Gg)(I),(0,s.Gg)(M)},63779:()=>{},64688:()=>{},64755:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(71354),s=n.n(r),a=n(76314),i=n.n(a)()(s());i.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;min-width:44px;justify-content:center;align-items:center;height:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.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;inset-inline: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,cAAA,CACA,sBAAA,CACA,kBAAA,CACA,WAAA,CACA,sBAAA,CACA,kBAAA,CACA,eAAA,CAEA,4BACC,UAAA,CACA,WAAA,CAEA,iCACC,iBAAA,CAIF,gEAEC,iBAAA,CACA,aAAA,CACA,KAAA,CACA,cAAA,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\tmin-width: 44px;\n\tjustify-content: center;\n\talign-items: center;\n\theight: 100%;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\toverflow: hidden;\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\tinset-inline: 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 o=i},66089:()=>{},73776:()=>{},77199:()=>{},77965:()=>{},78982:()=>{},79368:()=>{},79838:()=>{}},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 i=1/0;for(u=0;u<e.length;u++){for(var[n,r,s]=e[u],o=!0,l=0;l<n.length;l++)(!1&s||i>=s)&&Object.keys(a.O).every(e=>a.O[e](n[l]))?n.splice(l--,1):(o=!1,s<i&&(i=s));if(o){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="+{594:"706f8e77fcd637f25ccf",620:"8e3c118f58088ce04c74",2391:"a1c7f293d21dd6ef8096",2880:"62fd555d64b20d9a6c97",4139:"8177d90c42dbb1757b54",4325:"cc118df199f1941c08e4",5862:"4ca96c4f928b038599cf",7145:"375037f0ab8e6cfa581e",8339:"3f9cf3b616cfbc0082d4"}[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,i)=>{if(t[e])t[e].push(r);else{var o,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){o=d;break}}o||(l=!0,(o=document.createElement("script")).charset="utf-8",a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack",n+s),o.src=e),t[e]=[r];var f=(n,r)=>{o.onerror=o.onload=null,clearTimeout(p);var s=t[e];if(delete t[e],o.parentNode&&o.parentNode.removeChild(o),s&&s.forEach(e=>e(r)),n)return n(r)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=f.bind(null,o.onerror),o.onload=f.bind(null,o.onload),l&&document.head.appendChild(o)}},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&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(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(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{a.b="undefined"!=typeof document&&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 i=a.p+a.u(t),o=new Error;a.l(i,n=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+s+": "+i+")",o.name="ChunkLoadError",o.type=s,o.request=i,r[1](o)}},"chunk-"+t,t)}},a.O.j=t=>0===e[t];var t=(t,n)=>{var r,s,[i,o,l]=n,c=0;if(i.some(t=>0!==e[t])){for(r in o)a.o(o,r)&&(a.m[r]=o[r]);if(l)var u=l(a)}for(t&&t(n);c<i.length;c++)s=i[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 i=a.O(void 0,[4208],()=>a(61876));i=a.O(i)})();
//# sourceMappingURL=files_external-init.js.map?v=c442a13bb4d94f84b008