|
@@ -31,36 +31,40 @@ class NCCommunication: NSObject {
|
|
|
return instance
|
|
|
}()
|
|
|
|
|
|
- let NCResource =
|
|
|
- """
|
|
|
- <d:displayname/>
|
|
|
- <d:getcontenttype/>
|
|
|
- <d:resourcetype/>
|
|
|
- <d:getcontentlength/>
|
|
|
- <d:getlastmodified/>
|
|
|
- <d:creationdate/>
|
|
|
- <d:getetag/>
|
|
|
- <d:quota-used-bytes/>
|
|
|
- <d:quota-available-bytes/>
|
|
|
- <permissions xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <id xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <fileid xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <size xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <favorite xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <is-encrypted xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
- <mount-type xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
- <owner-id xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <owner-display-name xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <comments-unread xmlns=\"http://owncloud.org/ns\"/>
|
|
|
- <has-preview xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
- <trashbin-filename xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
- <trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
- <trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/>"
|
|
|
- """
|
|
|
-
|
|
|
@objc func readFolder(serverUrl: String, account: String, user: String, password: String, depth: String, userAgent: String, completionHandler: @escaping (_ result: [NCFile], _ account: String,_ error: Error?) -> Void) {
|
|
|
|
|
|
var files = [NCFile]()
|
|
|
+ let dataListFile =
|
|
|
+ """
|
|
|
+ <?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
|
|
+ <d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">
|
|
|
+ <d:prop>"
|
|
|
+ <d:displayname/>
|
|
|
+ <d:getcontenttype/>
|
|
|
+ <d:resourcetype/>
|
|
|
+ <d:getcontentlength/>
|
|
|
+ <d:getlastmodified/>
|
|
|
+ <d:creationdate/>
|
|
|
+ <d:getetag/>
|
|
|
+ <d:quota-used-bytes/>
|
|
|
+ <d:quota-available-bytes/>
|
|
|
+ <permissions xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <id xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <fileid xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <size xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <favorite xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <is-encrypted xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
+ <mount-type xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
+ <owner-id xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <owner-display-name xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <comments-unread xmlns=\"http://owncloud.org/ns\"/>
|
|
|
+ <has-preview xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
+ <trashbin-filename xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
+ <trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/>
|
|
|
+ <trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/>"
|
|
|
+ </d:prop>
|
|
|
+ </d:propfind>
|
|
|
+ """
|
|
|
|
|
|
// URL
|
|
|
var url: URLConvertible
|
|
@@ -78,7 +82,7 @@ class NCCommunication: NSObject {
|
|
|
headers.update(name: "Depth", value: depth)
|
|
|
|
|
|
// Parameters
|
|
|
- //let parameters: Parameters = ["":"<?xml version=\"1.0\" encoding=\"UTF-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><d:prop>" + NCResource + "</d:prop></d:propfind>"]
|
|
|
+ //let parameters: Parameters = ["":"<?xml version=\"1.0\" encoding=\"UTF-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><d:prop>" + NCResourceList + "</d:prop></d:propfind>"]
|
|
|
|
|
|
// Method
|
|
|
let method = HTTPMethod(rawValue: "PROPFIND")
|