@aiyiran/myclaw 1.0.239 → 1.0.241
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/assets/myclaw-artifacts.js +12 -5
- package/package.json +1 -1
- package/patches/patch.js +2 -2
|
@@ -47,11 +47,18 @@
|
|
|
47
47
|
return '';
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// ═══ 构建预览 URL ═══
|
|
50
|
+
// ═══ 构建预览 URL(CDN) ═══
|
|
51
51
|
function buildPreviewUrl(data, assetPath) {
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
return 'https://cdn.yiranlaoshi.com/' + claw + '/' + wsName + '/' + assetPath;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
// ═══ 创建按钮 ═══
|
|
@@ -199,7 +206,7 @@
|
|
|
199
206
|
claw = localStorage.getItem(CLAW_STORAGE_KEY);
|
|
200
207
|
if (!claw) {
|
|
201
208
|
console.log('[myclaw-artifacts] ❌ 未配置 claw 名称');
|
|
202
|
-
console.log('[myclaw-artifacts]
|
|
209
|
+
console.log('[myclaw-artifacts] 请在控制台执行: localStorage.setItem("myclaw-claw-name", "你的claw名称")');
|
|
203
210
|
return null;
|
|
204
211
|
}
|
|
205
212
|
}
|
package/package.json
CHANGED
package/patches/patch.js
CHANGED
|
@@ -263,11 +263,11 @@ function patch() {
|
|
|
263
263
|
);
|
|
264
264
|
cspPatches.push('frame-src');
|
|
265
265
|
}
|
|
266
|
-
// 放开 connect-src,允许 fetch/XHR 到外部 https API
|
|
266
|
+
// 放开 connect-src,允许 fetch/XHR 到外部 https API(包括 CDN)
|
|
267
267
|
if (needsConnectSrc) {
|
|
268
268
|
content = content.replace(
|
|
269
269
|
'"connect-src \'self\' ws: wss:"',
|
|
270
|
-
'"connect-src \'self\' https: ws: wss:"'
|
|
270
|
+
'"connect-src \'self\' https: ws: wss: https://cdn.yiranlaoshi.com"'
|
|
271
271
|
);
|
|
272
272
|
cspPatches.push('connect-src');
|
|
273
273
|
}
|