@aiyiran/myclaw 1.0.216 → 1.0.218

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.
@@ -312,8 +312,6 @@
312
312
  var nameSpan = document.createElement('span');
313
313
  nameSpan.textContent = pathParts[pathParts.length - 1] || asset.name || '未命名';
314
314
  nameSpan.title = asset.path || '';
315
- fname.appendChild(nameSpan);
316
-
317
315
  // [最新] 优先于 [有更新]
318
316
  if (isLatest && !isLatestSeen) {
319
317
  var badge = document.createElement('span');
@@ -327,6 +325,8 @@
327
325
  fname.appendChild(badge);
328
326
  }
329
327
 
328
+ fname.appendChild(nameSpan);
329
+
330
330
  row.appendChild(time);
331
331
  row.appendChild(fname);
332
332
  container.appendChild(row);
@@ -566,14 +566,33 @@
566
566
  titleInput.style.borderColor = '#ff4444';
567
567
  return;
568
568
  }
569
- var publishData = {
569
+ var agentName = getAgentName() || 'main';
570
+ var wsField = agentName === 'main' ? 'workspace' : 'workspace-' + agentName;
571
+ var clawVal = window.location.hostname.split('.')[0];
572
+ var payload = {
570
573
  title: titleVal,
574
+ workspace: wsField,
571
575
  cover_path: coverSelect.value || '',
572
576
  entry_path: entrySelect.value || '',
573
- published_at: new Date().toISOString(),
577
+ claw: clawVal,
574
578
  };
575
- console.log('[myclaw-artifacts-publish]', JSON.stringify(publishData));
576
- closePublishModal();
579
+ submitBtn.disabled = true;
580
+ submitBtn.textContent = '\u53D1\u5E03\u4E2D...';
581
+ fetch('https://www.yiranlaoshi.com/api/student_workspace_create', {
582
+ method: 'POST',
583
+ headers: { 'Content-Type': 'application/json' },
584
+ body: JSON.stringify(payload),
585
+ })
586
+ .then(function (res) { return res.json(); })
587
+ .then(function (data) {
588
+ console.log('[myclaw-artifacts-publish]', payload, data);
589
+ closePublishModal();
590
+ })
591
+ .catch(function (err) {
592
+ console.error('[myclaw-artifacts-publish] \u53D1\u5E03\u5931\u8D25:', err);
593
+ submitBtn.disabled = false;
594
+ submitBtn.textContent = '\u786E\u8BA4\u53D1\u5E03';
595
+ });
577
596
  };
578
597
 
579
598
  box.appendChild(header);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.216",
3
+ "version": "1.0.218",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/patches/patch.js CHANGED
@@ -250,21 +250,26 @@ function patch() {
250
250
  console.log('[myclaw-patch] ✅ 已修复 Permissions-Policy (microphone): ' + f);
251
251
  }
252
252
 
253
- // Patch 2: CSP frame-src - 在 buildControlUiCspHeader 的 CSP 数组中添加 frame-src
254
- // 原始: "default-src 'self'", ... "frame-ancestors 'none'"
255
- // 目标: "default-src 'self'" 后插入 "frame-src 'self' https:", 并修改 frame-ancestors
253
+ // Patch 2: CSP - 在 buildControlUiCspHeader 的 CSP 数组中放宽限制
254
+ // 原始: "default-src 'self'", "connect-src 'self' ws: wss:", "frame-ancestors 'none'"
255
+ // 目标: 添加 frame-src, 放开 connect-src frame-ancestors
256
256
  if (needsCspFramePatch) {
257
- // "default-src 'self'" 后面插入 frame-src 指令
257
+ // 添加 frame-src 指令(允许 iframe 加载外部 https 资源)
258
258
  content = content.replace(
259
259
  '"default-src \'self\'"',
260
260
  '"default-src \'self\'",\n\t\t"frame-src \'self\' https:"'
261
261
  );
262
- // 同时放开 frame-ancestors,允许被外部 iframe 嵌入
262
+ // 放开 connect-src,允许 fetch/XHR 到外部 https API
263
+ content = content.replace(
264
+ '"connect-src \'self\' ws: wss:"',
265
+ '"connect-src \'self\' https: ws: wss:"'
266
+ );
267
+ // 放开 frame-ancestors,允许被外部 https 页面嵌入
263
268
  content = content.replace(
264
269
  '"frame-ancestors \'none\'"',
265
270
  '"frame-ancestors \'self\' https:"'
266
271
  );
267
- console.log('[myclaw-patch] ✅ 已添加 CSP frame-src 允许 iframe 加载: ' + f);
272
+ console.log('[myclaw-patch] ✅ 已修复 CSP (frame-src, connect-src, frame-ancestors): ' + f);
268
273
  }
269
274
 
270
275
  fs.writeFileSync(filePath, content, 'utf8');