Compare commits
No commits in common. "97778e06dd804be55ff761c7fe2788af0ef50626" and "497e489af7adc0918303a352322a184b730c1fd9" have entirely different histories.
97778e06dd
...
497e489af7
8 changed files with 48 additions and 6069 deletions
38
Cargo.toml
38
Cargo.toml
|
|
@ -1,39 +1,39 @@
|
||||||
[package]
|
[package]
|
||||||
name = "botdevice"
|
name = "botdevice"
|
||||||
version = "6.1.0"
|
version = "1.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "BotDevice - Android, HarmonyOS & IoT powered by General Bots"
|
description = "BotDevice - Android, HarmonyOS & IoT powered by General Bots"
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
repository = "https://github.com/GeneralBots/BotServer"
|
|
||||||
keywords = ["bot", "mobile", "android", "iot", "tauri"]
|
|
||||||
categories = ["gui", "embedded"]
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "botdevice_lib"
|
name = "botdevice_lib"
|
||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
# Core from botlib
|
||||||
|
botlib = { path = "../botlib", features = ["http-client"] }
|
||||||
|
|
||||||
# Tauri with mobile features
|
# Tauri with mobile features
|
||||||
tauri = { workspace = true }
|
tauri = { version = "2", features = ["unstable"] }
|
||||||
tauri-plugin-dialog = { workspace = true }
|
tauri-plugin-dialog = "2"
|
||||||
tauri-plugin-opener = { workspace = true }
|
tauri-plugin-opener = "2"
|
||||||
tauri-plugin-notification = { workspace = true }
|
tauri-plugin-notification = "2"
|
||||||
tauri-plugin-http = { workspace = true }
|
tauri-plugin-http = "2"
|
||||||
tauri-plugin-geolocation = { workspace = true }
|
tauri-plugin-geolocation = "2"
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
log = { workspace = true }
|
anyhow = "1.0"
|
||||||
android_logger = { workspace = true }
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
env_logger = { workspace = true }
|
log = "0.4"
|
||||||
serde_json = { workspace = true }
|
android_logger = "0.14"
|
||||||
reqwest = { workspace = true, features = ["json"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
|
tokio = { version = "1.41", features = ["rt-multi-thread", "macros"] }
|
||||||
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { workspace = true, features = ["codegen"] }
|
tauri-build = { version = "2", features = ["codegen"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["custom-protocol"]
|
default = ["custom-protocol"]
|
||||||
custom-protocol = ["tauri/custom-protocol"]
|
custom-protocol = ["tauri/custom-protocol"]
|
||||||
|
|
||||||
[lints]
|
|
||||||
workspace = true
|
|
||||||
|
|
|
||||||
2
build.rs
2
build.rs
|
|
@ -1,3 +1,3 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri_build::build();
|
tauri_build::build()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
{"default":{"identifier":"default","description":"BotOS default capabilities","local":true,"windows":["main"],"permissions":["core:default","dialog:default","opener:default","notification:default","http:default","geolocation:default",{"identifier":"http:default","allow":[{"url":"https://**"},{"url":"http://**"}]}]}}
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
36
src/lib.rs
36
src/lib.rs
|
|
@ -1,3 +1,12 @@
|
||||||
|
//! BotOS - Android launcher powered by General Bots
|
||||||
|
//!
|
||||||
|
//! Minimal Android OS replacement using Tauri + botui
|
||||||
|
//! - Replaces default launcher (home screen)
|
||||||
|
//! - Access to camera, GPS, notifications
|
||||||
|
//! - Connects to General Bots server
|
||||||
|
|
||||||
|
use tauri::Manager;
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
fn init_logger() {
|
fn init_logger() {
|
||||||
android_logger::init_once(
|
android_logger::init_once(
|
||||||
|
|
@ -12,6 +21,7 @@ fn init_logger() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tauri command: Get device info
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn get_device_info() -> serde_json::Value {
|
fn get_device_info() -> serde_json::Value {
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
|
|
@ -21,17 +31,18 @@ fn get_device_info() -> serde_json::Value {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tauri command: Send message to bot server
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn send_to_bot(message: String, server_url: String) -> Result<String, String> {
|
async fn send_to_bot(message: String, server_url: String) -> Result<String, String> {
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.post(format!("{server_url}/api/messages"))
|
.post(&format!("{}/api/messages", server_url))
|
||||||
.json(&serde_json::json!({ "text": message }))
|
.json(&serde_json::json!({ "text": message }))
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
response.text().await.map_err(|e| e.to_string())
|
response.text().await.map_err(|e| e.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,20 +57,21 @@ pub fn run() {
|
||||||
.plugin(tauri_plugin_notification::init())
|
.plugin(tauri_plugin_notification::init())
|
||||||
.plugin(tauri_plugin_http::init())
|
.plugin(tauri_plugin_http::init())
|
||||||
.plugin(tauri_plugin_geolocation::init())
|
.plugin(tauri_plugin_geolocation::init())
|
||||||
.invoke_handler(tauri::generate_handler![get_device_info, send_to_bot])
|
.invoke_handler(tauri::generate_handler![
|
||||||
.setup(|_app| {
|
get_device_info,
|
||||||
|
send_to_bot
|
||||||
|
])
|
||||||
|
.setup(|app| {
|
||||||
log::info!("BotOS initialized, loading botui...");
|
log::info!("BotOS initialized, loading botui...");
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
use tauri::Manager;
|
let window = app.get_webview_window("main").unwrap();
|
||||||
if let Some(window) = _app.get_webview_window("main") {
|
window.open_devtools();
|
||||||
window.open_devtools();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.unwrap_or_else(|e| log::error!("BotOS failed to start: {e}"));
|
.expect("error running BotOS");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": ["apk", "aab"],
|
||||||
|
"android": {
|
||||||
|
"minSdkVersion": 24
|
||||||
|
},
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/icon.png"
|
"icons/icon.png"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue