Archived
This commit is contained in:
1 parent
6e7eaa9282
commit
f4929c7cac
12 files changed
+155
-16
No files matched your search
@@ -4587,6 +4587,14 @@ def extended_forward_add(iface: str, payload: dict[str, Any], *, update_id: str
|
||||
if not update_id and len(rows) >= 20:
|
||||
raise ValueError("Osiągnięto limit przekierowań w tej sieci")
|
||||
row = {"id": update_id or secrets.token_hex(8), "public_ip": public_ip, "public_port": public_port, "target_ip": target_ip, "target_port": target_port, "protocol": protocol, "device": device, "allowed_sources": sources}
|
||||
if payload.get('service') and isinstance(payload.get('responsibility'), dict):
|
||||
row['service'] = str(payload['service'])[:120]
|
||||
row['responsibility'] = payload['responsibility']
|
||||
elif update_id:
|
||||
previous = next(item for item in rows if item['id'] == update_id)
|
||||
for key in ('service', 'responsibility'):
|
||||
if key in previous:
|
||||
row[key] = previous[key]
|
||||
result = _extended_write_forwards(iface, [*(item for item in rows if item['id'] != update_id), row])
|
||||
return {**result, "forward": row}
|
||||
|
||||
|
||||
Reference in new issue
Block a user