From 343f91c8fd1769a8f6f9d4f4ac45e5ad61fa782d Mon Sep 17 00:00:00 2001 From: Daniel Steigerwald Date: Tue, 5 Mar 2024 11:06:18 +0100 Subject: [PATCH] Remove coop-coep headers from examples --- apps/web/pages/docs/installation.mdx | 29 ++++++++++++++-------------- examples/electron-app/src/index.ts | 13 ------------- examples/nextjs/next.config.js | 22 --------------------- examples/remix/server.mjs | 8 -------- examples/vite/vite.config.ts | 21 +------------------- 5 files changed, 15 insertions(+), 78 deletions(-) delete mode 100644 examples/nextjs/next.config.js diff --git a/apps/web/pages/docs/installation.mdx b/apps/web/pages/docs/installation.mdx index b19f6f3e9..da87d1261 100644 --- a/apps/web/pages/docs/installation.mdx +++ b/apps/web/pages/docs/installation.mdx @@ -16,14 +16,6 @@ Requirements: - The `strict` flag enabled in your `tsconfig.json` file -### Choose Framework - -Examples: [Next.js](https://github.com/evoluhq/evolu/tree/main/examples/nextjs), -[Vite](https://github.com/evoluhq/evolu/tree/main/examples/vite), -[Electron](https://github.com/evoluhq/evolu/tree/main/examples/electron-app), -[Expo](https://github.com/evoluhq/evolu/tree/main/apps/native), -[Remix](https://github.com/evoluhq/evolu/tree/main/examples/remix). - ### Install Evolu @@ -50,14 +42,21 @@ Examples: [Next.js](https://github.com/evoluhq/evolu/tree/main/examples/nextjs), -### Add Settings +### Check Examples + +Examples: [Next.js](https://github.com/evoluhq/evolu/tree/main/examples/nextjs), +[Vite](https://github.com/evoluhq/evolu/tree/main/examples/vite), +[Electron](https://github.com/evoluhq/evolu/tree/main/examples/electron-app), +[Expo](https://github.com/evoluhq/evolu/tree/main/apps/native), +[Remix](https://github.com/evoluhq/evolu/tree/main/examples/remix). + +Remember to check examples for additional settings. + +### Read Docs -Remember to check [examples](https://github.com/evoluhq/evolu/tree/main/examples) -for additional required settings like polyfills, etc. +While Evolu API is simple, the local-first concept brings new design patterns. - - For the web, remember to set COOP and COEP HTTP Headers. - [Example](https://github.com/evoluhq/evolu/blob/main/examples/nextjs/next.config.js) - +Everything should be described in Evolu docs, but if you are not sure about something, +feel free to ask in our [Evolu Discord](https://discord.gg/2J8yyyyxtZ). diff --git a/examples/electron-app/src/index.ts b/examples/electron-app/src/index.ts index 0df96d42f..5b11f05fe 100644 --- a/examples/electron-app/src/index.ts +++ b/examples/electron-app/src/index.ts @@ -23,19 +23,6 @@ const createWindow = (): void => { }, }); - // // Modify COOP and COEP headers - session.defaultSession.webRequest.onHeadersReceived((details, callback) => { - const responseHeaders = Object.assign({}, details.responseHeaders); - - // Set COOP header - responseHeaders["Cross-Origin-Opener-Policy"] = "same-origin"; - - // Set COEP header - responseHeaders["Cross-Origin-Embedder-Policy"] = "require-corp"; - - callback({ responseHeaders }); - }); - // and load the index.html of the app. mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY); diff --git a/examples/nextjs/next.config.js b/examples/nextjs/next.config.js deleted file mode 100644 index 0b453888e..000000000 --- a/examples/nextjs/next.config.js +++ /dev/null @@ -1,22 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = { - async headers() { - return [ - { - source: "/(.*?)", - headers: [ - { - key: "cross-origin-embedder-policy", - value: "require-corp", - }, - { - key: "cross-origin-opener-policy", - value: "same-origin", - }, - ], - }, - ]; - }, -}; - -module.exports = nextConfig; diff --git a/examples/remix/server.mjs b/examples/remix/server.mjs index 1798d5b8e..8cca0adee 100644 --- a/examples/remix/server.mjs +++ b/examples/remix/server.mjs @@ -21,14 +21,6 @@ const app = express(); // for evolu sync instead of the default https://evolu.world/ // const app = await Effect.runPromise(createExpressApp); -app.use((_, res, next) => { - res.set({ - "Cross-Origin-Opener-Policy": "same-origin", - "Cross-Origin-Embedder-Policy": "require-corp", - }); - next(); -}); - // handle asset requests if (vite) { app.use(vite.middlewares); diff --git a/examples/vite/vite.config.ts b/examples/vite/vite.config.ts index 815f1bd6c..fa6078aa7 100644 --- a/examples/vite/vite.config.ts +++ b/examples/vite/vite.config.ts @@ -21,24 +21,5 @@ export default defineConfig({ worker: { format: "es", }, - preview: { - headers: { - "Cross-Origin-Opener-Policy": "same-origin", - "Cross-Origin-Embedder-Policy": "require-corp", - }, - }, - plugins: [ - react(), - { - configureServer(server) { - server.middlewares.use((_req, res, next) => { - // https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep - res.setHeader("Cross-Origin-Opener-Policy", "same-origin"); - res.setHeader("Cross-Origin-Embedder-Policy", "require-corp"); - next(); - }); - }, - name: "configure-server", - }, - ], + plugins: [react()], });