mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-23 13:28:08 +08:00
Refactor examples list in CMake (#170)
* Reduce example list duplication * Add COEP and COOP headers in local HTTP server * Revert Examples URL in readme
This commit is contained in:

committed by
GitHub

parent
eeb4fa3648
commit
34d955e9ac
20
examples/run_webassembly.py
Executable file
20
examples/run_webassembly.py
Executable file
@@ -0,0 +1,20 @@
|
||||
#! /usr/bin/python3
|
||||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||
import sys
|
||||
import webbrowser
|
||||
|
||||
PORT = 8888
|
||||
|
||||
class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
|
||||
def end_headers(self):
|
||||
self.send_header("cross-origin-embedder-policy", "require-corp")
|
||||
self.send_header("cross-origin-opener-policy", "same-origin")
|
||||
SimpleHTTPRequestHandler.end_headers(self)
|
||||
|
||||
with HTTPServer(("", PORT), CustomHTTPRequestHandler) as httpd:
|
||||
try:
|
||||
webbrowser.open("http://localhost:%s" % PORT)
|
||||
print("serving at port", PORT)
|
||||
httpd.serve_forever()
|
||||
finally:
|
||||
sys.exit(0)
|
Reference in New Issue
Block a user