@vincentbanana/banana-gui 1.0.1 → 1.0.2

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/desktop/main.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // Banana 桌面版主进程:拉起本地 GUI 服务,再用窗口加载它。
2
2
  // 界面资源仍来自本包 ui/,agent 内核来自 @vincentbanana/bananacli。
3
- const { app, BrowserWindow, Menu, shell, dialog, ipcMain } = require('electron');
3
+ const { app, BrowserWindow, Menu, shell, dialog, ipcMain, nativeTheme } = require('electron');
4
4
  const { spawn, spawnSync } = require('node:child_process');
5
5
  const { createRequire } = require('node:module');
6
6
  const { join } = require('node:path');
@@ -103,7 +103,7 @@ async function createWindow() {
103
103
  height: 820,
104
104
  minWidth: 720,
105
105
  minHeight: 520,
106
- backgroundColor: '#ffffff',
106
+ backgroundColor: nativeTheme.shouldUseDarkColors ? '#161616' : '#ffffff',
107
107
  title: 'Banana',
108
108
  autoHideMenuBar: true,
109
109
  // Windows / Linux 用自绘标题栏;macOS 保留原生红绿灯更符合习惯
@@ -137,7 +137,12 @@ async function createWindow() {
137
137
  win.webContents.on('did-finish-load', reportMaximized);
138
138
  // 外部链接交给系统浏览器,窗口只负责本地界面
139
139
  win.webContents.setWindowOpenHandler(({ url: target }) => {
140
- shell.openExternal(target);
140
+ try {
141
+ const protocol = new URL(target).protocol;
142
+ if (protocol === 'http:' || protocol === 'https:') shell.openExternal(target);
143
+ } catch {
144
+ // 非法 URL 直接丢弃
145
+ }
141
146
  return { action: 'deny' };
142
147
  });
143
148
  if (process.argv.includes('--selftest')) await selfTest(url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincentbanana/banana-gui",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Banana 的图形界面:本地服务 + 浏览器。黑白主题,自绘图标,无第三方 UI 依赖",
5
5
  "type": "module",
6
6
  "engines": {
@@ -72,7 +72,7 @@
72
72
  "electron-builder": "^25.0.0"
73
73
  },
74
74
  "dependencies": {
75
- "@vincentbanana/bananacli": "^0.8.1"
75
+ "@vincentbanana/bananacli": "^0.8.2"
76
76
  },
77
77
  "license": "MIT",
78
78
  "publishConfig": {