diff --git a/assets/sw.js b/assets/sw.js index 7ecd229..5cf014b 100644 --- a/assets/sw.js +++ b/assets/sw.js @@ -1,4 +1,4 @@ -var cacheName = 'egui-template-pwa'; +var cacheName = 'minesweeper6d-pwa'; var filesToCache = [ './', './index.html', diff --git a/index.html b/index.html index 55d9141..324ddf2 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,6 @@ - diff --git a/src/main.rs b/src/main.rs index 2ed14ab..d5707a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,8 +8,6 @@ extern crate toml; extern crate rand_chacha; use itertools::Itertools; -#[cfg(target_arch = "wasm32")] -use wasm_bindgen::prelude::wasm_bindgen; pub mod hhmmss; use hhmmss::Hhmmss; @@ -24,7 +22,7 @@ use eframe::{egui, emath::Align2}; use eframe::egui::{Button, containers::panel::TopBottomPanel, Key, KeyboardShortcut, menu, Modifiers, PointerButton, Response, RichText, Sense}; use eframe::epaint::{Color32, FontId, Pos2, Rect, Rounding, Shadow, Shape, Stroke}; -use std::{cmp::min, fs, time::Duration}; +use std::{cmp::min, fs, time::Duration, include_str}; use web_time::SystemTime; use toml::Table; @@ -100,6 +98,7 @@ fn main() { eframe::WebLogger::init(log::LevelFilter::Debug).ok(); let web_options = eframe::WebOptions::default(); + let config_content = include_str!("../config.toml").to_owned(); wasm_bindgen_futures::spawn_local(async { eframe::WebRunner::new() @@ -113,18 +112,13 @@ fn main() { style.visuals.window_rounding = Rounding::ZERO; style.visuals.window_shadow = Shadow::NONE; }); - Box::new(MinesweeperViewController::new(get_config())) + Box::new(MinesweeperViewController::new(config_content)) }), ) .await .expect("failed to start eframe"); }); } -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -extern "C" { - fn get_config() -> String; -} struct MinesweeperViewController { current_initial_settings: InitialGameSettings,