mirror of
https://github.com/sipeed/NanoKVM-USB.git
synced 2026-09-11 05:59:57 -05:00
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:
@@ -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
|
||||
```
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user