Skip to content

Proof of concept to make a Flash application running in Ruffle "think" it runs on a different website than it does (directly in the client, no need for special server software or proxies).

Notifications You must be signed in to change notification settings

TBubba/ruffle-redirect-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruffle Redirect

A proof of concept for intercepting web requests made from a Flash application running inside (standalone) Ruffle.

The purpose of this is to make sure that is is feasable to make Ruffle run Flash applications that are "site locked" or relies on resources located at hard coded URLs.

Read the source code for more information (it's short and commented).

Running Demo

Note: This project does not contain any Flash files. You have to provide one yourself.

  1. Install Node
  2. Install dependencies npm i
  3. Build the project and run the file server npm run serve
  4. Place your Flash file in /static/redirect_root. This is the root folder of the file server
  5. Open the demo in your web browser http://localhost:8080/ (you will require specific seach paramters, see the next section)

Details

Search parameters

The demo uses the following search parameters:

  • redirect_to - Base URL that all redirects will be redirected to. Include a trailing slash.
  • entry - URL of the Flash file to load (this will be redirected).

Example: http://localhost:8080/?redirect_to=http://localhost:8080/redirect_root/&entry=https://www.coolmath-games.com/games/learn_to_fly_final_3.54k_coolmath_1.swf

"redirect_root" folder

The "redirect_root" folder scructure looks like this:

  • The direct subfolders of redirect_root are named after hostnames (examples: www.coolmath-games.com, argmorgames.com, localhost)
  • All deeper subfolders are parts from the pathname (example: games)
  • Files can be put anywhere in this folder structure

Example structure:

  • static/redirect_root
    • www.coolmath-games.com
      • games
        • learn_to_fly_final_3.54k_coolmath_1.swf
        • some_other_game_they_probably_have.swf
    • localhost
      • cool_game.swf
      • data.xml

Redirection

The redirection (roughly) works like this:

  • Ruffle attempts to send a request with the URL https://www.coolmath-games.com/games/very_cool/game.swf
  • The request is intercepted and its URL is remapped by using redirect_to and an algorithm (redirect_to = http://localhost:8080/redirect_root/).
    • The algorithm takes two arguments (the requsts URL and redirect_to) and it outputs the new request URL. First it sets the new request URL to redirect_to, then it appends the current requests hostname and pathname to the pathname of the new request URL (see this diagram).
  • The request is sent to http://localhost:8080/redirect_root/www.coolmath-games.com/games/very_cool/game.swf

About

Proof of concept to make a Flash application running in Ruffle "think" it runs on a different website than it does (directly in the client, no need for special server software or proxies).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published