Show guidelines on UI on how to setup network hook
This commit is contained in:
@ -5,6 +5,7 @@ use crate::constants::{DISK_NAME_MAX_LEN, DISK_NAME_MIN_LEN, DISK_SIZE_MAX, DISK
|
||||
use crate::controllers::{HttpResult, LibVirtReq};
|
||||
use crate::extractors::local_auth_extractor::LocalAuthEnabled;
|
||||
use crate::libvirt_rest_structures::hypervisor::HypervisorInfo;
|
||||
use crate::nat::nat_hook;
|
||||
use crate::utils::net_utils;
|
||||
use actix_web::{HttpResponse, Responder};
|
||||
use sysinfo::{System, SystemExt};
|
||||
@ -120,6 +121,21 @@ pub async fn server_info(client: LibVirtReq) -> HttpResult {
|
||||
}))
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct NetworkHookStatus {
|
||||
installed: bool,
|
||||
content: String,
|
||||
path: &'static str,
|
||||
}
|
||||
|
||||
pub async fn network_hook_status() -> HttpResult {
|
||||
Ok(HttpResponse::Ok().json(NetworkHookStatus {
|
||||
installed: nat_hook::is_installed()?,
|
||||
content: nat_hook::hook_content()?,
|
||||
path: constants::NAT_HOOK_PATH,
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn number_vcpus() -> HttpResult {
|
||||
let mut system = System::new();
|
||||
system.refresh_cpu();
|
||||
|
Reference in New Issue
Block a user