Skip to content

Commit 9a925dd

Browse files
authored
Merge pull request #93 from imguoguo/revert-nsis
fix(desktop): NSIS only elevates privileges when necessary
2 parents 1afc28a + 0db485d commit 9a925dd

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

desktop/README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ This is the NanoKVM-USB desktop version project.
55

66
## Development
77

8-
Linux build tool chain:
9-
10-
```shell
11-
sudo apt update
12-
sudo apt install -y build-essential python3 libudev-dev
13-
echo "python=/usr/bin/python3.10" >> ~/.npmrc # This should match you pyton version.
14-
```
15-
168
```shell
179
cd desktop
1810
pnpm install
@@ -31,10 +23,3 @@ pnpm build:mac
3123
# For Linux
3224
pnpm build:linux
3325
```
34-
35-
# For Linux run and install
36-
```shell
37-
dpkg -i dist/nanokvm-usb_1.0.0_amd64.deb
38-
sudo chown root:root /opt/NanoKVM-USB/chrome-sandbox
39-
sudo chmod 4755 /opt/NanoKVM-USB/chrome-sandbox
40-
```

desktop/electron-builder.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ win:
1919
executableName: NanoKVM-USB
2020

2121
nsis:
22-
oneClick: false # show installer wizard
23-
perMachine: true # install for all users
22+
oneClick: false
2423
allowToChangeInstallationDirectory: true
25-
allowElevation: true # request elevation when needed
2624
artifactName: ${productName}-${version}-setup.${ext}
2725
shortcutName: ${productName}
2826
uninstallDisplayName: ${productName}

desktop/src/main/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ function createWindow(): void {
2626
mainWindow.on('ready-to-show', () => {
2727
mainWindow.show()
2828
mainWindow.maximize()
29-
//mainWindow.webContents.openDevTools()
3029
})
3130

3231
mainWindow.webContents.setWindowOpenHandler((details) => {
@@ -45,11 +44,8 @@ app.whenReady().then(() => {
4544
electronApp.setAppUserModelId('com.sipeed.usbkvm')
4645

4746
session.defaultSession.setPermissionRequestHandler((_, permission, callback) => {
48-
if (['media', 'clipboard-read'].includes(permission)) {
49-
callback(true)
50-
} else {
51-
callback(false)
52-
}
47+
const allowedPermissions = ['media', 'clipboard-read']
48+
callback(allowedPermissions.includes(permission))
5349
})
5450

5551
app.on('browser-window-created', (_, window) => {

0 commit comments

Comments
 (0)