From cc21e6c4a2eb860af2ef91f72cdb75ad3bc2c1ba Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Sat, 7 Sep 2024 10:59:31 -0700 Subject: [PATCH] remove atomics / bulk-memory requirement --- README.md | 6 +++--- client/build.sh | 4 ++-- client/serve.py | 10 ---------- 3 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 client/serve.py diff --git a/README.md b/README.md index 12be662..130f460 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Epoxy is an encrypted proxy for browser javascript. It allows you to make requests that bypass CORS without compromising security, by running SSL/TLS inside webassembly. ## Using the client -Epoxy must be served with the [security headers needed for `SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements). Here is a simple usage example: +Here is a simple usage example: ```javascript import epoxy from "./epoxy-module-bundled.js"; @@ -37,7 +37,7 @@ In the `client` directory: bash build.sh ``` -To host a local server with the required headers: +To host a local server: ``` -python3 serve.py +python3 -m http.server ``` diff --git a/client/build.sh b/client/build.sh index 9efa6f1..ebdcfb1 100755 --- a/client/build.sh +++ b/client/build.sh @@ -12,7 +12,7 @@ else CARGOFLAGS="" fi -RUSTFLAGS='-C target-feature=+atomics,+bulk-memory -Zlocation-detail=none' cargo build --target wasm32-unknown-unknown -Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort,optimize_for_size --release $CARGOFLAGS "$@" +RUSTFLAGS='-Zlocation-detail=none' cargo build --target wasm32-unknown-unknown -Z build-std=panic_abort,std -Z build-std-features=panic_immediate_abort,optimize_for_size --release $CARGOFLAGS "$@" echo "[epx] cargo finished" wasm-bindgen --target web --out-dir out/ ../target/wasm32-unknown-unknown/release/epoxy_client.wasm echo "[epx] wasm-bindgen finished" @@ -27,7 +27,7 @@ if [ "${RELEASE:-0}" = "1" ]; then mv out/epoxy_client_bg.wasm out/epoxy_client_unoptimized.wasm ( G="--generate-global-effects" - time wasm-opt $WASMOPTFLAGS --enable-threads --enable-bulk-memory \ + time wasm-opt $WASMOPTFLAGS \ out/epoxy_client_unoptimized.wasm -o out/epoxy_client_bg.wasm \ --converge \ $G --type-unfinalizing $G --type-ssa $G -O4 $G --flatten $G --rereloop $G -O4 $G -O4 $G --type-merging $G --type-finalizing $G -O4 \ diff --git a/client/serve.py b/client/serve.py deleted file mode 100644 index e32b7a0..0000000 --- a/client/serve.py +++ /dev/null @@ -1,10 +0,0 @@ -from http.server import HTTPServer, SimpleHTTPRequestHandler, test -import sys - -class RequestHandler (SimpleHTTPRequestHandler): - def end_headers (self): - self.send_header('Cross-Origin-Opener-Policy', 'same-origin') - self.send_header('Cross-Origin-Embedder-Policy', 'require-corp') - SimpleHTTPRequestHandler.end_headers(self) - -test(RequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)