mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature] Enable cookie encryption
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
const { fuseElectron } = require("./fuse-electron")
|
||||
|
||||
exports.afterPack = async function afterPack(context) {
|
||||
await fuseElectron(context);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/// const { AfterPackContext } = require("electron-builder");
|
||||
const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses');
|
||||
const path = require("path");
|
||||
|
||||
exports.fuseElectron = async function fuseElectron({
|
||||
appOutDir,
|
||||
packager,
|
||||
electronPlatformName,
|
||||
}){
|
||||
|
||||
const { productFilename } = packager.appInfo;
|
||||
|
||||
const target = (() => {
|
||||
switch (electronPlatformName) {
|
||||
case "darwin":
|
||||
return `${productFilename}.app`;
|
||||
case "win32":
|
||||
return `${productFilename}.exe`;
|
||||
case "linux":
|
||||
// Sadly, `LinuxPackager` type is not exported by electron-builder so we have to improvise
|
||||
return packager.executableName;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${electronPlatformName}`);
|
||||
}
|
||||
})();
|
||||
|
||||
const electron = path.join(appOutDir, target);
|
||||
|
||||
console.log(`Fusing electron at ${electron}`);
|
||||
|
||||
return flipFuses(electron, {
|
||||
version: FuseVersion.V1,
|
||||
[FuseV1Options.EnableCookieEncryption]: true,
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user