WASM => WebAssembly

This commit is contained in:
ICheered
2023-08-03 17:18:38 +02:00
parent ea674be2ff
commit 6358e6c7ef
2 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
# Web-gPhoto2 # Web-gPhoto2
A gPhoto2 implementation using WASM to control DSLR cameras from the browser. A gPhoto2 implementation using WebAssembly to control DSLR cameras from the browser.
Powered by a [custom fork](https://github.com/RReverser/libgphoto2) of [libgphoto2](https://github.com/gphoto/libgphoto2), the [WebUSB](https://github.com/WICG/webusb) backend of [libusb](https://github.com/libusb/libusb), and WebAssembly via [Emscripten](https://emscripten.org/). Powered by a [custom fork](https://github.com/RReverser/libgphoto2) of [libgphoto2](https://github.com/gphoto/libgphoto2), the [WebUSB](https://github.com/WICG/webusb) backend of [libusb](https://github.com/libusb/libusb), and WebAssembly via [Emscripten](https://emscripten.org/).
@@ -78,7 +78,7 @@ More information can be found in the example included in the Github repository.
## Common Issues ## Common Issues
### SharedArrayBuffer can not be found ### SharedArrayBuffer can not be found
SharedArrayBuffer has been disabled across all browsers due to the Spectre vulnerability. This package uses SharedArrayBuffer to communicate with the WASM module. To work around this issue, you need to set two response headers for your document: SharedArrayBuffer has been disabled across all browsers due to the Spectre vulnerability. This package uses SharedArrayBuffer to communicate with the WebAssembly module. To work around this issue, you need to set two response headers for your document:
``` ```
Cross-Origin-Opener-Policy: same-origin Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp Cross-Origin-Embedder-Policy: require-corp
@@ -87,7 +87,7 @@ Cross-Origin-Embedder-Policy: require-corp
Information from [Stackoverflow](https://stackoverflow.com/questions/64650119/react-error-sharedarraybuffer-is-not-defined-in-firefox) Information from [Stackoverflow](https://stackoverflow.com/questions/64650119/react-error-sharedarraybuffer-is-not-defined-in-firefox)
### Error: Not found: /node_modules/.vite/deps/libapi.wasm ### Error: Not found: /node_modules/.vite/deps/libapi.wasm
Vite tries to optimize the dependencies by default. This causes the WASM module to be moved to a different location. To prevent this, you need to exclude the web-gphoto2 package from the optimization. Vite tries to optimize the dependencies by default. This causes the WebAssembly module to be moved to a different location. To prevent this, you need to exclude the web-gphoto2 package from the optimization.
In vite, both of the above mentioned issues are solved by adding the following to your vite.config.js: In vite, both of the above mentioned issues are solved by adding the following to your vite.config.js:
```ts ```ts

View File

@@ -1,7 +1,7 @@
{ {
"name": "web-gphoto2", "name": "web-gphoto2",
"version": "0.1.0", "version": "0.1.0",
"description": "WASM implementation of gphoto2 and libusb to control DSLR cameras over USB on the Web", "description": "WebAssembly implementation of gphoto2 and libusb to control DSLR cameras over USB on the Web",
"main": "ui/libapi.mjs", "main": "ui/libapi.mjs",
"types": "ui/libapi.mjs.d.ts", "types": "ui/libapi.mjs.d.ts",
"scripts": { "scripts": {
@@ -14,7 +14,7 @@
"keywords": [ "keywords": [
"gphoto2", "gphoto2",
"libusb", "libusb",
"wasm" "webassembly"
], ],
"author": "Ingvar Stepanyan - RReverser - me@rreverser.com", "author": "Ingvar Stepanyan - RReverser - me@rreverser.com",
"license": "LGPLv2.1", "license": "LGPLv2.1",