Compare commits
6 commits
497e489af7
...
97778e06dd
| Author | SHA1 | Date | |
|---|---|---|---|
| 97778e06dd | |||
| 27f4f8aa28 | |||
| 3cfd8860ca | |||
| a3add8ada3 | |||
| f2afa7e7be | |||
| 6d75421bc0 |
8 changed files with 6069 additions and 48 deletions
38
Cargo.toml
38
Cargo.toml
|
|
@ -1,39 +1,39 @@
|
||||||
[package]
|
[package]
|
||||||
name = "botdevice"
|
name = "botdevice"
|
||||||
version = "1.0.0"
|
version = "6.1.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 = { version = "2", features = ["unstable"] }
|
tauri = { workspace = true }
|
||||||
tauri-plugin-dialog = "2"
|
tauri-plugin-dialog = { workspace = true }
|
||||||
tauri-plugin-opener = "2"
|
tauri-plugin-opener = { workspace = true }
|
||||||
tauri-plugin-notification = "2"
|
tauri-plugin-notification = { workspace = true }
|
||||||
tauri-plugin-http = "2"
|
tauri-plugin-http = { workspace = true }
|
||||||
tauri-plugin-geolocation = "2"
|
tauri-plugin-geolocation = { workspace = true }
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
anyhow = "1.0"
|
log = { workspace = true }
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
android_logger = { workspace = true }
|
||||||
log = "0.4"
|
env_logger = { workspace = true }
|
||||||
android_logger = "0.14"
|
serde_json = { workspace = true }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
reqwest = { workspace = true, features = ["json"] }
|
||||||
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 = { version = "2", features = ["codegen"] }
|
tauri-build = { workspace = true, 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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
gen/schemas/acl-manifests.json
Normal file
1
gen/schemas/acl-manifests.json
Normal file
File diff suppressed because one or more lines are too long
1
gen/schemas/capabilities.json
Normal file
1
gen/schemas/capabilities.json
Normal 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://**"}]}]}}
|
||||||
3017
gen/schemas/desktop-schema.json
Normal file
3017
gen/schemas/desktop-schema.json
Normal file
File diff suppressed because it is too large
Load diff
3017
gen/schemas/linux-schema.json
Normal file
3017
gen/schemas/linux-schema.json
Normal file
File diff suppressed because it is too large
Load diff
28
src/lib.rs
28
src/lib.rs
|
|
@ -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")]
|
#[cfg(target_os = "android")]
|
||||||
fn init_logger() {
|
fn init_logger() {
|
||||||
android_logger::init_once(
|
android_logger::init_once(
|
||||||
|
|
@ -21,7 +12,6 @@ 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!({
|
||||||
|
|
@ -31,13 +21,12 @@ 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!("{}/api/messages", server_url))
|
.post(format!("{server_url}/api/messages"))
|
||||||
.json(&serde_json::json!({ "text": message }))
|
.json(&serde_json::json!({ "text": message }))
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
|
|
@ -57,21 +46,20 @@ 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![
|
.invoke_handler(tauri::generate_handler![get_device_info, send_to_bot])
|
||||||
get_device_info,
|
.setup(|_app| {
|
||||||
send_to_bot
|
|
||||||
])
|
|
||||||
.setup(|app| {
|
|
||||||
log::info!("BotOS initialized, loading botui...");
|
log::info!("BotOS initialized, loading botui...");
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
let window = app.get_webview_window("main").unwrap();
|
use tauri::Manager;
|
||||||
window.open_devtools();
|
if let Some(window) = _app.get_webview_window("main") {
|
||||||
|
window.open_devtools();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error running BotOS");
|
.unwrap_or_else(|e| log::error!("BotOS failed to start: {e}"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,7 @@
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": ["apk", "aab"],
|
"targets": "all",
|
||||||
"android": {
|
|
||||||
"minSdkVersion": 24
|
|
||||||
},
|
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/icon.png"
|
"icons/icon.png"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue