Updated API to accept public IP, Change the agent download to give full config options, remove Uvicorn - change to use Waitress for Windows, Guvicorn linux
This commit is contained in:
+2
-1
@@ -21,7 +21,8 @@ class Log(db.Model):
|
||||
event_type = db.Column(db.String(20), nullable=False)
|
||||
user_name = db.Column(db.String(50), nullable=False)
|
||||
computer_name = db.Column(db.String(50), nullable=False)
|
||||
ip_address = db.Column(db.String(15), nullable=False)
|
||||
local_ip = db.Column(db.String(45), nullable=True) # Increased size to support IPv6, made nullable
|
||||
public_ip = db.Column(db.String(45), nullable=True) # New field for public IP, nullable
|
||||
timestamp = db.Column(db.DateTime, nullable=False, default=get_current_time_with_timezone)
|
||||
retry = db.Column(db.Integer, default=0, nullable=False)
|
||||
company_id = db.Column(db.Integer, db.ForeignKey('app_auth_companies.id'), nullable=True)
|
||||
|
||||
+5
-2
@@ -144,7 +144,7 @@ def log_event():
|
||||
Log.event_type == data['EventType'],
|
||||
Log.user_name == data['UserName'],
|
||||
Log.computer_name == data['ComputerName'],
|
||||
Log.ip_address == data['IPAddress'],
|
||||
Log.local_ip == data.get('LocalIP'),
|
||||
Log.timestamp == timestamp
|
||||
)
|
||||
).first()
|
||||
@@ -158,7 +158,8 @@ def log_event():
|
||||
event_type=data['EventType'],
|
||||
user_name=data['UserName'],
|
||||
computer_name=data['ComputerName'],
|
||||
ip_address=data['IPAddress'],
|
||||
local_ip=data.get('LocalIP'),
|
||||
public_ip=data.get('PublicIP'),
|
||||
timestamp=timestamp,
|
||||
retry=is_retry,
|
||||
company_id=g.company_id, # Add the company ID from the API key
|
||||
@@ -180,6 +181,8 @@ def log_event():
|
||||
'event_type': data.get('EventType') if 'data' in locals() else None,
|
||||
'user_name': data.get('UserName') if 'data' in locals() else None,
|
||||
'computer_name': data.get('ComputerName') if 'data' in locals() else None,
|
||||
'local_ip': data.get('LocalIP') if 'data' in locals() else None,
|
||||
'public_ip': data.get('PublicIP') if 'data' in locals() else None,
|
||||
'retry_attempt': data.get('retry', 0) if 'data' in locals() else None,
|
||||
'error': str(e)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user