📚Docs, QoL improvements

This commit is contained in:
jokob-sk
2024-06-21 16:44:03 +10:00
parent 3b7cbba32b
commit a52e315732
28 changed files with 207 additions and 216 deletions

View File

@@ -48,7 +48,6 @@ jobs:
with:
# list of Docker images to use as base name for tags
images: |
jokobsk/pi.alert_dev
jokobsk/netalertx-dev
# generate Docker tags based on the following events/attributes
tags: |

View File

@@ -38,7 +38,7 @@ docker run -d --rm --network=host \
| `PORT` |Port of the web interface | `20211` |
| `LISTEN_ADDR` |Set the specific IP Address for the listener address for the nginx webserver (web interface). This could be useful when using multiple subnets to hide the web interface from all untrusted networks. | `0.0.0.0` |
|`TZ` |Time zone to display stats correctly. Find your time zone [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | `Europe/Berlin` |
|`ALWAYS_FRESH_INSTALL` | Setting `ALWAYS_FRESH_INSTALL=true` will delete the content of the `/db` & `/config` folders. For testing purposes. Can be coupled with [watchtower](https://github.com/containrrr/watchtower) to have an always freshly installed `netalertx`/`-dev` image. | `N/A` |
|`ALWAYS_FRESH_INSTALL` | Setting to `true` will delete the content of the `/db` & `/config` folders. For testing purposes. Can be coupled with [watchtower](https://github.com/containrrr/watchtower) to have an always freshly installed `netalertx`/`-dev` image. | `N/A` |
### Docker paths

64
docs/DEV_ENV_SETUP.md Executable file
View File

@@ -0,0 +1,64 @@
## Development environemnt set up
>[!NOTE]
> Replace `/development` with the path where your code files will be stored. The default container name is `netalertx` so there might be a conflict with your running containers.
## 1. Download the code:
- `mkdir /development`
- `cd /development && git clone https://github.com/jokob-sk/NetAlertX.git`
## 2. Create a DEV .env_dev file
`touch /development/.env_dev && sudo nano /development/.env_dev`
The file content should be following, with your custom values.
```yaml
#--------------------------------
#NETALERTX
#--------------------------------
TZ=Europe/Berlin
PORT=22222 # make sure this port is unique on your whole network
DEV_LOCATION=/development/NetAlertX
APP_DATA_LOCATION=/volume/docker_appdata
# ALWAYS_FRESH_INSTALL=true # uncommenting this will always delete the content of /config and /db dirs on boot to simulate a fresh install
```
## 3. Create /db and /config dirs
Create a folder `netalertx` in the `APP_DATA_LOCATION` (in this example in `/volume/docker_appdata`) with 2 subfolders `db` and `config`.
- `mkdir /volume/docker_appdata/netalertx`
- `mkdir /volume/docker_appdata/netalertx/db`
- `mkdir /volume/docker_appdata/netalertx/config`
## 4. Run the container
- `cd /development/NetAlertX && sudo docker-compose --env-file ../.env_dev `
You can then modify the python script without restarting/rebuilding the container every time. Additionally, you can trigger a plugin run via the UI:
![image](https://github.com/jokob-sk/NetAlertX/assets/96159884/3cbf2748-03c8-49e7-b801-f38c7755246b)
## 💡 Tips
A quick cheat sheet of useful commands.
### Removing the container and image
A command to stop, remove the container and the image (replace `netalertx` and `netalertx-netalertx` with the appropriate values)
- `sudo docker container stop netalertx ; sudo docker container rm netalertx ; sudo docker image rm netalertx-netalertx`
### Restart hanging python script
SSH into the container and kill & restart the main script loop
- `sudo docker exec -it netalertx /bin/bash`
- `pkill -f "python /app/server" && python /app/server & `

View File

@@ -52,4 +52,4 @@ In Notification Processing settings, you can specify blanket rules. These allow
You can completely ignore detected devices globally. This could be because your instance detects docker containers, you want to ignore devices from a specific manufacturer via MAC rules or you want to ignore devices on a specific IP range.
1. Ignored MACs (`NEWDEV_ignored_MACs`) - List of MACs to ignore.
2. Ignored IPs (`NEWDEV_ignored_MACs`) - List of IPs to ignore.
2. Ignored IPs (`NEWDEV_ignored_IPs`) - List of IPs to ignore.

View File

@@ -43,4 +43,7 @@ In the container execute:
## 7. Make sure permissions are correct
> [!TIP]
> You can try to start the container without mapping the `/app/config` and `/app/db` dirs and if the UI shows up then the issue is most likely related to your file system permissions or file ownership.
Please read the [Permissions troubleshooting guide](/docs/FILE_PERMISSIONS.md) and provide a screesnhot of the permissions and ownership in the `/app/db` and `app/config` directories.

View File

@@ -307,8 +307,6 @@ function getDevicesTotals(devicesData) {
// Calculate count dynamically based on filter condition
let count = filterDataByStatus(devicesData, filter.status).length;
console.log(getSetting('UI_hide_empty'));
// Check any condition to skip adding the object to dataArray
if (
(['', 'False'].includes(getSetting('UI_hide_empty')) || (getSetting('UI_hide_empty') == "True" && count > 0)) &&

View File

@@ -266,7 +266,7 @@ function checkNotification() {
if (oldestInterruptNotification) {
// Show modal dialog with the oldest unread notification
const decodedContent = JSON.parse(decodeURIComponent(oldestInterruptNotification.content));
const decodedContent = decodeURIComponent(oldestInterruptNotification.content);
showModalOK("Notification", decodedContent, function() {
// Mark the notification as read

View File

@@ -425,8 +425,10 @@ $db->close();
<div class="log-file">app.log <div class="logs-size"><?php echo number_format((filesize("./log/app.log") / 1000000),2,",",".") . ' MB';?>
<span class="span-padding"><a href="./log/app.log" target="_blank"><i class="fa fa-download"></i> </a></span>
</div></div>
<button class="btn btn-primary col-sm-2 col-xs-2" onclick="restartBackend()">Not working: Restart Backend</button>
<div class="log-purge">
<button class="btn btn-primary" onclick="logManage('app.log','cleanLog')"><?= lang('Gen_Purge');?></button>
<button class="btn btn-primary " onclick="logManage('app.log','cleanLog')"><?= lang('Gen_Purge');?></button>
</div>
</div>
</div>
@@ -690,6 +692,22 @@ function PiaPurgeDBBackups()
});
}
// Restart Backend
function restartBackend() {
// Execute
$.ajax({
method: "POST",
url: "php/server/util.php",
data: { function: 'restartBackend' },
success: function(data, textStatus) {
showModalOk ('Result', data );
}
})
}
// Export CSV
function askExportCSV() {
// Ask

View File

@@ -28,6 +28,10 @@ if(array_key_exists('settings', $_REQUEST) != FALSE)
// call functions based on requested params
switch ($FUNCTION) {
case 'restartBackend':
restartBackend();
break;
case 'savesettings':
saveSettings();
@@ -243,6 +247,28 @@ function addToExecutionQueue($action)
}
// ----------------------------------------------------------------------------------------
function restartBackend()
{
$command = 'pkill -f "python /app/server" && (python /app/server > /dev/null 2>&1 &) && echo "done" 2>&1';
// Execute the command
$output = [];
$output_str = "";
$return_var = 0;
exec($command, $output, $return_var);
// Format the output
foreach ($output as $line) {
$output_str .= $line . "\n";
}
echo "Command result: $return_var, $output_str";
}
// ----------------------------------------------------------------------------------------
function cleanLog($logFile)
{

View File

@@ -742,6 +742,7 @@
"settings_core_label": "",
"settings_device_scanners": "",
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "Gerätescanner",
"settings_enabled": "Aktive Einstellungen",
"settings_enabled_icon": "fa-solid fa-toggle-on",
@@ -756,6 +757,7 @@
"settings_other_scanners_label": "Andere Scanner",
"settings_publishers": "",
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "",
"settings_publishers_label": "Veröffentlicher",
"settings_saved": "<br/>Settings saved to the <code>app.conf</code> file.<br/><br/>A time-stamped backup of the previous file created. <br/><br/> Reloading...<br/>",
"settings_system_icon": "fa-solid fa-gear",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "Core",
"settings_device_scanners": "Device scanners used to discover devices that write into the CurrentScan database table.",
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
"settings_device_scanners_info": "Load even more Device Scanners with the <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a> setting",
"settings_device_scanners_label": "Device scanners",
"settings_enabled": "Enabled settings",
"settings_enabled_icon": "fa-solid fa-toggle-on",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "Other scanners",
"settings_publishers": "Enabled notification gateways - publishers, that will send a notification depending on your settings.",
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "Load more Publishers with the <a href=\"/settings.php#LOADED_PLUGINS\">LOADED_PLUGINS</a> setting",
"settings_publishers_label": "Publishers",
"settings_saved": "<br/>Settings saved. <br/> Reloading... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
"settings_system_icon": "fa-solid fa-gear",

View File

@@ -741,6 +741,7 @@
"settings_core_label": "Núcleo",
"settings_device_scanners": "Los escáneres de los dispositivos se utilizan para descubrir dispositivos que escriben en la tabla de base de datos de CurrentScan.",
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "Escáneres de dispositivos",
"settings_enabled": "Configuración activada",
"settings_enabled_icon": "fa-solid fa-toggle-on",
@@ -755,6 +756,7 @@
"settings_other_scanners_label": "Otros escáneres",
"settings_publishers": "Puertas de enlace para las notificación habilitadas: editores, que enviarán una notificación según su configuración.",
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "",
"settings_publishers_label": "Editores",
"settings_saved": "<br/>Ajustes guardados. <br/><br/> Recargando... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
"settings_system_icon": "fa-solid fa-gear",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "",
"settings_device_scanners": "",
"settings_device_scanners_icon": "",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "Scanners d'appareils",
"settings_enabled": "Paramètres activés",
"settings_enabled_icon": "",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "",
"settings_publishers": "",
"settings_publishers_icon": "",
"settings_publishers_info": "",
"settings_publishers_label": "Éditeurs",
"settings_saved": "",
"settings_system_icon": "",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "Core",
"settings_device_scanners": "Scanner dei dispositivi utilizzati per rilevare i dispositivi che scrivono nella tabella del database CurrentScan.",
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "Scanner dispositivi",
"settings_enabled": "Impostazioni abilitate",
"settings_enabled_icon": "fa-solid fa-toggle-on",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "Altri scanner",
"settings_publishers": "Gateway/editori di notifica abilitati, che invieranno una notifica in base alle tue impostazioni.",
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "",
"settings_publishers_label": "Editori",
"settings_saved": "<br/>Impostazioni salvate. <br/> Aggiornamento in corso... <br/> <i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
"settings_system_icon": "fa-solid fa-gear",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "Core",
"settings_device_scanners": "Enhets-skannere som brukes til å oppdage enheter som skrives inn i CurrentScan databasetabellen.",
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "Enhets skannere",
"settings_enabled": "Aktiverte innstillinger",
"settings_enabled_icon": "fa-solid fa-toggle-on",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "Andre skannere",
"settings_publishers": "Aktivert notifikasjons-gateways - utgivere, som vil sende en notifikasjon avhengig av innstillingene dine.",
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "",
"settings_publishers_label": "Utgivere",
"settings_saved": "<br/>Innstillinger lagret. <br/> Laster inn på nytt... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i><br/>",
"settings_system_icon": "fa-solid fa-gear",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "Główne",
"settings_device_scanners": "Urządzenia skanujące użyte do wykrycia urządzeń które wpisują do tabeli bazy danych CurrentScan.",
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "Skanery Urządzeń",
"settings_enabled": "Włącz ustawienia",
"settings_enabled_icon": "fa-solid fa-toggle-on",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "Inne Skanery",
"settings_publishers": "Włącz bramy/wydawców powiadomień, którzy będą wysyłać powiadomienia zależnie od ustawień.",
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "",
"settings_publishers_label": "Wydawcy",
"settings_saved": "<br/>Ustawienia zapisane.<br/>Przeładowanie...<br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i><br/>",
"settings_system_icon": "fa-solid fa-gear",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "",
"settings_device_scanners": "",
"settings_device_scanners_icon": "",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "",
"settings_enabled": "",
"settings_enabled_icon": "",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "",
"settings_publishers": "",
"settings_publishers_icon": "",
"settings_publishers_info": "",
"settings_publishers_label": "",
"settings_saved": "",
"settings_system_icon": "",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "Основные",
"settings_device_scanners": "Сканеры устройств, используемые для обнаружения устройств, записывающих данные в таблицу базы данных CurrentScan.",
"settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "Сканеры устройств",
"settings_enabled": "Вкл. настройки",
"settings_enabled_icon": "fa-solid fa-toggle-on",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "Другие сканеры",
"settings_publishers": "Включенные шлюзы уведомлений - сервисы, которые будут отправлять уведомления в зависимости от ваших настроек.",
"settings_publishers_icon": "fa-solid fa-paper-plane",
"settings_publishers_info": "",
"settings_publishers_label": "Уведомления",
"settings_saved": "<br/>Настройки сохранены. <br/> Перезагрузка... <br/><i class=\"ion ion-ios-loop-strong fa-spin fa-2x fa-fw\"></i> <br/>",
"settings_system_icon": "fa-solid fa-gear",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "",
"settings_device_scanners": "",
"settings_device_scanners_icon": "",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "",
"settings_enabled": "",
"settings_enabled_icon": "",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "",
"settings_publishers": "",
"settings_publishers_icon": "",
"settings_publishers_info": "",
"settings_publishers_label": "",
"settings_saved": "",
"settings_system_icon": "",

View File

@@ -661,6 +661,7 @@
"settings_core_label": "",
"settings_device_scanners": "",
"settings_device_scanners_icon": "",
"settings_device_scanners_info": "",
"settings_device_scanners_label": "",
"settings_enabled": "",
"settings_enabled_icon": "",
@@ -675,6 +676,7 @@
"settings_other_scanners_label": "",
"settings_publishers": "",
"settings_publishers_icon": "",
"settings_publishers_info": "",
"settings_publishers_label": "",
"settings_saved": "",
"settings_system_icon": "",

View File

@@ -1,6 +1,6 @@
## Overview
PLugin functionality overview and links to external resources if relevant. Include use cases if available.
Plugin functionality overview and links to external resources if relevant. Include use cases if available.
> [!TIP]
> Some tip.

View File

@@ -1,9 +1,9 @@
{
"code_name": "sync",
"unique_prefix": "SYNC",
"plugin_type": "system",
"code_name": "folder_name",
"unique_prefix": "",
"plugin_type": "core|general|system|scanner|other|publisher",
"enabled": true,
"data_source": "script",
"data_source": "script|app-db-query|template|sqlite-db-query",
"mapped_to_table": "CurrentScan",
"data_filters": [
{
@@ -19,13 +19,13 @@
"display_name": [
{
"language_code": "en_us",
"string": "Sync Hub"
"string": "Display Name"
}
],
"description": [
{
"language_code": "en_us",
"string": "Plugin to synchronize multiple NetAlertX instances."
"string": "Plugin to ..."
}
],
"icon": [
@@ -55,27 +55,18 @@
{
"language_code": "en_us",
"string": "When to run"
},
{
"language_code": "es_es",
"string": "Cuándo ejecutar"
},
{
"language_code": "de_de",
"string": "Wann laufen"
}
],
"description": [
{
"language_code": "en_us",
"string": "When the sync should run. Data might be lost if you run the sync less frequently. Good options are <code>always_after_scan</code>, <code>on_new_device</code>, <code>on_notification</code>"
"string": "When the plugin should run. Good options are <code>always_after_scan</code>, <code>on_new_device</code>, <code>on_notification</code>"
}
]
},
{
"function": "RUN_SCHD",
"type": "text",
"default_value": "*/5 * * * *",
"options": [],
"localized": ["name", "description"],
@@ -89,19 +80,11 @@
{
"language_code": "en_us",
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#SYNC_RUN\"><code>SYNC_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
},
{
"language_code": "es_es",
"string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#SYNC_RUN\"><code>SYNC_RUN</code></a>. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingresar <code>0 4 * * *</code> ejecutará el escaneo después de las 4 a.m. en el <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ código> que configuró arriba</a>. Se ejecutará la PRÓXIMA vez que pase el tiempo."
},
{
"language_code": "de_de",
"string": "Nur aktiviert, wenn Sie <code>schedule</code> in der <a href=\"#SYNC_RUN\"><code>SYNC_RUN</code>-Einstellung</a> auswählen. Stellen Sie sicher, dass Sie den Zeitplan im richtigen Cron-ähnlichen Format eingeben (z. B. validieren unter <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Wenn Sie beispielsweise <code>0 4 * * *</code> eingeben, wird der Scan nach 4 Uhr morgens in der <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ ausgeführt. Code> den Sie oben festgelegt haben</a>. Wird das NÄCHSTE Mal ausgeführt, wenn die Zeit vergeht."
}
]
},
{
"function": "api_token",
"function": "text_example",
"type": "text",
"maxLength": 50,
"default_value": "",
@@ -110,79 +93,18 @@
"name": [
{
"language_code": "en_us",
"string": "API token"
"string": "Setting name"
}
],
"description": [
{
"language_code": "en_us",
"string": "API token to secure communication. It's sent in the request header. The API token needs to be the same on the hub and on the nodes."
"string": "Description / simple setup instructions"
}
]
},
{
"function": "encryption_key",
"type": "text",
"maxLength": 50,
"default_value": "",
"options": [],
"localized": ["name", "description"],
"name": [
{
"language_code": "en_us",
"string": "Encryption Key"
}
],
"description": [
{
"language_code": "en_us",
"string": "Encryption key used to encrypt the data before sending and for decryption on th ehub. The key needs to be the same on the hub and on the nodes."
}
]
},
{
"function": "hub_url",
"type": "text",
"maxLength": 50,
"default_value": "",
"options": [],
"localized": ["name", "description"],
"name": [
{
"language_code": "en_us",
"string": "Hub URL"
}
],
"description": [
{
"language_code": "en_us",
"string": "The URL of the hub (target instance). Set on the Node. Without a trailig slash, for example <code>http://192.168.1.82:20211</code>"
}
]
},
{
"function": "node_name",
"type": "text",
"maxLength": 50,
"default_value": "",
"options": [],
"localized": ["name", "description"],
"name": [
{
"language_code": "en_us",
"string": "Node name"
}
],
"description": [
{
"language_code": "en_us",
"string": "Use a unique node name, without spaces or special characters, such as <code>Node_Vlan01</code>"
}
]
},
{
"function": "devices",
"function": "boolean_example",
"type": "boolean",
"default_value": false,
"options": [],
@@ -190,18 +112,18 @@
"name": [
{
"language_code": "en_us",
"string": "Sync Devices"
"string": "Setting name"
}
],
"description": [
{
"language_code": "en_us",
"string": "When enabled the whole Devices table is sent over. Only new devices with new MACs are inserted in the target hub."
"string": "Description / simple setup instructions"
}
]
},
{
"function": "plugins",
"function": "multiselect_example_from_setting",
"type": "text.multiselect",
"maxLength": 50,
"default_value": [],
@@ -217,13 +139,13 @@
"name": [
{
"language_code": "en_us",
"string": "Sync Plugins"
"string": "Setting name"
}
],
"description": [
{
"language_code": "en_us",
"string": "Plugins to synchronize. Only plugins that produce some kind of output in <code>last_result.log</code> can be synchronized."
"string": "Description / simple setup instructions"
}
]
},
@@ -237,28 +159,12 @@
{
"language_code": "en_us",
"string": "Command"
},
{
"language_code": "es_es",
"string": "Comando"
},
{
"language_code": "de_de",
"string": "Befehl"
}
],
"description": [
{
"language_code": "en_us",
"string": "Command to run. This can not be changed"
},
{
"language_code": "es_es",
"string": "Comando a ejecutar. Esto no se puede cambiar"
},
{
"language_code": "de_de",
"string": "Befehl zum Ausführen. Dies kann nicht geändert werden"
}
]
},
@@ -272,28 +178,12 @@
{
"language_code": "en_us",
"string": "Run timeout"
},
{
"language_code": "es_es",
"string": "Tiempo límite de ejecución"
},
{
"language_code": "de_de",
"string": "Zeitüberschreitung"
}
],
"description": [
{
"language_code": "en_us",
"string": "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted."
},
{
"language_code": "es_es",
"string": "Tiempo máximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela."
},
{
"language_code": "de_de",
"string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen."
}
]
}
@@ -312,14 +202,6 @@
{
"language_code": "en_us",
"string": "MAC"
},
{
"language_code": "es_es",
"string": "MAC"
},
{
"language_code": "de_de",
"string": "MAC"
}
]
},
@@ -336,14 +218,6 @@
{
"language_code": "en_us",
"string": "IP"
},
{
"language_code": "es_es",
"string": "IP"
},
{
"language_code": "de_de",
"string": "IP"
}
]
},
@@ -376,14 +250,6 @@
{
"language_code": "en_us",
"string": "Vendor"
},
{
"language_code": "es_es",
"string": "Proveedor"
},
{
"language_code": "de_de",
"string": "Hersteller"
}
]
},
@@ -434,14 +300,6 @@
{
"language_code": "en_us",
"string": "Scan method"
},
{
"language_code": "es_es",
"string": "Método de escaneo"
},
{
"language_code": "de_de",
"string": "Scanmethode"
}
]
},
@@ -457,14 +315,6 @@
{
"language_code": "en_us",
"string": "Created"
},
{
"language_code": "es_es",
"string": "Creado"
},
{
"language_code": "de_de",
"string": "Erstellt"
}
]
},
@@ -480,14 +330,6 @@
{
"language_code": "en_us",
"string": "Changed"
},
{
"language_code": "es_es",
"string": "Cambiado"
},
{
"language_code": "de_de",
"string": "Geändert"
}
]
},
@@ -520,14 +362,6 @@
{
"language_code": "en_us",
"string": "Status"
},
{
"language_code": "es_es",
"string": "Estado"
},
{
"language_code": "de_de",
"string": "Status"
}
]
}

View File

@@ -136,7 +136,7 @@
"description": [
{
"language_code": "en_us",
"string": "Encryption key used to encrypt the data before sending and for decryption on th ehub. The key needs to be the same on the hub and on the nodes."
"string": "Encryption key used to encrypt the data before sending and for decryption on the hub. The key needs to be the same on the hub and on the nodes."
}
]
},

View File

@@ -1,23 +1,8 @@
## Overview
PLugin functionality overview and links to external resources if relevant. Include use cases if available.
> [!TIP]
> Some tip.
### Quick setup guide
To set up the plugin correctly, make sure...
#### Required Settings
- When to run `PREF_RUN`
-
UI-related settings.
### Usage
- Head to **Settings** > **Plugin name** to adjust the default values.
- Head to **Settings** > **UI Settings** to adjust the default values.
### Notes
- Additional notes, limitations, Author info.

View File

@@ -6,14 +6,16 @@ A plugin allowing for importing devices from a UniFi controller.
Specify the following settings in the Settings section of NetAlertX:
- `UNFIMP_username` - Username used to login into the UNIFI controller.
- `UNFIMP_password` - Password used to login into the UNIFI controller.
- `UNFIMP_host` - Host url or IP address where the UNIFI controller is hosted (excluding http://)
- `UNFIMP_username` - Username used to log in the UNIFI controller.
- `UNFIMP_password` - Password used to log in the UNIFI controller.
- `UNFIMP_host` - Host URL or IP address where the UNIFI controller is hosted (excluding `http://`)
- `UNFIMP_sites` - Name of the sites (usually 'default', check the URL in your UniFi controller UI if unsure. The site id is in the following part of the URL: `https://192.168.1.1:8443/manage/site/this-is-the-site-id/settings/`).
- `UNFIMP_protocol` - https:// or http://
- `UNFIMP_port` - Usually 8443
- `UNFIMP_port` - Usually `8443` or `8843`
- `UNFIMP_version` - e.g. `UDMP-unifiOS` is used for the "Cloud Gateway Ultra"
### Notes
- Currently only used to import devices, not their status, type or network map.
- It is recommend to create a read-only user in your UniFi controller
- It is recommended to create a read-only user in your UniFi controller

View File

@@ -122,7 +122,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
<div class ="settings-group col-sm-12">
<i class="<?= lang("settings_device_scanners_icon");?>"></i> <?= lang("settings_device_scanners_label");?>
</div>
<div class =" col-sm-12" id="device_scanner_content"></div>
<div class =" col-sm-12" id="device_scanner_content"> <?= lang("settings_device_scanners_info");?> </div>
</div>
<div class ="bg-grey-dark color-palette panel panel-default col-sm-12 box-default box-info" id="other_content_header">
@@ -136,7 +136,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
<div class ="settings-group col-sm-12">
<i class="<?= lang("settings_publishers_icon");?>"></i> <?= lang("settings_publishers_label");?>
</div>
<div class =" col-sm-12" id="publisher_content"></div>
<div class =" col-sm-12" id="publisher_content"><?= lang("settings_publishers_info");?></div>
</div>
</div>

View File

@@ -5,6 +5,36 @@ server {
add_header X-Forwarded-Prefix "/app" always;
proxy_set_header X-Forwarded-Prefix "/app";
# Increase buffer sizes to handle larger headers
proxy_buffer_size 512k;
proxy_buffers 16 512k;
proxy_busy_buffers_size 512k;
proxy_http_version 1.1;
proxy_set_header Connection "";
# # Whitelisting IP addresses
# location /api/ {
# # Allow requests from localhost (loopback address)
# allow 127.0.0.1;
# # Allow requests from other trusted IP addresses
# # allow 192.168.1.0/24; # Replace with the actual IP of a trusted client
# # Deny all other IP addresses
# deny all;
# # Enable CORS for specific frontend domain
# add_header 'Access-Control-Allow-Origin' 'http://vlan_ip' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
# if ($request_method = 'OPTIONS') {
# return 204;
# }
# try_files $uri $uri/ =404;
# }
location ~* \.php$ {
# Set Cache-Control header to prevent caching on the first load
add_header Cache-Control "no-store";

View File

@@ -14,7 +14,8 @@ from logger import mylog
from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value
from api import update_api
from plugin_utils import logEventStatusCounts, get_plugin_string, get_plugin_setting_obj, print_plugin_info, list_to_csv, combine_plugin_objects, resolve_wildcards_arr, handle_empty, custom_plugin_decoder, decode_and_rename_files
from notification import Notification_obj
from notification import Notification_obj, write_notification
#-------------------------------------------------------------------------------
class plugin_param:
@@ -751,6 +752,9 @@ def check_and_run_user_event(db, all_plugins, pluginsState):
# Check if the log file exists
logFile = os.path.join(logPath, "execution_queue.log")
# track if not an API event
show_events_completed = False
if not os.path.exists(logFile):
return pluginsState
@@ -767,8 +771,10 @@ def check_and_run_user_event(db, all_plugins, pluginsState):
event, param = columns
if event == 'test':
show_events_completed = True
pluginsState = handle_test(param, db, all_plugins, pluginsState)
if event == 'run':
show_events_completed = True
pluginsState = handle_run(param, db, all_plugins, pluginsState)
if event == 'update_api':
# update API endpoints
@@ -777,6 +783,10 @@ def check_and_run_user_event(db, all_plugins, pluginsState):
# Clear the log file
open(logFile, "w").close()
# only show pop up if not an API event
if show_events_completed:
write_notification('[Ad-hoc events] All Events executed', 'interrupt', timeNowTZ())
return pluginsState