@aiyiran/myclaw 1.0.258 → 1.0.260
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 +1 -1
- package/assets/myclaw-inject.js +43 -0
- package/index.js +46 -9
- package/package.json +1 -1
package/assets/myclaw-inject.js
CHANGED
|
@@ -1042,6 +1042,49 @@ btn.addEventListener("click", function () {
|
|
|
1042
1042
|
|
|
1043
1043
|
form.appendChild(delRow);
|
|
1044
1044
|
|
|
1045
|
+
// ── 锁定版本 4.2 按钮 ──
|
|
1046
|
+
var lockRow = document.createElement("div");
|
|
1047
|
+
lockRow.style.cssText = [
|
|
1048
|
+
"padding:10px 14px",
|
|
1049
|
+
"background:#252536",
|
|
1050
|
+
"border-radius:6px",
|
|
1051
|
+
"cursor:pointer",
|
|
1052
|
+
"transition:background 0.15s",
|
|
1053
|
+
"display:flex",
|
|
1054
|
+
"align-items:center",
|
|
1055
|
+
"gap:10px",
|
|
1056
|
+
].join(";");
|
|
1057
|
+
lockRow.onmouseenter = function () { lockRow.style.background = "#2f2f4a"; };
|
|
1058
|
+
lockRow.onmouseleave = function () { lockRow.style.background = "#252536"; };
|
|
1059
|
+
|
|
1060
|
+
var lockBar = document.createElement("div");
|
|
1061
|
+
lockBar.style.cssText = "width:3px;height:28px;border-radius:2px;background:#f59e0b;flex-shrink:0;";
|
|
1062
|
+
lockRow.appendChild(lockBar);
|
|
1063
|
+
|
|
1064
|
+
var lockInfo = document.createElement("div");
|
|
1065
|
+
lockInfo.style.cssText = "flex:1;display:flex;flex-direction:column;gap:2px;";
|
|
1066
|
+
|
|
1067
|
+
var lockName = document.createElement("div");
|
|
1068
|
+
lockName.textContent = "\uD83D\uDD12 \u9501\u5B9A\u7248\u672C 4.2";
|
|
1069
|
+
lockName.style.cssText = "font-size:13px;font-weight:bold;color:#f59e0b;";
|
|
1070
|
+
lockInfo.appendChild(lockName);
|
|
1071
|
+
|
|
1072
|
+
var lockDesc = document.createElement("div");
|
|
1073
|
+
lockDesc.textContent = "\u5207\u6362\u5230\u7A33\u5B9A\u7248\u672C openclaw@2026.4.2";
|
|
1074
|
+
lockDesc.style.cssText = "font-size:11px;color:#888;";
|
|
1075
|
+
lockInfo.appendChild(lockDesc);
|
|
1076
|
+
|
|
1077
|
+
lockRow.appendChild(lockInfo);
|
|
1078
|
+
|
|
1079
|
+
var lockArrow = document.createElement("div");
|
|
1080
|
+
lockArrow.textContent = "\u25B6";
|
|
1081
|
+
lockArrow.style.cssText = "color:#555;font-size:10px;";
|
|
1082
|
+
lockRow.appendChild(lockArrow);
|
|
1083
|
+
|
|
1084
|
+
lockRow.onclick = function () { runCommand("mc lock4.2"); };
|
|
1085
|
+
|
|
1086
|
+
form.appendChild(lockRow);
|
|
1087
|
+
|
|
1045
1088
|
// 删除伙伴 - 双重确认弹框
|
|
1046
1089
|
function showDeleteConfirm() {
|
|
1047
1090
|
var mask = document.createElement("div");
|
package/index.js
CHANGED
|
@@ -220,8 +220,19 @@ function runLock42() {
|
|
|
220
220
|
console.log(bar);
|
|
221
221
|
console.log('');
|
|
222
222
|
|
|
223
|
-
// 1.
|
|
224
|
-
console.log('[1/
|
|
223
|
+
// 1. 设置中国镜像
|
|
224
|
+
console.log('[1/3] 🌐 设置 npm 中国镜像...');
|
|
225
|
+
try {
|
|
226
|
+
execSync('npm config set registry https://registry.npmmirror.com', { stdio: 'inherit' });
|
|
227
|
+
const registry = execSync('npm config get registry', { encoding: 'utf8' }).trim();
|
|
228
|
+
console.log(' ' + colors.green + '✓ ' + registry + colors.nc);
|
|
229
|
+
} catch (err) {
|
|
230
|
+
console.log(' ' + colors.yellow + '⚠ 镜像设置跳过' + colors.nc);
|
|
231
|
+
}
|
|
232
|
+
console.log('');
|
|
233
|
+
|
|
234
|
+
// 2. 卸载
|
|
235
|
+
console.log('[2/3] 🗑️ 卸载当前 openclaw...');
|
|
225
236
|
try {
|
|
226
237
|
execSync('npm uninstall -g openclaw', { stdio: 'inherit' });
|
|
227
238
|
console.log(' ' + colors.green + '✓ 卸载完成' + colors.nc);
|
|
@@ -230,8 +241,8 @@ function runLock42() {
|
|
|
230
241
|
}
|
|
231
242
|
console.log('');
|
|
232
243
|
|
|
233
|
-
//
|
|
234
|
-
console.log('[
|
|
244
|
+
// 3. 安装指定版本
|
|
245
|
+
console.log('[3/3] 📦 安装 openclaw@' + TARGET + '...');
|
|
235
246
|
try {
|
|
236
247
|
execSync('npm install -g openclaw@' + TARGET, { stdio: 'inherit' });
|
|
237
248
|
console.log(' ' + colors.green + '✓ 安装完成' + colors.nc);
|
|
@@ -241,7 +252,7 @@ function runLock42() {
|
|
|
241
252
|
}
|
|
242
253
|
console.log('');
|
|
243
254
|
|
|
244
|
-
//
|
|
255
|
+
// 验证版本
|
|
245
256
|
try {
|
|
246
257
|
const ver = execSync('openclaw --version', { encoding: 'utf8' }).trim();
|
|
247
258
|
console.log('[验证] ' + colors.green + ver + colors.nc);
|
|
@@ -872,9 +883,25 @@ function runOpen() {
|
|
|
872
883
|
function createDesktopShortcut(url) {
|
|
873
884
|
const fs = require('fs');
|
|
874
885
|
const platform = os.platform();
|
|
875
|
-
const desktopPath = path.join(os.homedir(), 'Desktop');
|
|
876
886
|
|
|
877
|
-
|
|
887
|
+
// 查找桌面路径(Windows 兼容 OneDrive 同步桌面)
|
|
888
|
+
function findDesktop() {
|
|
889
|
+
const candidates = [path.join(os.homedir(), 'Desktop')];
|
|
890
|
+
if (platform === 'win32') {
|
|
891
|
+
candidates.push(
|
|
892
|
+
path.join(os.homedir(), 'OneDrive', 'Desktop'),
|
|
893
|
+
path.join(os.homedir(), 'OneDrive - Personal', 'Desktop'),
|
|
894
|
+
path.join(os.homedir(), 'OneDrive - 个人', 'Desktop'),
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
for (const d of candidates) {
|
|
898
|
+
try { if (fs.existsSync(d)) return d; } catch {}
|
|
899
|
+
}
|
|
900
|
+
return null;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
const desktopPath = findDesktop();
|
|
904
|
+
if (!desktopPath) {
|
|
878
905
|
console.log('[shortcut] ⚠ 未找到桌面目录,跳过');
|
|
879
906
|
return;
|
|
880
907
|
}
|
|
@@ -904,8 +931,18 @@ Icon=text-html
|
|
|
904
931
|
fs.writeFileSync(desktop, content, 'utf8');
|
|
905
932
|
try { execSync('chmod +x "' + desktop + '"', { stdio: 'pipe' }); } catch {}
|
|
906
933
|
console.log('[shortcut] ✅ 桌面快捷方式已更新: OpenClaw.desktop');
|
|
907
|
-
} else {
|
|
908
|
-
|
|
934
|
+
} else if (platform === 'win32') {
|
|
935
|
+
// Windows: .url 文件(Internet Shortcut),Windows 原生支持,双击在默认浏览器打开
|
|
936
|
+
// 无需 PowerShell,直接写文件,100% 可靠
|
|
937
|
+
const urlFile = path.join(desktopPath, '打开网页小龙虾.url');
|
|
938
|
+
const content = '[InternetShortcut]\r\nURL=' + url + '\r\n';
|
|
939
|
+
try {
|
|
940
|
+
fs.writeFileSync(urlFile, content, 'utf8');
|
|
941
|
+
console.log('[shortcut] ✅ 桌面快捷方式已创建: 打开网页小龙虾.url');
|
|
942
|
+
console.log('[shortcut] 路径: ' + urlFile);
|
|
943
|
+
} catch (err) {
|
|
944
|
+
console.log('[shortcut] ⚠ 创建失败: ' + err.message);
|
|
945
|
+
}
|
|
909
946
|
}
|
|
910
947
|
}
|
|
911
948
|
|