Again in a little more detail :).
Hi,
first of all some information:
I’m trying to use js and webdav to output the contents of my nc folders as json.
I’ve been trying to do this for some time and have started a few attempts to get rid of the error message.
I have adjusted the trusted address in Docker :
docker exec --user www-data [someContainerName] php occ config:system:set trusted_domains 1 --value=localhost:1234
Since I have it running on Apache, I also tried to adjust the headers in apache2.conf and at sites enable. In the end :
Header always set Access-Control-Allow-Origin “*”
Header always set Access-Control-Allow-Credentials true
Header always set Access-Control-Allow-Methods “OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT”.
Header always set Access-Control-Allow-Headers “accept, content-type”.
inserted.
My Code:
import { createClient, parseXML } from "webdav";
const client = createClient("http://localhost:8080/", {
auth: {
username: "test@mail.de",
password: "12345",
},
});
const handle = async () => {
const testItems = await client.getDirectoryContents(
"/remote.php/dav/files/test@mail.de/Documents/?formt=json",
{
method: "PROPFIND",
headers: {
Accept: "text/plain",
Depth: "0",
},
responseType: "text",
}
);
const DAVResult = await parseXML(testItems.data);
return DAVResult;
};
The NC container is 100% requested, every time I reload my self-built client side I get this output in the Dockerlog:
…OPTIONS /remote.php/dav/files/test%40mail.com/Documents/%3Fformt%3Djson/ HTTP/1.1" 401 2222 “http://localhost:1234/” "Mozilla/5.0…
Can someone help me just get the output :?