7 Commits

Author SHA1 Message Date
taamarin
9f479cd546 fix(ctr): sanitize last_check_time, safe return, and add alt SSID method 2025-09-08 00:13:29 +07:00
taamarin
6074f4c6f0 fix(scripts): use /system/bin/sh and add curl timeout options in box.tool 2025-09-05 10:25:16 +07:00
taamarin
f61566bb2a refactor(scripts): simplify inotify & utils with busybox awk and case logic
- Replaced awk with busybox awk for better compatibility on Android.
- Simplified logging function indentation in ctr.inotify.
- Added clean_old_logs using busybox awk for log retention (24h).
- Unified service control logic:
  - Use case for WiFi blacklist/whitelist matching.
  - Consistent calls to ${scripts_dir}/box.service and ${scripts_dir}/box.iptables.
- Improved SSID retrieval:
  - Use cmd wifi status as primary method.
  - Fallback to iwconfig when available.
- Updated is_allowed_wifi:
  - Convert array → comma-separated string internally.
  - Trim spaces on SSID and list entries before comparison.
- Removed unused service_script and iptables_script vars.
- More descriptive log outputs for network events.

This refactor reduces duplication, improves Android compatibility,
and makes WiFi service control logic more maintainable.
2025-08-23 09:03:36 +07:00
taamarin
5378a141ee fix(network-switch): improve WiFi SSID list handling
- Changed log file path from Networkswitch_debug.log to netswitch.log
- Updated WiFi SSID check to properly handle array values from settings.ini
- Modified is_allowed_wifi to accept array arguments instead of comma-separated strings
- Adjusted calls to is_allowed_wifi in ctr.inotify to pass array correctly
2025-08-21 14:24:40 +07:00
taamarin
bafca21025 fix: improve logging, startup handling, and binary checks 2025-08-18 09:05:31 +07:00
taamarin
d28ba2f645 scripts: add settings.ini validation to all entry scripts
- Added syntax validation for `/data/adb/box/settings.ini` at the start of:
  * box.inotify
  * box.iptables
  * box.service
  * box.tool
  * ctr.inotify
  * start.sh
- If validation fails, an error message is logged to
  `/data/adb/box/run/settings_err.log` and the script exits immediately.
- Ensures misconfigured settings.ini do not break runtime scripts.
2025-08-17 05:23:42 +07:00
taamarin
b8a51ee1c2 feat: introduce network-based service control with Wi-Fi/SSID options 2025-08-16 14:46:01 +07:00