Compare commits

...

6 commits

8 changed files with 6069 additions and 48 deletions

View file

@ -1,39 +1,39 @@
[package]
name = "botdevice"
version = "1.0.0"
version = "6.1.0"
edition = "2021"
description = "BotDevice - Android, HarmonyOS & IoT powered by General Bots"
license = "AGPL-3.0"
repository = "https://github.com/GeneralBots/BotServer"
keywords = ["bot", "mobile", "android", "iot", "tauri"]
categories = ["gui", "embedded"]
[lib]
name = "botdevice_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[dependencies]
# Core from botlib
botlib = { path = "../botlib", features = ["http-client"] }
# Tauri with mobile features
tauri = { version = "2", features = ["unstable"] }
tauri-plugin-dialog = "2"
tauri-plugin-opener = "2"
tauri-plugin-notification = "2"
tauri-plugin-http = "2"
tauri-plugin-geolocation = "2"
tauri = { workspace = true }
tauri-plugin-dialog = { workspace = true }
tauri-plugin-opener = { workspace = true }
tauri-plugin-notification = { workspace = true }
tauri-plugin-http = { workspace = true }
tauri-plugin-geolocation = { workspace = true }
# Common
anyhow = "1.0"
chrono = { version = "0.4", features = ["serde"] }
log = "0.4"
android_logger = "0.14"
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"] }
log = { workspace = true }
android_logger = { workspace = true }
env_logger = { workspace = true }
serde_json = { workspace = true }
reqwest = { workspace = true, features = ["json"] }
[build-dependencies]
tauri-build = { version = "2", features = ["codegen"] }
tauri-build = { workspace = true, features = ["codegen"] }
[features]
default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]
[lints]
workspace = true

View file

@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build();
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"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

View file

@ -1,12 +1,3 @@
//! 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")]
fn init_logger() {
android_logger::init_once(
@ -21,7 +12,6 @@ fn init_logger() {
env_logger::init();
}
/// Tauri command: Get device info
#[tauri::command]
fn get_device_info() -> serde_json::Value {
serde_json::json!({
@ -31,13 +21,12 @@ fn get_device_info() -> serde_json::Value {
})
}
/// Tauri command: Send message to bot server
#[tauri::command]
async fn send_to_bot(message: String, server_url: String) -> Result<String, String> {
let client = reqwest::Client::new();
let response = client
.post(&format!("{}/api/messages", server_url))
.post(format!("{server_url}/api/messages"))
.json(&serde_json::json!({ "text": message }))
.send()
.await
@ -57,21 +46,20 @@ pub fn run() {
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_geolocation::init())
.invoke_handler(tauri::generate_handler![
get_device_info,
send_to_bot
])
.setup(|app| {
.invoke_handler(tauri::generate_handler![get_device_info, send_to_bot])
.setup(|_app| {
log::info!("BotOS initialized, loading botui...");
#[cfg(debug_assertions)]
{
let window = app.get_webview_window("main").unwrap();
window.open_devtools();
use tauri::Manager;
if let Some(window) = _app.get_webview_window("main") {
window.open_devtools();
}
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error running BotOS");
.unwrap_or_else(|e| log::error!("BotOS failed to start: {e}"));
}

View file

@ -22,10 +22,7 @@
},
"bundle": {
"active": true,
"targets": ["apk", "aab"],
"android": {
"minSdkVersion": 24
},
"targets": "all",
"icon": [
"icons/icon.png"
]