Skip to content

Commit

Permalink
Fixed JS part for Edge.
Browse files Browse the repository at this point in the history
  • Loading branch information
Revertron committed May 7, 2021
1 parent 01e97ed commit 8c2e89d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ FileDescription="Alternative Free Identity System"

[features]
webgui = ["web-view", "tinyfiledialogs", "open"]
edge = ["web-view/edge"]
edge = ["webgui", "web-view/edge"]
default = ["webgui"]
1 change: 1 addition & 0 deletions src/web_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ fn action_load_key(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
}

fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
info!("Interface loaded");
web_view.eval("showMiningIndicator(false, false);").expect("Error evaluating!");
let handle: Handle<()> = web_view.handle();
let threads = context.lock().unwrap().settings.mining.threads;
Expand Down
8 changes: 7 additions & 1 deletion src/webview/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ function editDomain(domain, event) {
function onLoad() {
// Workaround for Arch Linux Webkit
// https://github.com/Boscop/web-view/issues/212#issuecomment-671055663
window.external={invoke:function(x){window.webkit.messageHandlers.external.postMessage(x);}};
if (typeof window.external == 'undefined' || typeof window.external.invoke == 'undefined') {
window.external = {
invoke: function(x) {
window.webkit.messageHandlers.external.postMessage(x);
}
};
}

external.invoke(JSON.stringify({cmd: 'loaded'}));
}
Expand Down

0 comments on commit 8c2e89d

Please sign in to comment.