-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Loosen platform compatibility checks #240
Conversation
omg what a coincidence this helps with my project how could that be |
This comment was marked as spam.
This comment was marked as spam.
What mod is this for? This is the wrong approach and it absolutely does need tests but I want to know about your usecase first |
All the warning says is that
I'm inclined to say that this is perfectly reasonable to say for any third-party platform? that's why I want to know what mod wants this |
The warning is true, it's just that some addons can be compatible with TurboWarp, and have the right to specify if they are or not by specifying it in their platform name, instead of force-making it compatible it with TurboWarp only.
This addon is still indev and very barbones, but as an example, WlodekM's SLTLCC is a cross-compiler which works by converting (and in future injecting) text-based code to scratch projects compatible with any scratch mods. This is still 'as an example', and not just for one mod to "slide through".
Forcing the authors of projects created in addons like these to be compatible with only one platform (keep in mind this is only in example, who knows, but there is no denying that such 'addons' have been in the works or even already finished off and somewhere laying around on github for long now) is just an unnecessary evil, the only available road through this with full compatibility in mind is just compiling the same exact project for every platform with just changing one variable - the project's platform name. The question is not "why", it's "why not" (and hold on for a second here, this is not some cave johnson quote where i fire a man for being in a wheelchair), people should have freedom in making their projects compatible with any scratch mod. Take example the http's useragent string, people can specify whether it's some SLTLCC thing some 14yo ukrainian is yapping about, as a challenge of sorts (there's lots of reasons why people are still trying to run doom on everything they can) or just in sake of flexibility for everything there is, not by just making the one and only standard the original Scratch 3.0/2.0. after all, it's literally just ~20 bytes of change lmao, no need to be this overdramatic for just changing === to .includes(), this is not a security oversight whatsoever and will not harm tw in any way |
If the projects being generated work perfectly fine in all mods by just changing the platform name, then it sounds like it is only using features in vanilla Scratch. In this case you can exclude |
And then you can store whatever metadata you want in |
You definitely do not want to cite the modern mess that is User-Agent on the web as inspiration for a new feature. It is a disaster that harms compatibility, not helps it. And anyways |
you can think of meta.platform.name as being the "CPU architecture" that the project is supposed to run in since you are making a project generator (analogous to a compiler like gcc or clang), not some new project runner with new blocks and behaviors (analogous to adding new CPU instructions), you shouldn't be inventing new meta.platform.name values |
We will change the unknown platform warning to say something along "the project was made for another platform" instead of "the project was made with another platform" to reflect the above |
If you have a scenario where being compatible with multiple non-vanilla-Scratch platforms simultaneously is necessary we can reopen this with a different design that isn't simple string inclusion |
Proposed Changes
This pull request updates the platform checking functionality in TW so that it checks if TW's platform name is included in a given project's platform name.
Reason for Changes
The current platform checking logic in TW can lead to incompatibility issues with other platforms that include the TW name in their platform name, (e.g. cross-compilers and other addons that are compatible with TW and other Scratch modifications). To address this issue and allow for broader compatibility, the logic has been updated to check if the 'TurboWarp' (
runtime.platform.name
) string is included in the platform name, rather than strictly matching the name exactly. This improves compatibility without compromising the integrity of the platform checking functionality, reminiscent of useragents in the http/https protocol.Test Coverage
As this pull request involves a simple change in logic from using
===
toincludes()
, no tests were required to verify the behaviour of the change. This is because the test coverage of this particular area was already sufficient. Thestring.includes()
function is standard JavaScript, therefore testing isn't mandatory, nor should be. (...at least I hope so)TL;DR
remove annoying pop-up if platform name is not exactly 'TurboWarp' but addon is compatible with it