init: workspace opencode sync

This commit is contained in:
2026-08-15 00:28:08 +07:00
commit 2451170708
122 changed files with 10549 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
import librouteros
api = librouteros.connect('192.168.100.2', 'mi4', 'm14', port=8728)
fix_schedulers = ["Bulanan2", "Bulanan4", "vc-2K3J", "vc-5K10J", "Family", "DevB2"]
print("=== Fixing scheduler on-event ===")
for item in list(api('/system/scheduler/print')):
name = item['name']
if name not in fix_schedulers:
continue
oe = item['on-event']
if ':pic' not in oe:
print(f"{name}: no :pic found, skipping")
continue
fixed = oe.replace(':pic', ':pick')
count = oe.count(':pic')
api('/system/scheduler/set', **{'.id': item['.id'], 'on-event': fixed})
print(f"{name}: fixed {count} :pic -> :pick")
print("\n=== Verifying scheduler on-event ===")
for item in list(api('/system/scheduler/print')):
name = item['name']
if name not in fix_schedulers:
continue
oe = item.get('on-event', '')
has_pic = ':pic' in oe
has_pick = ':pick' in oe
status = 'OK' if has_pick and not has_pic else ('BROKEN' if has_pic else 'unknown')
print(f" {name}: {status}")
# Restore Bulanan2 comment from TEST_FIX_123
api('/system/scheduler/set', **{'.id': '*1', 'comment': 'Monitor Profile Bulanan2'})
print("\n=== Fixing profile on-login ===")
fix_profiles = ["Bulanan2", "Bulanan4", "vc-2K3J", "vc-5K10J", "Family", "home", "DevB2"]
for item in list(api('/ip/hotspot/user/profile/print')):
name = item['name']
if name not in fix_profiles:
continue
ol = item.get('on-login', '')
if ':pic' not in ol:
print(f"{name}: no :pic found, skipping")
continue
fixed = ol.replace(':pic', ':pick')
count = ol.count(':pic')
api('/ip/hotspot/user/profile/set', **{'.id': item['.id'], 'on-login': fixed})
print(f"{name}: fixed {count} :pic -> :pick")
print("\n=== Verifying profile on-login ===")
for item in list(api('/ip/hotspot/user/profile/print')):
name = item['name']
if name not in fix_profiles:
continue
ol = item.get('on-login', '')
has_pic = ':pic' in ol
has_pick = ':pick' in ol
status = 'OK' if has_pick and not has_pic else ('BROKEN' if has_pic else 'unknown')
print(f" {name}: {status}")
api.close()
print("\nALL DONE")