Skip to content

Commit fdd3dee

Browse files
committed
enabled embedding i think
1 parent 8cf741a commit fdd3dee

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/server.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ export default class CanvasServer {
33
this.room = room;
44
}
55

6+
onRequest(req) {
7+
return new Response(null, {
8+
headers: {
9+
"X-Frame-Options": "ALLOWALL",
10+
"Content-Security-Policy": "frame-ancestors *",
11+
},
12+
});
13+
}
14+
615
async onConnect(connection) {
716
const strokes = (await this.room.storage.get("strokes")) || [];
817
connection.send(JSON.stringify({ type: "init", strokes }));
@@ -22,11 +31,9 @@ export default class CanvasServer {
2231

2332
async onClose(connection) {
2433
const connections = [...this.room.getConnections()];
25-
2634
if (connections.length === 0) {
2735
await this.room.storage.put("strokes", []);
2836
}
29-
3037
this.broadcast({ type: "users", count: connections.length });
3138
}
3239

0 commit comments

Comments
 (0)