From 5183130427b5e9ea207c6f0ea7e55550dead4103 Mon Sep 17 00:00:00 2001 From: Jet Date: Tue, 17 Mar 2026 18:10:17 -0700 Subject: [PATCH 1/2] feat: add assets for discord embedded messages --- remote/cache-service/assets/closed.png | Bin 0 -> 16224 bytes remote/cache-service/assets/offline.png | Bin 0 -> 13320 bytes remote/cache-service/assets/open.png | Bin 0 -> 15513 bytes remote/cache-service/src/api.rs | 90 +++++++++++++++++++++++- remote/cache-service/src/main.rs | 5 ++ remote/discord-bot/src/main.rs | 9 +-- 6 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 remote/cache-service/assets/closed.png create mode 100644 remote/cache-service/assets/offline.png create mode 100644 remote/cache-service/assets/open.png diff --git a/remote/cache-service/assets/closed.png b/remote/cache-service/assets/closed.png new file mode 100644 index 0000000000000000000000000000000000000000..a5a48c62f2142f9c58d18c99e5a733ab440ae571 GIT binary patch literal 16224 zcmeAS@N?(olHy`uVBq!ia0y~yU}6Aa4mJh`hA$OYelajGa29w(7Bet#3xhBt!>lYum%DnqEp1e5f=NeV8W@*9BX$G7E4}v~l z$=`iS=3H55d3gBuFK6oP3#!Ad56`_h>(#3Iz0%AKqhK@y$P0njnJHm+w*9?dn_Tv0 zd-_}X&Bn&h&b;_=y#4;`)rJ4}+I~O(?QQb!Z_j@}dsuq<-<#myn`cWOyK_Uoj*a0! zRMbv}2V2(O@Ru^)cHb`h{-4O;nAiY@g2Qp|Z)aB>k4rn6BUOB_G=MCERH;;X@?U|YpttYWT@LIlv9s|RgSqE7e z^o(|8RK1YPd}$zIv0>_d-mrBy;~KqJU(jY?XqaQbyzpaI^w0X7uDppGBV})!30UMS zuk?R=|HHSJPx%5F7y?dTs%D7k{_lIa$mss`H(z(`oww<_WVz(`%|_ermS(?uo&N3D zktM~A2Y#MSn#W+v#L#dsDvDvjv`w`ixBEI}$4}j>^(+6zYwdThr~BB|o4G1{Sh(BH z`0Njd18nBPzrUWk@Qg#_?W|?fFFoGI$WZd~^|GD)KC_mxF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([(header::CONTENT_TYPE, "image/png"), (header::CACHE_CONTROL, "public, max-age=86400")], OPEN_PNG) +} + +pub async fn get_image_closed() -> impl IntoResponse { + ([(header::CONTENT_TYPE, "image/png"), (header::CACHE_CONTROL, "public, max-age=86400")], CLOSED_PNG) +} + +pub async fn get_image_offline() -> impl IntoResponse { + ([(header::CONTENT_TYPE, "image/png"), (header::CACHE_CONTROL, "public, max-age=86400")], OFFLINE_PNG) +} + +pub async fn get_image(State(state): State>) -> impl IntoResponse { + let db = state.db.clone(); + let status = tokio::task::spawn_blocking(move || { + let conn = db.blocking_lock(); + db::get_current_status_str(&conn) + }) + .await + .expect("db task panicked") + .ok() + .flatten(); + + let image = match status.as_deref() { + Some("open") => OPEN_PNG, + Some("closed") => CLOSED_PNG, + _ => OFFLINE_PNG, + }; + ([(header::CONTENT_TYPE, "image/png"), (header::CACHE_CONTROL, "public, max-age=5")], image) +} + +pub async fn get_badge(State(state): State>) -> impl IntoResponse { + let db = state.db.clone(); + let status = tokio::task::spawn_blocking(move || { + let conn = db.blocking_lock(); + db::get_current_status_str(&conn) + }) + .await + .expect("db task panicked") + .ok() + .flatten(); + + let (label, color) = match status.as_deref() { + Some("open") => ("open", "#57f287"), + Some("closed") => ("closed", "#ed4245"), + _ => ("offline", "#99aab5"), + }; + + let label_width = 70u32; + let value_width = 10 + label.len() as u32 * 7; + let total_width = label_width + value_width; + let label_x = label_width as f32 / 2.0; + let value_x = label_width as f32 + value_width as f32 / 2.0; + + let svg = format!( + "\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + noisebell\ + noisebell\ + {label}\ + {label}\ + " + ); + + ( + [ + (header::CONTENT_TYPE, "image/svg+xml"), + (header::CACHE_CONTROL, "no-cache, max-age=0"), + ], + svg, + ) +} diff --git a/remote/cache-service/src/main.rs b/remote/cache-service/src/main.rs index d2dc86d..8b25931 100644 --- a/remote/cache-service/src/main.rs +++ b/remote/cache-service/src/main.rs @@ -130,6 +130,11 @@ async fn main() -> Result<()> { .route("/status", get(api::get_status)) .route("/info", get(api::get_info)) .route("/history", get(api::get_history)) + .route("/image", get(api::get_image)) + .route("/image/open.png", get(api::get_image_open)) + .route("/image/closed.png", get(api::get_image_closed)) + .route("/image/offline.png", get(api::get_image_offline)) + .route("/badge.svg", get(api::get_badge)) .layer( TraceLayer::new_for_http() .make_span_with(tower_http::trace::DefaultMakeSpan::new().level(Level::INFO)) diff --git a/remote/discord-bot/src/main.rs b/remote/discord-bot/src/main.rs index b375293..d483d78 100644 --- a/remote/discord-bot/src/main.rs +++ b/remote/discord-bot/src/main.rs @@ -18,16 +18,17 @@ struct AppState { } fn build_embed(status: &str, timestamp: u64) -> CreateEmbed { - let (colour, title, description) = match status { - "open" => (Colour::from_rgb(87, 242, 135), "Door is open", "The door at Noisebridge is open."), - "closed" => (Colour::from_rgb(237, 66, 69), "Door is closed", "The door at Noisebridge is closed."), - _ => (Colour::from_rgb(153, 170, 181), "Pi is offline", "The Noisebridge Pi is offline."), + let (colour, title, description, image_url) = match status { + "open" => (Colour::from_rgb(0, 255, 0), "Noisebridge is Open!", "It's time to start hacking.", "https://noisebell.extremist.software/image/open.png"), + "closed" => (Colour::from_rgb(255, 0, 0), "Noisebridge is Closed!", "We'll see you again soon.", "https://noisebell.extremist.software/image/closed.png"), + _ => (Colour::from_rgb(153, 170, 181), "Noisebridge is Offline", "The Noisebridge Pi is not responding.", "https://noisebell.extremist.software/image/offline.png"), }; CreateEmbed::new() .title(title) .description(description) .colour(colour) + .thumbnail(image_url) .timestamp(serenity::model::Timestamp::from_unix_timestamp(timestamp as i64).unwrap_or_else(|_| serenity::model::Timestamp::now())) } From e8b60519e7d0753fc21e247495c0a02f890b4206 Mon Sep 17 00:00:00 2001 From: Jet Date: Wed, 18 Mar 2026 17:33:57 -0700 Subject: [PATCH 2/2] feat: reorganize to one flake one rust project --- .gitignore | 5 +- remote/Cargo.lock => Cargo.lock | 88 +- Cargo.toml | 9 + flake.lock | 103 +- flake.nix | 159 ++- pi/pi-service/Cargo.lock | 1663 ---------------------------- pi/pi-service/Cargo.toml | 1 + pi/pi-service/flake.lock | 64 -- pi/pi-service/flake.nix | 69 -- pi/pi-service/src/main.rs | 11 +- remote/Cargo.toml | 3 - remote/cache-service/src/api.rs | 47 +- remote/cache-service/src/db.rs | 158 ++- remote/cache-service/src/main.rs | 3 + remote/cache-service/src/poller.rs | 17 +- remote/cache-service/src/types.rs | 40 +- remote/discord-bot/Cargo.toml | 1 + remote/discord-bot/module.nix | 13 + remote/discord-bot/src/main.rs | 308 +++++- remote/flake.lock | 64 -- remote/flake.nix | 66 -- remote/noisebell-common/Cargo.toml | 3 + remote/noisebell-common/src/lib.rs | 41 + 23 files changed, 792 insertions(+), 2144 deletions(-) rename remote/Cargo.lock => Cargo.lock (96%) create mode 100644 Cargo.toml delete mode 100644 pi/pi-service/Cargo.lock delete mode 100644 pi/pi-service/flake.lock delete mode 100644 pi/pi-service/flake.nix delete mode 100644 remote/Cargo.toml delete mode 100644 remote/flake.lock delete mode 100644 remote/flake.nix diff --git a/.gitignore b/.gitignore index a27f459..1d082b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -remote/target -pi/pi-service/target +target/ +result +result-* .direnv diff --git a/remote/Cargo.lock b/Cargo.lock similarity index 96% rename from remote/Cargo.lock rename to Cargo.lock index a8f25db..c3428c2 100644 --- a/remote/Cargo.lock +++ b/Cargo.lock @@ -107,6 +107,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.11.0" @@ -142,9 +148,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cc" -version = "1.2.56" +version = "1.2.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" dependencies = [ "find-msvc-tools", "shlex", @@ -393,6 +399,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gpiod-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15a60e3beb5444643d049a3f8769b47ce246ec1f57e6cd1aed1e417d57a47110" +dependencies = [ + "nix", +] + [[package]] name = "hashbrown" version = "0.15.5" @@ -751,6 +766,35 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "noisebell" +version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "libc", + "noisebell-common", + "reqwest", + "sd-notify", + "serde", + "serde_json", + "tokio", + "tokio-gpiod", + "tracing", + "tracing-subscriber", +] + [[package]] name = "noisebell-cache" version = "0.1.0" @@ -774,6 +818,7 @@ version = "0.1.0" dependencies = [ "axum", "serde", + "serde_json", ] [[package]] @@ -783,6 +828,7 @@ dependencies = [ "anyhow", "axum", "noisebell-common", + "reqwest", "serde", "serde_json", "serenity", @@ -825,9 +871,9 @@ checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "percent-encoding" @@ -1094,7 +1140,7 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c6d5e5acb6f6129fe3f7ba0a7fc77bca1942cb568535e18e7bc40262baf3110" dependencies = [ - "bitflags", + "bitflags 2.11.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -1180,6 +1226,15 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "sd-notify" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b943eadf71d8b69e661330cb0e2656e31040acf21ee7708e2c238a0ec6af2bf4" +dependencies = [ + "libc", +] + [[package]] name = "secrecy" version = "0.8.0" @@ -1274,7 +1329,7 @@ dependencies = [ "arrayvec", "async-trait", "base64", - "bitflags", + "bitflags 2.11.0", "bytes", "flate2", "futures", @@ -1492,9 +1547,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" dependencies = [ "tinyvec_macros", ] @@ -1521,6 +1576,17 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "tokio-gpiod" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce15fa0021a7acacd2be506f72aeb5044a0a8b53d684963f133b37ace5c57f47" +dependencies = [ + "gpiod-core", + "libc", + "tokio", +] + [[package]] name = "tokio-macros" version = "2.6.1" @@ -1604,7 +1670,7 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags", + "bitflags 2.11.0", "bytes", "futures-util", "http", @@ -1675,9 +1741,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "matchers", "nu-ansi-term", diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d393826 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] +members = [ + "pi/pi-service", + "remote/noisebell-common", + "remote/cache-service", + "remote/discord-bot", + "remote/rss-service", +] +resolver = "2" diff --git a/flake.lock b/flake.lock index 8ec41ab..40cda20 100644 --- a/flake.lock +++ b/flake.lock @@ -25,26 +25,11 @@ }, "crane": { "locked": { - "lastModified": 1773189535, - "narHash": "sha256-E1G/Or6MWeP+L6mpQ0iTFLpzSzlpGrITfU2220Gq47g=", + "lastModified": 1773857772, + "narHash": "sha256-5xsK26KRHf0WytBtsBnQYC/lTWDhQuT57HJ7SzuqZcM=", "owner": "ipetkov", "repo": "crane", - "rev": "6fa2fb4cf4a89ba49fc9dd5a3eb6cde99d388269", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "crane_2": { - "locked": { - "lastModified": 1773115265, - "narHash": "sha256-5fDkKTYEgue2klksd52WvcXfZdY1EIlbk0QggAwpFog=", - "owner": "ipetkov", - "repo": "crane", - "rev": "27711550d109bf6236478dc9f53b9e29c1a374c5", + "rev": "b556d7bbae5ff86e378451511873dfd07e4504cd", "type": "github" }, "original": { @@ -112,98 +97,26 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1773646010, - "narHash": "sha256-iYrs97hS7p5u4lQzuNWzuALGIOdkPXvjz7bviiBjUu8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5b2c2d84341b2afb5647081c1386a80d7a8d8605", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "pi-service": { - "inputs": { - "crane": "crane", - "nixpkgs": "nixpkgs_2", - "rust-overlay": "rust-overlay" - }, - "locked": { - "path": "./pi/pi-service", - "type": "path" - }, - "original": { - "path": "./pi/pi-service", - "type": "path" - }, - "parent": [] - }, - "remote": { - "inputs": { - "crane": "crane_2", - "nixpkgs": [ - "nixpkgs" - ], - "rust-overlay": "rust-overlay_2" - }, - "locked": { - "path": "./remote", - "type": "path" - }, - "original": { - "path": "./remote", - "type": "path" - }, - "parent": [] - }, "root": { "inputs": { "agenix": "agenix", + "crane": "crane", "nixpkgs": "nixpkgs", - "pi-service": "pi-service", - "remote": "remote" + "rust-overlay": "rust-overlay" } }, "rust-overlay": { "inputs": { "nixpkgs": [ - "pi-service", "nixpkgs" ] }, "locked": { - "lastModified": 1773716879, - "narHash": "sha256-vXCTasEzzTTd0ZGEuyle20H2hjRom66JeNr7i2ktHD0=", + "lastModified": 1773803479, + "narHash": "sha256-GD6i1F2vrSxbsmbS92+8+x3DbHOJ+yrS78Pm4xigW4M=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1a9ddeb45c5751b800331363703641b84d1f41f0", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_2": { - "inputs": { - "nixpkgs": [ - "remote", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1773115373, - "narHash": "sha256-bfK9FJFcQth6f3ydYggS5m0z2NRGF/PY6Y2XgZDJ6pg=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "1924b4672a2b8e4aee6e6652ec2e59a8d3c5648e", + "rev": "f17186f52e82ec5cf40920b58eac63b78692ac7c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9b4eae4..dc0dd17 100644 --- a/flake.nix +++ b/flake.nix @@ -7,36 +7,135 @@ url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; }; - pi-service.url = "path:./pi/pi-service"; - remote.url = "path:./remote"; - remote.inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = { self, nixpkgs, agenix, pi-service, remote }: { - nixosModules = remote.nixosModules; - - nixosConfigurations.pi = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ - agenix.nixosModules.default - (import ./pi/module.nix { - pkg = pi-service.packages.aarch64-linux.default; - rev = self.shortRev or "dirty"; - }) - ./pi/configuration.nix - ./pi/hardware-configuration.nix - ]; - }; - - nixosConfigurations.bootstrap = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ ./pi/bootstrap.nix ]; - }; - - devShells.x86_64-linux.default = let - pkgs = nixpkgs.legacyPackages.x86_64-linux; - in pkgs.mkShell { - packages = [ agenix.packages.x86_64-linux.default ]; + crane.url = "github:ipetkov/crane"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; + + outputs = { self, nixpkgs, agenix, crane, rust-overlay }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + }; + + # --- Remote services (x86_64-linux) --- + + rustToolchain = pkgs.rust-bin.stable.latest.default; + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; + + src = pkgs.lib.cleanSourceWith { + src = ./.; + filter = path: type: + (builtins.match ".*\.png$" path != null) || (craneLib.filterCargoSources path type); + }; + + remoteArgs = { + inherit src; + pname = "noisebell"; + version = "0.1.0"; + strictDeps = true; + doCheck = false; + }; + + remoteArtifacts = craneLib.buildDepsOnly remoteArgs; + + buildRemoteMember = name: craneLib.buildPackage (remoteArgs // { + cargoArtifacts = remoteArtifacts; + cargoExtraArgs = "-p ${name}"; + }); + + noisebell-cache = buildRemoteMember "noisebell-cache"; + noisebell-discord = buildRemoteMember "noisebell-discord"; + noisebell-rss = buildRemoteMember "noisebell-rss"; + + # --- Pi service (cross-compiled to aarch64-linux) --- + + crossPkgs = import nixpkgs { + inherit system; + crossSystem.config = "aarch64-unknown-linux-gnu"; + overlays = [ rust-overlay.overlays.default ]; + }; + + piRustToolchain = pkgs.rust-bin.stable.latest.default.override { + targets = [ "aarch64-unknown-linux-gnu" ]; + }; + + piCraneLib = (crane.mkLib pkgs).overrideToolchain piRustToolchain; + + piArgs = { + inherit src; + pname = "noisebell-pi"; + version = "0.1.0"; + strictDeps = true; + doCheck = false; + + CARGO_BUILD_TARGET = "aarch64-unknown-linux-gnu"; + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = + "${crossPkgs.stdenv.cc.targetPrefix}cc"; + TARGET_CC = "${crossPkgs.stdenv.cc.targetPrefix}cc"; + CC_aarch64_unknown_linux_gnu = "${crossPkgs.stdenv.cc.targetPrefix}cc"; + HOST_CC = "${pkgs.stdenv.cc.nativePrefix}cc"; + + depsBuildBuild = [ crossPkgs.stdenv.cc ]; + cargoExtraArgs = "-p noisebell"; + }; + + piArtifacts = piCraneLib.buildDepsOnly piArgs; + + noisebell-pi = piCraneLib.buildPackage (piArgs // { + cargoArtifacts = piArtifacts; + }); + + in + { + packages.${system} = { + inherit noisebell-cache noisebell-discord noisebell-rss; + default = noisebell-cache; + }; + + packages.aarch64-linux = { + noisebell = noisebell-pi; + default = noisebell-pi; + }; + + nixosModules = { + cache = import ./remote/cache-service/module.nix noisebell-cache; + discord = import ./remote/discord-bot/module.nix noisebell-discord; + rss = import ./remote/rss-service/module.nix noisebell-rss; + default = { imports = [ + (import ./remote/cache-service/module.nix noisebell-cache) + (import ./remote/discord-bot/module.nix noisebell-discord) + (import ./remote/rss-service/module.nix noisebell-rss) + ]; }; + }; + + nixosConfigurations.pi = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + agenix.nixosModules.default + (import ./pi/module.nix { + pkg = noisebell-pi; + rev = self.shortRev or "dirty"; + }) + ./pi/configuration.nix + ./pi/hardware-configuration.nix + ]; + }; + + nixosConfigurations.bootstrap = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ ./pi/bootstrap.nix ]; + }; + + devShells.${system}.default = craneLib.devShell { + packages = [ + pkgs.rust-analyzer + agenix.packages.${system}.default + ]; + }; + }; } diff --git a/pi/pi-service/Cargo.lock b/pi/pi-service/Cargo.lock deleted file mode 100644 index 3156439..0000000 --- a/pi/pi-service/Cargo.lock +++ /dev/null @@ -1,1663 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - -[[package]] -name = "anyhow" -version = "1.0.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "axum" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" -dependencies = [ - "axum-core", - "bytes", - "form_urlencoded", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "serde_core", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "axum-core" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "sync_wrapper", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" - -[[package]] -name = "bumpalo" -version = "3.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" - -[[package]] -name = "bytes" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" - -[[package]] -name = "cc" -version = "1.2.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" -dependencies = [ - "find-msvc-tools", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" - -[[package]] -name = "futures-task" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" - -[[package]] -name = "futures-util" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" -dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "r-efi", - "wasip2", - "wasm-bindgen", -] - -[[package]] -name = "gpiod-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15a60e3beb5444643d049a3f8769b47ce246ec1f57e6cd1aed1e417d57a47110" -dependencies = [ - "nix", -] - -[[package]] -name = "http" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "pin-utils", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" -dependencies = [ - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", - "webpki-roots", -] - -[[package]] -name = "hyper-util" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" -dependencies = [ - "base64", - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "ipnet", - "libc", - "percent-encoding", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - -[[package]] -name = "icu_collections" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" - -[[package]] -name = "icu_properties" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" - -[[package]] -name = "icu_provider" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "ipnet" -version = "2.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" - -[[package]] -name = "iri-string" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "itoa" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" - -[[package]] -name = "js-sys" -version = "0.3.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.183" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" - -[[package]] -name = "litemap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - -[[package]] -name = "log" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" - -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - -[[package]] -name = "matchers" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "matchit" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" - -[[package]] -name = "memchr" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mio" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", -] - -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", -] - -[[package]] -name = "noisebell" -version = "0.1.0" -dependencies = [ - "anyhow", - "axum", - "libc", - "reqwest", - "sd-notify", - "serde", - "serde_json", - "tokio", - "tokio-gpiod", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "nu-ansi-term" -version = "0.50.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "potential_utf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" -dependencies = [ - "zerovec", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro2" -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quinn" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls", - "socket2", - "thiserror", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" -dependencies = [ - "bytes", - "getrandom 0.3.4", - "lru-slab", - "rand", - "ring", - "rustc-hash", - "rustls", - "rustls-pki-types", - "slab", - "thiserror", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.60.2", -] - -[[package]] -name = "quote" -version = "1.0.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" -dependencies = [ - "getrandom 0.3.4", -] - -[[package]] -name = "regex-automata" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" - -[[package]] -name = "reqwest" -version = "0.12.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" -dependencies = [ - "base64", - "bytes", - "futures-core", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "js-sys", - "log", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-rustls", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.17", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - -[[package]] -name = "rustls" -version = "0.23.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" -dependencies = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pki-types" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" -dependencies = [ - "web-time", - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - -[[package]] -name = "sd-notify" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b943eadf71d8b69e661330cb0e2656e31040acf21ee7708e2c238a0ec6af2bf4" -dependencies = [ - "libc", -] - -[[package]] -name = "serde" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_path_to_error" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" -dependencies = [ - "itoa", - "serde", - "serde_core", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "socket2" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "2.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thiserror" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" -dependencies = [ - "bytes", - "libc", - "mio", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-gpiod" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce15fa0021a7acacd2be506f72aeb5044a0a8b53d684963f133b37ace5c57f47" -dependencies = [ - "gpiod-core", - "libc", - "tokio", -] - -[[package]] -name = "tokio-macros" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tower" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-http" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" -dependencies = [ - "bitflags 2.11.0", - "bytes", - "futures-util", - "http", - "http-body", - "iri-string", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex-automata", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.2+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" -dependencies = [ - "cfg-if", - "futures-util", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "web-sys" -version = "0.3.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.5", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - -[[package]] -name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "yoke" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" - -[[package]] -name = "zerotrie" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zmij" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/pi/pi-service/Cargo.toml b/pi/pi-service/Cargo.toml index be7ae80..47cd18a 100644 --- a/pi/pi-service/Cargo.toml +++ b/pi/pi-service/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" anyhow = "1.0" axum = "0.8" libc = "0.2" +noisebell-common = { path = "../../remote/noisebell-common" } reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } sd-notify = "0.4" serde = { version = "1.0", features = ["derive"] } diff --git a/pi/pi-service/flake.lock b/pi/pi-service/flake.lock deleted file mode 100644 index 642dc3f..0000000 --- a/pi/pi-service/flake.lock +++ /dev/null @@ -1,64 +0,0 @@ -{ - "nodes": { - "crane": { - "locked": { - "lastModified": 1773189535, - "narHash": "sha256-E1G/Or6MWeP+L6mpQ0iTFLpzSzlpGrITfU2220Gq47g=", - "owner": "ipetkov", - "repo": "crane", - "rev": "6fa2fb4cf4a89ba49fc9dd5a3eb6cde99d388269", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1773646010, - "narHash": "sha256-iYrs97hS7p5u4lQzuNWzuALGIOdkPXvjz7bviiBjUu8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5b2c2d84341b2afb5647081c1386a80d7a8d8605", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "crane": "crane", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1773716879, - "narHash": "sha256-vXCTasEzzTTd0ZGEuyle20H2hjRom66JeNr7i2ktHD0=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "1a9ddeb45c5751b800331363703641b84d1f41f0", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/pi/pi-service/flake.nix b/pi/pi-service/flake.nix deleted file mode 100644 index 964f39f..0000000 --- a/pi/pi-service/flake.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ - description = "Noisebell - GPIO door monitor service"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - crane.url = "github:ipetkov/crane"; - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - - outputs = { self, nixpkgs, crane, rust-overlay }: - let - forSystem = system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ rust-overlay.overlays.default ]; - }; - - crossPkgs = import nixpkgs { - inherit system; - crossSystem.config = "aarch64-unknown-linux-gnu"; - overlays = [ rust-overlay.overlays.default ]; - }; - - rustToolchain = pkgs.rust-bin.stable.latest.default.override { - targets = [ "aarch64-unknown-linux-gnu" ]; - }; - - craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; - - src = craneLib.cleanCargoSource ./.; - - commonArgs = { - inherit src; - strictDeps = true; - doCheck = false; - - CARGO_BUILD_TARGET = "aarch64-unknown-linux-gnu"; - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = - "${crossPkgs.stdenv.cc.targetPrefix}cc"; - - TARGET_CC = "${crossPkgs.stdenv.cc.targetPrefix}cc"; - CC_aarch64_unknown_linux_gnu = "${crossPkgs.stdenv.cc.targetPrefix}cc"; - - HOST_CC = "${pkgs.stdenv.cc.nativePrefix}cc"; - - depsBuildBuild = [ crossPkgs.stdenv.cc ]; - }; - - cargoArtifacts = craneLib.buildDepsOnly commonArgs; - - noisebell = craneLib.buildPackage (commonArgs // { - inherit cargoArtifacts; - }); - in - { - packages.aarch64-linux.default = noisebell; - packages.aarch64-linux.noisebell = noisebell; - - devShells.${system}.default = craneLib.devShell { - packages = [ pkgs.rust-analyzer ]; - }; - }; - in - forSystem "x86_64-linux"; -} diff --git a/pi/pi-service/src/main.rs b/pi/pi-service/src/main.rs index f1c62c6..efd0541 100644 --- a/pi/pi-service/src/main.rs +++ b/pi/pi-service/src/main.rs @@ -7,6 +7,7 @@ use axum::extract::State; use axum::http::{HeaderMap, StatusCode}; use axum::routing::get; use axum::{Json, Router}; +use noisebell_common::{validate_bearer, WebhookPayload}; use serde::Serialize; use tokio_gpiod::{Bias, Chip, Edge, EdgeDetect, Options}; use tracing::{error, info, warn}; @@ -21,14 +22,6 @@ struct AppState { inbound_api_key: String, } -fn validate_bearer(headers: &HeaderMap, expected: &str) -> bool { - headers - .get("authorization") - .and_then(|v| v.to_str().ok()) - .map(|v| v.strip_prefix("Bearer ").unwrap_or("") == expected) - .unwrap_or(false) -} - #[derive(Serialize)] struct StatusResponse { status: &'static str, @@ -324,7 +317,7 @@ async fn main() -> Result<()> { let status = status_str(new_open); info!(status, timestamp, "state changed"); - let payload = serde_json::json!({ "status": status, "timestamp": timestamp }); + let payload = WebhookPayload { status: status.to_string(), timestamp }; for attempt in 0..=retry_attempts { let result = client diff --git a/remote/Cargo.toml b/remote/Cargo.toml deleted file mode 100644 index 99fd2cb..0000000 --- a/remote/Cargo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[workspace] -members = ["noisebell-common", "cache-service", "discord-bot", "rss-service"] -resolver = "2" diff --git a/remote/cache-service/src/api.rs b/remote/cache-service/src/api.rs index 326869d..97ce27c 100644 --- a/remote/cache-service/src/api.rs +++ b/remote/cache-service/src/api.rs @@ -23,6 +23,8 @@ pub struct AppState { pub webhooks: Vec, pub retry_attempts: u32, pub retry_base_delay_secs: u64, + pub webhook_last_request: std::sync::atomic::AtomicU64, + pub webhook_tokens: std::sync::atomic::AtomicU32, } fn unix_now() -> u64 { @@ -32,6 +34,9 @@ fn unix_now() -> u64 { .as_secs() } +const WEBHOOK_RATE_LIMIT: u32 = 10; +const WEBHOOK_RATE_WINDOW_SECS: u64 = 60; + pub async fn post_webhook( State(state): State>, headers: HeaderMap, @@ -41,6 +46,22 @@ pub async fn post_webhook( return StatusCode::UNAUTHORIZED; } + // Simple rate limiting: reset tokens every window, reject if exhausted + let now = unix_now(); + let last = state.webhook_last_request.load(std::sync::atomic::Ordering::Relaxed); + if now.saturating_sub(last) >= WEBHOOK_RATE_WINDOW_SECS { + state.webhook_tokens.store(WEBHOOK_RATE_LIMIT, std::sync::atomic::Ordering::Relaxed); + state.webhook_last_request.store(now, std::sync::atomic::Ordering::Relaxed); + } + let remaining = state.webhook_tokens.fetch_update( + std::sync::atomic::Ordering::Relaxed, + std::sync::atomic::Ordering::Relaxed, + |n| if n > 0 { Some(n - 1) } else { None }, + ); + if remaining.is_err() { + return StatusCode::TOO_MANY_REQUESTS; + } + let Some(status) = DoorStatus::from_str(&body.status) else { return StatusCode::BAD_REQUEST; }; @@ -148,17 +169,16 @@ pub async fn get_image(State(state): State>) -> impl IntoResponse let db = state.db.clone(); let status = tokio::task::spawn_blocking(move || { let conn = db.blocking_lock(); - db::get_current_status_str(&conn) + db::get_current_status(&conn) }) .await .expect("db task panicked") - .ok() - .flatten(); + .unwrap_or(DoorStatus::Offline); - let image = match status.as_deref() { - Some("open") => OPEN_PNG, - Some("closed") => CLOSED_PNG, - _ => OFFLINE_PNG, + let image = match status { + DoorStatus::Open => OPEN_PNG, + DoorStatus::Closed => CLOSED_PNG, + DoorStatus::Offline => OFFLINE_PNG, }; ([(header::CONTENT_TYPE, "image/png"), (header::CACHE_CONTROL, "public, max-age=5")], image) } @@ -167,17 +187,16 @@ pub async fn get_badge(State(state): State>) -> impl IntoResponse let db = state.db.clone(); let status = tokio::task::spawn_blocking(move || { let conn = db.blocking_lock(); - db::get_current_status_str(&conn) + db::get_current_status(&conn) }) .await .expect("db task panicked") - .ok() - .flatten(); + .unwrap_or(DoorStatus::Offline); - let (label, color) = match status.as_deref() { - Some("open") => ("open", "#57f287"), - Some("closed") => ("closed", "#ed4245"), - _ => ("offline", "#99aab5"), + let (label, color) = match status { + DoorStatus::Open => ("open", "#57f287"), + DoorStatus::Closed => ("closed", "#ed4245"), + DoorStatus::Offline => ("offline", "#99aab5"), }; let label_width = 70u32; diff --git a/remote/cache-service/src/db.rs b/remote/cache-service/src/db.rs index 77964de..0831cf8 100644 --- a/remote/cache-service/src/db.rs +++ b/remote/cache-service/src/db.rs @@ -12,7 +12,8 @@ pub fn init(path: &str) -> Result { id INTEGER PRIMARY KEY CHECK (id = 1), status TEXT, timestamp INTEGER, - last_seen INTEGER + last_seen INTEGER, + last_checked INTEGER ); CREATE TABLE IF NOT EXISTS state_log ( @@ -28,17 +29,29 @@ pub fn init(path: &str) -> Result { fetched_at INTEGER NOT NULL ); - INSERT OR IGNORE INTO current_state (id, status, timestamp, last_seen) VALUES (1, NULL, NULL, NULL); + INSERT OR IGNORE INTO current_state (id, status, timestamp, last_seen, last_checked) VALUES (1, 'offline', NULL, NULL, NULL); INSERT OR IGNORE INTO pi_info (id, data, fetched_at) VALUES (1, '{}', 0); ", ) .context("failed to initialize database schema")?; + + // Migration: add last_checked column if missing (existing databases) + let has_last_checked: bool = conn + .prepare("SELECT last_checked FROM current_state LIMIT 1") + .is_ok(); + if !has_last_checked { + conn.execute_batch("ALTER TABLE current_state ADD COLUMN last_checked INTEGER")?; + } + + // Migration: convert NULL status to 'offline' + conn.execute("UPDATE current_state SET status = 'offline' WHERE status IS NULL", [])?; + Ok(conn) } pub fn get_status(conn: &Connection) -> Result { - let (status, timestamp, last_seen) = conn.query_row( - "SELECT status, timestamp, last_seen FROM current_state WHERE id = 1", + let (status_str, timestamp, last_checked) = conn.query_row( + "SELECT status, timestamp, last_checked FROM current_state WHERE id = 1", [], |row| { Ok(( @@ -48,10 +61,14 @@ pub fn get_status(conn: &Connection) -> Result { )) }, )?; + let status = status_str + .as_deref() + .and_then(DoorStatus::from_str) + .unwrap_or(DoorStatus::Offline); Ok(StatusResponse { - status: status.unwrap_or_else(|| "offline".to_string()), - timestamp, - last_seen, + status, + since: timestamp, + last_checked, }) } @@ -59,7 +76,7 @@ pub fn update_state(conn: &Connection, status: DoorStatus, timestamp: u64, now: let status_str = status.as_str(); conn.execute( "UPDATE current_state SET status = ?1, timestamp = ?2, last_seen = ?3 WHERE id = 1", - rusqlite::params![status_str, timestamp, now], + rusqlite::params![status_str, now, now], )?; conn.execute( "INSERT INTO state_log (status, timestamp, recorded_at) VALUES (?1, ?2, ?3)", @@ -76,10 +93,18 @@ pub fn update_last_seen(conn: &Connection, now: u64) -> Result<()> { Ok(()) } +pub fn update_last_checked(conn: &Connection, now: u64) -> Result<()> { + conn.execute( + "UPDATE current_state SET last_checked = ?1 WHERE id = 1", + rusqlite::params![now], + )?; + Ok(()) +} + pub fn mark_offline(conn: &Connection, now: u64) -> Result<()> { conn.execute( - "UPDATE current_state SET status = NULL WHERE id = 1", - [], + "UPDATE current_state SET status = 'offline', timestamp = ?1 WHERE id = 1", + rusqlite::params![now], )?; conn.execute( "INSERT INTO state_log (status, timestamp, recorded_at) VALUES ('offline', ?1, ?1)", @@ -88,13 +113,16 @@ pub fn mark_offline(conn: &Connection, now: u64) -> Result<()> { Ok(()) } -pub fn get_current_status_str(conn: &Connection) -> Result> { - let status = conn.query_row( +pub fn get_current_status(conn: &Connection) -> Result { + let status_str: Option = conn.query_row( "SELECT status FROM current_state WHERE id = 1", [], - |row| row.get::<_, Option>(0), + |row| row.get(0), )?; - Ok(status) + Ok(status_str + .as_deref() + .and_then(DoorStatus::from_str) + .unwrap_or(DoorStatus::Offline)) } pub fn get_history(conn: &Connection, limit: u32) -> Result> { @@ -131,3 +159,105 @@ pub fn update_pi_info(conn: &Connection, data: &serde_json::Value, now: u64) -> )?; Ok(()) } + +#[cfg(test)] +mod tests { + use super::*; + + fn test_db() -> Connection { + init(":memory:").expect("failed to init test db") + } + + #[test] + fn initial_status_is_offline() { + let conn = test_db(); + let status = get_status(&conn).unwrap(); + assert_eq!(status.status, DoorStatus::Offline); + assert!(status.since.is_none()); + assert!(status.last_checked.is_none()); + } + + #[test] + fn update_state_changes_status() { + let conn = test_db(); + update_state(&conn, DoorStatus::Open, 1000, 1001).unwrap(); + + let status = get_status(&conn).unwrap(); + assert_eq!(status.status, DoorStatus::Open); + assert_eq!(status.since, Some(1001)); + } + + #[test] + fn mark_offline_sets_offline_status() { + let conn = test_db(); + update_state(&conn, DoorStatus::Open, 1000, 1001).unwrap(); + mark_offline(&conn, 2000).unwrap(); + + let status = get_status(&conn).unwrap(); + assert_eq!(status.status, DoorStatus::Offline); + assert_eq!(status.since, Some(2000)); + } + + #[test] + fn get_current_status_matches_get_status() { + let conn = test_db(); + assert_eq!(get_current_status(&conn).unwrap(), DoorStatus::Offline); + + update_state(&conn, DoorStatus::Closed, 1000, 1001).unwrap(); + assert_eq!(get_current_status(&conn).unwrap(), DoorStatus::Closed); + } + + #[test] + fn update_last_checked_is_readable() { + let conn = test_db(); + update_last_checked(&conn, 5000).unwrap(); + + let status = get_status(&conn).unwrap(); + assert_eq!(status.last_checked, Some(5000)); + } + + #[test] + fn history_records_state_changes() { + let conn = test_db(); + update_state(&conn, DoorStatus::Open, 1000, 1001).unwrap(); + update_state(&conn, DoorStatus::Closed, 2000, 2001).unwrap(); + mark_offline(&conn, 3000).unwrap(); + + let history = get_history(&conn, 10).unwrap(); + assert_eq!(history.len(), 3); + assert_eq!(history[0].status, "offline"); + assert_eq!(history[1].status, "closed"); + assert_eq!(history[2].status, "open"); + } + + #[test] + fn status_response_serializes_correctly() { + let resp = StatusResponse { + status: DoorStatus::Open, + since: Some(1234), + last_checked: Some(5678), + }; + let json = serde_json::to_value(&resp).unwrap(); + assert_eq!(json["status"], "open"); + assert_eq!(json["since"], 1234); + assert_eq!(json["last_checked"], 5678); + } + + #[test] + fn null_status_migration_converts_to_offline() { + // Simulate an old database with NULL status + let conn = Connection::open_in_memory().unwrap(); + conn.execute_batch(" + CREATE TABLE current_state (id INTEGER PRIMARY KEY CHECK (id = 1), status TEXT, timestamp INTEGER, last_seen INTEGER); + INSERT INTO current_state (id, status, timestamp, last_seen) VALUES (1, NULL, NULL, NULL); + CREATE TABLE state_log (id INTEGER PRIMARY KEY AUTOINCREMENT, status TEXT NOT NULL, timestamp INTEGER NOT NULL, recorded_at INTEGER NOT NULL); + CREATE TABLE pi_info (id INTEGER PRIMARY KEY CHECK (id = 1), data TEXT NOT NULL, fetched_at INTEGER NOT NULL); + INSERT INTO pi_info (id, data, fetched_at) VALUES (1, '{}', 0); + ").unwrap(); + + // Re-init should migrate + let conn = init(":memory:").unwrap(); + let status = get_current_status(&conn).unwrap(); + assert_eq!(status, DoorStatus::Offline); + } +} diff --git a/remote/cache-service/src/main.rs b/remote/cache-service/src/main.rs index 8b25931..a39014f 100644 --- a/remote/cache-service/src/main.rs +++ b/remote/cache-service/src/main.rs @@ -5,6 +5,7 @@ use anyhow::{Context, Result}; use axum::routing::{get, post}; use axum::Router; use tokio::sync::Mutex; +use std::sync::atomic::AtomicU64; use tower_http::trace::TraceLayer; use tracing::{info, Level}; @@ -122,6 +123,8 @@ async fn main() -> Result<()> { webhooks, retry_attempts, retry_base_delay_secs, + webhook_last_request: AtomicU64::new(0), + webhook_tokens: std::sync::atomic::AtomicU32::new(10), }); let app = Router::new() diff --git a/remote/cache-service/src/poller.rs b/remote/cache-service/src/poller.rs index aac7321..68affb7 100644 --- a/remote/cache-service/src/poller.rs +++ b/remote/cache-service/src/poller.rs @@ -37,6 +37,18 @@ pub fn spawn_status_poller( let mut was_offline = false; loop { + { + let now = unix_now(); + let db = db.clone(); + let _ = tokio::task::spawn_blocking(move || { + let conn = db.blocking_lock(); + if let Err(e) = db::update_last_checked(&conn, now) { + error!(error = %e, "failed to update last_checked"); + } + }) + .await; + } + let result = client .get(format!("{}/", config.pi_address)) .bearer_auth(&config.pi_api_key) @@ -65,10 +77,9 @@ pub fn spawn_status_poller( if let Some(ref status_str) = status_str { if let Some(status) = DoorStatus::from_str(status_str) { - let current = db::get_current_status_str(&conn); + let current = db::get_current_status(&conn); let changed = match ¤t { - Ok(Some(s)) => s != status.as_str(), - Ok(None) => true, + Ok(current) => *current != status, Err(_) => true, }; if changed { diff --git a/remote/cache-service/src/types.rs b/remote/cache-service/src/types.rs index 978fc16..16c7c18 100644 --- a/remote/cache-service/src/types.rs +++ b/remote/cache-service/src/types.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; pub enum DoorStatus { Open, Closed, + Offline, } impl DoorStatus { @@ -12,6 +13,7 @@ impl DoorStatus { match self { DoorStatus::Open => "open", DoorStatus::Closed => "closed", + DoorStatus::Offline => "offline", } } @@ -19,6 +21,7 @@ impl DoorStatus { match s { "open" => Some(DoorStatus::Open), "closed" => Some(DoorStatus::Closed), + "offline" => Some(DoorStatus::Offline), _ => None, } } @@ -26,9 +29,9 @@ impl DoorStatus { #[derive(Debug, Clone, Serialize)] pub struct StatusResponse { - pub status: String, // "open", "closed", or "offline" - pub timestamp: Option, - pub last_seen: Option, + pub status: DoorStatus, + pub since: Option, // when the current status was set + pub last_checked: Option, // when the cache last attempted to poll } #[derive(Debug, Clone)] @@ -36,3 +39,34 @@ pub struct WebhookTarget { pub url: String, pub secret: Option, } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn door_status_round_trip() { + for status in [DoorStatus::Open, DoorStatus::Closed, DoorStatus::Offline] { + let s = status.as_str(); + assert_eq!(DoorStatus::from_str(s), Some(status)); + } + } + + #[test] + fn door_status_from_str_rejects_unknown() { + assert_eq!(DoorStatus::from_str("unknown"), None); + assert_eq!(DoorStatus::from_str(""), None); + } + + #[test] + fn door_status_serde_lowercase() { + let json = serde_json::to_string(&DoorStatus::Open).unwrap(); + assert_eq!(json, "\"open\""); + + let deserialized: DoorStatus = serde_json::from_str("\"closed\"").unwrap(); + assert_eq!(deserialized, DoorStatus::Closed); + + let deserialized: DoorStatus = serde_json::from_str("\"offline\"").unwrap(); + assert_eq!(deserialized, DoorStatus::Offline); + } +} diff --git a/remote/discord-bot/Cargo.toml b/remote/discord-bot/Cargo.toml index a14b659..3dd4a51 100644 --- a/remote/discord-bot/Cargo.toml +++ b/remote/discord-bot/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" anyhow = "1.0" axum = "0.8" noisebell-common = { path = "../noisebell-common" } +reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serenity = { version = "0.12", default-features = false, features = ["client", "gateway", "model", "rustls_backend"] } diff --git a/remote/discord-bot/module.nix b/remote/discord-bot/module.nix index 3eff505..faad73d 100644 --- a/remote/discord-bot/module.nix +++ b/remote/discord-bot/module.nix @@ -33,6 +33,17 @@ in type = lib.types.path; description = "Path to file containing the webhook secret."; }; + + imageBaseUrl = lib.mkOption { + type = lib.types.str; + default = "https://noisebell.extremist.software/image"; + description = "Base URL for status images used in Discord embeds."; + }; + + cacheUrl = lib.mkOption { + type = lib.types.str; + description = "URL of the cache service for slash commands (e.g. http://localhost:3000)."; + }; }; config = lib.mkIf cfg.enable { @@ -54,6 +65,8 @@ in environment = { NOISEBELL_DISCORD_PORT = toString cfg.port; NOISEBELL_DISCORD_CHANNEL_ID = cfg.channelId; + NOISEBELL_DISCORD_IMAGE_BASE_URL = cfg.imageBaseUrl; + NOISEBELL_DISCORD_CACHE_URL = cfg.cacheUrl; RUST_LOG = "info"; }; script = '' diff --git a/remote/discord-bot/src/main.rs b/remote/discord-bot/src/main.rs index d483d78..14e7006 100644 --- a/remote/discord-bot/src/main.rs +++ b/remote/discord-bot/src/main.rs @@ -2,28 +2,37 @@ use std::sync::Arc; use std::time::Duration; use anyhow::{Context, Result}; -use axum::extract::State; +use axum::extract::State as AxumState; use axum::http::{HeaderMap, StatusCode}; use axum::routing::{get, post}; use axum::{Json, Router}; use noisebell_common::{validate_bearer, WebhookPayload}; -use serenity::all::{ChannelId, Colour, CreateEmbed, CreateMessage, GatewayIntents}; +use serenity::all::{ + ChannelId, Colour, CommandInteraction, CreateCommand, CreateEmbed, CreateInteractionResponse, + CreateInteractionResponseMessage, CreateMessage, GatewayIntents, Interaction, +}; +use serenity::async_trait; use tower_http::trace::TraceLayer; -use tracing::{error, info, Level}; +use tracing::{error, info, warn, Level}; struct AppState { http: Arc, channel_id: ChannelId, webhook_secret: String, + image_base_url: String, + cache_url: String, + client: reqwest::Client, } -fn build_embed(status: &str, timestamp: u64) -> CreateEmbed { - let (colour, title, description, image_url) = match status { - "open" => (Colour::from_rgb(0, 255, 0), "Noisebridge is Open!", "It's time to start hacking.", "https://noisebell.extremist.software/image/open.png"), - "closed" => (Colour::from_rgb(255, 0, 0), "Noisebridge is Closed!", "We'll see you again soon.", "https://noisebell.extremist.software/image/closed.png"), - _ => (Colour::from_rgb(153, 170, 181), "Noisebridge is Offline", "The Noisebridge Pi is not responding.", "https://noisebell.extremist.software/image/offline.png"), +fn build_embed(status: &str, timestamp: u64, image_base_url: &str) -> CreateEmbed { + let (colour, title, description, image_file) = match status { + "open" => (Colour::from_rgb(0, 255, 0), "Noisebridge is Open!", "It's time to start hacking.", "open.png"), + "closed" => (Colour::from_rgb(255, 0, 0), "Noisebridge is Closed!", "We'll see you again soon.", "closed.png"), + _ => (Colour::from_rgb(153, 170, 181), "Noisebridge is Offline", "The Noisebridge Pi is not responding.", "offline.png"), }; + let image_url = format!("{image_base_url}/{image_file}"); + CreateEmbed::new() .title(title) .description(description) @@ -33,7 +42,7 @@ fn build_embed(status: &str, timestamp: u64) -> CreateEmbed { } async fn post_webhook( - State(state): State>, + AxumState(state): AxumState>, headers: HeaderMap, Json(body): Json, ) -> StatusCode { @@ -43,7 +52,7 @@ async fn post_webhook( info!(status = %body.status, timestamp = body.timestamp, "received webhook"); - let embed = build_embed(&body.status, body.timestamp); + let embed = build_embed(&body.status, body.timestamp, &state.image_base_url); let message = CreateMessage::new().embed(embed); match state.channel_id.send_message(&state.http, message).await { @@ -58,9 +67,227 @@ async fn post_webhook( } } -struct Handler; +fn unix_now() -> u64 { + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_secs() +} -impl serenity::all::EventHandler for Handler {} +fn format_timestamp(ts: u64) -> String { + format!("", ts) +} + +async fn handle_status(state: &AppState, _command: &CommandInteraction) -> CreateInteractionResponse { + let url = format!("{}/status", state.cache_url); + let resp = state.client.get(&url).send().await; + + let embed = match resp { + Ok(resp) if resp.status().is_success() => { + match resp.json::().await { + Ok(data) => { + let status = data.get("status").and_then(|s| s.as_str()).unwrap_or("unknown"); + let since = data.get("since").and_then(|t| t.as_u64()); + let last_checked = data.get("last_checked").and_then(|t| t.as_u64()); + + let mut embed = build_embed(status, since.unwrap_or(unix_now()), &state.image_base_url); + + let mut fields = Vec::new(); + if let Some(ts) = since { + fields.push(("Since", format_timestamp(ts), true)); + } + if let Some(ts) = last_checked { + fields.push(("Last Checked", format_timestamp(ts), true)); + } + if !fields.is_empty() { + embed = embed.fields(fields); + } + embed + } + Err(e) => { + error!(error = %e, "failed to parse status response"); + CreateEmbed::new() + .title("Error") + .description("Failed to parse status response.") + .colour(Colour::from_rgb(255, 0, 0)) + } + } + } + _ => { + CreateEmbed::new() + .title("Error") + .description("Failed to reach the cache service.") + .colour(Colour::from_rgb(255, 0, 0)) + } + }; + + CreateInteractionResponse::Message( + CreateInteractionResponseMessage::new().embed(embed) + ) +} + +async fn handle_info(state: &AppState, _command: &CommandInteraction) -> CreateInteractionResponse { + let url = format!("{}/info", state.cache_url); + let resp = state.client.get(&url).send().await; + + let embed = match resp { + Ok(resp) if resp.status().is_success() => { + match resp.json::().await { + Ok(data) => { + let mut fields = Vec::new(); + + if let Some(temp) = data.get("cpu_temp_celsius").and_then(|t| t.as_f64()) { + fields.push(("CPU Temp", format!("{:.1}°C", temp), true)); + } + if let Some(load) = data.get("load_average").and_then(|l| l.as_array()) { + let loads: Vec = load.iter().filter_map(|v| v.as_f64()).map(|v| format!("{:.2}", v)).collect(); + fields.push(("Load Average", loads.join(", "), true)); + } + if let Some(total) = data.get("memory_total_kb").and_then(|t| t.as_u64()) { + if let Some(avail) = data.get("memory_available_kb").and_then(|a| a.as_u64()) { + let used = total.saturating_sub(avail); + fields.push(("Memory", format!("{} / {} MB", used / 1024, total / 1024), true)); + } + } + if let Some(total) = data.get("disk_total_bytes").and_then(|t| t.as_u64()) { + if let Some(avail) = data.get("disk_available_bytes").and_then(|a| a.as_u64()) { + let used = total.saturating_sub(avail); + fields.push(("Disk", format!("{:.1} / {:.1} GB", used as f64 / 1e9, total as f64 / 1e9), true)); + } + } + if let Some(uptime) = data.get("uptime_secs").and_then(|u| u.as_u64()) { + let hours = uptime / 3600; + let mins = (uptime % 3600) / 60; + fields.push(("Uptime", format!("{}h {}m", hours, mins), true)); + } + if let Some(version) = data.get("nixos_version").and_then(|v| v.as_str()) { + fields.push(("NixOS", version.to_string(), true)); + } + if let Some(commit) = data.get("commit").and_then(|c| c.as_str()) { + fields.push(("Commit", commit.to_string(), true)); + } + + CreateEmbed::new() + .title("Noisebridge Pi Info") + .colour(Colour::BLUE) + .fields(fields) + } + Err(e) => { + error!(error = %e, "failed to parse info response"); + CreateEmbed::new() + .title("Error") + .description("Failed to parse Pi info.") + .colour(Colour::from_rgb(255, 0, 0)) + } + } + } + _ => { + CreateEmbed::new() + .title("Error") + .description("Failed to reach the cache service.") + .colour(Colour::from_rgb(255, 0, 0)) + } + }; + + CreateInteractionResponse::Message( + CreateInteractionResponseMessage::new().embed(embed) + ) +} + +async fn handle_history(state: &AppState, _command: &CommandInteraction) -> CreateInteractionResponse { + let url = format!("{}/history", state.cache_url); + let resp = state.client.get(&url).send().await; + + let embed = match resp { + Ok(resp) if resp.status().is_success() => { + match resp.json::>().await { + Ok(entries) => { + let lines: Vec = entries.iter().take(10).map(|entry| { + let status = entry.get("status").and_then(|s| s.as_str()).unwrap_or("unknown"); + let ts = entry.get("timestamp").and_then(|t| t.as_u64()).unwrap_or(0); + let emoji = match status { + "open" => "🟢", + "closed" => "🔴", + "offline" => "⚪", + _ => "❓", + }; + format!("{} **{}** — {}", emoji, status, format_timestamp(ts)) + }).collect(); + + let description = if lines.is_empty() { + "No history available.".to_string() + } else { + lines.join("\n") + }; + + CreateEmbed::new() + .title("Recent Door History") + .description(description) + .colour(Colour::BLUE) + } + Err(e) => { + error!(error = %e, "failed to parse history response"); + CreateEmbed::new() + .title("Error") + .description("Failed to parse history.") + .colour(Colour::from_rgb(255, 0, 0)) + } + } + } + _ => { + CreateEmbed::new() + .title("Error") + .description("Failed to reach the cache service.") + .colour(Colour::from_rgb(255, 0, 0)) + } + }; + + CreateInteractionResponse::Message( + CreateInteractionResponseMessage::new().embed(embed) + ) +} + +struct Handler { + state: Arc, +} + +#[async_trait] +impl serenity::all::EventHandler for Handler { + async fn ready(&self, ctx: serenity::all::Context, ready: serenity::model::gateway::Ready) { + info!(user = %ready.user.name, "Discord bot connected"); + + let commands = vec![ + CreateCommand::new("status").description("Show the current door status"), + CreateCommand::new("info").description("Show Pi system information"), + CreateCommand::new("history").description("Show recent door history"), + ]; + + if let Err(e) = serenity::all::Command::set_global_commands(&ctx.http, commands).await { + error!(error = %e, "failed to register slash commands"); + } else { + info!("slash commands registered"); + } + } + + async fn interaction_create(&self, ctx: serenity::all::Context, interaction: Interaction) { + if let Interaction::Command(command) = interaction { + let response = match command.data.name.as_str() { + "status" => handle_status(&self.state, &command).await, + "info" => handle_info(&self.state, &command).await, + "history" => handle_history(&self.state, &command).await, + _ => { + CreateInteractionResponse::Message( + CreateInteractionResponseMessage::new().content("Unknown command.") + ) + } + }; + + if let Err(e) = command.create_response(&ctx.http, response).await { + error!(error = %e, command = %command.data.name, "failed to respond to slash command"); + } + } + } +} #[tokio::main] async fn main() -> Result<()> { @@ -84,20 +311,47 @@ async fn main() -> Result<()> { .parse() .context("NOISEBELL_DISCORD_PORT must be a valid u16")?; + let image_base_url = std::env::var("NOISEBELL_DISCORD_IMAGE_BASE_URL") + .unwrap_or_else(|_| "https://noisebell.extremist.software/image".into()) + .trim_end_matches('/') + .to_string(); + + let cache_url = std::env::var("NOISEBELL_DISCORD_CACHE_URL") + .context("NOISEBELL_DISCORD_CACHE_URL is required")? + .trim_end_matches('/') + .to_string(); + info!(port, channel_id, "starting noisebell-discord"); + let client = reqwest::Client::builder() + .timeout(Duration::from_secs(10)) + .build() + .context("failed to build HTTP client")?; + let intents = GatewayIntents::empty(); - let mut initial_client = serenity::Client::builder(&discord_token, intents) - .event_handler(Handler) + let mut discord_client = serenity::Client::builder(&discord_token, intents) + .event_handler_arc(Arc::new(Handler { + state: Arc::new(AppState { + http: Arc::new(serenity::all::Http::new(&discord_token)), + channel_id: ChannelId::new(channel_id), + webhook_secret: webhook_secret.clone(), + image_base_url: image_base_url.clone(), + cache_url: cache_url.clone(), + client: client.clone(), + }), + })) .await .context("failed to create Discord client")?; - let http = initial_client.http.clone(); + let http = discord_client.http.clone(); let app_state = Arc::new(AppState { http, channel_id: ChannelId::new(channel_id), webhook_secret, + image_base_url, + cache_url, + client, }); let app = Router::new() @@ -116,28 +370,14 @@ async fn main() -> Result<()> { info!(port, "webhook listener ready"); - // Gateway reconnect loop — the Http client for sending messages is independent - let token_for_gateway = discord_token.clone(); + // Spawn gateway connection for slash commands tokio::spawn(async move { - if let Err(e) = initial_client.start().await { - error!(error = %e, "Discord gateway disconnected"); - } loop { - tokio::time::sleep(Duration::from_secs(5)).await; - info!("reconnecting to Discord gateway"); - match serenity::Client::builder(&token_for_gateway, GatewayIntents::empty()) - .event_handler(Handler) - .await - { - Ok(mut client) => { - if let Err(e) = client.start().await { - error!(error = %e, "Discord gateway disconnected"); - } - } - Err(e) => { - error!(error = %e, "failed to create Discord client"); - } + if let Err(e) = discord_client.start().await { + error!(error = %e, "Discord gateway disconnected"); } + warn!("reconnecting to Discord gateway in 5s"); + tokio::time::sleep(Duration::from_secs(5)).await; } }); diff --git a/remote/flake.lock b/remote/flake.lock deleted file mode 100644 index 5385057..0000000 --- a/remote/flake.lock +++ /dev/null @@ -1,64 +0,0 @@ -{ - "nodes": { - "crane": { - "locked": { - "lastModified": 1773115265, - "narHash": "sha256-5fDkKTYEgue2klksd52WvcXfZdY1EIlbk0QggAwpFog=", - "owner": "ipetkov", - "repo": "crane", - "rev": "27711550d109bf6236478dc9f53b9e29c1a374c5", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1772963539, - "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "crane": "crane", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1773115373, - "narHash": "sha256-bfK9FJFcQth6f3ydYggS5m0z2NRGF/PY6Y2XgZDJ6pg=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "1924b4672a2b8e4aee6e6652ec2e59a8d3c5648e", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/remote/flake.nix b/remote/flake.nix deleted file mode 100644 index 0af03a3..0000000 --- a/remote/flake.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - description = "Noisebell remote services"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - crane.url = "github:ipetkov/crane"; - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - - outputs = { self, nixpkgs, crane, rust-overlay }: - let - system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - overlays = [ rust-overlay.overlays.default ]; - }; - - rustToolchain = pkgs.rust-bin.stable.latest.default; - craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; - - src = craneLib.cleanCargoSource ./.; - - commonArgs = { - inherit src; - pname = "noisebell"; - version = "0.1.0"; - strictDeps = true; - doCheck = false; - }; - - cargoArtifacts = craneLib.buildDepsOnly commonArgs; - - buildMember = name: craneLib.buildPackage (commonArgs // { - inherit cargoArtifacts; - cargoExtraArgs = "-p ${name}"; - }); - - noisebell-cache = buildMember "noisebell-cache"; - noisebell-discord = buildMember "noisebell-discord"; - noisebell-rss = buildMember "noisebell-rss"; - in - { - packages.${system} = { - inherit noisebell-cache noisebell-discord noisebell-rss; - default = noisebell-cache; - }; - - nixosModules = { - cache = import ./cache-service/module.nix noisebell-cache; - discord = import ./discord-bot/module.nix noisebell-discord; - rss = import ./rss-service/module.nix noisebell-rss; - default = { imports = [ - (import ./cache-service/module.nix noisebell-cache) - (import ./discord-bot/module.nix noisebell-discord) - (import ./rss-service/module.nix noisebell-rss) - ]; }; - }; - - devShells.${system}.default = craneLib.devShell { - packages = [ pkgs.rust-analyzer ]; - }; - }; -} diff --git a/remote/noisebell-common/Cargo.toml b/remote/noisebell-common/Cargo.toml index 7f0eece..6cb2d0e 100644 --- a/remote/noisebell-common/Cargo.toml +++ b/remote/noisebell-common/Cargo.toml @@ -6,3 +6,6 @@ edition = "2021" [dependencies] axum = "0.8" serde = { version = "1.0", features = ["derive"] } + +[dev-dependencies] +serde_json = "1.0" diff --git a/remote/noisebell-common/src/lib.rs b/remote/noisebell-common/src/lib.rs index 002214d..2c96ade 100644 --- a/remote/noisebell-common/src/lib.rs +++ b/remote/noisebell-common/src/lib.rs @@ -22,3 +22,44 @@ pub struct HistoryEntry { pub timestamp: u64, pub recorded_at: u64, } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn validate_bearer_accepts_correct_token() { + let mut headers = HeaderMap::new(); + headers.insert("authorization", "Bearer secret123".parse().unwrap()); + assert!(validate_bearer(&headers, "secret123")); + } + + #[test] + fn validate_bearer_rejects_wrong_token() { + let mut headers = HeaderMap::new(); + headers.insert("authorization", "Bearer wrong".parse().unwrap()); + assert!(!validate_bearer(&headers, "secret123")); + } + + #[test] + fn validate_bearer_rejects_missing_header() { + let headers = HeaderMap::new(); + assert!(!validate_bearer(&headers, "secret123")); + } + + #[test] + fn validate_bearer_rejects_non_bearer_scheme() { + let mut headers = HeaderMap::new(); + headers.insert("authorization", "Basic secret123".parse().unwrap()); + assert!(!validate_bearer(&headers, "secret123")); + } + + #[test] + fn webhook_payload_round_trips() { + let payload = WebhookPayload { status: "open".into(), timestamp: 1234567890 }; + let json = serde_json::to_string(&payload).unwrap(); + let deserialized: WebhookPayload = serde_json::from_str(&json).unwrap(); + assert_eq!(deserialized.status, "open"); + assert_eq!(deserialized.timestamp, 1234567890); + } +}