Skip to content

Commit

Permalink
fix: remove redundant extension stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Sep 18, 2024
1 parent dc57341 commit b706e04
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src-tauri/src/functionality/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{log, util::paths::get_extensions_dir};
pub fn add_extension(win: &WebviewWindow, path: PathBuf) {
use webview2_com::{
Microsoft::Web::WebView2::Win32::{
ICoreWebView2EnvironmentOptions6, ICoreWebView2Profile7, ICoreWebView2_13,
ICoreWebView2Profile7, ICoreWebView2_13,
},
ProfileAddBrowserExtensionCompletedHandler,
};
Expand Down Expand Up @@ -47,27 +47,6 @@ pub fn add_extension(win: &WebviewWindow, path: PathBuf) {
}
};

let environment = match casted.Environment() {
Ok(environment) => environment,
Err(e) => {
log!("Failed to get Environment: {:?}", e);
return;
}
};

let environment = match environment.cast::<ICoreWebView2EnvironmentOptions6>() {
Ok(environment) => environment,
Err(e) => {
log!("Failed to cast environment: {:?}", e);
return;
}
};

match environment.SetAreBrowserExtensionsEnabled(true) {
Ok(_) => (),
Err(e) => log!("Failed to set browser extensions enabled: {:?}", e),
};

log!("Attempting to add extension...");

let handler = ProfileAddBrowserExtensionCompletedHandler::create(Box::new(|result, _ext| {
Expand Down Expand Up @@ -108,6 +87,9 @@ pub fn load_extensions(win: &WebviewWindow) {
}
}
}

// Refresh the page to ensure extensions are loaded
win.eval("window.location.reload();").unwrap_or_default();
}

#[cfg(not(target_os = "windows"))]
Expand Down

0 comments on commit b706e04

Please sign in to comment.