Skip to content

Commit

Permalink
fix(AppImage): Add default argument --no-sandbox (#4496)
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbundy authored Oct 16, 2020
1 parent aa3625d commit ede6d50
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/app-builder-lib/src/targets/AppImageTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Arch, serializeToYaml } from "builder-util"
import { outputFile } from "fs-extra"
import { Lazy } from "lazy-val"
import * as path from "path"
import * as semver from "semver"
import { AppImageOptions } from ".."
import { Target } from "../core"
import { LinuxPackager } from "../linuxPackager"
Expand All @@ -19,7 +20,7 @@ export default class AppImageTarget extends Target {
constructor(ignored: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {
super("appImage")

this.desktopEntry = new Lazy<string>(() => helper.computeDesktopEntry(this.options, "AppRun %U", {
this.desktopEntry = new Lazy<string>(() => helper.computeDesktopEntry(this.options, "AppRun --no-sandbox %U", {
"X-AppImage-Version": `${packager.appInfo.buildVersion}`,
}))
}
Expand Down
8 changes: 4 additions & 4 deletions packages/app-builder-lib/src/targets/snap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export default class SnapTarget extends Target {
}

private async createDescriptor(arch: Arch): Promise<any> {
if (!this.isElectronVersionGreaterOrEqualThen("4.0.0")) {
if (!this.isElectronVersionGreaterOrEqualThen("2.0.0-beta.1")) {
if (!this.isElectronVersionGreaterOrEqualThan("4.0.0")) {
if (!this.isElectronVersionGreaterOrEqualThan("2.0.0-beta.1")) {
throw new InvalidConfigurationError("Electron 2 and higher is required to build Snap")
}

Expand Down Expand Up @@ -194,7 +194,7 @@ export default class SnapTarget extends Target {
Icon: "${SNAP}/meta/gui/icon.png"
})

if (this.isElectronVersionGreaterOrEqualThen("5.0.0") && !isBrowserSandboxAllowed(snap)) {
if (this.isElectronVersionGreaterOrEqualThan("5.0.0") && !isBrowserSandboxAllowed(snap)) {
args.push("--extraAppArgs=--no-sandbox")
if (this.isUseTemplateApp) {
args.push("--exclude", "chrome-sandbox")
Expand Down Expand Up @@ -227,7 +227,7 @@ export default class SnapTarget extends Target {
})
}

private isElectronVersionGreaterOrEqualThen(version: string) {
private isElectronVersionGreaterOrEqualThan(version: string) {
return semver.gte(this.packager.config.electronVersion || "7.0.0", version)
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/snapshots/linux/linuxPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`AppImage - default icon, custom executable and custom desktop 1`] = `
"[Desktop Entry]
Name=Test App ßW
Exec=AppRun %U
Exec=AppRun --no-sandbox %U
Terminal=true
Type=Application
Icon=Foo
Expand Down

0 comments on commit ede6d50

Please sign in to comment.