1 unstable release
0.1.1 | Dec 21, 2024 |
---|
#4 in #uptime
131 downloads per month
80KB
206 lines
A library for UptimeKuma, at last
If you use both Rust and Kuma you may have noticed that there practically are no libraries for it, until now
Purpose
I made this program as part of a project integrate LEDs with Kuma
Usage
There is no binary of CLI yet but you can use the library, all you need is a few dependencies, a Kuma instance and an .env file
dotenv
# the key will look something like this
# do NOT include a ':' at the start, it is not needed
# don't share your key with anyone
KEY="EXAMPLEKEY"
# the URI should NOT include HTTP/HTTPS
# HTTP support is not currently included
URI="kuma.instance/metrics"
main.rs
#[tokio::main]
async fn main() {
let _ = dotenv();
let data = Kuma::new(env::var("URI").unwrap(), env::var("KEY").unwrap())
.get()
.await
.unwrap();
}
GUI
Installing
git clone https://github.com/toastxc/kuma-rs.git
cd kuma-rs/
rustup update
cargo b -r --example gui
cp ./target/release/examples/gui ./target/release/
sudo flatpak-builder --install --force-clean build-dir xyz.toastxc.Kuma.yaml
Running
cargo r --example gui
Library
Installing
cargo add kuma-rs
Dependencies
~4–15MB
~191K SLoC