feat: probe autoupdate (#88)

* feat: autoupdate

* chore: bump version

* feat: publish installer

* fix: standalone builds

* ci: release docs

* fix: windows icmp socket

* docs: windows notice

* docs: remove line breaks
This commit is contained in:
LowderPlay
2026-08-29 00:22:08 +05:00
committed by GitHub
parent 0c43f470cd
commit 63dff075c0
29 changed files with 1734 additions and 203 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "website"
version = "1.2.4"
version = "1.2.5"
edition = "2024"
[dependencies]
+2
View File
@@ -6,6 +6,7 @@ mod database_refresh;
mod db;
mod mqtt;
mod mqtt_auth;
mod probe_installer;
mod whitelist;
use env_logger::Env;
@@ -106,6 +107,7 @@ async fn rocket() -> _ {
)
.mount("/agency", routes![agency::upload_report])
.mount("/mqtt", routes![mqtt_auth::auth, mqtt_auth::acl])
.mount("/", routes![probe_installer::download])
.mount("/whitelist", routes![whitelist::export_csv])
.register("/", catchers![api_error])
}
+13 -1
View File
@@ -120,7 +120,11 @@ pub async fn acl(
}
async fn can_probe_subscribe(client_id: &str, topic: &str, pool: &PgPool) -> bool {
if topic == "probe/config/v1" || is_own_task_subscription(client_id, topic) {
if topic == "probe/config/v1"
|| topic == "probe/update/v1"
|| topic == format!("probe/update/v1/{client_id}")
|| is_own_task_subscription(client_id, topic)
{
return true;
}
if !is_global_task_subscription(topic) {
@@ -182,6 +186,14 @@ mod tests {
assert!(!is_own_task_subscription("42", "probe/tasks/v1/#"));
}
#[rocket::async_test]
async fn update_subscriptions_are_node_scoped() {
let pool = PgPool::connect_lazy("postgres://localhost/unused").unwrap();
assert!(can_probe_subscribe("42", "probe/update/v1", &pool).await);
assert!(can_probe_subscribe("42", "probe/update/v1/42", &pool).await);
assert!(!can_probe_subscribe("42", "probe/update/v1/7", &pool).await);
}
#[test]
fn results_can_only_be_published_as_the_authenticated_node() {
assert!(can_probe_publish("42", "probe/results/v1/job/42"));
+8
View File
@@ -0,0 +1,8 @@
use rocket::http::ContentType;
const INSTALLER: &str = include_str!("../../probe/install.sh");
#[get("/install-probe.sh")]
pub fn download() -> (ContentType, &'static str) {
(ContentType::new("text", "x-shellscript"), INSTALLER)
}