diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json old mode 100644 new mode 100755 diff --git a/front/plugins/sync/hub.php b/front/plugins/sync/hub.php index 0e9b2ee3..ddd69d89 100755 --- a/front/plugins/sync/hub.php +++ b/front/plugins/sync/hub.php @@ -24,14 +24,14 @@ function checkAuthorization($method) { // ---------------------------------------------- // Function to return JSON response -function jsonResponse($status, $data = [], $message = '') { +function jsonResponse($status, $data = '', $message = '') { http_response_code($status); header('Content-Type: application/json'); echo json_encode([ 'node_name' => getSettingValue('SYNC_node_name'), 'status' => $status, 'message' => $message, - 'data' => $data, + 'data_base64' => $data, 'timestamp' => date('Y-m-d H:i:s') ]); } @@ -50,13 +50,13 @@ if ($method === 'GET') { $data = file_get_contents($file_path); // Prepare the data to return as a JSON response - $response_data = [ - 'data_base64' => base64_encode($data), - ]; + $response_data = base64_encode($data); // Return JSON response jsonResponse(200, $response_data, 'OK'); + write_notification("[Plugin: SYNC] Data sent", "info"); + } // receiving data (this is a HUB) else if ($method === 'POST') { diff --git a/front/plugins/sync/sync.py b/front/plugins/sync/sync.py index eae9a2a6..2cd6303e 100755 --- a/front/plugins/sync/sync.py +++ b/front/plugins/sync/sync.py @@ -7,6 +7,7 @@ import hashlib import requests import json import sqlite3 +import base64 # Define the installation path and extend the system path for plugin imports @@ -106,7 +107,7 @@ def main(): # pull data from nodes if specified if len(pull_nodes) > 0: 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 node_name = response_json.get('node_name', 'unknown_node') @@ -119,10 +120,10 @@ def main(): log_file_name = f'{file_prefix}.{node_name}.log' # 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) - 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]) write_notification(message, 'info', timeNowTZ()) @@ -269,7 +270,7 @@ def get_data(api_token, node_url): # mylog('verbose', [f'[{pluginName}] response: "{response}"']) - if response.status_code == 200: + if response.status_code == 200: try: # Parse JSON response response_json = response.json() diff --git a/server/initialise.py b/server/initialise.py index 26a25caf..feba2caf 100755 --- a/server/initialise.py +++ b/server/initialise.py @@ -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('VERSION', buildTimestamp , c_d, '_KEEP_', '_KEEP_', '_KEEP_', '_KEEP_', None, "_KEEP_", "", None, None, True) - write_notification(f'[Upgrade] : App upgraded 🚀 Please clear the cache:
  1. Clear the browser cache (shift + browser refresh button)
  2. Clear app cache with the 🔄 (reload) button in the header
Check out new features and what has changed in the 📓 release notes.', 'interrupt', timeNowTZ()) + write_notification(f'[Upgrade] : App upgraded 🚀 Please clear the cache:
  1. Click OK below
  2. Clear the browser cache (shift + browser refresh button)
  3. Clear app cache with the 🔄 (reload) button in the header
  4. Go to Settings and click Save
Check out new features and what has changed in the 📓 release notes.', 'interrupt', timeNowTZ()) # Insert settings into the DB