mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-08-27 12:53:00 +02:00
v0.9.6: InfoNet hashchain, Wormhole gate encryption, mesh reputation, 16 community contributors
Gate messages now propagate via the Infonet hashchain as encrypted blobs — every node syncs them through normal chain sync while only Gate members with MLS keys can decrypt. Added mesh reputation system, peer push workers, voluntary Wormhole opt-in for node participation, fork recovery, killwormhole scripts, obfuscated terminology, and hardened the self-updater to protect encryption keys and chain state during updates. New features: Shodan search, train tracking, Sentinel Hub imagery, 8 new intelligence layers, CCTV expansion to 11,000+ cameras across 6 countries, Mesh Terminal CLI, prediction markets, desktop-shell scaffold, and comprehensive mesh test suite (215 frontend + backend tests passing). Community contributors: @wa1id, @AlborzNazari, @adust09, @Xpirix, @imqdcr, @csysp, @suranyami, @chr0n1x, @johan-martensson, @singularfailure, @smithbh, @OrfeoTerkuci, @deuza, @tm-const, @Elhard1, @ttulttul
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
use serde_json::Value;
|
||||
use tauri::State;
|
||||
|
||||
use crate::{handlers::dispatch_control_command, DesktopAppState};
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn invoke_local_control(
|
||||
command: String,
|
||||
payload: Option<Value>,
|
||||
state: State<'_, DesktopAppState>,
|
||||
) -> Result<Value, String> {
|
||||
dispatch_control_command(
|
||||
&state.backend_base_url,
|
||||
state.admin_key.as_deref(),
|
||||
&command,
|
||||
payload,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
use reqwest::Method;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::http_client::call_backend_json;
|
||||
|
||||
pub async fn dispatch_control_command(
|
||||
backend_base_url: &str,
|
||||
admin_key: Option<&str>,
|
||||
command: &str,
|
||||
payload: Option<Value>,
|
||||
) -> Result<Value, String> {
|
||||
match command {
|
||||
"wormhole.status" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/wormhole/status", Method::GET, None).await
|
||||
}
|
||||
"wormhole.connect" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/wormhole/connect", Method::POST, None).await
|
||||
}
|
||||
"wormhole.disconnect" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/wormhole/disconnect", Method::POST, None).await
|
||||
}
|
||||
"wormhole.restart" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/wormhole/restart", Method::POST, None).await
|
||||
}
|
||||
"settings.wormhole.get" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/wormhole", Method::GET, None).await
|
||||
}
|
||||
"settings.wormhole.set" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/wormhole", Method::PUT, payload).await
|
||||
}
|
||||
"settings.privacy.get" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/privacy-profile", Method::GET, None).await
|
||||
}
|
||||
"settings.privacy.set" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/privacy-profile", Method::PUT, payload).await
|
||||
}
|
||||
"settings.api_keys.get" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/api-keys", Method::GET, None).await
|
||||
}
|
||||
"settings.api_keys.set" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/api-keys", Method::PUT, payload).await
|
||||
}
|
||||
"settings.news.get" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/news-feeds", Method::GET, None).await
|
||||
}
|
||||
"settings.news.set" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/news-feeds", Method::PUT, payload).await
|
||||
}
|
||||
"settings.news.reset" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/settings/news-feeds/reset", Method::POST, None).await
|
||||
}
|
||||
"system.update" => {
|
||||
call_backend_json(backend_base_url, admin_key, "/api/system/update", Method::POST, None).await
|
||||
}
|
||||
_ => Err(format!("unsupported_control_command:{command}")),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
use reqwest::Method;
|
||||
use serde_json::Value;
|
||||
|
||||
pub async fn call_backend_json(
|
||||
base_url: &str,
|
||||
admin_key: Option<&str>,
|
||||
path: &str,
|
||||
method: Method,
|
||||
payload: Option<Value>,
|
||||
) -> Result<Value, String> {
|
||||
let client = reqwest::Client::new();
|
||||
let mut request = client.request(method, format!("{base_url}{path}"));
|
||||
if let Some(key) = admin_key {
|
||||
if !key.trim().is_empty() {
|
||||
request = request.header("X-Admin-Key", key);
|
||||
}
|
||||
}
|
||||
if let Some(value) = payload {
|
||||
request = request.json(&value);
|
||||
}
|
||||
let response = request
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| format!("backend_request_failed:{e}"))?;
|
||||
let status = response.status();
|
||||
let text = response
|
||||
.text()
|
||||
.await
|
||||
.map_err(|e| format!("backend_response_failed:{e}"))?;
|
||||
let value: Value = serde_json::from_str(&text).unwrap_or_else(|_| serde_json::json!({}));
|
||||
if !status.is_success() || value.get("ok") == Some(&Value::Bool(false)) {
|
||||
let detail = value
|
||||
.get("detail")
|
||||
.and_then(|v| v.as_str())
|
||||
.or_else(|| value.get("message").and_then(|v| v.as_str()))
|
||||
.unwrap_or("native_control_request_failed");
|
||||
return Err(detail.to_string());
|
||||
}
|
||||
Ok(value)
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
mod bridge;
|
||||
mod handlers;
|
||||
mod http_client;
|
||||
|
||||
use bridge::invoke_local_control;
|
||||
|
||||
pub struct DesktopAppState {
|
||||
pub backend_base_url: String,
|
||||
pub admin_key: Option<String>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let backend_base_url =
|
||||
std::env::var("SHADOWBROKER_BACKEND_URL").unwrap_or_else(|_| "http://127.0.0.1:8000".to_string());
|
||||
let admin_key = std::env::var("SHADOWBROKER_ADMIN_KEY").ok();
|
||||
|
||||
tauri::Builder::default()
|
||||
.manage(DesktopAppState {
|
||||
backend_base_url,
|
||||
admin_key,
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![invoke_local_control])
|
||||
.setup(|app| {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let script = r#"
|
||||
window.__SHADOWBROKER_DESKTOP__ = {
|
||||
invokeLocalControl: (command, payload) =>
|
||||
window.__TAURI__.core.invoke('invoke_local_control', { command, payload })
|
||||
};
|
||||
"#;
|
||||
let _ = window.eval(script);
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("failed to run shadowbroker tauri shell");
|
||||
}
|
||||
Reference in New Issue
Block a user