feat(electron): refine Linux sandbox handling and format copy filter

Improve sandbox handling on Linux by detecting Snap, Flatpak,
and AppImage environments and applying appropriate Chromium
command-line switches:

- If running in Snap or Flatpak, disable Chromium's sandbox
  (--no-sandbox) to avoid conflicts with the distribution's
  own sandboxing.
- Otherwise (traditional packages and AppImage), disable the
  SUID sandbox and prefer the user namespace sandbox
  (--disable-setuid-sandbox). This avoids requiring a SUID
  chrome-sandbox binary and aligns with modern Linux best
  practices.

Also adjust apps/electron-backend/src/main.ts to only apply
these changes on Linux (process.platform === 'linux').

Minor formatting: expand the package.json copy "filter" array
to a multiline style for readability.
This commit is contained in:
4gray committed 2025-12-14 12:31:00 +01:00
1 parent d7bfd2648c
commit c714996ce0
3 files changed
+148 -96

No files matched your search

+134
View File
@@ -0,0 +1,134 @@
{
"appId": "com.fourgray.iptvnator",
"productName": "IPTVnator",
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
"directories": {
"buildResources": "dist/apps",
"output": "dist/executables"
},
"files": [
{
"from": "dist/apps/remote-control-web",
"to": "remote-control-web",
"filter": [
"**/*"
]
},
"electron-backend/**/*",
"web/**/*",
"!**/*.map"
],
"asarUnpack": [
"**/better-sqlite3/**"
],
"extraMetadata": {
"main": "electron-backend/main.js"
},
"extraResources": [
"dist/apps/electron-backend/workers"
],
"mac": {
"target": {
"target": "dmg",
"arch": [
"x64",
"arm64"
]
},
"category": "public.app-category.video",
"identity": null,
"gatekeeperAssess": false,
"hardenedRuntime": false,
"entitlements": null,
"entitlementsInherit": null,
"icon": "apps/web/src/assets/icons/favicon.icns"
},
"linux": {
"category": "Video",
"target": [
{
"target": "AppImage",
"arch": [
"x64",
"armv7l",
"arm64"
]
},
{
"target": "deb",
"arch": [
"x64",
"armv7l",
"arm64"
]
},
{
"target": "Snap",
"arch": [
"x64",
"armv7l"
]
},
{
"target": "rpm",
"arch": [
"x64"
]
},
{
"target": "pacman",
"arch": [
"x64"
]
},
{
"target": "flatpak",
"arch": [
"x64"
]
}
],
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
"icon": "apps/web/src/assets/icons"
},
"afterPack": "electron-builder-sandbox-fix",
"snap": {
"confinement": "strict",
"grade": "stable",
"summary": "IPTV player application for M3U playlists, Xtream Codes API, and Stalker portals",
"plugs": [
"default",
"network",
"network-bind",
"home",
"removable-media",
"browser-support",
"audio-playback",
"pulseaudio",
"opengl",
"screen-inhibit-control",
"x11",
"desktop",
"desktop-legacy"
],
"environment": {
"DISABLE_WAYLAND": "1"
}
},
"win": {
"compression": "maximum",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"artifactName": "${name}-${version}-windows-${arch}-setup.${ext}",
"icon": "apps/web/src/assets/icons/icon.png"
},
"nsis": {
"artifactName": "${name}-${version}-windows-${arch}-setup.${ext}"
}
}
+13 -5
View File
@@ -1,12 +1,12 @@
{
"name": "iptvnator",
"version": "0.17.0",
"version": "0.17.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "iptvnator",
"version": "0.17.0",
"version": "0.17.1",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
@@ -38,6 +38,7 @@
"better-sqlite3": "^12.5.0",
"date-fns": "4.1.0",
"drizzle-orm": "0.44.6",
"electron-builder-sandbox-fix": "1.1.1",
"electron-conf": "1.3.0",
"epg-parser": "0.4.0",
"fix-path": "5.0.0",
@@ -113,6 +114,7 @@
"drizzle-kit": "0.31.5",
"electron": "^39.0.0",
"electron-builder": "^26.0.12",
"electron-playwright-helpers": "1.8.2",
"esbuild": "0.27.0",
"eslint": "^9.8.0",
"eslint-config-prettier": "^10.1.8",
@@ -16277,7 +16279,6 @@
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.1.0",
@@ -19212,6 +19213,15 @@
"node": ">=14.0.0"
}
},
"node_modules/electron-builder-sandbox-fix": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/electron-builder-sandbox-fix/-/electron-builder-sandbox-fix-1.1.1.tgz",
"integrity": "sha512-+gSiLZ7KZDRr3ATm89eud96QwURauUXMzB2lbzZffkAYMC4yyF2fqq0W2xoTg38eDVFCJThcoyW1p8Ph/unxoA==",
"license": "MIT",
"dependencies": {
"chalk": "^4.1.2"
}
},
"node_modules/electron-builder/node_modules/fs-extra": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
@@ -22547,7 +22557,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@@ -37193,7 +37202,6 @@
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
+1 -91
View File
@@ -19,97 +19,6 @@
"video",
"tv"
],
"build": {
"appId": "com.fourgray.iptvnator",
"productName": "IPTVnator",
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
"directories": {
"buildResources": "dist/apps",
"output": "dist/executables"
},
"files": [
{
"from": "dist/apps/remote-control-web",
"to": "remote-control-web",
"filter": ["**/*"]
},
"electron-backend/**/*",
"web/**/*",
"!**/*.map"
],
"asarUnpack": [
"**/better-sqlite3/**"
],
"extraMetadata": {
"main": "electron-backend/main.js"
},
"extraResources": [
"dist/apps/electron-backend/workers"
],
"mac": {
"target": {
"target": "dmg",
"arch": [
"x64",
"arm64"
]
},
"category": "public.app-category.video",
"identity": null,
"gatekeeperAssess": false,
"hardenedRuntime": false,
"entitlements": null,
"entitlementsInherit": null,
"icon": "apps/web/src/assets/icons/favicon.icns"
},
"linux": {
"category": "Video",
"target": [
{
"target": "AppImage",
"arch": ["x64", "armv7l", "arm64"]
},
{
"target": "deb",
"arch": ["x64", "armv7l", "arm64"]
},
{
"target": "Snap",
"arch": ["x64"]
},
{
"target": "rpm",
"arch": ["x64"]
},
{
"target": "pacman",
"arch": ["x64"]
},
{
"target": "flatpak",
"arch": ["x64"]
}
],
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
"icon": "apps/web/src/assets/icons"
},
"win": {
"compression": "maximum",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"artifactName": "${name}-${version}-windows-${arch}-setup.${ext}",
"icon": "apps/web/src/assets/icons/icon.png"
},
"nsis": {
"artifactName": "${name}-${version}-windows-${arch}-setup.${ext}"
}
},
"scripts": {
"postinstall": "electron-builder install-app-deps",
"build:frontend": "nx build web",
@@ -153,6 +62,7 @@
"better-sqlite3": "^12.5.0",
"date-fns": "4.1.0",
"drizzle-orm": "0.44.6",
"electron-builder-sandbox-fix": "1.1.1",
"electron-conf": "1.3.0",
"epg-parser": "0.4.0",
"fix-path": "5.0.0",