Skip to content

add endsideout iframe - #149

Merged
sean-dickinson merged 12 commits into
abachman/not-a-real-gamefrom
add-endsideout-iframe
Oct 31, 2026
Merged

sean-dickinson merged 12 commits into
abachman/not-a-real-gamefrom
add-endsideout-iframe

Conversation

@sean-dickinson

@sean-dickinson sean-dickinson commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Resolves #81

Description

  • Updates the game player to use the actual games url. Note the this is environment specific, as they have a staging site for the games. So we are only using the production games link when we are in production. Any other environment uses the staging version.
  • Adds rack cors so we can correctly handle the cross origin requests
  • Updates the game attempts controller/method for finishing a game to handle whatever params we end up needing while still maintaining the timestamp.
  • Adds documentation to share with endsideout developers on how the games should interact with our application.

@sean-dickinson
sean-dickinson added this pull request to stack #150 October 29, 2026 00:06
@sean-dickinson
sean-dickinson marked this pull request as ready for review October 29, 2026 00:13
sean-dickinson and others added 12 commits October 31, 2026 13:44
The external_game route now reads its host from one config value. Production
uses endsideoutgames.netlify.app. Every other environment uses
staging--endsideout-games.netlify.app.

The route also accepts an optional token and adds it to the URL as a GET
parameter.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Games run on another origin and have no Rails session, so the start and
finish endpoints now skip CSRF protection. The signed token is the
credential.

The endpoints send CORS headers only for the games host and answer OPTIONS
preflight requests. A missing or changed token now returns a 422 JSON error
with the message "Invalid token" instead of a 500.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The play page now embeds the game from the games host and passes the signed
game attempt token as the token GET parameter.

The fake quiz is no longer needed, so this removes the quiz controller, the
embed page and layout, and the embed route.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add docs/game-api.md. It explains the token GET parameter on the game URL,
the start and finish endpoints, the error responses, and the hosts. It
includes fetch and curl examples. The README links to it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Replace the after_action headers, the preflight action, and the OPTIONS
routes with the rack-cors middleware. The allowed origin is still the games
host, and the rules for the game attempts API now live in
config/initializers/cors.rb.

The middleware answers preflight requests with status 200 instead of 204, so
the preflight test now expects 200.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sean-dickinson
sean-dickinson merged commit 97f4e0a into main Oct 31, 2026
8 of 10 checks passed
@sean-dickinson
sean-dickinson deleted the add-endsideout-iframe branch October 31, 2026 17:47
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

Successfully merging this pull request may close these issues.

Game Viewer

1 participant