mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
This commit is contained in:
0
front/php/templates/language/es_es.json
Normal file → Executable file
0
front/php/templates/language/es_es.json
Normal file → Executable file
@@ -24,14 +24,14 @@ function checkAuthorization($method) {
|
|||||||
|
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
// Function to return JSON response
|
// Function to return JSON response
|
||||||
function jsonResponse($status, $data = [], $message = '') {
|
function jsonResponse($status, $data = '', $message = '') {
|
||||||
http_response_code($status);
|
http_response_code($status);
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'node_name' => getSettingValue('SYNC_node_name'),
|
'node_name' => getSettingValue('SYNC_node_name'),
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'data' => $data,
|
'data_base64' => $data,
|
||||||
'timestamp' => date('Y-m-d H:i:s')
|
'timestamp' => date('Y-m-d H:i:s')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -50,13 +50,13 @@ if ($method === 'GET') {
|
|||||||
$data = file_get_contents($file_path);
|
$data = file_get_contents($file_path);
|
||||||
|
|
||||||
// Prepare the data to return as a JSON response
|
// Prepare the data to return as a JSON response
|
||||||
$response_data = [
|
$response_data = base64_encode($data);
|
||||||
'data_base64' => base64_encode($data),
|
|
||||||
];
|
|
||||||
|
|
||||||
// Return JSON response
|
// Return JSON response
|
||||||
jsonResponse(200, $response_data, 'OK');
|
jsonResponse(200, $response_data, 'OK');
|
||||||
|
|
||||||
|
write_notification("[Plugin: SYNC] Data sent", "info");
|
||||||
|
|
||||||
}
|
}
|
||||||
// receiving data (this is a HUB)
|
// receiving data (this is a HUB)
|
||||||
else if ($method === 'POST') {
|
else if ($method === 'POST') {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import hashlib
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import base64
|
||||||
|
|
||||||
|
|
||||||
# Define the installation path and extend the system path for plugin imports
|
# Define the installation path and extend the system path for plugin imports
|
||||||
@@ -106,7 +107,7 @@ def main():
|
|||||||
# pull data from nodes if specified
|
# pull data from nodes if specified
|
||||||
if len(pull_nodes) > 0:
|
if len(pull_nodes) > 0:
|
||||||
for node_url in pull_nodes:
|
for node_url in pull_nodes:
|
||||||
response_json, node_name = get_data(api_token, node_url)
|
response_json = get_data(api_token, node_url)
|
||||||
|
|
||||||
# Extract node_name and base64 data
|
# Extract node_name and base64 data
|
||||||
node_name = response_json.get('node_name', 'unknown_node')
|
node_name = response_json.get('node_name', 'unknown_node')
|
||||||
@@ -119,10 +120,10 @@ def main():
|
|||||||
log_file_name = f'{file_prefix}.{node_name}.log'
|
log_file_name = f'{file_prefix}.{node_name}.log'
|
||||||
|
|
||||||
# Write decoded data to log file
|
# Write decoded data to log file
|
||||||
with open(file_path = os.path.join(file_dir, log_file_name), 'wb') as log_file:
|
with open(os.path.join(file_dir, log_file_name), 'wb') as log_file:
|
||||||
log_file.write(decoded_data)
|
log_file.write(decoded_data)
|
||||||
|
|
||||||
message = f'[{pluginName}] Data for "{plugin_folder}" from node "{node_name}" written to {log_file_name}'
|
message = f'[{pluginName}] Device data from node "{node_name}" written to {log_file_name}'
|
||||||
mylog('verbose', [message])
|
mylog('verbose', [message])
|
||||||
write_notification(message, 'info', timeNowTZ())
|
write_notification(message, 'info', timeNowTZ())
|
||||||
|
|
||||||
@@ -269,7 +270,7 @@ def get_data(api_token, node_url):
|
|||||||
|
|
||||||
# mylog('verbose', [f'[{pluginName}] response: "{response}"'])
|
# mylog('verbose', [f'[{pluginName}] response: "{response}"'])
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
try:
|
try:
|
||||||
# Parse JSON response
|
# Parse JSON response
|
||||||
response_json = response.json()
|
response_json = response.json()
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ def importConfigs (db, all_plugins):
|
|||||||
# ccd(key, default, config_dir, name, inputtype, options, group, events=None, desc="", regex="", setJsonMetadata=None, overrideTemplate=None, forceDefault=False)
|
# ccd(key, default, config_dir, name, inputtype, options, group, events=None, desc="", regex="", setJsonMetadata=None, overrideTemplate=None, forceDefault=False)
|
||||||
ccd('VERSION', buildTimestamp , c_d, '_KEEP_', '_KEEP_', '_KEEP_', '_KEEP_', None, "_KEEP_", "", None, None, True)
|
ccd('VERSION', buildTimestamp , c_d, '_KEEP_', '_KEEP_', '_KEEP_', '_KEEP_', None, "_KEEP_", "", None, None, True)
|
||||||
|
|
||||||
write_notification(f'[Upgrade] : App upgraded 🚀 Please clear the cache: <ol> <li>Clear the browser cache (shift + browser refresh button)</li> <li> Clear app cache with the 🔄 (reload) button in the header</li></ol> Check out new features and what has changed in the <a href="https://github.com/jokob-sk/NetAlertX/releases" target="_blank">📓 release notes</a>.', 'interrupt', timeNowTZ())
|
write_notification(f'[Upgrade] : App upgraded 🚀 Please clear the cache: <ol> <li>Click OK below</li> <li>Clear the browser cache (shift + browser refresh button)</li> <li> Clear app cache with the 🔄 (reload) button in the header</li><li>Go to Settings and click Save</li> </ol> Check out new features and what has changed in the <a href="https://github.com/jokob-sk/NetAlertX/releases" target="_blank">📓 release notes</a>.', 'interrupt', timeNowTZ())
|
||||||
|
|
||||||
|
|
||||||
# Insert settings into the DB
|
# Insert settings into the DB
|
||||||
|
|||||||
Reference in New Issue
Block a user