fix(desktop): NSIS only elevates privileges when necessary

...also revert and optimize some unnecessary changes in https://github.com/sipeed/NanoKVM-USB/pull/22
This commit is contained in:
Guoguo
2025-12-16 10:56:13 +08:00
parent 699e132aad
commit 0db485d2f9
3 changed files with 3 additions and 24 deletions

View File

@@ -5,14 +5,6 @@ This is the NanoKVM-USB desktop version project.
## Development
Linux build tool chain:
```shell
sudo apt update
sudo apt install -y build-essential python3 libudev-dev
echo "python=/usr/bin/python3.10" >> ~/.npmrc # This should match you pyton version.
```
```shell
cd desktop
pnpm install
@@ -31,10 +23,3 @@ pnpm build:mac
# For Linux
pnpm build:linux
```
# For Linux run and install
```shell
dpkg -i dist/nanokvm-usb_1.0.0_amd64.deb
sudo chown root:root /opt/NanoKVM-USB/chrome-sandbox
sudo chmod 4755 /opt/NanoKVM-USB/chrome-sandbox
```

View File

@@ -19,10 +19,8 @@ win:
executableName: NanoKVM-USB
nsis:
oneClick: false # show installer wizard
perMachine: true # install for all users
oneClick: false
allowToChangeInstallationDirectory: true
allowElevation: true # request elevation when needed
artifactName: ${productName}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}

View File

@@ -26,7 +26,6 @@ function createWindow(): void {
mainWindow.on('ready-to-show', () => {
mainWindow.show()
mainWindow.maximize()
//mainWindow.webContents.openDevTools()
})
mainWindow.webContents.setWindowOpenHandler((details) => {
@@ -45,11 +44,8 @@ app.whenReady().then(() => {
electronApp.setAppUserModelId('com.sipeed.usbkvm')
session.defaultSession.setPermissionRequestHandler((_, permission, callback) => {
if (['media', 'clipboard-read'].includes(permission)) {
callback(true)
} else {
callback(false)
}
const allowedPermissions = ['media', 'clipboard-read']
callback(allowedPermissions.includes(permission))
})
app.on('browser-window-created', (_, window) => {