docs + cleanup

This commit is contained in:
jokob-sk
2025-01-04 13:20:18 +11:00
parent 19441a4431
commit f2a0018982
10 changed files with 35 additions and 53 deletions

9
.gitignore vendored
View File

@@ -11,6 +11,7 @@ front/log/*
front/api/*
/api/*
**/plugins/**/*.log
**/plugins/cloud_services/*
**/%40eaDir/
**/@eaDir/
@@ -24,10 +25,10 @@ __pycache__/
**/pialert.db_bak
.*.swp
front/img/account/*
**/account.php
**/account.js
front/css/account.css
front/img/cloud_services/*
**/cloud_services.php
**/cloud_services.js
front/css/cloud_services.css
docker-compose.yml.ffsb42
.env.omada.ffsb42

View File

@@ -39,10 +39,6 @@ services:
- ${DEV_LOCATION}/front/lib:/app/front/lib
- ${DEV_LOCATION}/front/js:/app/front/js
- ${DEV_LOCATION}/front/report_templates:/front/report_templates
- ${DEV_LOCATION}/install/start.debian.sh:/app/install/start.debian.sh
- ${DEV_LOCATION}/install/user-mapping.debian.sh:/app/install/user-mapping.debian.sh
- ${DEV_LOCATION}/install/install.debian.sh:/app/install/install.debian.sh
- ${DEV_LOCATION}/install/install_dependencies.debian.sh:/app/install/install_dependencies.debian.sh
- ${DEV_LOCATION}/front/php:/app/front/php
- ${DEV_LOCATION}/front/deviceDetails.php:/app/front/deviceDetails.php
- ${DEV_LOCATION}/front/deviceDetailsEdit.php:/app/front/deviceDetailsEdit.php
@@ -62,7 +58,7 @@ services:
- ${DEV_LOCATION}/front/presence.php:/app/front/presence.php
- ${DEV_LOCATION}/front/settings.php:/app/front/settings.php
- ${DEV_LOCATION}/front/systeminfo.php:/app/front/systeminfo.php
- ${DEV_LOCATION}/front/account.php:/app/front/account.php
- ${DEV_LOCATION}/front/cloud_services.php:/app/front/cloud_services.php
- ${DEV_LOCATION}/front/report.php:/app/front/report.php
- ${DEV_LOCATION}/front/workflows.php:/app/front/workflows.php
- ${DEV_LOCATION}/front/appEventsCore.php:/app/front/appEventsCore.php

View File

@@ -12,6 +12,9 @@ NetAlertX comes with a plugin system to feed events from third-party scripts int
### 🎥 Watch the video:
> [!TIP]
> Read this guide [Development environment setup guide](/docs/DEV_ENV_SETUP.md) to set up your local environment for development. 👩‍💻
[![Watch the video](/docs/img/YouTube_thumbnail.png)](https://youtu.be/cdbxlwiWhv8)
### 📸 Screenshots

View File

@@ -615,7 +615,7 @@ body
.modal_red
{
color: rgb(245, 245, 245);
color: #d41001;
background-color: #e2acaa;
border-color: #d41001;
}

View File

@@ -732,4 +732,8 @@ input[type="password"]::-webkit-caps-lock-indicator {
background-color: #000 !important;
}
.callout code {
background-color: #fff !important;
color:#000 !important;
}

View File

@@ -735,3 +735,8 @@
}
}
.callout code {
background-color: #fff !important;
color:#000 !important;
}

View File

@@ -937,12 +937,15 @@ function generateFormHtml(settingsData, set, overrideValue, overrideOptions, ori
const setKey = set['setKey'];
const setType = set['setType'];
// if (setKey == '') {
// console.log(setType);
// console.log(setTypeEscaped); // Final transformed result
// console.log(setKey);
// console.log(overrideValue);
// console.log(inVal);
// }
// Parse the setType JSON string
const setTypeObject = JSON.parse(processQuotes(setType))
const dataType = setTypeObject.dataType;
@@ -976,6 +979,16 @@ function generateFormHtml(settingsData, set, overrideValue, overrideOptions, ori
// Override value
let val = valRes;
// if (setKey == '') {
// console.log(setType);
// console.log(setKey);
// console.log(overrideValue);
// console.log(inVal);
// console.log(val);
// }
// Generate HTML based on elementType
switch (elementType) {
case 'select':

View File

@@ -37,7 +37,6 @@ fi
# Run setup scripts
echo "[INSTALL] Run setup scripts"
"${INSTALL_PATH}/install/user-mapping.debian.sh"
"${INSTALL_PATH}/install/install_dependencies.debian.sh" # if modifying this file transfer the changes into the root Dockerfile.debian as well!
echo "[INSTALL] Setup NGINX"

View File

@@ -1,39 +0,0 @@
#!/usr/bin/env bash
echo "---------------------------------------------------------"
echo "[INSTALL] Run user-mapping.debian.sh"
echo "---------------------------------------------------------"
if [ -z "${USER}" ]; then
echo "We need USER to be set!"; exit 100
fi
# if both not set we do not need to do anything
if [ -z "${HOST_USER_ID}" ] && [ -z "${HOST_USER_GID}" ]; then
echo "Nothing to do here." ; exit 0
fi
# reset user_id to either new id or if empty old (still one of above
# might not be set)
USER_ID=${HOST_USER_ID:=$USER_ID}
USER_GID=${HOST_USER_GID:=$USER_GID}
LINE=$(grep -F "${USER}" /etc/passwd)
# replace all ':' with a space and create array
array=( "${LINE//:/ }" )
# home is 5th element
USER_HOME=${array[4]}
# print debug output
echo USER_ID" ": "${USER_ID}";
echo USER_GID : "${USER_GID}";
echo USER_HOME: "${USER_HOME}";
echo TZ" ": "${TZ}";
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:[0-9]*/${USER}:\1:${USER_ID}:${USER_GID}/" /etc/passwd
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
chown -R "${USER_ID}:${USER_GID} ${USER_HOME}"
exec su - "${USER}"

View File

@@ -172,7 +172,7 @@ def importConfigs (db, all_plugins):
conf.NETWORK_DEVICE_TYPES = ccd('NETWORK_DEVICE_TYPES', ['AP', 'Gateway', 'Firewall', 'Hypervisor', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet'] , c_d, 'Network device types', '{"dataType":"array","elements":[{"elementType":"input","elementOptions":[{"placeholder":"Enter value"},{"suffix":"_in"},{"cssClasses":"col-sm-10"},{"prefillValue":"null"}],"transformers":[]},{"elementType":"button","elementOptions":[{"sourceSuffixes":["_in"]},{"separator":""},{"cssClasses":"col-xs-12"},{"onClick":"addList(this,false)"},{"getStringKey":"Gen_Add"}],"transformers":[]},{"elementType":"select", "elementHasInputValue":1,"elementOptions":[{"multiple":"true"},{"readonly":"true"},{"editable":"true"}],"transformers":[]},{"elementType":"button","elementOptions":[{"sourceSuffixes":[]},{"separator":""},{"cssClasses":"col-xs-6"},{"onClick":"removeAllOptions(this)"},{"getStringKey":"Gen_Remove_All"}],"transformers":[]},{"elementType":"button","elementOptions":[{"sourceSuffixes":[]},{"separator":""},{"cssClasses":"col-xs-6"},{"onClick":"removeFromList(this)"},{"getStringKey":"Gen_Remove_Last"}],"transformers":[]}]}', '[]', 'General')
conf.GRAPHQL_PORT = ccd('GRAPHQL_PORT', 20212 , c_d, 'GraphQL port', '{"dataType":"integer", "elements": [{"elementType" : "input", "elementOptions" : [{"type": "number"}] ,"transformers": []}]}', '[]', 'General')
conf.API_TOKEN = ccd('API_TOKEN', 't_' + generate_random_string(20) , c_d, 'API token', '{"dataType": "string","elements": [{"elementType": "input","elementHasInputValue": 1,"elementOptions": [{ "cssClasses": "col-xs-12" }],"transformers": []},{"elementType": "button","elementOptions": [{ "getStringKey": "Gen_Generate" },{ "customParams": "API_TOKEN" },{ "onClick": "generateApiToken(this, 20)" },{ "cssClasses": "col-xs-12" }],"transformers": []}]}', '[]', 'General')
conf.ENCRYPTION_KEY = ccd('ENCRYPTION_KEY', get_random_bytes(16) , c_d, 'Encryption key', '{"dataType": "string","elements": [{"elementType": "input","elementHasInputValue": 1,"elementOptions": [{ "cssClasses": "col-xs-12" }],"transformers": []},{"elementType": "button","elementOptions": [{ "getStringKey": "Gen_Generate" },{ "customParams": "ENCRYPTION_KEY" },{ "onClick": "getRandomBytes(this, 16)" },{ "cssClasses": "col-xs-12" }],"transformers": []}]}', '[]', 'General')
conf.CLOUD_ENCRYPTION_KEY = ccd('CLOUD_ENCRYPTION_KEY', get_random_bytes(32) , c_d, 'Encryption key', '{"dataType": "string","elements": [{"elementType": "input","elementHasInputValue": 1,"elementOptions": [{ "cssClasses": "col-xs-12" }],"transformers": []},{"elementType": "button","elementOptions": [{ "getStringKey": "Gen_Generate" },{ "customParams": "ENCRYPTION_KEY" },{ "onClick": "getRandomBytes(this, 16)" },{ "cssClasses": "col-xs-12" }],"transformers": []}]}', '[]', 'CLOUD')
# UI
conf.UI_LANG = ccd('UI_LANG', 'English' , c_d, 'Language Interface', '{"dataType":"string", "elements": [{"elementType" : "select", "elementOptions" : [] ,"transformers": []}]}', "['English', 'German', 'Spanish', 'French', 'Norwegian', 'Russian', 'Italian (it_it)', 'Portuguese (pt_br)', 'Polish (pl_pl)', 'Chinese (zh_cn)', 'Turkish (tr_tr)', 'Czech (cs_cz)', 'Arabic (ar_ar)', 'Catalan (ca_ca)', 'Ukrainian (uk_ua)' ]", 'UI')
@@ -204,7 +204,7 @@ def importConfigs (db, all_plugins):
# Plugins START
# -----------------
necessary_plugins = ['UI', 'CUSTPROP', 'DBCLNP', 'INTRNT','MAINT','NEWDEV', 'SETPWD', 'SYNC', 'VNDRPDT', 'WORKFLOWS']
necessary_plugins = ['UI', 'CUSTPROP', 'CLOUD' ,'DBCLNP', 'INTRNT','MAINT','NEWDEV', 'SETPWD', 'SYNC', 'VNDRPDT', 'WORKFLOWS']
# make sure necessary plugins are loaded
conf.LOADED_PLUGINS += [plugin for plugin in necessary_plugins if plugin not in conf.LOADED_PLUGINS]