From 1ea7990314f3be1b42016e54f67e2d47fe972d71 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Mon, 19 Dec 2022 23:53:48 +1100 Subject: [PATCH] settings prep 0 --- back/pialert.py | 163 ++++++++++++++++++---- docker-compose.yml | 1 + front/css/pialert.css | 53 +++++++ front/php/server/db.php | 23 +++- front/php/server/util.php | 20 +++ front/php/templates/header.php | 5 +- front/php/templates/language/de_de.php | 125 +++++++++++++++++ front/php/templates/language/en_us.php | 126 +++++++++++++++++ front/php/templates/language/es_es.php | 128 ++++++++++++++++- front/settings.php | 184 +++++++++++++++++++++++++ 10 files changed, 796 insertions(+), 32 deletions(-) create mode 100644 front/settings.php diff --git a/back/pialert.py b/back/pialert.py index d1e91170..052a5c93 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -49,11 +49,14 @@ STOPARPSCAN = pialertPath + "/db/setting_stoparpscan" PRINT_LOG = False TIMEZONE = 'Europe/Berlin' PIALERT_WEB_PROTECTION = False +PIALERT_WEB_PASSWORD = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92' INCLUDED_SECTIONS = ['internet', 'new_devices', 'down_devices', 'events'] # Specifies which events trigger notifications. # Remove the event type(s) you don't want to get notified on # Overrides device-specific settings in the UI. SCAN_CYCLE_MINUTES = 5 # delay between scans +SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0'] + # EMAIL settings # ---------------------- SMTP_SERVER = '' @@ -66,7 +69,6 @@ SMTP_SKIP_LOGIN = False REPORT_MAIL = False REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>' REPORT_TO = 'user@gmail.com' -REPORT_DEVICE_URL = 'http://pi.alert/deviceDetails.php?mac=' REPORT_DASHBOARD_URL = 'http://pi.alert/' # Webhook settings @@ -112,6 +114,10 @@ MQTT_DELAY_SEC = 2 # DynDNS # ---------------------- DDNS_ACTIVE = False +DDNS_DOMAIN = 'your_domain.freeddns.org' +DDNS_USER = 'dynu_user' +DDNS_PASSWORD = 'A0000000B0000000C0000000D0000000' +DDNS_UPDATE_URL = 'https://api.dynu.com/nic/update?' # PIHOLE settings # ---------------------- @@ -121,6 +127,13 @@ DHCP_ACTIVE = False # if enabled you need to # keep 90 days of network activity if not specified how many days to keep DAYS_TO_KEEP_EVENTS = 90 +# load the variables from pialert.conf +if (sys.version_info > (3,0)): + exec(open(pialertPath + "/config/pialert.conf").read()) +else: + execfile (pialertPath + "/config/pialert.conf") + +deviceUrl = REPORT_DASHBOARD_URL + '/deviceDetails.php?mac=' pialertPath = '/home/pi/pialert' dbPath = pialertPath + '/db/pialert.db' vendorsDB = '/usr/share/arp-scan/ieee-oui.txt' @@ -128,12 +141,12 @@ logPath = pialertPath + '/front/log' piholeDB = '/etc/pihole/pihole-FTL.db' piholeDhcpleases = '/etc/pihole/dhcp.leases' -# load user configuration +# # load user configuration -if (sys.version_info > (3,0)): - exec(open(pialertPath + "/config/pialert.conf").read()) -else: - execfile (pialertPath + "/config/pialert.conf") +# if (sys.version_info > (3,0)): +# exec(open(pialertPath + "/config/pialert.conf").read()) +# else: +# execfile (pialertPath + "/config/pialert.conf") #=============================================================================== # MAIN @@ -158,6 +171,14 @@ def main (): # second set of global variables global startTime, log_timestamp, sql_connection, sql + + # DB + sql_connection = None + sql = None + + # Upgrade DB if needed + upgradeDB() + # create log files write_file(logPath + 'IP_changes.log', '') write_file(logPath + 'stdout.log', '') @@ -168,12 +189,6 @@ def main (): # update NOW time time_now = datetime.datetime.now() - # re-load user configuration - if (sys.version_info > (3,0)): - exec(open(pialertPath + "/config/pialert.conf").read()) - else: - execfile (pialertPath + "/config/pialert.conf") - # proceed if 1 minute passed if last_run + timedelta(minutes=1) < time_now : @@ -188,16 +203,12 @@ def main (): log_timestamp = time_now - # DB - sql_connection = None - sql = None - # Timestamp startTime = time_now startTime = startTime.replace (second=0, microsecond=0) - # Upgrade DB if needed - upgradeDB() + # re-load user configuration + importConfig() # determine run/scan type based on passed time if last_internet_IP_scan + timedelta(minutes=3) < time_now: @@ -1479,7 +1490,7 @@ def email_reporting (): 'Event:', eventAlert['eve_EventType'], 'Time:', eventAlert['eve_DateTime'], 'IP:', eventAlert['eve_IP'], 'More Info:', eventAlert['eve_AdditionalInfo']) mail_html_Internet += html_line_template.format ( - REPORT_DEVICE_URL, eventAlert['eve_MAC'], + deviceUrl, eventAlert['eve_MAC'], eventAlert['eve_EventType'], eventAlert['eve_DateTime'], eventAlert['eve_IP'], eventAlert['eve_AdditionalInfo']) @@ -1511,7 +1522,7 @@ def email_reporting (): 'Name: ', eventAlert['dev_Name'], 'MAC: ', eventAlert['eve_MAC'], 'IP: ', eventAlert['eve_IP'], 'Time: ', eventAlert['eve_DateTime'], 'More Info: ', eventAlert['eve_AdditionalInfo']) mail_html_new_devices += html_line_template.format ( - REPORT_DEVICE_URL, eventAlert['eve_MAC'], eventAlert['eve_MAC'], + deviceUrl, eventAlert['eve_MAC'], eventAlert['eve_MAC'], eventAlert['eve_DateTime'], eventAlert['eve_IP'], eventAlert['dev_Name'], eventAlert['eve_AdditionalInfo']) @@ -1543,7 +1554,7 @@ def email_reporting (): 'Name: ', eventAlert['dev_Name'], 'MAC: ', eventAlert['eve_MAC'], 'Time: ', eventAlert['eve_DateTime'],'IP: ', eventAlert['eve_IP']) mail_html_devices_down += html_line_template.format ( - REPORT_DEVICE_URL, eventAlert['eve_MAC'], eventAlert['eve_MAC'], + deviceUrl, eventAlert['eve_MAC'], eventAlert['eve_MAC'], eventAlert['eve_DateTime'], eventAlert['eve_IP'], eventAlert['dev_Name']) @@ -1578,7 +1589,7 @@ def email_reporting (): 'IP: ', eventAlert['eve_IP'],'Time: ', eventAlert['eve_DateTime'], 'Event: ', eventAlert['eve_EventType'],'More Info: ', eventAlert['eve_AdditionalInfo']) mail_html_events += html_line_template.format ( - REPORT_DEVICE_URL, eventAlert['eve_MAC'], eventAlert['eve_MAC'], + deviceUrl, eventAlert['eve_MAC'], eventAlert['eve_MAC'], eventAlert['eve_DateTime'], eventAlert['eve_IP'], eventAlert['eve_EventType'], eventAlert['dev_Name'], eventAlert['eve_AdditionalInfo']) @@ -2095,8 +2106,6 @@ def mqtt_start(): # retain=True, # ) # time.sleep(10) - # client.loop() - # #------------------------------------------------------------------------------- @@ -2120,10 +2129,99 @@ def start_mqtt_thread (): #=============================================================================== # DB #=============================================================================== +def importConfig (): + openDB() + + # file_print('pialertPath:', pialertPath) + + # Code_Name, Display_Name, Description, Type, Options, Value, Group + settings = [ + + # General + ('SCAN_SUBNETS', 'Subnets to scan', '', 'text', '', '' , str(SCAN_SUBNETS) , 'General'), + ('PRINT_LOG', 'Print additional logging', '', 'boolean', '', '' , str(PRINT_LOG) , 'General'), + ('TIMEZONE', 'Time zone', '', 'text', '', '' ,str(TIMEZONE) , 'General'), + ('PIALERT_WEB_PROTECTION', 'Enable logon', '', 'boolean', '', '' , str(PIALERT_WEB_PROTECTION) , 'General'), + ('PIALERT_WEB_PASSWORD', 'Logon password', '', 'password', '', '' , str(PIALERT_WEB_PASSWORD) , 'General'), + ('INCLUDED_SECTIONS', 'Notify on changes in', '', 'multiselect', "['internet', 'new_devices', 'down_devices', 'events']", '' , str(INCLUDED_SECTIONS) , 'General'), + ('SCAN_CYCLE_MINUTES', 'Scan cycle delay (m)', '', 'integer', '', '' , str(SCAN_CYCLE_MINUTES) , 'General'), + ('DAYS_TO_KEEP_EVENTS', 'Delete events older than (days)', '', 'integer', '', '' , str(DAYS_TO_KEEP_EVENTS) , 'General'), + ('REPORT_DASHBOARD_URL', 'PiAlert URL', '', 'text', '', '' , str(REPORT_DASHBOARD_URL) , 'General'), + + # Email + ('REPORT_MAIL', 'Enable email', '', 'boolean', '', '' , str(REPORT_MAIL) , 'Email'), + ('SMTP_SERVER', 'SMTP server URL', '', 'text', '', '' , str(SMTP_SERVER) , 'Email'), + ('SMTP_PORT', 'SMTP port', '', 'text', '', '' , str(SMTP_PORT) , 'Email'), + ('REPORT_TO', 'Email to', '', 'text', '', '' , str(REPORT_TO) , 'Email'), + ('REPORT_FROM', 'Email Subject', '', 'text', '', '' , str(REPORT_FROM) , 'Email'), + ('SMTP_SKIP_LOGIN', 'SMTP skip login', '', 'boolean', '', '' , str(SMTP_SKIP_LOGIN) , 'Email'), + ('SMTP_USER', 'SMTP user', '', 'text', '', '' , str(SMTP_USER) , 'Email'), + ('SMTP_PASS', 'SMTP password', '', 'password', '', '' , str(SMTP_PASS) , 'Email'), + ('SMTP_SKIP_TLS', 'SMTP skip TLS', '', 'boolean', '', '' , str(SMTP_SKIP_TLS) , 'Email'), + + # Webhooks + ('REPORT_WEBHOOK', 'Enable Webhooks', '', 'boolean', '', '' , str(REPORT_WEBHOOK) , 'Webhooks'), + ('WEBHOOK_URL', 'Target URL', '', 'text', '', '' , str(WEBHOOK_URL) , 'Webhooks'), + ('WEBHOOK_PAYLOAD', 'Payload type', '', 'select', "['json', 'html', 'text']", '' , str(WEBHOOK_PAYLOAD) , 'Webhooks'), + ('WEBHOOK_REQUEST_METHOD', 'Request type', '', 'select', "['GET', 'POST', 'PUT']", '' , str(WEBHOOK_REQUEST_METHOD) , 'Webhooks'), + + # Apprise + ('REPORT_APPRISE', 'Enable Apprise', '', 'boolean', '', '' , str(REPORT_APPRISE) , 'Apprise'), + ('APPRISE_HOST', 'Apprise host URL', '', 'text', '', '' , str(APPRISE_HOST) , 'Apprise'), + ('APPRISE_URL', 'Apprise notification URL', '', 'text', '', '' , str(APPRISE_URL) , 'Apprise'), + + # NTFY + ('REPORT_NTFY', 'Enable NTFY', '', 'boolean', '', '' , str(REPORT_NTFY) , 'NTFY'), + ('NTFY_HOST', 'NTFY host URL', '', 'text', '', '' , str(NTFY_HOST) , 'NTFY'), + ('NTFY_TOPIC', 'NTFY topic', '', 'text', '', '' , str(NTFY_TOPIC) , 'NTFY'), + ('NTFY_USER', 'NTFY user', '', 'text', '', '' , str(NTFY_USER) , 'NTFY'), + ('NTFY_PASSWORD', 'NTFY password', '', 'password', '', '' , str(NTFY_PASSWORD) , 'NTFY'), + + # PUSHSAFER + ('REPORT_PUSHSAFER', 'Enable PUSHSAFER', '', 'boolean', '', '' , str(REPORT_PUSHSAFER) , 'PUSHSAFER'), + ('PUSHSAFER_TOKEN', 'PUSHSAFER token', '', 'text', '', '' , str(PUSHSAFER_TOKEN) , 'PUSHSAFER'), + + # MQTT + ('REPORT_MQTT', 'Enable MQTT', '', 'boolean', '', '' , str(REPORT_MQTT) , 'MQTT'), + ('MQTT_BROKER', 'MQTT broker host URL', '', 'text', '', '' , str(MQTT_BROKER) , 'MQTT'), + ('MQTT_PORT', 'MQTT broker port', '', 'text', '', '' , str(MQTT_PORT) , 'MQTT'), + ('MQTT_USER', 'MQTT user', '', 'text', '', '' , str(MQTT_USER) , 'MQTT'), + ('MQTT_PASSWORD', 'MQTT password', '', 'password', '', '' , str(MQTT_PASSWORD) , 'MQTT'), + ('MQTT_QOS', 'MQTT Quality of Service', '', 'select', "['0', '1', '2']", '' , str(MQTT_QOS) , 'MQTT'), + ('MQTT_DELAY_SEC', 'MQTT delay per device (s)', '', 'select', "['2', '3', '4', '5']", '' , str(MQTT_DELAY_SEC) , 'MQTT'), + + #DynDNS + ('DDNS_ACTIVE', 'Enable DynDNS', '', 'boolean', '', '' , str(DDNS_ACTIVE) , 'DynDNS'), + # ('QUERY_MYIP_SERVER', 'Query MY IP Server URL', '', 'text', '', '' , QUERY_MYIP_SERVER , 'DynDNS'), + ('DDNS_DOMAIN', 'DynDNS domain URL', '', 'text', '', '' , str(DDNS_DOMAIN) , 'DynDNS'), + ('DDNS_USER', 'DynDNS user', '', 'text', '', '' , str(DDNS_USER) , 'DynDNS'), + ('DDNS_PASSWORD', 'DynDNS password', '', 'password', '', '' , str(DDNS_PASSWORD) , 'DynDNS'), + ('DDNS_UPDATE_URL', 'DynDNS update URL', '', 'text', '', '' , str(DDNS_UPDATE_URL) , 'DynDNS'), + + # PiHole + ('PIHOLE_ACTIVE', 'Enable PiHole mapping', 'If enabled you need to map /etc/pihole/pihole-FTL.db in your docker-compose.yml', 'boolean', '', '' , str(PIHOLE_ACTIVE) , 'PiHole'), + ('DHCP_ACTIVE', 'Enable PiHole DHCP', 'If enabled you need to map /etc/pihole/dhcp.leases in your docker-compose.yml', 'boolean', '', '' , str(DHCP_ACTIVE) , 'PiHole') + + ] + # Insert into DB + sql.execute ("DELETE FROM Settings") + + sql.executemany ("""INSERT INTO Settings ("Code_Name", "Display_Name", "Description", "Type", "Options", + "RegEx", "Value", "Group" ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)""", settings) + + closeDB() + + def upgradeDB (): openDB() + # indicates, if Settings table is available + settingsMissing = sql.execute(""" + SELECT name FROM sqlite_master WHERE type='table' + AND name='Settings'; + """).fetchone() == None + # indicates, if Online_History table is available onlineHistoryAvailable = sql.execute(""" SELECT name FROM sqlite_master WHERE type='table' @@ -2157,6 +2255,23 @@ def upgradeDB (): ); """) + # Settings table + if settingsMissing: + sql.execute(""" + CREATE TABLE "Settings" ( + "Index" INTEGER, + "Code_Name" TEXT, + "Display_Name" TEXT, + "Description" TEXT, + "Type" TEXT, + "Options" TEXT, + "RegEx" TEXT, + "Value" TEXT, + "Group" TEXT, + PRIMARY KEY("Index" AUTOINCREMENT) + ); + """) + # Alter Devices table # dev_Network_Node_MAC_ADDR column dev_Network_Node_MAC_ADDR_missing = sql.execute (""" diff --git a/docker-compose.yml b/docker-compose.yml index fcd96fbc..e44cd0ce 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,7 @@ services: - ${DEV_LOCATION}/front/maintenance.php:/home/pi/pialert/front/maintenance.php - ${DEV_LOCATION}/front/network.php:/home/pi/pialert/front/network.php - ${DEV_LOCATION}/front/presence.php:/home/pi/pialert/front/presence.php + - ${DEV_LOCATION}/front/settings.php:/home/pi/pialert/front/settings.php environment: - TZ=${TZ} - PORT=${PORT} diff --git a/front/css/pialert.css b/front/css/pialert.css index cf16aa16..cc039ae6 100755 --- a/front/css/pialert.css +++ b/front/css/pialert.css @@ -547,3 +547,56 @@ height: 50px; .infobox_label { font-size: 16px !important; } + +/*settings*/ + +.table_row { + padding: 3px; + width:100%; + display: flex; + border-bottom-width: 1px; + border-bottom-style: solid; + border-color: #606060; +} + +.table_cell { + float:left; + padding: 3px; + padding-left: 10px; +} + + + +.setting_name +{ + width:20%; + font-weight: 300; +} + +.setting_description +{ + width:50%; +} + +.setting_input +{ + width:30%; +} + +.setting_input input +{ + width:300px; +} + +.settings_content { + padding: 10px; + background-color: #272c30; + margin: 10px; + +} + +.settings_content input[type=checkbox] +{ + width: auto +} + diff --git a/front/php/server/db.php b/front/php/server/db.php index d4458bc6..e89ecccf 100755 --- a/front/php/server/db.php +++ b/front/php/server/db.php @@ -20,7 +20,6 @@ date_default_timezone_set($Pia_TimeZone); // DB File Path $DBFILE = '../../../db/pialert.db'; - //------------------------------------------------------------------------------ // Connect DB //------------------------------------------------------------------------------ @@ -36,9 +35,11 @@ function SQLite3_connect ($trytoreconnect) { { // sqlite3 throws an exception when it is unable to connect // try to reconnect one time after 3 seconds + if($trytoreconnect) { - sleep(3); + echo ''; + sleep(3); return SQLite3_connect(false); } } @@ -48,21 +49,31 @@ function SQLite3_connect ($trytoreconnect) { //------------------------------------------------------------------------------ // Open DB //------------------------------------------------------------------------------ -function OpenDB () { + +function OpenDB (...$DBPath) { global $DBFILE; global $db; + // use custom path if supplied + foreach ($DBPath as $path) { + $DBFILE = $path; + } + if(strlen($DBFILE) == 0) { - die ('Database no available'); + echo ''; + die ('
Database not available
'); } $db = SQLite3_connect(true); - $db->exec('PRAGMA journal_mode = wal;'); + if(!$db) { - die ('Error connecting to database'); + echo ''; + die ('
Error connecting to the database
'); } + + $db->exec('PRAGMA journal_mode = wal;'); } ?> \ No newline at end of file diff --git a/front/php/server/util.php b/front/php/server/util.php index 58e75f4f..171c85e0 100755 --- a/front/php/server/util.php +++ b/front/php/server/util.php @@ -19,6 +19,14 @@ date_default_timezone_set($Pia_TimeZone); //------------------------------------------------------------------------------ // Formatting data functions //------------------------------------------------------------------------------ +function createArray($input){ + $pattern = '/(^\s*\[)|(\]\s*$)/'; + $replacement = ''; + $noBrackets = preg_replace($pattern, $replacement, $input); + + return $options = explode(",", $noBrackets); +} + function formatDate ($date1) { return date_format (new DateTime ($date1) , 'Y-m-d H:i'); } @@ -51,6 +59,18 @@ function formatIPlong ($IP) { //------------------------------------------------------------------------------ // Others functions //------------------------------------------------------------------------------ +function getString ($codeName, $default, $pia_lang) { + + $result = $pia_lang[$codeName]; + + if ($result ) + { + return $result; + } + + return $default; +} + function getDateFromPeriod () { $period = $_REQUEST['period']; return '"'. date ('Y-m-d', strtotime ('+1 day -'. $period) ) .'"'; diff --git a/front/php/templates/header.php b/front/php/templates/header.php index 0cb9a7eb..5c5ced86 100755 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -237,7 +237,10 @@ document.addEventListener("visibilitychange",()=>{
  • - + +
  • +
  • +
  • diff --git a/front/php/templates/language/de_de.php b/front/php/templates/language/de_de.php index 49cf7d8f..9494d095 100755 --- a/front/php/templates/language/de_de.php +++ b/front/php/templates/language/de_de.php @@ -42,6 +42,7 @@ $pia_lang['Navigation_Devices'] = 'Geräte'; $pia_lang['Navigation_Presence'] = 'Anwesenheit'; $pia_lang['Navigation_Events'] = 'Ereignisse'; $pia_lang['Navigation_Maintenance'] = 'Wartung'; +$pia_lang['Navigation_Settings'] = 'Einstellung'; $pia_lang['Navigation_Network'] = 'Netzwerk'; $pia_lang['Navigation_HelpFAQ'] = 'Hilfe / FAQ'; @@ -400,4 +401,128 @@ $pia_lang['HelpFAQ_Cat_Network_600_text'] = 'Diese Seite soll dir die Möglichke sie ggf. mit einer Portanzahl versehen und bereits erkannte Geräte diesen zuordnen. Diese Zuordnung erfolgt in der Detailansicht, des zuzuordnenden Gerätes. So ist es dir möglich, schnell festzustellen an welchem Port ein Host angeschlossen und ob er online ist.'; +////////////////////////////////////////////////////////////////// +// Settings +////////////////////////////////////////////////////////////////// + +//General +$pia_lang['SCAN_SUBNETS_name'] = 'Subnets to scan'; +$pia_lang['SCAN_SUBNETS_description'] = ' +
      +
    1. Specify the network mask. For example, the filter 192.168.1.0/24 covers IP ranges 192.168.1.0 to 192.168.1.255.
    2. +
    3. Run iwconfig to find your interface name(s) (e.g.: eth0, eth1)
    4. +
    5. Examples ( Note the [\'...\', \'...\'] format for two and more subnets): +
    +'; +$pia_lang['PRINT_LOG_name'] = 'Print additional logging'; +$pia_lang['PRINT_LOG_description'] = 'This setting will enable more verbose logging. Useful for debugging events writing into the database.'; +$pia_lang['TIMEZONE_name'] = 'Time zone'; +$pia_lang['TIMEZONE_description'] = 'Time zone to display stats correctly. Find your time zone here.'; +$pia_lang['PIALERT_WEB_PROTECTION_name'] = 'Enable login'; +$pia_lang['PIALERT_WEB_PROTECTION_description'] = 'When enabled a login dialog is displayed. Read below carefully if you get locked out of your instance.'; +$pia_lang['PIALERT_WEB_PASSWORD_name'] = 'Login password'; +$pia_lang['PIALERT_WEB_PASSWORD_description'] = 'The default password is 123456. To change password run /home/pi/pialert/back/pialert-cli'; +$pia_lang['INCLUDED_SECTIONS_name'] = 'Notify on'; +$pia_lang['INCLUDED_SECTIONS_description'] = 'Specifies which events trigger notifications. Remove the event type(s) you don\'t want to get notified on. This setting overrides device-specific settings in the UI. (CTRL + Click to select / deselect).'; +$pia_lang['SCAN_CYCLE_MINUTES_name'] = 'Scan cycle delay'; +$pia_lang['SCAN_CYCLE_MINUTES_description'] = 'The delay between scans. The shortest tested interval between scans was 3 minutes. A 5 minutes loop works reliably on a /24 network mask. If using arp-scan, the scan time itself depends on the number of IP addresses to check. This number depends on the network mask set in the "Subnets to scan" setting at the top. For example, a /24 mask results in 256 IPs to check, where as a /16 mask checks around 65000. Every IP takes a couple seconds to scan.'; +$pia_lang['DAYS_TO_KEEP_EVENTS_name'] = 'Delete events older than'; +$pia_lang['DAYS_TO_KEEP_EVENTS_description'] = 'This is a maintenance setting. This specifies the number of days worth of event entries that will be kept. All older events will be deleted periodically.'; +$pia_lang['REPORT_DASHBOARD_URL_name'] = 'Pi.Alert URL'; +$pia_lang['REPORT_DASHBOARD_URL_description'] = 'This URL is used as the base for generating links in the emails. Enter full URL starting with http:// including the port number (no trailig slash /).'; + +//Email +$pia_lang['REPORT_MAIL_name'] = 'Enable email'; +$pia_lang['REPORT_MAIL_description'] = 'If enabled an email is sent out with a list of changes you\'ve subscribed to. Please also fill out all remaining settings related to the SMTP setup below.'; +$pia_lang['SMTP_SERVER_name'] = 'SMTP server URL'; +$pia_lang['SMTP_SERVER_description'] = 'The SMTP server host URL. For example smtp-relay.sendinblue.com.'; +$pia_lang['SMTP_PORT_name'] = 'SMTP server PORT'; +$pia_lang['SMTP_PORT_description'] = 'Port number used for the SMTP connection.'; +$pia_lang['SMTP_SKIP_LOGIN_name'] = 'Skip authentication'; +$pia_lang['SMTP_SKIP_LOGIN_description'] = 'Don\'t use authentication when connecting to the SMTP server.'; +$pia_lang['SMTP_USER_name'] = 'SMTP user'; +$pia_lang['SMTP_USER_description'] = 'The user name used to login into the SMTP server (sometimes a full email address).'; +$pia_lang['SMTP_PASS_name'] = 'SMTP password'; +$pia_lang['SMTP_PASS_description'] = 'The SMTP server password. '; +$pia_lang['SMTP_SKIP_TLS_name'] = 'Don\'t use TLS'; +$pia_lang['SMTP_SKIP_TLS_description'] = 'Disable TLS when connecting to your SMTP server.'; +$pia_lang['REPORT_TO_name'] = 'Send email to'; +$pia_lang['REPORT_TO_description'] = 'Email address to which the notification will be send to.'; +$pia_lang['REPORT_FROM_name'] = 'Email subject'; +$pia_lang['REPORT_FROM_description'] = 'Notification email subject line.'; + +//Webhooks +$pia_lang['REPORT_WEBHOOK_name'] = 'Enable Webhooks'; +$pia_lang['REPORT_WEBHOOK_description'] = 'Enable webhooks for notifications. If enabled, configure related settings below.'; +$pia_lang['WEBHOOK_URL_name'] = 'Target URL'; +$pia_lang['WEBHOOK_URL_description'] = 'Target URL starting with http:// or https://.'; +$pia_lang['WEBHOOK_PAYLOAD_name'] = 'Payload type'; +$pia_lang['WEBHOOK_PAYLOAD_description'] = 'The Webhook payload data format for the "body > attachements > text" attribute in the payload json. See an examnple of the payload here. (e.g.: for discord use \'html\')'; +$pia_lang['WEBHOOK_REQUEST_METHOD_name'] = 'Request method'; +$pia_lang['WEBHOOK_REQUEST_METHOD_description'] = 'The HTTP request method to be used for the webhook call.'; + +// Apprise +$pia_lang['REPORT_APPRISE_name'] = 'Enable Apprise'; +$pia_lang['REPORT_APPRISE_description'] = 'Enable sending notifications via Apprise.'; +$pia_lang['APPRISE_HOST_name'] = 'Apprise host URL'; +$pia_lang['APPRISE_HOST_description'] = 'Apprise host URL starting with http:// or https://. (don\'t forget to include /notify at the end)'; +$pia_lang['APPRISE_URL_name'] = 'Apprise notification URL'; +$pia_lang['APPRISE_URL_description'] = 'Apprise notification target URL.'; + +// NTFY +$pia_lang['REPORT_NTFY_name'] = 'Enable NTFY'; +$pia_lang['REPORT_NTFY_description'] = 'Enable sending notifications via NTFY.'; +$pia_lang['NTFY_HOST_name'] = 'NTFY host URL'; +$pia_lang['NTFY_HOST_description'] = 'NTFY host URL starting with http:// or https://. You can use the hosted instance on https://ntfy.sh by simply entering https://ntfy.sh.'; +$pia_lang['NTFY_TOPIC_name'] = 'NTFY topic'; +$pia_lang['NTFY_TOPIC_description'] = 'Your secret topic.'; +$pia_lang['NTFY_USER_name'] = 'NTFY user'; +$pia_lang['NTFY_USER_description'] = 'Enter user if you need (host) an instance with enabled authetication.'; +$pia_lang['NTFY_PASSWORD_name'] = 'NTFY password'; +$pia_lang['NTFY_PASSWORD_description'] = 'Enter password if you need (host) an instance with enabled authetication.'; + +// Pushsafer +$pia_lang['REPORT_PUSHSAFER_name'] = 'Enable Pushsafer'; +$pia_lang['REPORT_PUSHSAFER_description'] = 'Enable sending notifications via Pushsafer.'; +$pia_lang['PUSHSAFER_TOKEN_name'] = 'Pushsafer token'; +$pia_lang['PUSHSAFER_TOKEN_description'] = 'Your secret Pushsafer API key (token).'; + + +// MQTT +$pia_lang['REPORT_MQTT_name'] = 'Enable MQTT'; +$pia_lang['REPORT_MQTT_description'] = 'Enable sending notifications via MQTT to your Home Assistance instance.'; +$pia_lang['MQTT_BROKER_name'] = 'MQTT broker URL'; +$pia_lang['MQTT_BROKER_description'] = 'MQTT host URL (don\'t include http:// or https://).'; +$pia_lang['MQTT_PORT_name'] = 'MQTT broker port'; +$pia_lang['MQTT_PORT_description'] = 'Port number where the broker is listening. Usually 1883.'; +$pia_lang['MQTT_USER_name'] = 'MQTT user'; +$pia_lang['MQTT_USER_description'] = 'User name used to login into your MQTT broker instance.'; +$pia_lang['MQTT_PASSWORD_name'] = 'MQTT password'; +$pia_lang['MQTT_PASSWORD_description'] = 'Password used to login into your MQTT broker instance.'; +$pia_lang['MQTT_QOS_name'] = 'MQTT Quality of Service'; +$pia_lang['MQTT_QOS_description'] = 'Quality of service setting for MQTT message sending. 0 - Low quality to 2 - High quality. The higher the quality the longer the delay.'; +$pia_lang['MQTT_DELAY_SEC_name'] = 'MQTT delay per device'; +$pia_lang['MQTT_DELAY_SEC_description'] = 'A little hack - delay adding to the queue in case the process is restarted and previous publish processes aborted (it takes ~2s to update a sensor config on the broker). Tested with 2-3 seconds of delay. This delay is only applied when devices are created (during the first notification loop). It doesn\'t affect subsequent scans or notifications.'; + +//DynDNS +$pia_lang['DDNS_ACTIVE_name'] = 'Enable DynDNS'; +$pia_lang['DDNS_ACTIVE_description'] = ''; +$pia_lang['DDNS_DOMAIN_name'] = 'DynDNS domain URL'; +$pia_lang['DDNS_DOMAIN_description'] = ''; +$pia_lang['DDNS_USER_name'] = 'DynDNS user'; +$pia_lang['DDNS_USER_description'] = ''; +$pia_lang['DDNS_PASSWORD_name'] = 'DynDNS password'; +$pia_lang['DDNS_PASSWORD_description'] = ''; +$pia_lang['DDNS_UPDATE_URL_name'] = 'DynDNS update URL'; +$pia_lang['DDNS_UPDATE_URL_description'] = 'Update URL starting with http:// or https://.'; + +// PiHole +$pia_lang['PIHOLE_ACTIVE_name'] = 'Enable PiHole mapping'; +$pia_lang['PIHOLE_ACTIVE_description'] = 'If enabled you need to map :/etc/pihole/pihole-FTL.db in your docker-compose.yml file.'; +$pia_lang['DHCP_ACTIVE_name'] = 'Enable PiHole DHCP'; +$pia_lang['DHCP_ACTIVE_description'] = 'If enabled you need to map :/etc/pihole/dhcp.leases in your docker-compose.yml file.'; + ?> \ No newline at end of file diff --git a/front/php/templates/language/en_us.php b/front/php/templates/language/en_us.php index 8c2a918a..3bd9736d 100755 --- a/front/php/templates/language/en_us.php +++ b/front/php/templates/language/en_us.php @@ -42,6 +42,7 @@ $pia_lang['Navigation_Devices'] = 'Devices'; $pia_lang['Navigation_Presence'] = 'Presence'; $pia_lang['Navigation_Events'] = 'Events'; $pia_lang['Navigation_Maintenance'] = 'Maintenance'; +$pia_lang['Navigation_Settings'] = 'Settings'; $pia_lang['Navigation_Network'] = 'Network'; $pia_lang['Navigation_HelpFAQ'] = 'Help / FAQ'; $pia_lang['Device_Title'] = 'Devices'; @@ -412,4 +413,129 @@ $pia_lang['HelpFAQ_Cat_Network_600_head'] = 'What is this page for?'; $pia_lang['HelpFAQ_Cat_Network_600_text'] = 'This page should offer you the possibility to map the assignment of your network devices. For this purpose, you can create one or more switches, WLANs, routers, etc., provide them with a port number if necessary and assign already detected devices to them. This assignment is done in the detailed view of the device to be assigned. So it is possible for you to quickly determine to which port a host is connected and if it is online.'; +////////////////////////////////////////////////////////////////// +// Settings +////////////////////////////////////////////////////////////////// + +//General +$pia_lang['SCAN_SUBNETS_name'] = 'Subnets to scan'; +$pia_lang['SCAN_SUBNETS_description'] = ' +
      +
    1. Specify the network mask. For example, the filter 192.168.1.0/24 covers IP ranges 192.168.1.0 to 192.168.1.255.
    2. +
    3. Run iwconfig to find your interface name(s) (e.g.: eth0, eth1)
    4. +
    5. Examples ( Note the [\'...\', \'...\'] format for two and more subnets): +
    +'; +$pia_lang['PRINT_LOG_name'] = 'Print additional logging'; +$pia_lang['PRINT_LOG_description'] = 'This setting will enable more verbose logging. Useful for debugging events writing into the database.'; +$pia_lang['TIMEZONE_name'] = 'Time zone'; +$pia_lang['TIMEZONE_description'] = 'Time zone to display stats correctly. Find your time zone here.'; +$pia_lang['PIALERT_WEB_PROTECTION_name'] = 'Enable login'; +$pia_lang['PIALERT_WEB_PROTECTION_description'] = 'When enabled a login dialog is displayed. Read below carefully if you get locked out of your instance.'; +$pia_lang['PIALERT_WEB_PASSWORD_name'] = 'Login password'; +$pia_lang['PIALERT_WEB_PASSWORD_description'] = 'The default password is 123456. To change password run /home/pi/pialert/back/pialert-cli'; +$pia_lang['INCLUDED_SECTIONS_name'] = 'Notify on'; +$pia_lang['INCLUDED_SECTIONS_description'] = 'Specifies which events trigger notifications. Remove the event type(s) you don\'t want to get notified on. This setting overrides device-specific settings in the UI. (CTRL + Click to select / deselect).'; +$pia_lang['SCAN_CYCLE_MINUTES_name'] = 'Scan cycle delay'; +$pia_lang['SCAN_CYCLE_MINUTES_description'] = 'The delay between scans. The shortest tested interval between scans was 3 minutes. A 5 minutes loop works reliably on a /24 network mask. If using arp-scan, the scan time itself depends on the number of IP addresses to check. This number depends on the network mask set in the "Subnets to scan" setting at the top. For example, a /24 mask results in 256 IPs to check, where as a /16 mask checks around 65000. Every IP takes a couple seconds to scan.'; +$pia_lang['DAYS_TO_KEEP_EVENTS_name'] = 'Delete events older than'; +$pia_lang['DAYS_TO_KEEP_EVENTS_description'] = 'This is a maintenance setting. This specifies the number of days worth of event entries that will be kept. All older events will be deleted periodically.'; +$pia_lang['REPORT_DASHBOARD_URL_name'] = 'Pi.Alert URL'; +$pia_lang['REPORT_DASHBOARD_URL_description'] = 'This URL is used as the base for generating links in the emails. Enter full URL starting with http:// including the port number (no trailig slash /).'; + +//Email +$pia_lang['REPORT_MAIL_name'] = 'Enable email'; +$pia_lang['REPORT_MAIL_description'] = 'If enabled an email is sent out with a list of changes you\'ve subscribed to. Please also fill out all remaining settings related to the SMTP setup below.'; +$pia_lang['SMTP_SERVER_name'] = 'SMTP server URL'; +$pia_lang['SMTP_SERVER_description'] = 'The SMTP server host URL. For example smtp-relay.sendinblue.com.'; +$pia_lang['SMTP_PORT_name'] = 'SMTP server PORT'; +$pia_lang['SMTP_PORT_description'] = 'Port number used for the SMTP connection.'; +$pia_lang['SMTP_SKIP_LOGIN_name'] = 'Skip authentication'; +$pia_lang['SMTP_SKIP_LOGIN_description'] = 'Don\'t use authentication when connecting to the SMTP server.'; +$pia_lang['SMTP_USER_name'] = 'SMTP user'; +$pia_lang['SMTP_USER_description'] = 'The user name used to login into the SMTP server (sometimes a full email address).'; +$pia_lang['SMTP_PASS_name'] = 'SMTP password'; +$pia_lang['SMTP_PASS_description'] = 'The SMTP server password. '; +$pia_lang['SMTP_SKIP_TLS_name'] = 'Don\'t use TLS'; +$pia_lang['SMTP_SKIP_TLS_description'] = 'Disable TLS when connecting to your SMTP server.'; +$pia_lang['REPORT_TO_name'] = 'Send email to'; +$pia_lang['REPORT_TO_description'] = 'Email address to which the notification will be send to.'; +$pia_lang['REPORT_FROM_name'] = 'Email subject'; +$pia_lang['REPORT_FROM_description'] = 'Notification email subject line.'; + +//Webhooks +$pia_lang['REPORT_WEBHOOK_name'] = 'Enable Webhooks'; +$pia_lang['REPORT_WEBHOOK_description'] = 'Enable webhooks for notifications. If enabled, configure related settings below.'; +$pia_lang['WEBHOOK_URL_name'] = 'Target URL'; +$pia_lang['WEBHOOK_URL_description'] = 'Target URL starting with http:// or https://.'; +$pia_lang['WEBHOOK_PAYLOAD_name'] = 'Payload type'; +$pia_lang['WEBHOOK_PAYLOAD_description'] = 'The Webhook payload data format for the "body > attachements > text" attribute in the payload json. See an examnple of the payload here. (e.g.: for discord use \'html\')'; +$pia_lang['WEBHOOK_REQUEST_METHOD_name'] = 'Request method'; +$pia_lang['WEBHOOK_REQUEST_METHOD_description'] = 'The HTTP request method to be used for the webhook call.'; + +// Apprise +$pia_lang['REPORT_APPRISE_name'] = 'Enable Apprise'; +$pia_lang['REPORT_APPRISE_description'] = 'Enable sending notifications via Apprise.'; +$pia_lang['APPRISE_HOST_name'] = 'Apprise host URL'; +$pia_lang['APPRISE_HOST_description'] = 'Apprise host URL starting with http:// or https://. (don\'t forget to include /notify at the end)'; +$pia_lang['APPRISE_URL_name'] = 'Apprise notification URL'; +$pia_lang['APPRISE_URL_description'] = 'Apprise notification target URL.'; + +// NTFY +$pia_lang['REPORT_NTFY_name'] = 'Enable NTFY'; +$pia_lang['REPORT_NTFY_description'] = 'Enable sending notifications via NTFY.'; +$pia_lang['NTFY_HOST_name'] = 'NTFY host URL'; +$pia_lang['NTFY_HOST_description'] = 'NTFY host URL starting with http:// or https://. You can use the hosted instance on https://ntfy.sh by simply entering https://ntfy.sh.'; +$pia_lang['NTFY_TOPIC_name'] = 'NTFY topic'; +$pia_lang['NTFY_TOPIC_description'] = 'Your secret topic.'; +$pia_lang['NTFY_USER_name'] = 'NTFY user'; +$pia_lang['NTFY_USER_description'] = 'Enter user if you need (host) an instance with enabled authetication.'; +$pia_lang['NTFY_PASSWORD_name'] = 'NTFY password'; +$pia_lang['NTFY_PASSWORD_description'] = 'Enter password if you need (host) an instance with enabled authetication.'; + +// Pushsafer +$pia_lang['REPORT_PUSHSAFER_name'] = 'Enable Pushsafer'; +$pia_lang['REPORT_PUSHSAFER_description'] = 'Enable sending notifications via Pushsafer.'; +$pia_lang['PUSHSAFER_TOKEN_name'] = 'Pushsafer token'; +$pia_lang['PUSHSAFER_TOKEN_description'] = 'Your secret Pushsafer API key (token).'; + + +// MQTT +$pia_lang['REPORT_MQTT_name'] = 'Enable MQTT'; +$pia_lang['REPORT_MQTT_description'] = 'Enable sending notifications via MQTT to your Home Assistance instance.'; +$pia_lang['MQTT_BROKER_name'] = 'MQTT broker URL'; +$pia_lang['MQTT_BROKER_description'] = 'MQTT host URL (don\'t include http:// or https://).'; +$pia_lang['MQTT_PORT_name'] = 'MQTT broker port'; +$pia_lang['MQTT_PORT_description'] = 'Port number where the broker is listening. Usually 1883.'; +$pia_lang['MQTT_USER_name'] = 'MQTT user'; +$pia_lang['MQTT_USER_description'] = 'User name used to login into your MQTT broker instance.'; +$pia_lang['MQTT_PASSWORD_name'] = 'MQTT password'; +$pia_lang['MQTT_PASSWORD_description'] = 'Password used to login into your MQTT broker instance.'; +$pia_lang['MQTT_QOS_name'] = 'MQTT Quality of Service'; +$pia_lang['MQTT_QOS_description'] = 'Quality of service setting for MQTT message sending. 0 - Low quality to 2 - High quality. The higher the quality the longer the delay.'; +$pia_lang['MQTT_DELAY_SEC_name'] = 'MQTT delay per device'; +$pia_lang['MQTT_DELAY_SEC_description'] = 'A little hack - delay adding to the queue in case the process is restarted and previous publish processes aborted (it takes ~2s to update a sensor config on the broker). Tested with 2-3 seconds of delay. This delay is only applied when devices are created (during the first notification loop). It doesn\'t affect subsequent scans or notifications.'; + +//DynDNS +$pia_lang['DDNS_ACTIVE_name'] = 'Enable DynDNS'; +$pia_lang['DDNS_ACTIVE_description'] = ''; +$pia_lang['DDNS_DOMAIN_name'] = 'DynDNS domain URL'; +$pia_lang['DDNS_DOMAIN_description'] = ''; +$pia_lang['DDNS_USER_name'] = 'DynDNS user'; +$pia_lang['DDNS_USER_description'] = ''; +$pia_lang['DDNS_PASSWORD_name'] = 'DynDNS password'; +$pia_lang['DDNS_PASSWORD_description'] = ''; +$pia_lang['DDNS_UPDATE_URL_name'] = 'DynDNS update URL'; +$pia_lang['DDNS_UPDATE_URL_description'] = 'Update URL starting with http:// or https://.'; + +// PiHole +$pia_lang['PIHOLE_ACTIVE_name'] = 'Enable PiHole mapping'; +$pia_lang['PIHOLE_ACTIVE_description'] = 'If enabled you need to map :/etc/pihole/pihole-FTL.db in your docker-compose.yml file.'; +$pia_lang['DHCP_ACTIVE_name'] = 'Enable PiHole DHCP'; +$pia_lang['DHCP_ACTIVE_description'] = 'If enabled you need to map :/etc/pihole/dhcp.leases in your docker-compose.yml file.'; + + ?> diff --git a/front/php/templates/language/es_es.php b/front/php/templates/language/es_es.php index cb0e1615..341360ae 100755 --- a/front/php/templates/language/es_es.php +++ b/front/php/templates/language/es_es.php @@ -42,7 +42,8 @@ $pia_lang['Login_Toggle_Alert_headline'] = 'Alerta de Contraseña!'; $pia_lang['Navigation_Devices'] = 'Dispositivos'; $pia_lang['Navigation_Presence'] = 'Historial'; $pia_lang['Navigation_Events'] = 'Eventos'; -$pia_lang['Navigation_Maintenance'] = 'Mantenimiento'; +$pia_lang['Navigation_Maintenance'] = 'Cantenimiento'; +$pia_lang['Navigation_Settings'] = 'configuración'; $pia_lang['Navigation_Network'] = 'Red'; $pia_lang['Navigation_HelpFAQ'] = 'Ayuda / FAQ'; $pia_lang['Device_Title'] = 'Dispositivos'; @@ -406,4 +407,129 @@ $pia_lang['HelpFAQ_Cat_Network_600_text'] = 'Esta sección debería ofrecerle la ya detectados. Esta asignación se realiza en la vista detallada del dispositivo a asignar. Por lo tanto, es posible determinar rápidamente a qué puerto está conectado un host y si está en línea. Es posible asignar un dispositivo a múltiples puertos (agrupación de puertos), así como múltiples dispositivos a un puerto (máquinas virtuales).'; +////////////////////////////////////////////////////////////////// +// Settings +////////////////////////////////////////////////////////////////// + +//General +$pia_lang['SCAN_SUBNETS_name'] = 'Subnets to scan'; +$pia_lang['SCAN_SUBNETS_description'] = ' +
      +
    1. Specify the network mask. For example, the filter 192.168.1.0/24 covers IP ranges 192.168.1.0 to 192.168.1.255.
    2. +
    3. Run iwconfig to find your interface name(s) (e.g.: eth0, eth1)
    4. +
    5. Examples ( Note the [\'...\', \'...\'] format for two and more subnets): +
    +'; +$pia_lang['PRINT_LOG_name'] = 'Print additional logging'; +$pia_lang['PRINT_LOG_description'] = 'This setting will enable more verbose logging. Useful for debugging events writing into the database.'; +$pia_lang['TIMEZONE_name'] = 'Time zone'; +$pia_lang['TIMEZONE_description'] = 'Time zone to display stats correctly. Find your time zone here.'; +$pia_lang['PIALERT_WEB_PROTECTION_name'] = 'Enable login'; +$pia_lang['PIALERT_WEB_PROTECTION_description'] = 'When enabled a login dialog is displayed. Read below carefully if you get locked out of your instance.'; +$pia_lang['PIALERT_WEB_PASSWORD_name'] = 'Login password'; +$pia_lang['PIALERT_WEB_PASSWORD_description'] = 'The default password is 123456. To change password run /home/pi/pialert/back/pialert-cli'; +$pia_lang['INCLUDED_SECTIONS_name'] = 'Notify on'; +$pia_lang['INCLUDED_SECTIONS_description'] = 'Specifies which events trigger notifications. Remove the event type(s) you don\'t want to get notified on. This setting overrides device-specific settings in the UI. (CTRL + Click to select / deselect).'; +$pia_lang['SCAN_CYCLE_MINUTES_name'] = 'Scan cycle delay'; +$pia_lang['SCAN_CYCLE_MINUTES_description'] = 'The delay between scans. The shortest tested interval between scans was 3 minutes. A 5 minutes loop works reliably on a /24 network mask. If using arp-scan, the scan time itself depends on the number of IP addresses to check. This number depends on the network mask set in the "Subnets to scan" setting at the top. For example, a /24 mask results in 256 IPs to check, where as a /16 mask checks around 65000. Every IP takes a couple seconds to scan.'; +$pia_lang['DAYS_TO_KEEP_EVENTS_name'] = 'Delete events older than'; +$pia_lang['DAYS_TO_KEEP_EVENTS_description'] = 'This is a maintenance setting. This specifies the number of days worth of event entries that will be kept. All older events will be deleted periodically.'; +$pia_lang['REPORT_DASHBOARD_URL_name'] = 'Pi.Alert URL'; +$pia_lang['REPORT_DASHBOARD_URL_description'] = 'This URL is used as the base for generating links in the emails. Enter full URL starting with http:// including the port number (no trailig slash /).'; + +//Email +$pia_lang['REPORT_MAIL_name'] = 'Enable email'; +$pia_lang['REPORT_MAIL_description'] = 'If enabled an email is sent out with a list of changes you\'ve subscribed to. Please also fill out all remaining settings related to the SMTP setup below.'; +$pia_lang['SMTP_SERVER_name'] = 'SMTP server URL'; +$pia_lang['SMTP_SERVER_description'] = 'The SMTP server host URL. For example smtp-relay.sendinblue.com.'; +$pia_lang['SMTP_PORT_name'] = 'SMTP server PORT'; +$pia_lang['SMTP_PORT_description'] = 'Port number used for the SMTP connection.'; +$pia_lang['SMTP_SKIP_LOGIN_name'] = 'Skip authentication'; +$pia_lang['SMTP_SKIP_LOGIN_description'] = 'Don\'t use authentication when connecting to the SMTP server.'; +$pia_lang['SMTP_USER_name'] = 'SMTP user'; +$pia_lang['SMTP_USER_description'] = 'The user name used to login into the SMTP server (sometimes a full email address).'; +$pia_lang['SMTP_PASS_name'] = 'SMTP password'; +$pia_lang['SMTP_PASS_description'] = 'The SMTP server password. '; +$pia_lang['SMTP_SKIP_TLS_name'] = 'Don\'t use TLS'; +$pia_lang['SMTP_SKIP_TLS_description'] = 'Disable TLS when connecting to your SMTP server.'; +$pia_lang['REPORT_TO_name'] = 'Send email to'; +$pia_lang['REPORT_TO_description'] = 'Email address to which the notification will be send to.'; +$pia_lang['REPORT_FROM_name'] = 'Email subject'; +$pia_lang['REPORT_FROM_description'] = 'Notification email subject line.'; + +//Webhooks +$pia_lang['REPORT_WEBHOOK_name'] = 'Enable Webhooks'; +$pia_lang['REPORT_WEBHOOK_description'] = 'Enable webhooks for notifications. If enabled, configure related settings below.'; +$pia_lang['WEBHOOK_URL_name'] = 'Target URL'; +$pia_lang['WEBHOOK_URL_description'] = 'Target URL starting with http:// or https://.'; +$pia_lang['WEBHOOK_PAYLOAD_name'] = 'Payload type'; +$pia_lang['WEBHOOK_PAYLOAD_description'] = 'The Webhook payload data format for the "body > attachements > text" attribute in the payload json. See an examnple of the payload here. (e.g.: for discord use \'html\')'; +$pia_lang['WEBHOOK_REQUEST_METHOD_name'] = 'Request method'; +$pia_lang['WEBHOOK_REQUEST_METHOD_description'] = 'The HTTP request method to be used for the webhook call.'; + +// Apprise +$pia_lang['REPORT_APPRISE_name'] = 'Enable Apprise'; +$pia_lang['REPORT_APPRISE_description'] = 'Enable sending notifications via Apprise.'; +$pia_lang['APPRISE_HOST_name'] = 'Apprise host URL'; +$pia_lang['APPRISE_HOST_description'] = 'Apprise host URL starting with http:// or https://. (don\'t forget to include /notify at the end)'; +$pia_lang['APPRISE_URL_name'] = 'Apprise notification URL'; +$pia_lang['APPRISE_URL_description'] = 'Apprise notification target URL.'; + +// NTFY +$pia_lang['REPORT_NTFY_name'] = 'Enable NTFY'; +$pia_lang['REPORT_NTFY_description'] = 'Enable sending notifications via NTFY.'; +$pia_lang['NTFY_HOST_name'] = 'NTFY host URL'; +$pia_lang['NTFY_HOST_description'] = 'NTFY host URL starting with http:// or https://. You can use the hosted instance on https://ntfy.sh by simply entering https://ntfy.sh.'; +$pia_lang['NTFY_TOPIC_name'] = 'NTFY topic'; +$pia_lang['NTFY_TOPIC_description'] = 'Your secret topic.'; +$pia_lang['NTFY_USER_name'] = 'NTFY user'; +$pia_lang['NTFY_USER_description'] = 'Enter user if you need (host) an instance with enabled authetication.'; +$pia_lang['NTFY_PASSWORD_name'] = 'NTFY password'; +$pia_lang['NTFY_PASSWORD_description'] = 'Enter password if you need (host) an instance with enabled authetication.'; + +// Pushsafer +$pia_lang['REPORT_PUSHSAFER_name'] = 'Enable Pushsafer'; +$pia_lang['REPORT_PUSHSAFER_description'] = 'Enable sending notifications via Pushsafer.'; +$pia_lang['PUSHSAFER_TOKEN_name'] = 'Pushsafer token'; +$pia_lang['PUSHSAFER_TOKEN_description'] = 'Your secret Pushsafer API key (token).'; + + +// MQTT +$pia_lang['REPORT_MQTT_name'] = 'Enable MQTT'; +$pia_lang['REPORT_MQTT_description'] = 'Enable sending notifications via MQTT to your Home Assistance instance.'; +$pia_lang['MQTT_BROKER_name'] = 'MQTT broker URL'; +$pia_lang['MQTT_BROKER_description'] = 'MQTT host URL (don\'t include http:// or https://).'; +$pia_lang['MQTT_PORT_name'] = 'MQTT broker port'; +$pia_lang['MQTT_PORT_description'] = 'Port number where the broker is listening. Usually 1883.'; +$pia_lang['MQTT_USER_name'] = 'MQTT user'; +$pia_lang['MQTT_USER_description'] = 'User name used to login into your MQTT broker instance.'; +$pia_lang['MQTT_PASSWORD_name'] = 'MQTT password'; +$pia_lang['MQTT_PASSWORD_description'] = 'Password used to login into your MQTT broker instance.'; +$pia_lang['MQTT_QOS_name'] = 'MQTT Quality of Service'; +$pia_lang['MQTT_QOS_description'] = 'Quality of service setting for MQTT message sending. 0 - Low quality to 2 - High quality. The higher the quality the longer the delay.'; +$pia_lang['MQTT_DELAY_SEC_name'] = 'MQTT delay per device'; +$pia_lang['MQTT_DELAY_SEC_description'] = 'A little hack - delay adding to the queue in case the process is restarted and previous publish processes aborted (it takes ~2s to update a sensor config on the broker). Tested with 2-3 seconds of delay. This delay is only applied when devices are created (during the first notification loop). It doesn\'t affect subsequent scans or notifications.'; + +//DynDNS +$pia_lang['DDNS_ACTIVE_name'] = 'Enable DynDNS'; +$pia_lang['DDNS_ACTIVE_description'] = ''; +$pia_lang['DDNS_DOMAIN_name'] = 'DynDNS domain URL'; +$pia_lang['DDNS_DOMAIN_description'] = ''; +$pia_lang['DDNS_USER_name'] = 'DynDNS user'; +$pia_lang['DDNS_USER_description'] = ''; +$pia_lang['DDNS_PASSWORD_name'] = 'DynDNS password'; +$pia_lang['DDNS_PASSWORD_description'] = ''; +$pia_lang['DDNS_UPDATE_URL_name'] = 'DynDNS update URL'; +$pia_lang['DDNS_UPDATE_URL_description'] = 'Update URL starting with http:// or https://.'; + +// PiHole +$pia_lang['PIHOLE_ACTIVE_name'] = 'Enable PiHole mapping'; +$pia_lang['PIHOLE_ACTIVE_description'] = 'If enabled you need to map :/etc/pihole/pihole-FTL.db in your docker-compose.yml file.'; +$pia_lang['DHCP_ACTIVE_name'] = 'Enable PiHole DHCP'; +$pia_lang['DHCP_ACTIVE_description'] = 'If enabled you need to map :/etc/pihole/dhcp.leases in your docker-compose.yml file.'; + + ?> diff --git a/front/settings.php b/front/settings.php new file mode 100644 index 00000000..26748fa6 --- /dev/null +++ b/front/settings.php @@ -0,0 +1,184 @@ +query("SELECT * FROM Settings"); + +// array +$settings = array(); +while ($row = $result -> fetchArray (SQLITE3_ASSOC)) { + // Push row data + $settings[] = array( 'Index' => $row['Index'], + 'Code_Name' => $row['Code_Name'], + 'Display_Name' => $row['Display_Name'], + 'Description' => $row['Description'], + 'Type' => $row['Type'], + 'Options' => $row['Options'], + 'RegEx' => $row['RegEx'], + 'Value' => $row['Value'], + 'Group' => $row['Group'] + ); +} + +$db->close(); + +?> + +
    + + +
    + +

    + +

    +
    + + +

    '.$group.'

    '; + + // populate settings for each group + foreach ($settings as $setting) { + if($setting["Group"] == $group) + { + $resultHTML = $resultHTML. + '
    +
    '; + + $resultHTML = $resultHTML.getString ($setting['Code_Name'].'_name', $setting['Display_Name'], $pia_lang); + + $resultHTML = $resultHTML. + '
    +
    '; + + $resultHTML = $resultHTML.getString ($setting['Code_Name'].'_description', $setting['Description'], $pia_lang); + + $resultHTML = $resultHTML. + '
    +
    '; + + // render different input types based on the setting type + $inputType = ""; + // text - textbox + if($setting['Type'] == 'text') + { + $inputType = ''; + } + // password - hidden text + elseif ($setting['Type'] == 'password') + { + $inputType = ''; + } + // boolean - checkbox + elseif ($setting['Type'] == 'boolean') + { + $checked = ""; + if ($setting['Value'] == "True") { $checked = "checked";}; + $inputType = ''; + } + // integer - number input + elseif ($setting['Type'] == 'integer') + { + $inputType = ''; + } + // select - dropdown + elseif ($setting['Type'] == 'select') + { + $inputType = ''; + } + // multiselect + elseif ($setting['Type'] == 'multiselect') + { + $inputType = ''; + } + + $resultHTML = $resultHTML.$inputType; + + $resultHTML = $resultHTML.'
    +
    '; + } + } + + $resultHTML = $resultHTML.''; + } + + echo $resultHTML; + ?> + + +
    + +
    +
    + + + + + +