-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Locally Hosted Configuration has CORS conflict with API #1078
Comments
Would it make more sense to check if the hostname != pokerogue and set the serverUrl based on the hostname, then? |
Initially I tried to add in some overrides to define locally hosted server configs and have |
Wouldnt // Check if the current hostname is 'localhost' or an IP address, and ensure a port is specified
export const isLocal = (window.location.hostname === 'localhost' ||
/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(window.location.hostname)) &&
window.location.port !== '';
// Set the server URL based on whether it's local or not
export const serverUrl = isLocal ? `${window.location.hostname}:${window.location.port}` : ''; not be enough? So it is local if run on localhost or some IP with a port no matter what. And this should also fix the serverURL as far as i know |
Yeah that makes sense to me |
I tested this fix on my setup and had no issues using the network address and completing the area where it previously failed: |
Then please create a Pull Request with this change! |
@CodeTappert I think it would be best for you to make the pull request and link it to this issue seeing as it's your code :) |
Well then i will do that in like 9h or so. After i slept |
@IceFire03 See #1122 |
Locally Hosted in this context refers to running from source, using
npm run start:dev
It's been reported already in discord that the game fails to run the
GameOverPhase
, although the source of the issue was unknown. I ran into this issue and identified the source/conflict preventing it from loading properly.Essentially the game is attempting to run the
api.pokerogue.net
, specifically:Access to fetch at 'https://api.pokerogue.net/savedata/newclear?slot=0'
The source of this is caused when the individual connects via the Network option instead of localhost. This causes the
utils.ts
to not recognize it as being run locally, specificallylocalhost
To resolve this issue locally I modified the
src/utils.ts
line 218 to include my hosted IP address in the secondary option of thewindow.location.hostname
This example uses
10.10.10.10
as my hosted IPThe text was updated successfully, but these errors were encountered: