electerm 3.3.3 → 3.3.8
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/README.md +0 -3
- package/npm/electerm +21 -1
- package/npm/install.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,9 +90,6 @@ Check [https://electerm-repos.html5beta.com/deb](https://electerm-repos.html5bet
|
|
|
90
90
|
```bash
|
|
91
91
|
npm i -g electerm
|
|
92
92
|
|
|
93
|
-
# After installation, it will immediately open for windows and linux,
|
|
94
|
-
# For macOS, it will open the drag to install panel
|
|
95
|
-
|
|
96
93
|
```
|
|
97
94
|
|
|
98
95
|
## Upgrade
|
package/npm/electerm
CHANGED
|
@@ -34,6 +34,21 @@ function getElectermExePath () {
|
|
|
34
34
|
return path.join(packageRoot, 'electerm', 'electerm')
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function isSandboxReady () {
|
|
38
|
+
// chrome-sandbox must be owned by root (uid 0) and have setuid bit set (mode 4755)
|
|
39
|
+
// This requires root during install, which npm global install does not provide.
|
|
40
|
+
try {
|
|
41
|
+
const sandboxPath = path.join(packageRoot, 'electerm', 'chrome-sandbox')
|
|
42
|
+
if (!fs.existsSync(sandboxPath)) return false
|
|
43
|
+
const stat = fs.statSync(sandboxPath)
|
|
44
|
+
const hasSetuid = (stat.mode & 0o4000) !== 0
|
|
45
|
+
const ownedByRoot = stat.uid === 0
|
|
46
|
+
return hasSetuid && ownedByRoot
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
function launchElecterm () {
|
|
38
53
|
const exePath = getElectermExePath()
|
|
39
54
|
|
|
@@ -46,7 +61,12 @@ function launchElecterm () {
|
|
|
46
61
|
process.exit(1)
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
const
|
|
64
|
+
const extraArgs = []
|
|
65
|
+
if (plat === 'linux' && !isSandboxReady()) {
|
|
66
|
+
extraArgs.push('--no-sandbox')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const child = spawn(exePath, [...extraArgs, ...process.argv.slice(2)], {
|
|
50
70
|
stdio: 'inherit',
|
|
51
71
|
detached: plat !== 'win32',
|
|
52
72
|
windowsHide: false
|
package/npm/install.js
CHANGED
|
@@ -192,11 +192,15 @@ async function runLinux (folderName, filePattern) {
|
|
|
192
192
|
mv(join(tmpDir, extractedFolder), extractDir)
|
|
193
193
|
|
|
194
194
|
// Fix chrome-sandbox permissions on Linux (Electron requires specific permissions)
|
|
195
|
+
// Note: setting the setuid bit requires root ownership, which npm install cannot provide.
|
|
196
|
+
// The launcher handles this by passing --no-sandbox when the sandbox is not root-owned.
|
|
195
197
|
if (plat === 'linux') {
|
|
196
198
|
const chromeSandboxPath = join(extractDir, 'chrome-sandbox')
|
|
197
199
|
if (fs.existsSync(chromeSandboxPath)) {
|
|
198
|
-
console.log('
|
|
199
|
-
|
|
200
|
+
console.log(' Note: To enable the Electron sandbox, run:')
|
|
201
|
+
console.log(` sudo chown root:root "${chromeSandboxPath}"`)
|
|
202
|
+
console.log(` sudo chmod 4755 "${chromeSandboxPath}"`)
|
|
203
|
+
console.log(' Otherwise, electerm will launch with --no-sandbox automatically.')
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
206
|
|