init: workspace opencode sync

This commit is contained in:
2026-08-15 00:28:04 +07:00
commit c5f3549e8e
2 changed files with 77 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
*.log
__pycache__/
*.pyc.DS_Store
node_modules/.env
+72
View File
@@ -0,0 +1,72 @@
# Monitor hotspot user expiry — unified
# Monitors: Bulanan2, Bulanan4, Family, home
# Voucher (vc-2K3J, vc-5K10J): removed when expired
# Bulanan/Family/home: limit-uptime=1s when expired
:local montharray { "jan"; "feb"; "mar"; "apr"; "may"; "jun"; "jul"; "aug"; "sep"; "oct"; "nov"; "dec" }
:local dateint do={
:local days [:pick $d 4 6]
:local monthstr [:pick $d 0 3]
:local year [:pick $d 7 11]
:local monthint ([ :find $montharray $monthstr ] + 1)
:local month "$monthint"
:if ([len $month] = 1) do={ :set month "0$month" }
:return [:tonum "$year$month$days"]
}
:local timeint do={
:local hours [:pick $t 0 2]
:local minutes [:pick $t 3 5]
:return ($hours * 60 + $minutes)
}
:local now [/system clock get date]
:local nowtime [/system clock get time]
:local today [$dateint d=$now]
:local curtime [$timeint t=$nowtime]
:local profiles { "Bulanan2"; "Bulanan4"; "Family"; "home" }
:local vouchProfiles { "vc-2K3J"; "vc-5K10J" }
:local expiredCount 0
:foreach profile in=$profiles do={
:foreach i in=[/ip hotspot user find where profile=$profile] do={
:local comment [/ip hotspot user get $i comment]
:local name [/ip hotspot user get $i name]
:if (([:pick $comment 3] = "/") and ([:pick $comment 6] = "/")) do={
:local expd [$dateint d=$comment]
:local exptStart [:pick $comment 12 20]
:local exptMin [$timeint t=$exptStart]
:if (($expd < $today) or (($expd = $today) and ($exptMin < $curtime))) do={
/ip hotspot user set limit-uptime=1s $i
/ip hotspot active remove [find where user=$name]
:set expiredCount ($expiredCount + 1)
:log info ("Expired: " . $name . " (" . $profile . ")")
}
}
}
}
:foreach profile in=$vouchProfiles do={
:foreach i in=[/ip hotspot user find where profile=$profile] do={
:local comment [/ip hotspot user get $i comment]
:local name [/ip hotspot user get $i name]
:if (([:pick $comment 3] = "/") and ([:pick $comment 6] = "/")) do={
:local expd [$dateint d=$comment]
:local exptStart [:pick $comment 12 20]
:local exptMin [$timeint t=$exptStart]
:if (($expd < $today) or (($expd = $today) and ($exptMin < $curtime))) do={
/ip hotspot user remove $i
/ip hotspot active remove [find where user=$name]
:set expiredCount ($expiredCount + 1)
:log info ("Voucher expired & removed: " . $name)
}
}
}
}
:if ($expiredCount > 0) do={
:log info ("Monitor-expiry: " . $expiredCount . " user(s) expired")
}