Skip to content
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

admin2: Implement type verification for changing resource settings #564

Open
Dark-Dragon opened this issue Oct 19, 2024 · 0 comments
Open

Comments

@Dark-Dragon
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Recently I've gotten myself in a frustrating situation when I attempted to change a setting of the freeroam resource via admin2. Parts of freeroam stopped working as it expected a table in that setting and even using correct JSON formatting admin2 set the setting as a string. A user shouldn't be able to break parts of default resources like this, especially with no easy way to undo the damage in clear sight. The way set() behaves makes it to neither restarting the resource or changing the setting in the resources meta.xml will actually help you get back to normal.

Describe the solution you'd like
Settings already often have a 'accepted' attribute, however it's not even used consistently within default resources. My desired solution would implement some sort of type checking and update all existing default resources to properly define what type of value they expect.

Describe alternatives you've considered
For the more savvy users converting properly JSON formatted values before applying the setting would be enough, however I believe we can do better.

A 'restore default' button would also be the very least we can offer.

Additional context
The main problem is that there is no standardized nomenclature for the 'accept' attribute. Some use 'bool', others 'boolean', then there are some that list possible values like 'true,false', some will say 'float' or 'int' while others say 'positive number'. It's gonna be impossible to suit every single use perfectly. At the very least the default lua types 'boolean' 'number' 'string' and 'table' should be supported, but I believe there is room to catch some of the commonly used nomenclature variants like 'true/false' and add some basic functionality to be able to verify if a value is a 'positive number', within the range of '0-100' or whether a string is shorter than 32 characters.

[Pending testing] I believe admin1 currently has the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant