2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
(()=>{var e,t,n,r={15340:()=>{},21769:(e,t,n)=>{"use strict";var r=n(35810),i=n(21777),a=n(19051),s=n(85168),o=n(61338),l=n(53334),d=n(71225),c=n(63814),u=n(35947);const f=(0,u.YK)().setApp("files").detectUser().build();var b=n(3153);const p=`/trashbin/${(0,i.HW)()?.uid}/trash`,h=(0,r.H4)(),m=`<?xml version="1.0"?>\n<d:propfind ${(0,r.CP)()}>\n\t<d:prop>\n\t\t<nc:trashbin-deletion-time />\n\t\t<nc:trashbin-original-location />\n\t\t<nc:trashbin-title />\n\t\t<nc:trashbin-deleted-by-id />\n\t\t<nc:trashbin-deleted-by-display-name />\n\t\t${(0,r.VX)()}\n\t</d:prop>\n</d:propfind>`;function y(e){const t=(0,r.Al)(e,p);return t.attributes.previewUrl=(0,c.Jv)("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:t.fileid}),t}var g=n(85471),v=n(77764);const w=new r.VP({id:"files_trashbin--original-location",title:(0,l.t)("files_trashbin","Original location"),render(e){const t=x(e),n=document.createElement("span");return n.title=t,n.textContent=t,n},sort(e,t){const n=x(e),r=x(t);return n.localeCompare(r,[(0,l.Z0)(),(0,l.lO)()],{numeric:!0,usage:"sort"})}}),A=new r.VP({id:"files_trashbin--deleted-by",title:(0,l.t)("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:n,label:r}=C(e);if(r){const e=document.createElement("span");return e.textContent=r,e}return new(g.Ay.extend(v.A))({propsData:{size:32,user:t??void 0,displayName:n??t}}).$mount().$el},sort(e,t){const n=C(e),r=n.label??n.displayName??n.userId,i=C(t),a=i.label??i.displayName??i.userId;return r.localeCompare(a,[(0,l.Z0)(),(0,l.lO)()],{numeric:!0,usage:"sort"})}}),_=new r.VP({id:"files_trashbin--deleted",title:(0,l.t)("files_trashbin","Deleted"),render(e){const t=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3,n=document.createElement("span");if(t){const e=Intl.DateTimeFormat([(0,l.lO)()],{dateStyle:"long",timeStyle:"short"}),r=new Date(1e3*t);return n.title=e.format(r),n.textContent=(0,l.fw)(r,{ignoreSeconds:(0,l.t)("files","few seconds ago")}),n}return n.textContent=(0,l.t)("files_trashbin","A long time ago"),n},sort(e,t){const n=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3;return(t.attributes?.["trashbin-deletion-time"]||(t?.mtime?.getTime()??0)/1e3)-n}});function x(e){const t=S(e.attributes?.["trashbin-original-location"]);if(!t)return(0,l.t)("files_trashbin","Unknown");const n=(0,d.pD)(t);return n===t?(0,l.t)("files_trashbin","All files"):n.replace(/^\//,"")}function C(e){const t=S(e.attributes?.["trashbin-deleted-by-id"]),n=S(e.attributes?.["trashbin-deleted-by-display-name"]);let r;const a=(0,i.HW)()?.uid;return t===a&&(r=(0,l.t)("files_trashbin","You")),t||n||(r=(0,l.t)("files_trashbin","Unknown")),{userId:t,displayName:n,label:r}}function S(e){return e?String(e):null}const T="trashbin",P=new r.Ss({id:T,name:(0,l.t)("files_trashbin","Deleted files"),caption:(0,l.t)("files_trashbin","List of files that have been deleted."),emptyTitle:(0,l.t)("files_trashbin","No deleted files"),emptyCaption:(0,l.t)("files_trashbin","Files and folders you have deleted will show up here"),icon:b,order:50,sticky:!0,defaultSortKey:"deleted",columns:[w,A,_],getContents:async function(e="/"){const t=(await h.getDirectoryContents(`${p}${e}`,{details:!0,data:m,includeSelf:!0})).data.map(y),[n]=t.splice(t.findIndex(t=>t.path===e),1);return{folder:n,contents:t}}}),O=new r.hY({id:"restore",displayName:()=>(0,l.t)("files_trashbin","Restore"),iconSvgInline:()=>'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-history" viewBox="0 0 24 24"><path d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3" /></svg>',enabled:(e,t)=>t.id===T&&e.length>0&&e.map(e=>e.permissions).every(e=>Boolean(e&r.aX.READ)),async exec(e){try{const t=(0,c.dC)((0,d.O0)(`dav/trashbin/${(0,i.HW)().uid}/restore/${e.basename}`));return await a.Ay.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),(0,o.Ic)("files:node:deleted",e),!0}catch(t){return 507===t.response?.status&&(0,s.Qg)((0,l.t)("files_trashbin","Not enough free space to restore the file/folder")),f.error("Failed to restore node",{error:t,node:e}),!1}},async execBatch(e,t,n){return Promise.all(e.map(e=>this.exec(e,t,n)))},order:1,inline:()=>!0});var E=n(81222),k=n(1822);const N=(0,u.YK)().setApp("files_trashbin").detectUser().build(),I=new r.VI({id:"empty-trash",displayName:()=>(0,l.t)("files_trashbin","Empty deleted files"),order:0,enabled:(e,t,n)=>e.id===T&&(!!(0,E.C)("files_trashbin","config").allow_delete&&t.length>0&&"/"===n.path),async exec(e,t){const n=new Promise(e=>{(0,s.As)((0,l.t)("files_trashbin","Confirm permanent deletion")).setSeverity("warning").setText((0,l.t)("files_trashbin","Are you sure you want to permanently delete all files and folders in the trash? This cannot be undone.")).setButtons([{label:(0,l.t)("files_trashbin","Cancel"),variant:"secondary",callback:()=>e(!1)},{label:(0,l.t)("files_trashbin","Empty deleted files"),variant:"error",callback:()=>e(!0)}]).build().show().then(()=>{e(!1)})});return!0===await n?(await async function(){try{return await a.Ay.delete(`${k.b}/trashbin/${(0,i.HW)().uid}/trash`),(0,s.Te)((0,l.t)("files_trashbin","All files have been permanently deleted")),!0}catch(e){return(0,s.Qg)((0,l.t)("files_trashbin","Failed to empty deleted files")),N.error("Failed to empty deleted files",{error:e}),!1}}()&&t.forEach(e=>(0,o.Ic)("files:node:deleted",e)),null):null}});var $=n(85072),D=n.n($),L=n(97825),j=n.n(L),H=n(77659),F=n.n(H),V=n(55056),B=n.n(V),U=n(10540),M=n.n(U),X=n(41113),G=n.n(X),R=n(98290),W={};W.styleTagTransform=G(),W.setAttributes=B(),W.insert=F().bind(null,"head"),W.domAPI=j(),W.insertStyleElement=M(),D()(R.A,W),R.A&&R.A.locals&&R.A.locals,(0,r.bh)().register(P),(0,r.yC)(I),(0,r.Gg)(O)},47790:()=>{},51069:()=>{},63779:()=>{},64688:()=>{},66089:()=>{},73776:()=>{},77199:()=>{},77965:()=>{},78982:()=>{},79368:()=>{},79838:()=>{},98290:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(71354),i=n.n(r),a=n(76314),s=n.n(a)()(i());s.push([e.id,"/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */.files-list__row-trashbin-original-location{width:150px !important}","",{version:3,sources:["webpack://./apps/files_trashbin/src/trashbin.scss"],names:[],mappings:"AAAA;;;EAAA,CAIA,4CACE,sBAAA",sourcesContent:["/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n.files-list__row-trashbin-original-location {\n width: 150px !important;\n}\n"],sourceRoot:""}]);const o=s}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[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,i)=>{if(!n){var s=1/0;for(c=0;c<e.length;c++){for(var[n,r,i]=e[c],o=!0,l=0;l<n.length;l++)(!1&i||s>=i)&&Object.keys(a.O).every(e=>a.O[e](n[l]))?n.splice(l--,1):(o=!1,i<s&&(s=i));if(o){e.splice(c--,1);var d=r();void 0!==d&&(t=d)}}return t}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[n,r,i]},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:"2c86902dfae9a5006399",620:"8f7783b39d802f10e22b",2391:"908fc68e4bc9b878c937",2880:"fdf99dc4a6f328ebe498",4325:"67df7ab13a8e8d214551",5862:"d020c05f13d21afee82a",7145:"7889fe0b0ebc57e3d5f1",8339:"6cdca71a6b3b2d7bef33"}[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-ui-legacy:",a.l=(e,r,i,s)=>{if(t[e])t[e].push(r);else{var o,l;if(void 0!==i)for(var d=document.getElementsByTagName("script"),c=0;c<d.length;c++){var u=d[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+i){o=u;break}}o||(l=!0,(o=document.createElement("script")).charset="utf-8",a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack",n+i),o.src=e),t[e]=[r];var f=(n,r)=>{o.onerror=o.onload=null,clearTimeout(b);var i=t[e];if(delete t[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(r)),n)return n(r)},b=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=2573,(()=>{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={2573: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 i=new Promise((n,i)=>r=e[t]=[n,i]);n.push(r[2]=i);var s=a.p+a.u(t),o=new Error;a.l(s,n=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+s+")",o.name="ChunkLoadError",o.type=i,o.request=s,r[1](o)}},"chunk-"+t,t)}},a.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[s,o,l]=n,d=0;if(s.some(t=>0!==e[t])){for(r in o)a.o(o,r)&&(a.m[r]=o[r]);if(l)var c=l(a)}for(t&&t(n);d<s.length;d++)i=s[d],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(c)},n=globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),a.nc=void 0;var s=a.O(void 0,[4208],()=>a(21769));s=a.O(s)})();
|
|
//# sourceMappingURL=files_trashbin-init.js.map?v=ee327678eb203ddc7fa6
|