Skip to content

Commit

Permalink
chore: add electron fuses support
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Oct 10, 2024
1 parent a5fc021 commit 16ed6f8
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 128 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
with:
token: ${{ github.token }}
branch: main
patchAll: true
skipInvalidTags: true

- name: Create Draft Release
Expand Down
174 changes: 46 additions & 128 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"vue-router": "4.4.5"
},
"devDependencies": {
"@electron/fuses": "1.8.0",
"@eslint/eslintrc": "3.1.0",
"@quasar/app-vite": "2.0.0-beta.21",
"@vue/language-plugin-pug": "2.1.6",
Expand Down
24 changes: 24 additions & 0 deletions quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

import { configure } from 'quasar/wrappers'
import { readFileSync } from 'node:fs'
import { path } from 'node:path'
import { mergeConfig } from 'vite'
import { flipFuses, FuseVersion, FuseV1Options } from '@electron/fuses'

export default configure((/* ctx */) => {
const curYear = new Date().getFullYear()
Expand Down Expand Up @@ -318,6 +320,28 @@ export default configure((/* ctx */) => {
publishAutoUpdate: true
}
]
},
afterPack: async (context) => {
const ext = {
darwin: '.app',
win32: '.exe',
linux: ''
}[context.electronPlatformName]

const executableName = context.electronPlatformName === 'linux'
? context.packager.appInfo.productFilename.toLowerCase().replace('-dev', '').replace(' ', '-')
: context.packager.appInfo.productFilename

await flipFuses(path.join(context.appOutDir, `${executableName}${ext}`), {
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
[FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: false
})
}
}
}
Expand Down

0 comments on commit 16ed6f8

Please sign in to comment.