-
-
Notifications
You must be signed in to change notification settings - Fork 805
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
web: Resolve URLs without a protocol in the extension player and improve error messages #16913
base: master
Are you sure you want to change the base?
Conversation
hello Korne, |
Hey :) |
"The url blabla test is no valid url" |
Hmm, I would have thought that both is valid tbh, although the second one is probably better. |
amittedly its a nitpick 😅 |
699e67a
to
86352c1
Compare
@Croworbit Don't worry, I really appreciate it! Especially the things that I overlooked myself are good to know :) |
86352c1
to
1621c78
Compare
1621c78
to
e95d53c
Compare
I rebased the Pull Request and adapted it accordingly to @kjarosh's suggestions. |
c648f07
to
2395f4d
Compare
71754a9
to
8ad6076
Compare
fc91e68
to
bd5d627
Compare
Extension-player specific error messages (as well as the http advice) are now only shown in the extension player, and a new additional error message is displayed if a website is misconfigured and uses a different protocol. This is done by creating a so-called |
Previously, only URLs explicitly including the web protocol (HTTPS or HTTP) in the beginning could be resolved in the extension player. This has been changed. The extension player now resolves URLs without a protocol and adds https:// or http:// if the URL is likely a valid web URL and file:/// if the URL is a valid file URL. HTTP is only used if the server only supports HTTP and not HTTPS.
Previously, the Ruffle player had shown an incorrect error message if the entered URL wasn't a valid web URL. This has been fixed and improved. Three new error messages have been added for this case: One in case the entered URL is a local file URL, one in case the entered URL uses a different protocol than https, http or file and one in case the entered URL isn't a valid URL for any protocol at all. Additionally, the error message in case Ruffle couldn't load the SWF file (using a valid web URL) has been improved to also include the tip that the HTTP protocol should be (explicitly) used for websites that don't support HTTPS.
Previously, when entering a URL in the extension player, it had been resolved before the loading screen had been displayed. As resolving can include testing for server availability (to decide whether HTTPS or HTTP is used), this could create a wait time without the loading screen. This has been fixed. The loading screen is now displayed while the URL is resolved. Additionally, the timeouts have been increased (they were low because of the lack of a loading animation). A bug that caused the document title to not be set correctly if the SWF URL was the main page of a domain has also been fixed.
After entering a URL in the extension player, Ruffle resolves it, potentially adding a protocol. This resolved URL is now displayed in the URL input element instead of the original input URL. This improves the transparency of which protocol is used and makes it easier for the user to change it.
If Ruffle recognises that a URL is invalid or not supported, it now doesn't try to connect to it, but instantly panics. This reduces unnecessary connection attempts and improves reaction speed.
The error messages outside the extension player have been fixed. Ruffle now correctly determines whether the last load command originated from the extension player and displays the error messages specific to it (invalid URL / local URL / URL with unsupported protocol entered) only in that case. The advice to try entering http explicitly has also been removed if the URL is not loaded from the extension player. Additionally, if the website now embeds a URL with an unsupported protocol (e.g. file), a new specific error message about the website being misconfigured is now displayed instead of a button to open the URL in the extension player (which itself will result in an error).
bd5d627
to
d85a8b5
Compare
The new OriginAPI has been added to the web player. It is used to access behaviour that's specific to the Ruffle origin (selfhosted, demo or extension). Unlike the SourceAPI, which manages the whole Ruffle polyfill and player, it provides minor helper methods and is given to the (internal) Ruffle player. The OriginAPI has three implementations: SelfhostedOrigin, DemoOrigin and ExtensionOrigin. The respective instance is created when installing the Ruffle instance. When using SourceAPI#createPlayer or #polyfill, the OriginAPI is given to the then-created (internal) player. This is done by calling the new RufflePlayerElement#initialize method after creating it. The player API now also provides a method to access its OriginAPI. The previous extension related variables and functions (like inExtensionPlayer) have been removed from the core code. Instead, createPanicError now uses OriginAPI calls to display the correct error message. Additionally, internalSourceApi and its usages have been replaced by several functions, reducing the likelihood of future mistakes. The documentation and code quality have also been generally improved.
d85a8b5
to
66d9be3
Compare
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:
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:
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:
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.