Skip to content

Commit

Permalink
Remove coop-coep headers from examples
Browse files Browse the repository at this point in the history
  • Loading branch information
steida committed Mar 5, 2024
1 parent d6f80eb commit 343f91c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 78 deletions.
29 changes: 14 additions & 15 deletions apps/web/pages/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ Requirements:
- The `strict` flag enabled in your `tsconfig.json` file

<Steps>
### 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

<Tabs items={["React", "React Native", "All other Frameworks"]}>
Expand All @@ -50,14 +42,21 @@ Examples: [Next.js](https://github.com/evoluhq/evolu/tree/main/examples/nextjs),
</Tabs.Tab>
</Tabs>

### 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.

<Callout type="warning" emoji="‼️">
For the web, remember to set COOP and COEP HTTP Headers.
[Example](https://github.com/evoluhq/evolu/blob/main/examples/nextjs/next.config.js)
</Callout>
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).

</Steps>
13 changes: 0 additions & 13 deletions examples/electron-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
22 changes: 0 additions & 22 deletions examples/nextjs/next.config.js

This file was deleted.

8 changes: 0 additions & 8 deletions examples/remix/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
21 changes: 1 addition & 20 deletions examples/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
});

0 comments on commit 343f91c

Please sign in to comment.