Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Greet' example does not work on Windows 11 or Linux (Pop_OS 22.04) #147

Open
pyroraptor07 opened this issue Jun 4, 2023 · 3 comments
Open

Comments

@pyroraptor07
Copy link

The 'greet' example from this repo gives the following error in the devtools console on Windows:

Fetch API cannot load ipc://localhost/greet/greet. URL scheme "ipc" is not supported.

On Linux, the following error is received instead:

[Error] Origin http://localhost:1420 is not allowed by Access-Control-Allow-Origin. Status code: 200
[Error] Failed to load resource: Origin http://localhost:1420 is not allowed by Access-Control-Allow-Origin. Status code: 200 (greet, line 0)
[Error] Fetch API cannot load ipc://localhost/greet/greet due to access control checks.

The example does appear to work just fine on MacOS.

Steps to reproduce:

  1. Clone a fresh copy of the tauri-bindgen repository to the test machine
  2. Checkout the 'v.0.2.0' tag
  3. Change directory into the 'examples/greet' folder and run 'cargo tauri dev'
  4. Open the console in devtools, enter a name into the main window text box, then hit the 'Greet' button

Expected result:

Text to appear below the text box with a greeting using the name provided.

Actual result:

Nothing appears in the main window and errors appear in the devtools console.
tauri-bindgen-error_windows.txt
tauri-bindgen-error_linux.txt

@JonasKruckenberg
Copy link
Contributor

JonasKruckenberg commented Jun 5, 2023

Thanks for the report, I kinda expected this to be the case since I haven't tried the new ipc router on windows or linux yet. Thanks for the heads up though 👍

Edit: For later reference the url scheme on windows looks like this https://${protocol}.localhost/${path}

Edit2: Fixing this on linux is more difficult since older versions of webkitgtk don't preserve request bodies (please don't ask why, I don't know myself it's absolutely stupid) with this only being fixed in the very latest versions. We're currently exploring all possible options (including potentially replacing webkitgtk with chromium) so any ideas are very welcome here

@Zercerium
Copy link
Contributor

Zercerium commented Jul 3, 2023

I could try to provide a PR for this (to fix this on Windows).

I would use conditional compilation or any other suggestions. (Command line flag?)
At the moment the CI is running on Linux. Suggestion would be for the moment to just add an extra condition for windows.

Would that be ok?

Edit1:

  • Generation for Windows and Mac via CLI should be straight forward
  • Open Question: How to deal with WebAssembly (WASM) to set the correct OS?
    • add a build.rs to guest-rust?

@Zercerium
Copy link
Contributor

any updates?
my current suggestion would be to add a flag and if not present fall back to the current os as the default, I think I could provide a PR draft if I know what the way to go should be.

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

No branches or pull requests

3 participants