You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud-server/dist/core-files_client.js

3 lines
12 KiB

/*! For license information please see core-files_client.js.LICENSE.txt */
(()=>{"use strict";var e,t={40828:(e,t,s)=>{var n=s(70580),r=s.n(n),i=s(96763);!function(e,t){var s=function(t){this._root=t.root,"/"===this._root.charAt(this._root.length-1)&&(this._root=this._root.substr(0,this._root.length-1));let n=s.PROTOCOL_HTTP+"://";t.useHTTPS&&(n=s.PROTOCOL_HTTPS+"://"),n+=t.host+this._root,this._host=t.host,this._defaultHeaders=t.defaultHeaders||{"X-Requested-With":"XMLHttpRequest",requesttoken:e.requestToken},this._baseUrl=n;const r={baseUrl:this._baseUrl,xmlNamespaces:{"DAV:":"d","http://owncloud.org/ns":"oc","http://nextcloud.org/ns":"nc","http://open-collaboration-services.org/ns":"ocs"}};t.userName&&(r.userName=t.userName),t.password&&(r.password=t.password),this._client=new dav.Client(r),this._client.xhrProvider=_.bind(this._xhrProvider,this),this._fileInfoParsers=[]};s.NS_OWNCLOUD="http://owncloud.org/ns",s.NS_NEXTCLOUD="http://nextcloud.org/ns",s.NS_DAV="DAV:",s.NS_OCS="http://open-collaboration-services.org/ns",s.PROPERTY_GETLASTMODIFIED="{"+s.NS_DAV+"}getlastmodified",s.PROPERTY_GETETAG="{"+s.NS_DAV+"}getetag",s.PROPERTY_GETCONTENTTYPE="{"+s.NS_DAV+"}getcontenttype",s.PROPERTY_RESOURCETYPE="{"+s.NS_DAV+"}resourcetype",s.PROPERTY_INTERNAL_FILEID="{"+s.NS_OWNCLOUD+"}fileid",s.PROPERTY_PERMISSIONS="{"+s.NS_OWNCLOUD+"}permissions",s.PROPERTY_SIZE="{"+s.NS_OWNCLOUD+"}size",s.PROPERTY_GETCONTENTLENGTH="{"+s.NS_DAV+"}getcontentlength",s.PROPERTY_ISENCRYPTED="{"+s.NS_DAV+"}is-encrypted",s.PROPERTY_SHARE_PERMISSIONS="{"+s.NS_OCS+"}share-permissions",s.PROPERTY_SHARE_ATTRIBUTES="{"+s.NS_NEXTCLOUD+"}share-attributes",s.PROPERTY_QUOTA_AVAILABLE_BYTES="{"+s.NS_DAV+"}quota-available-bytes",s.PROTOCOL_HTTP="http",s.PROTOCOL_HTTPS="https",s._PROPFIND_PROPERTIES=[[s.NS_DAV,"getlastmodified"],[s.NS_DAV,"getetag"],[s.NS_DAV,"getcontenttype"],[s.NS_DAV,"resourcetype"],[s.NS_OWNCLOUD,"fileid"],[s.NS_OWNCLOUD,"permissions"],[s.NS_OWNCLOUD,"size"],[s.NS_DAV,"getcontentlength"],[s.NS_DAV,"quota-available-bytes"],[s.NS_NEXTCLOUD,"has-preview"],[s.NS_NEXTCLOUD,"mount-type"],[s.NS_NEXTCLOUD,"is-encrypted"],[s.NS_OCS,"share-permissions"],[s.NS_NEXTCLOUD,"share-attributes"]],s.prototype={_root:null,_client:null,_fileInfoParsers:[],_xhrProvider:function(){const t=this._defaultHeaders,s=new XMLHttpRequest,n=s.open;return s.open=function(){const e=n.apply(this,arguments);return _.each(t,(function(e,t){s.setRequestHeader(t,e)})),e},e.registerXHRForErrorProcessing(s),s},_buildUrl:function(){let e=this._buildPath.apply(this,arguments);return"/"===e.charAt([e.length-1])&&(e=e.substr(0,e.length-1)),"/"===e.charAt(0)&&(e=e.substr(1)),this._baseUrl+"/"+e},_buildPath:function(){let t=e.joinPaths.apply(this,arguments);const s=t.split("/");let n;for(n=0;n<s.length;n++)s[n]=encodeURIComponent(s[n]);return t=s.join("/"),t},_parseHeaders:function(e){const t=e.split("\n"),s={};for(let e=0;e<t.length;e++){const n=t[e].indexOf(":");if(n<0)continue;const r=t[e].substr(0,n),i=t[e].substr(n+2);s[r]||(s[r]=[]),s[r].push(i)}return s},_parseEtag:function(e){return'"'===e.charAt(0)?e.split('"')[1]:e},_parseFileInfo:function(n){let r=decodeURIComponent(n.href);if(r.substr(0,this._root.length)===this._root&&(r=r.substr(this._root.length)),"/"===r.charAt(r.length-1)&&(r=r.substr(0,r.length-1)),0===n.propStat.length||"HTTP/1.1 200 OK"!==n.propStat[0].status)return null;const o=n.propStat[0].properties,a={id:o[s.PROPERTY_INTERNAL_FILEID],path:e.dirname(r)||"/",name:e.basename(r),mtime:new Date(o[s.PROPERTY_GETLASTMODIFIED]).getTime()},c=o[s.PROPERTY_GETETAG];_.isUndefined(c)||(a.etag=this._parseEtag(c));let u=o[s.PROPERTY_GETCONTENTLENGTH];_.isUndefined(u)||(a.size=parseInt(u,10)),u=o[s.PROPERTY_SIZE],_.isUndefined(u)||(a.size=parseInt(u,10));const l=o["{"+s.NS_NEXTCLOUD+"}has-preview"];_.isUndefined(l)?a.hasPreview=!0:a.hasPreview="true"===l;const p=o["{"+s.NS_NEXTCLOUD+"}is-encrypted"];_.isUndefined(p)?a.isEncrypted=!1:a.isEncrypted="1"===p;const h=o["{"+s.NS_OWNCLOUD+"}favorite"];_.isUndefined(h)?a.isFavourited=!1:a.isFavourited="1"===h;const d=o[s.PROPERTY_GETCONTENTTYPE];_.isUndefined(d)||(a.mimetype=d);const f=o[s.PROPERTY_RESOURCETYPE]
//# sourceMappingURL=core-files_client.js.map?v=4639d62779c6562c7e14