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

Help to migrate blichess to Capacitor 6 #2542

Closed
vovagorodok opened this issue Jan 2, 2025 · 2 comments
Closed

Help to migrate blichess to Capacitor 6 #2542

vovagorodok opened this issue Jan 2, 2025 · 2 comments

Comments

@vovagorodok
Copy link

vovagorodok commented Jan 2, 2025

In order to release blichess on Google Play, upgrade to Capacitor 6 (SDK 34) is needed.
The release in Google Play is needed so that as many people as possible can test the new protocol before adding it to other applications.
It was decided to write here because there is a greater chance to find a hint

Ported version compiles and works fine:
vovagorodok/blichess@bluetooth...vovagorodok:blichess:migrate-to-capacitor-6
Except one error. After migration, application can't connect to lichess.org, because of log:
File: https://localhost/ - Line 0 - Msg: Access to fetch at 'https://lichess.org/' from origin 'https://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I wonder what happened that Capacitor 6 now requires CORS from https://localhost/

@vovagorodok
Copy link
Author

vovagorodok commented Jan 12, 2025

Adding to capacitor.config.ts (according to https://capacitorjs.com/docs/guides/autofill-credentials#set-capacitor-server-hostname):

  server: {
    hostname: 'lichess.org',
    androidScheme: 'https'
  }

helps a bit (solve CORS issue?), but next issue is visible:
File: https://lichess.org/ - Line 1 - Msg: Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
Even for Capacitor 5 after adding it. Looks that adding server fix CORS for Capacitor 6, but broke somenhing for Capacitor 5 and 6

@vovagorodok
Copy link
Author

Fixed by adding to capacitor.config.ts (according to https://capacitorjs.com/docs/guides/autofill-credentials#set-capacitor-server-hostname):

  server: {
    hostname: 'localhost',
    androidScheme: 'http'
  }

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

1 participant