@aiyiran/myclaw 1.0.240 → 1.0.242
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 +2 -15
- package/package.json +1 -1
- package/patches/patch.js +2 -2
|
@@ -58,8 +58,7 @@
|
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
var wsName = data.workspace_id || 'main';
|
|
61
|
-
|
|
62
|
-
return 'https://cdn.yiranlaoshi.com/' + claw + '/' + wsPrefix + '/' + assetPath;
|
|
61
|
+
return 'https://cdn.yiranlaoshi.com/' + claw + '/' + wsName + '/' + assetPath;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
// ═══ 创建按钮 ═══
|
|
@@ -198,22 +197,10 @@
|
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
// ═══ 请求数据 ═══
|
|
201
|
-
var CLAW_STORAGE_KEY = 'myclaw-claw-name';
|
|
202
|
-
|
|
203
200
|
function getArtifactsUrl() {
|
|
204
|
-
var claw = window.location.hostname.split('.')[0];
|
|
205
|
-
// 如果 hostname 不含 claw,从 localStorage 读取
|
|
206
|
-
if (!claw.includes('claw')) {
|
|
207
|
-
claw = localStorage.getItem(CLAW_STORAGE_KEY);
|
|
208
|
-
if (!claw) {
|
|
209
|
-
console.log('[myclaw-artifacts] ❌ 未配置 claw 名称');
|
|
210
|
-
console.log('[myclaw-artifacts] 请在控制台执行: localStorage.setItem("myclaw-claw-name", "你的claw名称")');
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
201
|
var agentName = getAgentName() || 'main';
|
|
215
202
|
var wsPrefix = agentName === 'main' ? 'workspace' : 'workspace-' + agentName;
|
|
216
|
-
return
|
|
203
|
+
return window.location.origin + '/cmd/api/preview?path=' + wsPrefix + '/.myclaw/__MY_ARTIFACTS__.json';
|
|
217
204
|
}
|
|
218
205
|
|
|
219
206
|
function fetchArtifacts(contentEl) {
|
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
|
}
|