-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Custom Scriptlets names should allow uppercase characters and not be restricted to lowercase only. #43107
Comments
Hey!! @ShivanKaul |
You can just look at the commits in brave-core and see how it works, no reason for anyone from Brave team to explain it, especially when it is disabled by default. Anyway, you just install Nightly on Desktop, enable |
@boocmp do you remember why we decided to restrict the script name to be lowercase? I can't think of a security reason for doing so. |
@Antrikshgwal we'll be enabling Custom Scriptlets by default on Brave Nightly soon: brave/brave-core#27334 The feature itself is available (default off right now) in Brave Nightly and Brave Beta. You can enable it manually like @TEMP-ad said:
If you have any trouble, let me know. |
Because it is the requirement of the scriptlets themself. Our engine makes them lowercase internally (and adds |
Well, if we talk about how internally things work, then Brave actually reads Scriptlets that have different cases and treat them as different Scriptlets, so Regardless how things get added to resources.json, if we manually add scriptlets, you can test this pretty easy: Something like: {
"name": "Brave-fix.js",
"aliases": [],
"kind": { "mime": "application/javascript" },
"content": "Y29uc29sZS5sb2coInRlc3QxIik="
},
{
"name": "Brave-Fix.js",
"aliases": [],
"kind": { "mime": "application/javascript" },
"content": "Y29uc29sZS5sb2coInRlc3QwIik="
}
They will be used as different scriptlets, and you can use them as
So two console.log and then the other one being the default one and deleting the Brave navigator info gets applied to the page. Now, if the scriptlets are changed to have the same name, in my tests, it the Adblocker will just read the ones at the top, so if whatever is first, will be read and then the others ignored. so something like this will give the {
"name": "brave-fix.js",
"aliases": [],
"kind": { "mime": "application/javascript" },
"content": "Y29uc29sZS5sb2coInRlc3QwIik="
},
{
"name": "brave-fix.js",
"aliases": [],
"kind": { "mime": "application/javascript" },
"content": "Y29uc29sZS5sb2coInRlc3QxIik="
},
{
"name": "brave-fix.js",
"aliases": [],
"kind": { "mime": "application/javascript" },
"content": "Ly8vIGJyYXZlLWZpeC5qcwovLy8gYWxpYXMgYmYuanMKZGVsZXRlIE5hdmlnYXRvci5wcm90b3R5cGUuYnJhdmUKZGVsZXRlIHdpbmRvdy5uYXZpZ2F0b3IuYnJhdmUK"
}, So I am not saying adding And in the end, if possible, at least it would be nice to have the lowercase name rescrition removed, because it is easier to read for the brain something that is not completely lowercase, examples of scriptlets I made: I know, technically the name doesn't matter, and dashes is what scriptlets usually use to make the spaces and make them easy to read, but having too many scriptlets in the list and scrolldown with all lowercase is just awkward to look at, especially when we can't just re-order the scriptlets to have them grouped properly if needed. |
@TEMP-ad. |
Platforms
all
Description
While not a big issue, having all Scriptlet names being all lower case, is just not the best thing in some cases.
For example, sometimes you might create a name based on a function, and you used
thisFunction
in the code, so for the brain to want to see it as user-thisfuncion.js is just weird.Or for example, if you add the Return Dislike Button userscript as scriptlet, you might want to use it as user-ReturnDislikeButton.js just as you are used to see it on the extension and the internet, or YouTube or YT rather than yt just for easily spot the Scriptlets in the list.
It is more of a QOL implementation, since having eveything lowercase is just not the same as being able to read scriptlets name with some uppercase on them. The only way to kind of do this by now is adding dashes (
-
) to the name, but that means a longer name thaty could be easily fixed by not restricting scriptlets names to be only lowercase.The text was updated successfully, but these errors were encountered: