memex-in commited on
Commit
0da2a12
·
verified ·
1 Parent(s): 67425fb

Create run.sh

Browse files
Files changed (1) hide show
  1. run.sh +28 -0
run.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # This script starts a Python HTTP server with custom headers
4
+ # required for SharedArrayBuffer (COEP and COOP).
5
+
6
+ # Create a temporary Python server script
7
+ cat <<EOF > server.py
8
+ import http.server
9
+ import socketserver
10
+
11
+ PORT = 8000
12
+
13
+ class Handler(http.server.SimpleHTTPRequestHandler):
14
+ def end_headers(self):
15
+ # Add the required Cross-Origin-Embedder-Policy header
16
+ self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')
17
+ # Add the required Cross-Origin-Opener-Policy header
18
+ self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
19
+ super().end_headers() # Call the original end_headers to send other headers
20
+
21
+ # Start the server
22
+ with socketserver.TCPServer(("", PORT), Handler) as httpd:
23
+ print(f"Serving real_webvm.html at http://localhost:{PORT}")
24
+ httpd.serve_forever()
25
+ EOF
26
+
27
+ # Execute the Python server script
28
+ python server.py