nextcloud/dist/files_trashbin-main.js

3 lines
15 KiB
JavaScript
Raw Normal View History

/*! For license information please see files_trashbin-main.js.LICENSE.txt */
(()=>{var e,t={32641:(e,t,n)=>{"use strict";var i,r,s,o=n(31352),a=n(80351),l=n.n(a),d=n(45994),c=n(17499),u=n(62520);null===(i=(0,d.ts)())?(0,c.IY)().setApp("files").build():(0,c.IY)().setApp("files").setUid(i.uid).build(),function(e){e.Folder="folder",e.File="file"}(r||(r={})),function(e){e[e.NONE=0]="NONE",e[e.CREATE=4]="CREATE",e[e.READ=1]="READ",e[e.UPDATE=2]="UPDATE",e[e.DELETE=8]="DELETE",e[e.SHARE=16]="SHARE",e[e.ALL=31]="ALL"}(s||(s={}));class h{_data;_attributes;_knownDavService=/(remote|public)\.php\/(web)?dav/i;constructor(e,t){(e=>{if("id"in e&&("number"!=typeof e.id||e.id<0))throw new Error("Invalid id type of value");if(!e.source)throw new Error("Missing mandatory source");if(!e.source.startsWith("http"))throw new Error("Invalid source format");if("mtime"in e&&!(e.mtime instanceof Date))throw new Error("Invalid mtime type");if("crtime"in e&&!(e.crtime instanceof Date))throw new Error("Invalid crtime type");if(!e.mime||"string"!=typeof e.mime||!e.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))throw new Error("Missing or invalid mandatory mime");if("size"in e&&"number"!=typeof e.size)throw new Error("Invalid size type");if("permissions"in e&&!("number"==typeof e.permissions&&e.permissions>=s.NONE&&e.permissions<=s.ALL))throw new Error("Invalid permissions");if("owner"in e&&null!==e.owner&&"string"!=typeof e.owner)throw new Error("Invalid owner type");if("attributes"in e&&"object"!=typeof e.attributes)throw new Error("Invalid attributes format");if("root"in e&&"string"!=typeof e.root)throw new Error("Invalid root format");if(e.root&&!e.root.startsWith("/"))throw new Error("Root must start with a leading slash")})(e),this._data=e,this._attributes=e.attributes||{},delete this._data.attributes,t&&(this._knownDavService=t)}get source(){return this._data.source.replace(/\/$/i,"")}get basename(){return(0,u.basename)(this.source)}get extension(){return(0,u.extname)(this.source)}get dirname(){return this.root?(0,u.dirname)(this.source.split(this.root).pop()||"/"):(0,u.dirname)(this.source)}get mime(){return this._data.mime}get size(){return this._data.size}get attributes(){return this._attributes}get permissions(){return(null!==this.owner||this.isDavRessource)&&this._data.permissions||s.READ}get owner(){return this.isDavRessource?this._data.owner:null}get isDavRessource(){return null!==this.source.match(this._knownDavService)}get root(){return this._data.root?this._data.root.replace(/^(.+)\/$/,"$1"):this.isDavRessource&&(0,u.dirname)(this.source).split(this._knownDavService).pop()||null}get path(){return(this.dirname+"/"+this.basename).replace(/\/\//g,"/")}get fileid(){return this.attributes?.fileid}move(e){this._data.source=e}rename(e){if(e.includes("/"))throw new Error("Invalid basename");this.move((0,u.dirname)(this.source)+"/"+e)}}class m extends h{get type(){return r.File}}class f extends h{constructor(e){super({...e,mime:"httpd/unix-directory"})}get type(){return r.Folder}get extension(){return null}get mime(){return"httpd/unix-directory"}}var j,p=n(79753),v=n(14596);const b="/trashbin/".concat(null===(j=(0,d.ts)())||void 0===j?void 0:j.uid,"/trash"),w=(0,p.generateRemoteUrl)("dav"+b),g=(0,v.eI)(w,{headers:{requesttoken:(0,d.IH)()}}),y='<?xml version="1.0"?>\n<d:propfind xmlns:d="DAV:"\n\txmlns:oc="http://owncloud.org/ns"\n\txmlns:nc="http://nextcloud.org/ns">\n\t<d:prop>\n\t\t<nc:trashbin-filename />\n\t\t<nc:trashbin-deletion-time />\n\t\t<nc:trashbin-original-location />\n\t\t<nc:trashbin-title />\n\t\t<d:getlastmodified />\n\t\t<d:getetag />\n\t\t<d:getcontenttype />\n\t\t<d:resourcetype />\n\t\t<oc:fileid />\n\t\t<oc:permissions />\n\t\t<oc:size />\n\t\t<d:getcontentlength />\n\t</d:prop>\n</d:propfind>',E=function(e){var t,n,i,r,o;const a=function(e=""){let t=s.NONE;return e?((e.includes("C")||e.includes("K"))&&(t|=s.CREATE),e.includes("G")&&(t|=s.READ),(e.includes("W")||e.includes("N")||e.includes("V"))&&(t|=s.UPDATE),e.includes("D")&&(t|=s.DELETE),e.includes("R")&&(t|=s.SHARE),t):t}(null===(t=e.props)||void 0===t?void 0:t.permissions),l=null===(n=(0,d.ts)())||void 0===n?void 0:n.uid,c=(0,p.generateUrl)("/apps/fi
//# sourceMappingURL=files_trashbin-main.js.map?v=fb195a27b9e5a3e8330b