TestaDiMucca / kraftizen

A citizen of Kraftlaandia powered by Mineflayer
0 stars 0 forks source link

Web UI #14

Open Jkwok0714 opened 2 months ago

Jkwok0714 commented 2 months ago

A small web UI to show what bots are up to and their locations. Updates from bot on an interval.

May add option to recall them to home point or manually set a home point.

Jkwok0714 commented 2 months ago

Alternatively, package into a Tauri project. This may make it more accessible to users not familiar with node.

The Tauri project should simply control the node server, which is packaged by something like pkg.

use std::process::{Command, Child};

fn start_node_server() -> std::io::Result<Child> {
    let child = Command::new("./bin/your_node_app_executable")
        .spawn()?;
    Ok(child)
}

fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![start_node_server])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
import { invoke } from '@tauri-apps/api/tauri';

async function startServer() {
    try {
        await invoke('start_node_server');
        console.log('Server started successfully');
    } catch (e) {
        console.error('Failed to start server:', e);
    }
}
Jkwok0714 commented 1 month ago

Could be both, the node server may start a web server to configure the names, etc.