diff --git a/Cargo.lock b/Cargo.lock index a624c20..70b4c94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -573,6 +573,7 @@ dependencies = [ "three-d", "three-d-asset", "tokio", + "wasm-bindgen-futures", ] [[package]] diff --git a/bff-cli/src/main.rs b/bff-cli/src/main.rs index af2c204..756c70d 100644 --- a/bff-cli/src/main.rs +++ b/bff-cli/src/main.rs @@ -115,7 +115,7 @@ enum Commands { Csc { input: StdioOrPath, output: StdioOrPath, - #[arg(short, long, default_value_t = 255)] + #[arg(short, long, default_value_t = 255, help = "If the default value of 255 does not work, try 252")] key: u8, }, #[clap(alias = "xpsc")] diff --git a/bff-gui/.cargo/config.toml b/bff-gui/.cargo/config.toml new file mode 100644 index 0000000..bac83fe --- /dev/null +++ b/bff-gui/.cargo/config.toml @@ -0,0 +1,6 @@ +# clipboard api is still unstable, so web-sys requires the below flag to be passed for copy (ctrl + c) to work +# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html +# check status at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility +# we don't use `[build]` because of rust analyzer's build cache invalidation https://github.com/emilk/eframe_template/issues/93 +[target.wasm32-unknown-unknown] +rustflags = ["--cfg=web_sys_unstable_apis"] \ No newline at end of file diff --git a/bff-gui/Cargo.toml b/bff-gui/Cargo.toml index f577238..9b0137f 100644 --- a/bff-gui/Cargo.toml +++ b/bff-gui/Cargo.toml @@ -21,3 +21,8 @@ serde_json = "1.0.107" three-d = "0.16.1" three-d-asset = "0.6.0" tokio = { version = "1.33.0", features = ["rt-multi-thread", "time"] } + +# web: +[target.'cfg(target_arch = "wasm32")'.dependencies] +wasm-bindgen-futures = "0.4" + diff --git a/bff-gui/Trunk.toml b/bff-gui/Trunk.toml new file mode 100644 index 0000000..a7b19c9 --- /dev/null +++ b/bff-gui/Trunk.toml @@ -0,0 +1 @@ +[build] diff --git a/bff-gui/assets/favicon.ico b/bff-gui/assets/favicon.ico new file mode 100644 index 0000000..61ad031 Binary files /dev/null and b/bff-gui/assets/favicon.ico differ diff --git a/bff-gui/assets/icon-1024.png b/bff-gui/assets/icon-1024.png new file mode 100644 index 0000000..1b5868a Binary files /dev/null and b/bff-gui/assets/icon-1024.png differ diff --git a/bff-gui/assets/icon-256.png b/bff-gui/assets/icon-256.png new file mode 100644 index 0000000..ae72287 Binary files /dev/null and b/bff-gui/assets/icon-256.png differ diff --git a/bff-gui/assets/icon_ios_touch_192.png b/bff-gui/assets/icon_ios_touch_192.png new file mode 100644 index 0000000..8472802 Binary files /dev/null and b/bff-gui/assets/icon_ios_touch_192.png differ diff --git a/bff-gui/assets/manifest.json b/bff-gui/assets/manifest.json new file mode 100644 index 0000000..2a137fb --- /dev/null +++ b/bff-gui/assets/manifest.json @@ -0,0 +1,28 @@ +{ + "name": "egui Template PWA", + "short_name": "egui-template-pwa", + "icons": [ + { + "src": "./icon-256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "./maskable_icon_x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any maskable" + }, + { + "src": "./icon-1024.png", + "sizes": "1024x1024", + "type": "image/png" + } + ], + "lang": "en-US", + "id": "/index.html", + "start_url": "./index.html", + "display": "standalone", + "background_color": "white", + "theme_color": "white" +} diff --git a/bff-gui/assets/maskable_icon_x512.png b/bff-gui/assets/maskable_icon_x512.png new file mode 100644 index 0000000..db8df3e Binary files /dev/null and b/bff-gui/assets/maskable_icon_x512.png differ diff --git a/bff-gui/assets/sw.js b/bff-gui/assets/sw.js new file mode 100644 index 0000000..7ecd229 --- /dev/null +++ b/bff-gui/assets/sw.js @@ -0,0 +1,25 @@ +var cacheName = 'egui-template-pwa'; +var filesToCache = [ + './', + './index.html', + './eframe_template.js', + './eframe_template_bg.wasm', +]; + +/* Start the service worker and cache all of the app's content */ +self.addEventListener('install', function (e) { + e.waitUntil( + caches.open(cacheName).then(function (cache) { + return cache.addAll(filesToCache); + }) + ); +}); + +/* Serve cached content when offline */ +self.addEventListener('fetch', function (e) { + e.respondWith( + caches.match(e.request).then(function (response) { + return response || fetch(e.request); + }) + ); +}); diff --git a/bff-gui/index.html b/bff-gui/index.html new file mode 100644 index 0000000..872b4f4 --- /dev/null +++ b/bff-gui/index.html @@ -0,0 +1,140 @@ + + + + + + + +
+ +