rhysd / electron-about-window

'About This App' mini-window for Electron apps
https://www.npmjs.com/package/about-window
MIT License
409 stars 46 forks source link

Doesn't work with sandbox option enabled (via win_options) #36

Open vladimiry opened 5 years ago

vladimiry commented 5 years ago

About window doesn't show a window content. Not sure about all the platforms but it certainly doesn't work on Linux with Electron v5. I guess because Electron v5 goes with enhanced sandboxing enabled by default.

The reason is that require is forbidden to use in the web page scope.

Workaround is in loading the renderer.js as a preload script, so you add similar win_options option calling the function:

aboutWindow({
    win_options: {
        webPreferences: {
            preload: path.join(__dirname, "./node_modules/about-window/src/renderer.js"),
            // nodeIntegration: false,
            // webSecurity: true,
            // sandbox: true,
        },
    },
});

What can be done in order to fix the issue:

rhysd commented 4 years ago

Thanks for catching this. Yes, as you described, this package does not work without node integration. As you pointed, we need to move preload script to avoid using electron module after loading HTML. I know how to do that but I currently cannot allocate enough time to address this. PR is welcome.

webSecurity: true,

I believe webSecurity: true should work with the current version because it is true by default.