carnet panel2
This commit is contained in:
parent
68a8c73439
commit
9d232cc5cf
@ -45,37 +45,19 @@ export async function GET(request: Request) {
|
|||||||
const normalizedBaseURL = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
|
const normalizedBaseURL = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
|
||||||
|
|
||||||
// Construct the full WebDAV URL
|
// Construct the full WebDAV URL
|
||||||
const webdavURL = `${normalizedBaseURL}/remote.php/dav`;
|
const webdavURL = `${normalizedBaseURL}/remote.php/dav/files/${credentials.username}/Private/${folder}`;
|
||||||
console.log('WebDAV URL:', webdavURL);
|
console.log('WebDAV URL:', webdavURL);
|
||||||
|
|
||||||
const client = createClient({
|
const client = createClient({
|
||||||
username: credentials.username,
|
username: credentials.username,
|
||||||
password: credentials.password,
|
password: credentials.password,
|
||||||
baseURL: webdavURL,
|
baseURL: normalizedBaseURL,
|
||||||
authType: 'basic',
|
authType: 'basic',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Construct the folder path
|
|
||||||
const folderPath = `files/${credentials.username}/Private/${folder}`;
|
|
||||||
console.log('Full folder path:', folderPath);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// List files in the specified folder with detailed properties
|
// List files in the specified folder
|
||||||
const files = await client.getDirectoryContents(folderPath, {
|
const files = await client.getDirectoryContents(`/remote.php/dav/files/${credentials.username}/Private/${folder}`);
|
||||||
details: true,
|
|
||||||
data: `<?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:getlastmodified/>
|
|
||||||
<d:getcontentlength/>
|
|
||||||
<d:getcontenttype/>
|
|
||||||
<oc:permissions/>
|
|
||||||
<d:resourcetype/>
|
|
||||||
<d:getetag/>
|
|
||||||
<d:displayname/>
|
|
||||||
</d:prop>
|
|
||||||
</d:propfind>`
|
|
||||||
});
|
|
||||||
console.log('Found files:', files.length);
|
console.log('Found files:', files.length);
|
||||||
|
|
||||||
// Filter for .md files and format the response
|
// Filter for .md files and format the response
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user