@aiyiran/myclaw 1.0.239 → 1.0.240

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.
@@ -47,11 +47,19 @@
47
47
  return '';
48
48
  }
49
49
 
50
- // ═══ 构建预览 URL ═══
50
+ // ═══ 构建预览 URL(CDN) ═══
51
51
  function buildPreviewUrl(data, assetPath) {
52
- var base = data.base_url || '';
53
- var wsName = data.workspace_id || '';
54
- return base + '/' + wsName + '/' + assetPath;
52
+ var claw = window.location.hostname.split('.')[0];
53
+ if (!claw.includes('claw')) {
54
+ claw = localStorage.getItem(CLAW_STORAGE_KEY);
55
+ }
56
+ if (!claw) {
57
+ console.error('[myclaw-artifacts] ❌ 未配置 claw 名称,无法构建预览链接');
58
+ return null;
59
+ }
60
+ var wsName = data.workspace_id || 'main';
61
+ var wsPrefix = wsName === 'main' ? 'workspace' : 'workspace-' + wsName;
62
+ return 'https://cdn.yiranlaoshi.com/' + claw + '/' + wsPrefix + '/' + assetPath;
55
63
  }
56
64
 
57
65
  // ═══ 创建按钮 ═══
@@ -199,7 +207,7 @@
199
207
  claw = localStorage.getItem(CLAW_STORAGE_KEY);
200
208
  if (!claw) {
201
209
  console.log('[myclaw-artifacts] ❌ 未配置 claw 名称');
202
- console.log('[myclaw-artifacts] 请运行: myclaw set claw <你的claw名称>');
210
+ console.log('[myclaw-artifacts] 请在控制台执行: localStorage.setItem("myclaw-claw-name", "你的claw名称")');
203
211
  return null;
204
212
  }
205
213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.239",
3
+ "version": "1.0.240",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {