@gallop.software/studio 2.3.142 → 2.3.144

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.
@@ -11,7 +11,7 @@
11
11
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
12
  }
13
13
  </style>
14
- <script type="module" crossorigin src="/assets/index-CKf_Sdm0.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BU5jKhxs.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-DfPQBmNf.css">
16
16
  </head>
17
17
  <body>
@@ -4728,6 +4728,43 @@ async function handleFontsDelete(request) {
4728
4728
  return jsonResponse({ error: "Failed to delete" }, { status: 500 });
4729
4729
  }
4730
4730
  }
4731
+ async function handleFontsRename(request) {
4732
+ try {
4733
+ const { oldPath, newName } = await request.json();
4734
+ if (!oldPath || !newName) {
4735
+ return jsonResponse({ error: "oldPath and newName are required" }, { status: 400 });
4736
+ }
4737
+ if (!oldPath.startsWith("_fonts/")) {
4738
+ return jsonResponse({ error: "Can only rename items in _fonts/" }, { status: 400 });
4739
+ }
4740
+ if (newName.includes("/") || newName.includes("\\")) {
4741
+ return jsonResponse({ error: "Invalid folder name" }, { status: 400 });
4742
+ }
4743
+ const oldFullPath = getWorkspacePath(oldPath);
4744
+ const parentDir = path11.dirname(oldPath);
4745
+ const newPath = `${parentDir}/${newName.toLowerCase()}`;
4746
+ const newFullPath = getWorkspacePath(newPath);
4747
+ try {
4748
+ await fs12.stat(oldFullPath);
4749
+ } catch {
4750
+ return jsonResponse({ error: "Path not found" }, { status: 404 });
4751
+ }
4752
+ try {
4753
+ await fs12.stat(newFullPath);
4754
+ return jsonResponse({ error: "A folder with that name already exists" }, { status: 400 });
4755
+ } catch {
4756
+ }
4757
+ await fs12.rename(oldFullPath, newFullPath);
4758
+ return jsonResponse({
4759
+ success: true,
4760
+ oldPath,
4761
+ newPath
4762
+ });
4763
+ } catch (error) {
4764
+ console.error("Error renaming:", error);
4765
+ return jsonResponse({ error: "Failed to rename" }, { status: 500 });
4766
+ }
4767
+ }
4731
4768
 
4732
4769
  // src/server/index.ts
4733
4770
  var __filename = fileURLToPath(import.meta.url);
@@ -4807,6 +4844,7 @@ async function startServer(options) {
4807
4844
  app.post("/api/studio/fonts/upload", wrapRawHandler(handleFontsUpload));
4808
4845
  app.post("/api/studio/fonts/create-folder", wrapHandler(handleFontsCreateFolder));
4809
4846
  app.post("/api/studio/fonts/delete", wrapHandler(handleFontsDelete));
4847
+ app.post("/api/studio/fonts/rename", wrapHandler(handleFontsRename));
4810
4848
  app.post("/api/studio/upload", wrapRawHandler(handleUpload));
4811
4849
  app.post("/api/studio/create-folder", wrapHandler(handleCreateFolder));
4812
4850
  app.post("/api/studio/rename", wrapHandler(handleRename));