Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sandboxを有効化 #2074

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,6 @@ async function createWindow() {
backgroundColor,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: false,
contextIsolation: true,
sandbox: false, // TODO: 外しても問題ないか検証して外す
Comment on lines -403 to -405
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全部デフォルトはセキュアな方になっているので削除します。

},
icon: path.join(__static, "icon.png"),
});
Expand Down
48 changes: 32 additions & 16 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,41 @@ export default defineConfig((options) => {
}),
isElectron && [
cleanDistPlugin(),
electron({
entry: [
"./src/backend/electron/main.ts",
"./src/backend/electron/preload.ts",
],
// ref: https://github.com/electron-vite/vite-plugin-electron/pull/122
onstart: ({ startup }) => {
if (options.mode !== "test") {
startup([".", "--no-sandbox"]);
}
electron([
{
entry: "./src/backend/electron/main.ts",
// ref: https://github.com/electron-vite/vite-plugin-electron/pull/122
onstart: ({ startup }) => {
if (options.mode !== "test") {
startup([".", "--no-sandbox"]);
}
},
vite: {
plugins: [tsconfigPaths({ root: __dirname })],
build: {
outDir: path.resolve(__dirname, "dist"),
sourcemap,
},
},
},
vite: {
plugins: [tsconfigPaths({ root: __dirname })],
build: {
outDir: path.resolve(__dirname, "dist"),
sourcemap,
{
// ref: https://electron-vite.github.io/guide/preload-not-split.html
entry: "./src/backend/electron/preload.ts",
onstart({ reload }) {
reload();
},
vite: {
plugins: [tsconfigPaths({ root: __dirname })],
build: {
outDir: path.resolve(__dirname, "dist"),
sourcemap,
rollupOptions: {
output: { inlineDynamicImports: true },
},
},
},
},
}),
]),
],
isBrowser && injectBrowserPreloadPlugin(),
],
Expand Down
Loading