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

Game API stops working after navigation in app #1185

Open
celestora opened this issue Dec 13, 2024 · 1 comment
Open

Game API stops working after navigation in app #1185

celestora opened this issue Dec 13, 2024 · 1 comment

Comments

@celestora
Copy link
Member

Due to this line in GameAPI.js:
image
VKAPI requests stop working since after app navigates (other page opened inside iframe) document.referer changes it's value and API requests get sent to origin of an app and not OpenVK instance (and OVK instance can't receive and subsequently reply to the request).

Proposed solutions:

  1. Don't restrict origins and just use '*' to send message to the parent window. Perhaps we could also use window.top for that? It's unlikely that OVK will be open in non-top context either way. Not sure if that's secure tho, but idk seems secure enough although I wonder why'd they add that parameter for restricting origins if it's not safe enough with '*'.
  2. Use stackinfo library (available in npm) to obtain origin from inside the script via stack tricks:
    image
@celestora
Copy link
Member Author

Initially reported by Зубная Паста

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

No branches or pull requests

1 participant