owncloud / owncloud-sdk

:cloud: ownCloud client library for JavaScript
https://owncloud.dev/owncloud-sdk/
MIT License
75 stars 33 forks source link

Comments and tag APIs #1215

Open tarkhil opened 1 year ago

tarkhil commented 1 year ago

Could not find them in SDK; are they not implemented (yet) or are they considered too trivial and to be implemented by user?

kulmann commented 1 year ago

Hey @tarkhil

TL;DR: sorry to say that both are not implemented and currently not planned... at least not by an ownCloud developer.

tarkhil commented 1 year ago

Okay; I'm going to implement all of this myself, but maybe you can help me with oc.davClient.

                const dav = this.oc.files.davClient;
                await dav.request( 'POST',
                                   `/dav/comments/files/${d.fileid}`,
                                   {},
                                   {
                                       actorType:"users",
                                       verb:"comment",
                                       message: this.newComment
                                   },
                                   {
                                       withCredentials: true
                                   }
                                 );

for some reason does not supply credentials. Client has been initialized with URL/username/password and has just performed some requests. oc.helpers._authHeader exists. Adding `Authorization: oc.helpers._authHeader results in

cess to XMLHttpRequest at 'https://owncloud/remote.php/dav/dav/comments/files/49838' from origin 'http://client' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

The answer should be rather trivial, but I'm stuck.

tarkhil commented 1 year ago

Sorry, my dumb fault. /comments/files/${d.fileid} instead of /dav/comments/files/${d.fileid}

I still wonder why withCredentials: true does not work