desktop enables are actually disabled
parent
e489fd7b5a
commit
b4b41e45e3
16
src/main.rs
16
src/main.rs
|
@ -97,6 +97,14 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
let upend = Arc::new(open_result.db);
|
let upend = Arc::new(open_result.db);
|
||||||
|
|
||||||
|
let ui_path = env::current_exe().unwrap().parent().unwrap().join("webui");
|
||||||
|
if !ui_path.exists() {
|
||||||
|
warn!("No Web UI directory present ({:?}), disabling...", ui_path);
|
||||||
|
}
|
||||||
|
let desktop_enabled = !matches.is_present("NO_DESKTOP");
|
||||||
|
let ui_enabled = ui_path.exists() && !matches.is_present("NO_UI");
|
||||||
|
let browser_enabled = desktop_enabled && !matches.is_present("NO_BROWSER");
|
||||||
|
|
||||||
#[cfg(feature = "previews")]
|
#[cfg(feature = "previews")]
|
||||||
let preview_store = Some(Arc::new(crate::previews::PreviewStore::new(
|
let preview_store = Some(Arc::new(crate::previews::PreviewStore::new(
|
||||||
upend.db_path.join("previews"),
|
upend.db_path.join("previews"),
|
||||||
|
@ -129,14 +137,10 @@ fn main() -> Result<()> {
|
||||||
),
|
),
|
||||||
job_container: job_container.clone(),
|
job_container: job_container.clone(),
|
||||||
preview_store,
|
preview_store,
|
||||||
|
desktop_enabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Start HTTP server
|
// Start HTTP server
|
||||||
let ui_path = env::current_exe().unwrap().parent().unwrap().join("webui");
|
|
||||||
if !ui_path.exists() {
|
|
||||||
warn!("No Web UI directory present ({:?}), disabling...", ui_path);
|
|
||||||
}
|
|
||||||
let ui_enabled = ui_path.exists() && !matches.is_present("NO_UI");
|
|
||||||
|
|
||||||
let mut cnt = 0;
|
let mut cnt = 0;
|
||||||
let server = loop {
|
let server = loop {
|
||||||
|
@ -195,7 +199,7 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
{
|
{
|
||||||
if !matches.is_present("NO_BROWSER") && !matches.is_present("NO_DESKTOP") && ui_enabled {
|
if browser_enabled && ui_enabled {
|
||||||
let ui_result = webbrowser::open(&format!("http://localhost:{}", bind.port()));
|
let ui_result = webbrowser::open(&format!("http://localhost:{}", bind.port()));
|
||||||
if ui_result.is_err() {
|
if ui_result.is_err() {
|
||||||
warn!("Could not open UI in browser!");
|
warn!("Could not open UI in browser!");
|
||||||
|
|
|
@ -38,6 +38,7 @@ pub struct State {
|
||||||
pub vault_name: Option<String>,
|
pub vault_name: Option<String>,
|
||||||
pub job_container: Arc<RwLock<JobContainer>>,
|
pub job_container: Arc<RwLock<JobContainer>>,
|
||||||
pub preview_store: Option<Arc<PreviewStore>>,
|
pub preview_store: Option<Arc<PreviewStore>>,
|
||||||
|
pub desktop_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -73,7 +74,7 @@ pub async fn get_raw(
|
||||||
|
|
||||||
if query.native.is_none() {
|
if query.native.is_none() {
|
||||||
Ok(Either::A(NamedFile::open(file_path)?))
|
Ok(Either::A(NamedFile::open(file_path)?))
|
||||||
} else if cfg!(feature = "desktop") {
|
} else if state.desktop_enabled {
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
{
|
{
|
||||||
info!("Opening {:?}...", file_path);
|
info!("Opening {:?}...", file_path);
|
||||||
|
|
Loading…
Reference in New Issue