Projektseite wie Plancraft, Zahlungsplan automatisch, Spaltenbreiten im Terminplan (0.6.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { Nextcloud } from "../src/server/nextcloud.js";
|
||||
|
||||
/** Kleine WebDAV-Nachbildung im Speicher: nur Ordner, wie Nextcloud sie beantwortet */
|
||||
/** Kleine WebDAV-Nachbildung im Speicher: Ordner und Dateien, wie Nextcloud sie beantwortet */
|
||||
export function falscheNextcloud(basis = "https://cloud.test/remote.php/dav/files/henning/Projekte") {
|
||||
const ordner = new Set<string>();
|
||||
const dateien = new Map<string, string>();
|
||||
const pfad = (u: string) => decodeURIComponent(new URL(u).pathname).replace(/\/+$/, "");
|
||||
const wurzel = pfad(basis);
|
||||
ordner.add(wurzel);
|
||||
@@ -13,10 +14,16 @@ export function falscheNextcloud(basis = "https://cloud.test/remote.php/dav/file
|
||||
switch (init?.method) {
|
||||
case "PROPFIND": {
|
||||
if (!ordner.has(p)) return new Response(null, { status: 404 });
|
||||
const kinder = kopf.depth === "1" ? [...ordner].filter((o) => o.startsWith(p + "/") && !o.slice(p.length + 1).includes("/")) : [];
|
||||
const hrefs = [p, ...kinder].map((o) => `<d:response><d:href>${o.split("/").map(encodeURIComponent).join("/")}/</d:href></d:response>`).join("");
|
||||
const direkt = (o: string) => o.startsWith(p + "/") && !o.slice(p.length + 1).includes("/");
|
||||
const kinder = kopf.depth === "1" ? [...ordner].filter(direkt) : [];
|
||||
const href = (o: string) => o.split("/").map(encodeURIComponent).join("/");
|
||||
const hrefs = [p, ...kinder].map((o) => `<d:response><d:href>${href(o)}/</d:href><d:propstat><d:prop><d:resourcetype><d:collection/></d:resourcetype></d:prop></d:propstat></d:response>`).join("")
|
||||
+ (kopf.depth === "1" ? [...dateien].filter(([d]) => direkt(d)).map(([d, inhalt]) =>
|
||||
`<d:response><d:href>${href(d)}</d:href><d:propstat><d:prop><d:resourcetype/><d:getcontentlength>${inhalt.length}</d:getcontentlength><d:getlastmodified>Mon, 19 Oct 2026 08:00:00 GMT</d:getlastmodified></d:prop></d:propstat></d:response>`).join("") : "");
|
||||
return new Response(`<?xml version="1.0"?><d:multistatus xmlns:d="DAV:">${hrefs}</d:multistatus>`, { status: 207 });
|
||||
}
|
||||
case "GET":
|
||||
return dateien.has(p) ? new Response(dateien.get(p)!, { status: 200, headers: { "content-type": "application/pdf" } }) : new Response(null, { status: 404 });
|
||||
case "MKCOL":
|
||||
if (ordner.has(p)) return new Response(null, { status: 405 });
|
||||
if (!ordner.has(eltern)) return new Response(null, { status: 409 });
|
||||
@@ -32,5 +39,5 @@ export function falscheNextcloud(basis = "https://cloud.test/remote.php/dav/file
|
||||
return new Response(null, { status: 400 });
|
||||
}) as typeof fetch;
|
||||
const relativ = () => [...ordner].filter((o) => o !== wurzel).map((o) => o.slice(wurzel.length + 1)).sort();
|
||||
return { nc: new Nextcloud({ url: basis, benutzer: "henning", passwort: "geheim" }, abruf), ordner, wurzel, relativ };
|
||||
return { nc: new Nextcloud({ url: basis, benutzer: "henning", passwort: "geheim" }, abruf), ordner, dateien, wurzel, relativ };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user