settings prep 0

This commit is contained in:
Jokob-sk
2022-12-19 23:53:48 +11:00
parent 4839c02d50
commit 1ea7990314
10 changed files with 796 additions and 32 deletions

View File

@@ -49,11 +49,14 @@ STOPARPSCAN = pialertPath + "/db/setting_stoparpscan"
PRINT_LOG = False PRINT_LOG = False
TIMEZONE = 'Europe/Berlin' TIMEZONE = 'Europe/Berlin'
PIALERT_WEB_PROTECTION = False PIALERT_WEB_PROTECTION = False
PIALERT_WEB_PASSWORD = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
INCLUDED_SECTIONS = ['internet', 'new_devices', 'down_devices', 'events'] # Specifies which events trigger notifications. 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 # Remove the event type(s) you don't want to get notified on
# Overrides device-specific settings in the UI. # Overrides device-specific settings in the UI.
SCAN_CYCLE_MINUTES = 5 # delay between scans 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 # EMAIL settings
# ---------------------- # ----------------------
SMTP_SERVER = '' SMTP_SERVER = ''
@@ -66,7 +69,6 @@ SMTP_SKIP_LOGIN = False
REPORT_MAIL = False REPORT_MAIL = False
REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>' REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>'
REPORT_TO = 'user@gmail.com' REPORT_TO = 'user@gmail.com'
REPORT_DEVICE_URL = 'http://pi.alert/deviceDetails.php?mac='
REPORT_DASHBOARD_URL = 'http://pi.alert/' REPORT_DASHBOARD_URL = 'http://pi.alert/'
# Webhook settings # Webhook settings
@@ -112,6 +114,10 @@ MQTT_DELAY_SEC = 2
# DynDNS # DynDNS
# ---------------------- # ----------------------
DDNS_ACTIVE = False 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 # 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 # keep 90 days of network activity if not specified how many days to keep
DAYS_TO_KEEP_EVENTS = 90 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' pialertPath = '/home/pi/pialert'
dbPath = pialertPath + '/db/pialert.db' dbPath = pialertPath + '/db/pialert.db'
vendorsDB = '/usr/share/arp-scan/ieee-oui.txt' vendorsDB = '/usr/share/arp-scan/ieee-oui.txt'
@@ -128,12 +141,12 @@ logPath = pialertPath + '/front/log'
piholeDB = '/etc/pihole/pihole-FTL.db' piholeDB = '/etc/pihole/pihole-FTL.db'
piholeDhcpleases = '/etc/pihole/dhcp.leases' piholeDhcpleases = '/etc/pihole/dhcp.leases'
# load user configuration # # load user configuration
if (sys.version_info > (3,0)): # if (sys.version_info > (3,0)):
exec(open(pialertPath + "/config/pialert.conf").read()) # exec(open(pialertPath + "/config/pialert.conf").read())
else: # else:
execfile (pialertPath + "/config/pialert.conf") # execfile (pialertPath + "/config/pialert.conf")
#=============================================================================== #===============================================================================
# MAIN # MAIN
@@ -158,6 +171,14 @@ def main ():
# second set of global variables # second set of global variables
global startTime, log_timestamp, sql_connection, sql global startTime, log_timestamp, sql_connection, sql
# DB
sql_connection = None
sql = None
# Upgrade DB if needed
upgradeDB()
# create log files # create log files
write_file(logPath + 'IP_changes.log', '') write_file(logPath + 'IP_changes.log', '')
write_file(logPath + 'stdout.log', '') write_file(logPath + 'stdout.log', '')
@@ -168,12 +189,6 @@ def main ():
# update NOW time # update NOW time
time_now = datetime.datetime.now() 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 # proceed if 1 minute passed
if last_run + timedelta(minutes=1) < time_now : if last_run + timedelta(minutes=1) < time_now :
@@ -188,16 +203,12 @@ def main ():
log_timestamp = time_now log_timestamp = time_now
# DB
sql_connection = None
sql = None
# Timestamp # Timestamp
startTime = time_now startTime = time_now
startTime = startTime.replace (second=0, microsecond=0) startTime = startTime.replace (second=0, microsecond=0)
# Upgrade DB if needed # re-load user configuration
upgradeDB() importConfig()
# determine run/scan type based on passed time # determine run/scan type based on passed time
if last_internet_IP_scan + timedelta(minutes=3) < time_now: 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'], 'Event:', eventAlert['eve_EventType'], 'Time:', eventAlert['eve_DateTime'],
'IP:', eventAlert['eve_IP'], 'More Info:', eventAlert['eve_AdditionalInfo']) 'IP:', eventAlert['eve_IP'], 'More Info:', eventAlert['eve_AdditionalInfo'])
mail_html_Internet += html_line_template.format ( 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_EventType'], eventAlert['eve_DateTime'],
eventAlert['eve_IP'], eventAlert['eve_AdditionalInfo']) 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'], 'Name: ', eventAlert['dev_Name'], 'MAC: ', eventAlert['eve_MAC'], 'IP: ', eventAlert['eve_IP'],
'Time: ', eventAlert['eve_DateTime'], 'More Info: ', eventAlert['eve_AdditionalInfo']) 'Time: ', eventAlert['eve_DateTime'], 'More Info: ', eventAlert['eve_AdditionalInfo'])
mail_html_new_devices += html_line_template.format ( 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['eve_DateTime'], eventAlert['eve_IP'],
eventAlert['dev_Name'], eventAlert['eve_AdditionalInfo']) eventAlert['dev_Name'], eventAlert['eve_AdditionalInfo'])
@@ -1543,7 +1554,7 @@ def email_reporting ():
'Name: ', eventAlert['dev_Name'], 'MAC: ', eventAlert['eve_MAC'], 'Name: ', eventAlert['dev_Name'], 'MAC: ', eventAlert['eve_MAC'],
'Time: ', eventAlert['eve_DateTime'],'IP: ', eventAlert['eve_IP']) 'Time: ', eventAlert['eve_DateTime'],'IP: ', eventAlert['eve_IP'])
mail_html_devices_down += html_line_template.format ( 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['eve_DateTime'], eventAlert['eve_IP'],
eventAlert['dev_Name']) eventAlert['dev_Name'])
@@ -1578,7 +1589,7 @@ def email_reporting ():
'IP: ', eventAlert['eve_IP'],'Time: ', eventAlert['eve_DateTime'], 'IP: ', eventAlert['eve_IP'],'Time: ', eventAlert['eve_DateTime'],
'Event: ', eventAlert['eve_EventType'],'More Info: ', eventAlert['eve_AdditionalInfo']) 'Event: ', eventAlert['eve_EventType'],'More Info: ', eventAlert['eve_AdditionalInfo'])
mail_html_events += html_line_template.format ( 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_DateTime'], eventAlert['eve_IP'],
eventAlert['eve_EventType'], eventAlert['dev_Name'], eventAlert['eve_EventType'], eventAlert['dev_Name'],
eventAlert['eve_AdditionalInfo']) eventAlert['eve_AdditionalInfo'])
@@ -2095,8 +2106,6 @@ def mqtt_start():
# retain=True, # retain=True,
# ) # )
# time.sleep(10) # time.sleep(10)
# client.loop()
# #------------------------------------------------------------------------------- # #-------------------------------------------------------------------------------
@@ -2120,10 +2129,99 @@ def start_mqtt_thread ():
#=============================================================================== #===============================================================================
# DB # 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 (): def upgradeDB ():
openDB() 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 # indicates, if Online_History table is available
onlineHistoryAvailable = sql.execute(""" onlineHistoryAvailable = sql.execute("""
SELECT name FROM sqlite_master WHERE type='table' 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 # Alter Devices table
# dev_Network_Node_MAC_ADDR column # dev_Network_Node_MAC_ADDR column
dev_Network_Node_MAC_ADDR_missing = sql.execute (""" dev_Network_Node_MAC_ADDR_missing = sql.execute ("""

View File

@@ -26,6 +26,7 @@ services:
- ${DEV_LOCATION}/front/maintenance.php:/home/pi/pialert/front/maintenance.php - ${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/network.php:/home/pi/pialert/front/network.php
- ${DEV_LOCATION}/front/presence.php:/home/pi/pialert/front/presence.php - ${DEV_LOCATION}/front/presence.php:/home/pi/pialert/front/presence.php
- ${DEV_LOCATION}/front/settings.php:/home/pi/pialert/front/settings.php
environment: environment:
- TZ=${TZ} - TZ=${TZ}
- PORT=${PORT} - PORT=${PORT}

View File

@@ -547,3 +547,56 @@ height: 50px;
.infobox_label { .infobox_label {
font-size: 16px !important; 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
}

View File

@@ -20,7 +20,6 @@ date_default_timezone_set($Pia_TimeZone);
// DB File Path // DB File Path
$DBFILE = '../../../db/pialert.db'; $DBFILE = '../../../db/pialert.db';
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Connect DB // Connect DB
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -36,8 +35,10 @@ function SQLite3_connect ($trytoreconnect) {
{ {
// sqlite3 throws an exception when it is unable to connect // sqlite3 throws an exception when it is unable to connect
// try to reconnect one time after 3 seconds // try to reconnect one time after 3 seconds
if($trytoreconnect) if($trytoreconnect)
{ {
echo '<script>alert("Error connecting to database, will try in 3s")</script>';
sleep(3); sleep(3);
return SQLite3_connect(false); return SQLite3_connect(false);
} }
@@ -48,21 +49,31 @@ function SQLite3_connect ($trytoreconnect) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Open DB // Open DB
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
function OpenDB () {
function OpenDB (...$DBPath) {
global $DBFILE; global $DBFILE;
global $db; global $db;
// use custom path if supplied
foreach ($DBPath as $path) {
$DBFILE = $path;
}
if(strlen($DBFILE) == 0) if(strlen($DBFILE) == 0)
{ {
die ('Database no available'); echo '<script>alert("Database not available")</script>';
die ('<div style="padding-left:150px">Database not available</div>');
} }
$db = SQLite3_connect(true); $db = SQLite3_connect(true);
$db->exec('PRAGMA journal_mode = wal;');
if(!$db) if(!$db)
{ {
die ('Error connecting to database'); echo '<script>alert("Error connecting to the database")</script>';
die ('<div style="padding-left:150px">Error connecting to the database</div>');
} }
$db->exec('PRAGMA journal_mode = wal;');
} }
?> ?>

View File

@@ -19,6 +19,14 @@ date_default_timezone_set($Pia_TimeZone);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Formatting data functions // Formatting data functions
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
function createArray($input){
$pattern = '/(^\s*\[)|(\]\s*$)/';
$replacement = '';
$noBrackets = preg_replace($pattern, $replacement, $input);
return $options = explode(",", $noBrackets);
}
function formatDate ($date1) { function formatDate ($date1) {
return date_format (new DateTime ($date1) , 'Y-m-d H:i'); return date_format (new DateTime ($date1) , 'Y-m-d H:i');
} }
@@ -51,6 +59,18 @@ function formatIPlong ($IP) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Others functions // Others functions
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
function getString ($codeName, $default, $pia_lang) {
$result = $pia_lang[$codeName];
if ($result )
{
return $result;
}
return $default;
}
function getDateFromPeriod () { function getDateFromPeriod () {
$period = $_REQUEST['period']; $period = $_REQUEST['period'];
return '"'. date ('Y-m-d', strtotime ('+1 day -'. $period) ) .'"'; return '"'. date ('Y-m-d', strtotime ('+1 day -'. $period) ) .'"';

View File

@@ -237,7 +237,10 @@ document.addEventListener("visibilitychange",()=>{
</li> </li>
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('maintenance.php') ) ){ echo 'active'; } ?>"> <li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('maintenance.php') ) ){ echo 'active'; } ?>">
<a href="maintenance.php"><i class="fa fa-cog"></i> <span><?php echo $pia_lang['Navigation_Maintenance'];?></span></a> <a href="maintenance.php"><i class="fa fa-wrench "></i> <span><?php echo $pia_lang['Navigation_Maintenance'];?></span></a>
</li>
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('settings.php') ) ){ echo 'active'; } ?>">
<a href="settings.php"><i class="fa fa-cog"></i> <span><?php echo $pia_lang['Navigation_Settings'];?></span></a>
</li> </li>
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('help_faq.php') ) ){ echo 'active'; } ?>"> <li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('help_faq.php') ) ){ echo 'active'; } ?>">

View File

@@ -42,6 +42,7 @@ $pia_lang['Navigation_Devices'] = 'Geräte';
$pia_lang['Navigation_Presence'] = 'Anwesenheit'; $pia_lang['Navigation_Presence'] = 'Anwesenheit';
$pia_lang['Navigation_Events'] = 'Ereignisse'; $pia_lang['Navigation_Events'] = 'Ereignisse';
$pia_lang['Navigation_Maintenance'] = 'Wartung'; $pia_lang['Navigation_Maintenance'] = 'Wartung';
$pia_lang['Navigation_Settings'] = 'Einstellung';
$pia_lang['Navigation_Network'] = 'Netzwerk'; $pia_lang['Navigation_Network'] = 'Netzwerk';
$pia_lang['Navigation_HelpFAQ'] = 'Hilfe / FAQ'; $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 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.'; 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'] = '
<ol>
<li>Specify the network mask. For example, the filter <code>192.168.1.0/24</code> covers IP ranges 192.168.1.0 to 192.168.1.255.</li>
<li>Run <code>iwconfig</code> to find your interface name(s) (e.g.: <code>eth0</code>, <code>eth1</code>)</li>
<li>Examples (<g-emoji class="g-emoji" alias="exclamation" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2757.png">❗</g-emoji> Note the <code>[\'...\', \'...\']</code> format for two and more subnets):
</ol>
<ul dir="auto">
<li>One subnet: <code>\'192.168.1.0/24 --interface=eth0\'</code></li>
<li>Two subnets: <code>[\'192.168.1.0/24 --interface=eth0\', \'192.168.1.0/24 --interface=eth1\']</code></li>
</ul>';
$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 <a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">here</a>.';
$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 <code>123456</code>. To change password run <code>/home/pi/pialert/back/pialert-cli</code>';
$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 <code>/24</code> 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 <code>/24</code> mask results in 256 IPs to check, where as a <code>/16</code> 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 <code>http://</code> including the port number (no trailig slash <code>/</code>).';
//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 <code>smtp-relay.sendinblue.com</code>.';
$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 <code>http://</code> or <code>https://</code>.';
$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 <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/webhook_json_sample.json">here</a>. (e.g.: for discord use <code>\'html\'</code>)';
$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 <a target="_blank" href="https://hub.docker.com/r/caronc/apprise">Apprise</a>.';
$pia_lang['APPRISE_HOST_name'] = 'Apprise host URL';
$pia_lang['APPRISE_HOST_description'] = 'Apprise host URL starting with <code>http://</code> or <code>https://</code>. (don\'t forget to include <code>/notify</code> 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 <a target="_blank" href="https://ntfy.sh/">NTFY</a>.';
$pia_lang['NTFY_HOST_name'] = 'NTFY host URL';
$pia_lang['NTFY_HOST_description'] = 'NTFY host URL starting with <code>http://</code> or <code>https://</code>. You can use the hosted instance on <a target="_blank" href="https://ntfy.sh/">https://ntfy.sh</a> by simply entering <code>https://ntfy.sh</code>.';
$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 <a target="_blank" href="https://www.pushsafer.com/">Pushsafer</a>.';
$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 <a target="_blank" href="https://www.home-assistant.io/integrations/mqtt/">MQTT</a> to your Home Assistance instance.';
$pia_lang['MQTT_BROKER_name'] = 'MQTT broker URL';
$pia_lang['MQTT_BROKER_description'] = 'MQTT host URL (don\'t include <code>http://</code> or <code>https://</code>).';
$pia_lang['MQTT_PORT_name'] = 'MQTT broker port';
$pia_lang['MQTT_PORT_description'] = 'Port number where the broker is listening. Usually <code>1883</code>.';
$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 <code>http://</code> or <code>https://</code>.';
// PiHole
$pia_lang['PIHOLE_ACTIVE_name'] = 'Enable PiHole mapping';
$pia_lang['PIHOLE_ACTIVE_description'] = 'If enabled you need to map <code>:/etc/pihole/pihole-FTL.db</code> in your <code>docker-compose.yml</code> file.';
$pia_lang['DHCP_ACTIVE_name'] = 'Enable PiHole DHCP';
$pia_lang['DHCP_ACTIVE_description'] = 'If enabled you need to map <code>:/etc/pihole/dhcp.leases</code> in your <code>docker-compose.yml</code> file.';
?> ?>

View File

@@ -42,6 +42,7 @@ $pia_lang['Navigation_Devices'] = 'Devices';
$pia_lang['Navigation_Presence'] = 'Presence'; $pia_lang['Navigation_Presence'] = 'Presence';
$pia_lang['Navigation_Events'] = 'Events'; $pia_lang['Navigation_Events'] = 'Events';
$pia_lang['Navigation_Maintenance'] = 'Maintenance'; $pia_lang['Navigation_Maintenance'] = 'Maintenance';
$pia_lang['Navigation_Settings'] = 'Settings';
$pia_lang['Navigation_Network'] = 'Network'; $pia_lang['Navigation_Network'] = 'Network';
$pia_lang['Navigation_HelpFAQ'] = 'Help / FAQ'; $pia_lang['Navigation_HelpFAQ'] = 'Help / FAQ';
$pia_lang['Device_Title'] = 'Devices'; $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 $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.'; 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'] = '
<ol>
<li>Specify the network mask. For example, the filter <code>192.168.1.0/24</code> covers IP ranges 192.168.1.0 to 192.168.1.255.</li>
<li>Run <code>iwconfig</code> to find your interface name(s) (e.g.: <code>eth0</code>, <code>eth1</code>)</li>
<li>Examples (<g-emoji class="g-emoji" alias="exclamation" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2757.png">❗</g-emoji> Note the <code>[\'...\', \'...\']</code> format for two and more subnets):
</ol>
<ul dir="auto">
<li>One subnet: <code>\'192.168.1.0/24 --interface=eth0\'</code></li>
<li>Two subnets: <code>[\'192.168.1.0/24 --interface=eth0\', \'192.168.1.0/24 --interface=eth1\']</code></li>
</ul>';
$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 <a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">here</a>.';
$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 <code>123456</code>. To change password run <code>/home/pi/pialert/back/pialert-cli</code>';
$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 <code>/24</code> 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 <code>/24</code> mask results in 256 IPs to check, where as a <code>/16</code> 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 <code>http://</code> including the port number (no trailig slash <code>/</code>).';
//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 <code>smtp-relay.sendinblue.com</code>.';
$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 <code>http://</code> or <code>https://</code>.';
$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 <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/webhook_json_sample.json">here</a>. (e.g.: for discord use <code>\'html\'</code>)';
$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 <a target="_blank" href="https://hub.docker.com/r/caronc/apprise">Apprise</a>.';
$pia_lang['APPRISE_HOST_name'] = 'Apprise host URL';
$pia_lang['APPRISE_HOST_description'] = 'Apprise host URL starting with <code>http://</code> or <code>https://</code>. (don\'t forget to include <code>/notify</code> 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 <a target="_blank" href="https://ntfy.sh/">NTFY</a>.';
$pia_lang['NTFY_HOST_name'] = 'NTFY host URL';
$pia_lang['NTFY_HOST_description'] = 'NTFY host URL starting with <code>http://</code> or <code>https://</code>. You can use the hosted instance on <a target="_blank" href="https://ntfy.sh/">https://ntfy.sh</a> by simply entering <code>https://ntfy.sh</code>.';
$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 <a target="_blank" href="https://www.pushsafer.com/">Pushsafer</a>.';
$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 <a target="_blank" href="https://www.home-assistant.io/integrations/mqtt/">MQTT</a> to your Home Assistance instance.';
$pia_lang['MQTT_BROKER_name'] = 'MQTT broker URL';
$pia_lang['MQTT_BROKER_description'] = 'MQTT host URL (don\'t include <code>http://</code> or <code>https://</code>).';
$pia_lang['MQTT_PORT_name'] = 'MQTT broker port';
$pia_lang['MQTT_PORT_description'] = 'Port number where the broker is listening. Usually <code>1883</code>.';
$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 <code>http://</code> or <code>https://</code>.';
// PiHole
$pia_lang['PIHOLE_ACTIVE_name'] = 'Enable PiHole mapping';
$pia_lang['PIHOLE_ACTIVE_description'] = 'If enabled you need to map <code>:/etc/pihole/pihole-FTL.db</code> in your <code>docker-compose.yml</code> file.';
$pia_lang['DHCP_ACTIVE_name'] = 'Enable PiHole DHCP';
$pia_lang['DHCP_ACTIVE_description'] = 'If enabled you need to map <code>:/etc/pihole/dhcp.leases</code> in your <code>docker-compose.yml</code> file.';
?> ?>

View File

@@ -42,7 +42,8 @@ $pia_lang['Login_Toggle_Alert_headline'] = 'Alerta de Contraseña!';
$pia_lang['Navigation_Devices'] = 'Dispositivos'; $pia_lang['Navigation_Devices'] = 'Dispositivos';
$pia_lang['Navigation_Presence'] = 'Historial'; $pia_lang['Navigation_Presence'] = 'Historial';
$pia_lang['Navigation_Events'] = 'Eventos'; $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_Network'] = 'Red';
$pia_lang['Navigation_HelpFAQ'] = 'Ayuda / FAQ'; $pia_lang['Navigation_HelpFAQ'] = 'Ayuda / FAQ';
$pia_lang['Device_Title'] = 'Dispositivos'; $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 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).'; 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'] = '
<ol>
<li>Specify the network mask. For example, the filter <code>192.168.1.0/24</code> covers IP ranges 192.168.1.0 to 192.168.1.255.</li>
<li>Run <code>iwconfig</code> to find your interface name(s) (e.g.: <code>eth0</code>, <code>eth1</code>)</li>
<li>Examples (<g-emoji class="g-emoji" alias="exclamation" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2757.png">❗</g-emoji> Note the <code>[\'...\', \'...\']</code> format for two and more subnets):
</ol>
<ul dir="auto">
<li>One subnet: <code>\'192.168.1.0/24 --interface=eth0\'</code></li>
<li>Two subnets: <code>[\'192.168.1.0/24 --interface=eth0\', \'192.168.1.0/24 --interface=eth1\']</code></li>
</ul>';
$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 <a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">here</a>.';
$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 <code>123456</code>. To change password run <code>/home/pi/pialert/back/pialert-cli</code>';
$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 <code>/24</code> 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 <code>/24</code> mask results in 256 IPs to check, where as a <code>/16</code> 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 <code>http://</code> including the port number (no trailig slash <code>/</code>).';
//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 <code>smtp-relay.sendinblue.com</code>.';
$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 <code>http://</code> or <code>https://</code>.';
$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 <a target="_blank" href="https://github.com/jokob-sk/Pi.Alert/blob/main/docs/webhook_json_sample.json">here</a>. (e.g.: for discord use <code>\'html\'</code>)';
$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 <a target="_blank" href="https://hub.docker.com/r/caronc/apprise">Apprise</a>.';
$pia_lang['APPRISE_HOST_name'] = 'Apprise host URL';
$pia_lang['APPRISE_HOST_description'] = 'Apprise host URL starting with <code>http://</code> or <code>https://</code>. (don\'t forget to include <code>/notify</code> 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 <a target="_blank" href="https://ntfy.sh/">NTFY</a>.';
$pia_lang['NTFY_HOST_name'] = 'NTFY host URL';
$pia_lang['NTFY_HOST_description'] = 'NTFY host URL starting with <code>http://</code> or <code>https://</code>. You can use the hosted instance on <a target="_blank" href="https://ntfy.sh/">https://ntfy.sh</a> by simply entering <code>https://ntfy.sh</code>.';
$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 <a target="_blank" href="https://www.pushsafer.com/">Pushsafer</a>.';
$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 <a target="_blank" href="https://www.home-assistant.io/integrations/mqtt/">MQTT</a> to your Home Assistance instance.';
$pia_lang['MQTT_BROKER_name'] = 'MQTT broker URL';
$pia_lang['MQTT_BROKER_description'] = 'MQTT host URL (don\'t include <code>http://</code> or <code>https://</code>).';
$pia_lang['MQTT_PORT_name'] = 'MQTT broker port';
$pia_lang['MQTT_PORT_description'] = 'Port number where the broker is listening. Usually <code>1883</code>.';
$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 <code>http://</code> or <code>https://</code>.';
// PiHole
$pia_lang['PIHOLE_ACTIVE_name'] = 'Enable PiHole mapping';
$pia_lang['PIHOLE_ACTIVE_description'] = 'If enabled you need to map <code>:/etc/pihole/pihole-FTL.db</code> in your <code>docker-compose.yml</code> file.';
$pia_lang['DHCP_ACTIVE_name'] = 'Enable PiHole DHCP';
$pia_lang['DHCP_ACTIVE_description'] = 'If enabled you need to map <code>:/etc/pihole/dhcp.leases</code> in your <code>docker-compose.yml</code> file.';
?> ?>

184
front/settings.php Normal file
View File

@@ -0,0 +1,184 @@
<?php
session_start();
if ($_SESSION["login"] != 1)
{
header('Location: index.php');
exit;
}
require 'php/templates/header.php';
foreach (glob("../db/setting_language*") as $filename) {
$pia_lang_selected = str_replace('setting_language_','',basename($filename));
}
if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';}
//------------------------------------------------------------------------------
// External files
require 'php/server/db.php';
require 'php/server/util.php';
require 'php/templates/language/'.$pia_lang_selected.'.php';
//------------------------------------------------------------------------------
// Action selector
//------------------------------------------------------------------------------
// Set maximum execution time to 15 seconds
ini_set ('max_execution_time','30');
// Open DB
OpenDB('../db/pialert.db');
global $db;
global $pia_lang;
$result = $db->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();
?>
<!-- Page ------------------------------------------------------------------ -->
<div class="content-wrapper">
<!-- Content header--------------------------------------------------------- -->
<section class="content-header">
<?php require 'php/templates/notification.php'; ?>
<h1 id="pageTitle">
<?php echo $pia_lang['Navigation_Settings'];?>
</h1>
</section>
<?php
$resultHTML = "";
$groups = [];
// collect all groups
foreach ($settings as $row) {
if( in_array($row['Group'] , $groups) == false) {
array_push($groups ,$row['Group']);
}
}
// create settings groups
foreach ($groups as $group) {
$resultHTML = $resultHTML.'<section class="settings_content">
<h4>'.$group.'</h4>';
// populate settings for each group
foreach ($settings as $setting) {
if($setting["Group"] == $group)
{
$resultHTML = $resultHTML.
'<div class="table_row" >
<div class="table_cell setting_name" >';
$resultHTML = $resultHTML.getString ($setting['Code_Name'].'_name', $setting['Display_Name'], $pia_lang);
$resultHTML = $resultHTML.
'</div>
<div class="table_cell setting_description" >';
$resultHTML = $resultHTML.getString ($setting['Code_Name'].'_description', $setting['Description'], $pia_lang);
$resultHTML = $resultHTML.
'</div>
<div class="table_cell setting_input" >';
// render different input types based on the setting type
$inputType = "";
// text - textbox
if($setting['Type'] == 'text')
{
$inputType = '<input value="'.$setting['Value'].'"/>';
}
// password - hidden text
elseif ($setting['Type'] == 'password')
{
$inputType = '<input type="password" value="'.$setting['Value'].'"/>';
}
// boolean - checkbox
elseif ($setting['Type'] == 'boolean')
{
$checked = "";
if ($setting['Value'] == "True") { $checked = "checked";};
$inputType = '<input type="checkbox" value="'.$setting['Value'].'" '.$checked.' />';
}
// integer - number input
elseif ($setting['Type'] == 'integer')
{
$inputType = '<input type="number" value="'.$setting['Value'].'"/>';
}
// select - dropdown
elseif ($setting['Type'] == 'select')
{
$inputType = '<select name="'.$setting['Code_Name'].'" id="'.$setting['Code_Name'].'">';
$options = createArray($setting['Options']);
foreach ($options as $option) {
$inputType = $inputType.'<option value="'.$option.'">'.$option.'</option>';
}
$inputType = $inputType.'</select>';
}
// multiselect
elseif ($setting['Type'] == 'multiselect')
{
$inputType = '<select name="'.$setting['Code_Name'].'" id="'.$setting['Code_Name'].'" multiple>';
$values = createArray($setting['Value']);
$options = createArray($setting['Options']);
foreach ($options as $option) {
$selected = "";
if( in_array( $option , $values) == true) {
$selected = "selected";
}
$inputType = $inputType.'<option value="'.$option.'" '.$selected.'>'.$option.'</option>';
}
$inputType = $inputType.'</select>';
}
$resultHTML = $resultHTML.$inputType;
$resultHTML = $resultHTML.'</div>
</div>';
}
}
$resultHTML = $resultHTML.'</section>';
}
echo $resultHTML;
?>
<!-- /.content -->
<div class="table_row" >
<button type="button" class="btn btn-default pa-btn bg-green dbtools-button" id="save" onclick="alert('Not yet implemented.')"><?php echo $pia_lang['DevDetail_button_Save'];?></button>
</div>
</div>
<!-- /.content-wrapper -->
<!-- ----------------------------------------------------------------------- -->
<?php
require 'php/templates/footer.php';
?>