ruffle icon indicating copy to clipboard operation
ruffle copied to clipboard

web: Resolve URLs without a protocol in the extension player and improve error messages

Open Korne127 opened this issue 8 months ago • 6 comments

Currently, only URLs explicitly including the web protocol (HTTPS or HTTP) in the beginning can be resolved in the extension player. Additionally, if the URL doesn't include the HTTPS or HTTP protocol in the beginning, a wrong error is displayed. It states that the user ran Ruffle on the file: protocol which is wrong and confusing: Bildschirmfoto 2024-06-28 um 15 53 04

This pull request fixes this. With this pull request, the extension player resolves URLs without a protocol. It adds https:// or http:// if the URL is likely a valid web URL and file:/// if the URL is a valid file URL. To determine whether HTTPS or HTTP should be used, Ruffle tests whether the server supports HTTPS. HTTP is only used if the server only supports HTTP and not HTTPS. This test happens while the loading screen is displayed.

This means that the user can now enter URLs without a leading https:// like you (usually) do in the browser.

Additionally, this pull request fixes and improves the error behaviour if the URL can't be resolved or used. Instead of the wrong error, one of four more specific errors will be displayed:

  • One new error if the given URL is a local file URL: Bildschirmfoto 2024-06-28 um 15 56 26
  • One new error if the given URL uses a different protocol than https, http or file (e.g. ftp): Bildschirmfoto 2024-06-28 um 15 57 44
  • One new error if the given URL can't be resolved to any valid URL for any protocol Bildschirmfoto 2024-06-28 um 15 58 07
  • And the usual SWF file not found error if the file under the given web URL couldn't be found. That error has also been modified to also include the tip that the HTTP protocol should be (explicitly) used for websites that don't support HTTPS: Bildschirmfoto 2024-06-28 um 15 54 12

Also, a bug that caused the document title to not be set correctly if the SWF URL was the main page of a domain has been fixed. The handling of setting the document title of the extension player has generally been made more consistent.

Korne127 avatar Jun 28 '24 14:06 Korne127