diff options
| author | 2025-05-08 13:50:07 +0100 | |
|---|---|---|
| committer | 2025-05-08 13:50:07 +0100 | |
| commit | 39a35689d385c89f79f97ce69bf214308be5e2fd (patch) | |
| tree | c4fbdca93d18f95f21a30cc6ec8d35b9b56b05ce | |
| parent | e8aa5b71df378669ff732444a5f8c57098052e5e (diff) | |
| download | macaw-web-39a35689d385c89f79f97ce69bf214308be5e2fd.tar.gz macaw-web-39a35689d385c89f79f97ce69bf214308be5e2fd.tar.bz2 macaw-web-39a35689d385c89f79f97ce69bf214308be5e2fd.zip  | |
feat: OPFS database
| -rw-r--r-- | .cargo/config.toml | 19 | ||||
| -rw-r--r-- | Cargo.lock | 5 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | Trunk.toml | 1 | ||||
| -rw-r--r-- | src/lib.rs | 8 | 
5 files changed, 28 insertions, 7 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml index c91c3f3..9fa8b2c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,21 @@ +[build] +rustflags = [ +	# LLD (shipped with the Rust toolchain) is used as the default linker +	# "-C", "link-arg=-Tlink.x", + +	# if you run into problems with LLD switch to the GNU linker by commenting out +	# this line +	# "-C", "linker=arm-none-eabi-ld", + +	# if you need to link to pre-compiled C libraries provided by a C toolchain +	# use GCC as the linker by commenting out both lines above and then +	# uncommenting the three lines below +	"-C", +  "target-feature=+atomics,+bulk-memory,+mutable-globals", +] + +[unstable] +build-std = ["std", "panic_abort"] +  [net]  git-fetch-with-cli = true @@ -318,7 +318,6 @@ dependencies = [   "iana-time-zone",   "js-sys",   "num-traits", - "serde",   "wasm-bindgen",   "windows-link",  ] @@ -822,7 +821,6 @@ dependencies = [   "lampada",   "reactive_stores",   "rusqlite", - "serde",   "sha1",   "sha2",   "sha3", @@ -1532,7 +1530,6 @@ name = "jid"  version = "0.1.0"  dependencies = [   "rusqlite", - "serde",  ]  [[package]] @@ -1578,7 +1575,6 @@ dependencies = [   "jid",   "luz",   "peanuts", - "serde",   "stanza",   "thiserror 2.0.12",   "tokio", @@ -3768,7 +3764,6 @@ checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"  dependencies = [   "getrandom 0.3.2",   "js-sys", - "serde",   "wasm-bindgen",  ] @@ -8,7 +8,7 @@ base64 = "0.22.1"  chrono = "0.4.41"  chrono-humanize = "0.2.3"  console_error_panic_hook = "0.1.7" -filamento = { path = "../luz/filamento", features = ["serde", "reactive_stores", "opfs"] } +filamento = { path = "../luz/filamento", features = ["reactive_stores", "opfs"] }  futures = "0.3.31"  indexmap = "2.9.0"  jid = { path = "../luz/jid" } @@ -13,6 +13,7 @@ public_url = "/"  filehash = true  # Whether to inject scripts (and module preloads) into the finalized output.  inject_scripts = true +cargo_flags = ["-Z build-std=std,panic_abort"]  # Run without network access  # offline = false  # Require Cargo.lock and cache are up to date @@ -190,7 +190,13 @@ fn LoginPage(set_app: WriteSignal<AppState>, set_client: RwSignal<Option<(Client              };              // initialise the client -            let db = Db::create_connect_and_migrate("mem.db").await.unwrap(); +            let db = if remember_me.get_untracked() { +                debug!("creating db in opfs"); +                Db::create_connect_and_migrate(jid.as_bare().to_string()).await.unwrap() +            } else { +                debug!("creating db in memory"); +                Db::create_connect_and_migrate_memory().await.unwrap() +            };              let files = if remember_me.get_untracked() {                  let opfs = FilesOPFS::new(jid.as_bare().to_string()).await;                  match opfs {  | 
