refactor UI backend calls to python endpoints

This commit is contained in:
Jokob @NetAlertX
2026-01-10 03:06:02 +00:00
parent 6aa4e13b54
commit d849583dd5
33 changed files with 2186 additions and 313 deletions

View File

@@ -74,6 +74,28 @@ def row_to_json(names, row):
return rowEntry
# -------------------------------------------------------------------------------
def safe_int(setting_name):
"""
Helper to ensure integer values are valid (not empty strings or None).
Parameters:
setting_name (str): The name of the setting to retrieve.
Returns:
int: The setting value as an integer if valid, otherwise 0.
"""
# Import here to avoid circular dependency
from helper import get_setting_value
try:
val = get_setting_value(setting_name)
if val in ['', None, 'None', 'null']:
return 0
return int(val)
except (ValueError, TypeError, Exception):
return 0
# -------------------------------------------------------------------------------
def sanitize_SQL_input(val):
"""