Fix: Only include client_id in report data when rustdesk_id is configured

- Check if rustdesk_id is configured before including client_id in report data
- Use rustdesk_id value as client_id when configured
- Set client_id to None if rustdesk_id is not set
- Prevents sending machine-generated client_id when rustdesk_id is not configured
parent 30cef1b5
...@@ -1014,8 +1014,12 @@ class ReportsSyncResponseHandler(ResponseHandler): ...@@ -1014,8 +1014,12 @@ class ReportsSyncResponseHandler(ResponseHandler):
def collect_report_data(self, date_range: str = 'today') -> Dict[str, Any]: def collect_report_data(self, date_range: str = 'today') -> Dict[str, Any]:
"""Collect report data from database for synchronization (incremental - only new/changed data)""" """Collect report data from database for synchronization (incremental - only new/changed data)"""
try: try:
# NEW: Query server for last sync information before collecting data # Get client_id only if rustdesk_id is configured
client_id = self._get_client_id() client_id = None
if self.api_client and hasattr(self.api_client, 'settings') and self.api_client.settings.rustdesk_id:
client_id = str(self.api_client.settings.rustdesk_id)
# Query server for last sync information
server_info = self.query_server_last_sync(client_id) server_info = self.query_server_last_sync(client_id)
# Check if recovery is needed (returns tuple: (needs_recovery, is_full_resync)) # Check if recovery is needed (returns tuple: (needs_recovery, is_full_resync))
...@@ -1150,7 +1154,7 @@ class ReportsSyncResponseHandler(ResponseHandler): ...@@ -1150,7 +1154,7 @@ class ReportsSyncResponseHandler(ResponseHandler):
# Build report data payload (incremental - only new/changed data) # Build report data payload (incremental - only new/changed data)
report_data = { report_data = {
'sync_id': self._generate_sync_id(), 'sync_id': self._generate_sync_id(),
'client_id': self._get_client_id(), 'client_id': client_id, # Only include if rustdesk_id is configured
'sync_timestamp': datetime.utcnow().isoformat(), 'sync_timestamp': datetime.utcnow().isoformat(),
'date_range': date_range, 'date_range': date_range,
'start_date': start_date.isoformat(), 'start_date': start_date.isoformat(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment