Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

interupt will navigate #53

Open
nanu-c opened this issue Mar 7, 2022 · 4 comments
Open

interupt will navigate #53

nanu-c opened this issue Mar 7, 2022 · 4 comments

Comments

@nanu-c
Copy link

nanu-c commented Mar 7, 2022

I need a programmatically interruption here to prevent site navigation on a page that generates a token. Would it be possible to have the a callback function?

@asticode
Copy link
Owner

asticode commented Mar 7, 2022

Are you using astilectron in go-astilectron?

@nanu-c
Copy link
Author

nanu-c commented Mar 7, 2022

Yes, in go-astilectron. The function in js that is triggering the navigation event is a callback function from google recaptcha. It's not possible for me to overwrite the captacha rendering.

An example js snippet would be:

function execute() {
	window.location ="appidentifier://token"
}
setTimeout(execute, 1000);

And this should go to window.location='http://" + config.ServerHost + ":" + config.ServerPort + "/?token=" + e.URLNew

but maybe i should open this issue in go-astilectron.

@asticode
Copy link
Owner

This is a tricky one, since right now there's no way in js astilectron to send a message and wait for its response before continuing js execution. Which is what would be needed:

  • in will-navigate, call go-astilectron to see whether we need to redirect this request
  • based on go-astilectron, call event.preventDefault() and update window.location manually if we need a redirection

I don't have a proper answer for you right now, I'd have to think about it.

@nanu-c
Copy link
Author

nanu-c commented May 9, 2022

I found another way, because i needed to circumvent the situation. I replace the original js with my own js that I have sideloaded. Then i reinitialize the captcha and finally i have the captcha on the correct domain and i can get the token and everyone is happy. Not a good solution in my eyes because it shows how sensible electron is, because i can do whatever i want and break sandboxing and browser security.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants