@aiyiran/myclaw 1.0.259 → 1.0.261

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.
@@ -163,7 +163,7 @@
163
163
  'top: 75px',
164
164
  'right: 0',
165
165
  'width: 380px',
166
- 'max-height: calc(100vh - 550px)',
166
+ 'height: 500px',
167
167
  'background: #1e1e2e',
168
168
  'border-radius: 8px 0 0 8px',
169
169
  'overflow: hidden',
package/index.js CHANGED
@@ -883,9 +883,25 @@ function runOpen() {
883
883
  function createDesktopShortcut(url) {
884
884
  const fs = require('fs');
885
885
  const platform = os.platform();
886
- const desktopPath = path.join(os.homedir(), 'Desktop');
887
886
 
888
- if (!fs.existsSync(desktopPath)) {
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) {
889
905
  console.log('[shortcut] ⚠ 未找到桌面目录,跳过');
890
906
  return;
891
907
  }
@@ -915,8 +931,18 @@ Icon=text-html
915
931
  fs.writeFileSync(desktop, content, 'utf8');
916
932
  try { execSync('chmod +x "' + desktop + '"', { stdio: 'pipe' }); } catch {}
917
933
  console.log('[shortcut] ✅ 桌面快捷方式已更新: OpenClaw.desktop');
918
- } else {
919
- console.log('[shortcut] Windows 请使用 mc bat 创建桌面快捷方式');
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
+ }
920
946
  }
921
947
  }
922
948
 
@@ -1322,12 +1348,24 @@ function showMachineMenu() {
1322
1348
  console.log(colors.green + ' → 已选择: ' + selected.name + ' (' + selected.claw + ')' + colors.nc);
1323
1349
  console.log(' ' + colors.dim + '→ 正在打开浏览器...' + colors.nc);
1324
1350
  const { exec } = require('child_process');
1351
+ const fs = require('fs');
1325
1352
  const machineUrl = 'https://' + selected.claw + '.kekouen.cn?token=aiyiran';
1326
1353
  const platform = os.platform();
1327
1354
  if (platform === 'darwin') {
1328
1355
  exec('open -a "Google Chrome" "' + machineUrl + '"');
1329
1356
  } else if (platform === 'win32') {
1330
- exec('start "" "' + machineUrl + '"', { shell: true });
1357
+ // 优先找 Chrome,找不到才用默认浏览器
1358
+ const chromeCandidates = [
1359
+ path.join(process.env.PROGRAMFILES || 'C:\\Program Files', 'Google', 'Chrome', 'Application', 'chrome.exe'),
1360
+ path.join(process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)', 'Google', 'Chrome', 'Application', 'chrome.exe'),
1361
+ path.join(process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'), 'Google', 'Chrome', 'Application', 'chrome.exe'),
1362
+ ];
1363
+ const chromePath = chromeCandidates.find(function (p) { try { return fs.existsSync(p); } catch { return false; } });
1364
+ if (chromePath) {
1365
+ exec('"' + chromePath + '" "' + machineUrl + '"');
1366
+ } else {
1367
+ exec('start "" "' + machineUrl + '"', { shell: true });
1368
+ }
1331
1369
  } else {
1332
1370
  exec('xdg-open "' + machineUrl + '"');
1333
1371
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.259",
3
+ "version": "1.0.261",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {