mdk-skills 2.3.13 → 2.3.14

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.
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>mdk-skills 管理面板</title>
7
- <script type="module" crossorigin src="/assets/index-pHDOtonU.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-DdbAYqm7.css">
7
+ <script type="module" crossorigin src="/assets/index-Cm36es6e.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-CLehfVwa.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="app"></div>
@@ -525,6 +525,18 @@ async function handleApi(req, res) {
525
525
  return sendJSON(res, { ok: true, imported, skipped });
526
526
  }
527
527
 
528
+ // POST /api/skills/pull-cancel — 取消预览,清理缓存和临时目录
529
+ if (method === "POST" && pathname === "/api/skills/pull-cancel") {
530
+ const body = await parseBody(req);
531
+ const url = (body.url || "").trim();
532
+ if (url && pullCache.has(url)) {
533
+ const entry = pullCache.get(url);
534
+ pullCache.delete(url);
535
+ try { fs.rmSync(entry.tmpDir, { recursive: true, force: true }); } catch {}
536
+ }
537
+ return sendJSON(res, { ok: true });
538
+ }
539
+
528
540
  // GET /api/skills/:name/source — 查询技能来源
529
541
  const sourceMatch = pathname.match(/^\/api\/skills\/([^/]+)\/source$/);
530
542
  if (method === "GET" && sourceMatch) {
@@ -116,6 +116,13 @@ export function pullSkills(url, names = []) {
116
116
  });
117
117
  }
118
118
 
119
+ export function cancelPull(url) {
120
+ return request("/skills/pull-cancel", {
121
+ method: "POST",
122
+ body: JSON.stringify({ url }),
123
+ });
124
+ }
125
+
119
126
  export function deleteSkill(name) {
120
127
  return request("/skills/" + encodeURIComponent(name), {
121
128
  method: "DELETE",
@@ -172,7 +172,7 @@
172
172
  title="从远程仓库拉取"
173
173
  width="600px"
174
174
  :mask-closable="true"
175
- @update:show="(v) => { if (!v) { showPullModal = false; pulling = false; previewing = false; cancelTask(); } }"
175
+ @update:show="(v) => { if (!v) { showPullModal = false; pulling = false; previewing = false; cancelTask(); cancelPull(pullUrl).catch(() => {}); } }"
176
176
  >
177
177
  <div class="pull-modal-body">
178
178
  <!-- URL 输入 -->
@@ -328,7 +328,7 @@ import { marked } from "marked";
328
328
  import hljs from "highlight.js";
329
329
  import SkillCard from "../components/SkillCard.vue";
330
330
  import ModalComp from "../components/ModalComp.vue";
331
- import { getSkills, getReadme, getSkillReadme, updateSkillMeta, deleteSkill, pullSkills, installSkills, getSkillSource, updateSkill, batchUpdateSkills, openSkillDir, cancelTask } from "../api/skills";
331
+ import { getSkills, getReadme, getSkillReadme, updateSkillMeta, deleteSkill, pullSkills, cancelPull, installSkills, getSkillSource, updateSkill, batchUpdateSkills, openSkillDir, cancelTask } from "../api/skills";
332
332
  import { sortSkills, getUsageMap, recordUsage } from "../utils/usage";
333
333
 
334
334
  // marked 配置:代码高亮 + 外链安全