mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
This commit is contained in:
@@ -49,6 +49,15 @@ def handleEmpty(input):
|
|||||||
input = re.sub(r'[^\x00-\x7F]+', ' ', input)
|
input = re.sub(r'[^\x00-\x7F]+', ' ', input)
|
||||||
input = input.replace('\n', '') # Removing new lines
|
input = input.replace('\n', '') # Removing new lines
|
||||||
return input
|
return input
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
# Sanitizes string
|
||||||
|
def rmBadChars(input):
|
||||||
|
|
||||||
|
input = handleEmpty(input)
|
||||||
|
input = input.replace("'", '_') # Removing ' (single quotes)
|
||||||
|
|
||||||
|
return input
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# Check if a valid MAC address
|
# Check if a valid MAC address
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from pyunifi.controller import Controller
|
|||||||
INSTALL_PATH="/app"
|
INSTALL_PATH="/app"
|
||||||
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
||||||
|
|
||||||
from plugin_helper import Plugin_Object, Plugin_Objects
|
from plugin_helper import Plugin_Object, Plugin_Objects, rmBadChars
|
||||||
from logger import mylog
|
from logger import mylog
|
||||||
from helper import timeNowTZ, get_setting_value
|
from helper import timeNowTZ, get_setting_value
|
||||||
import conf
|
import conf
|
||||||
@@ -200,7 +200,7 @@ def get_unifi_val(obj, key, default='null'):
|
|||||||
def get_name(*names: str) -> str:
|
def get_name(*names: str) -> str:
|
||||||
for name in names:
|
for name in names:
|
||||||
if name and name != 'null':
|
if name and name != 'null':
|
||||||
return name
|
return rmBadChars(name)
|
||||||
return 'null'
|
return 'null'
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user