add sanitized for all

This commit is contained in:
Jesse Bannon 2023-12-13 10:05:24 -08:00
parent 2c04d7ce6f
commit cfd61f4b71
2 changed files with 4 additions and 2 deletions

View file

@ -37,6 +37,6 @@ class ScriptUtils:
elif isinstance(value, bool):
out = f"{{%bool({value})}}"
else:
out = f"{{%from_json('''{json.dumps(value, ensure_ascii=False)}''')}}"
out = f"{{%from_json('''{json.dumps(value, ensure_ascii=False, sort_keys=True)}''')}}"
return out

View file

@ -14,7 +14,9 @@ from ytdl_sub.utils.script import ScriptUtils
class Scriptable(ABC):
def __init__(self):
self.script = Script(
dict(copy.deepcopy(VARIABLE_SCRIPTS), **copy.deepcopy(CUSTOM_FUNCTION_SCRIPTS))
ScriptUtils.add_sanitized_variables(
dict(copy.deepcopy(VARIABLE_SCRIPTS), **copy.deepcopy(CUSTOM_FUNCTION_SCRIPTS))
)
)
self.unresolvable: Set[str] = copy.deepcopy(UNRESOLVED_VARIABLES)