@frumu/tandem-panel 0.4.35 → 0.4.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/setup.js CHANGED
@@ -1942,6 +1942,31 @@ async function handleFilesApi(req, res, _session) {
1942
1942
  return true;
1943
1943
  }
1944
1944
 
1945
+ if (pathname === "/api/files/mkdir" && req.method === "POST") {
1946
+ try {
1947
+ const body = await readJsonBody(req);
1948
+ const rel = toSafeRelPath(body?.path || "", true);
1949
+ if (!rel) {
1950
+ sendJson(res, 400, { ok: false, error: "Missing or invalid directory path." });
1951
+ return true;
1952
+ }
1953
+ const full = resolve(FILES_ROOT, visibleFilesPathToPhysicalPath(rel));
1954
+ await mkdir(full, { recursive: true });
1955
+ const info = await stat(full);
1956
+ sendJson(res, 200, {
1957
+ ok: true,
1958
+ root: FILES_ROOT,
1959
+ path: rel,
1960
+ absPath: full,
1961
+ updatedAt: info.mtimeMs,
1962
+ previewKind: "directory",
1963
+ });
1964
+ } catch (e) {
1965
+ sendJson(res, 500, { ok: false, error: e instanceof Error ? e.message : String(e) });
1966
+ }
1967
+ return true;
1968
+ }
1969
+
1945
1970
  if (pathname === "/api/files/download" && req.method === "GET") {
1946
1971
  const rel = toSafeRelPath(url.searchParams.get("path") || "", false);
1947
1972
  if (!rel) {