Skip to content

KsuWebUI-SN 1.2-33

Choose a tag to compare

@dnascorpionofficial dnascorpionofficial released this 12 Nov 06:51
· 41 commits to main since this release
4a712ab

Tip

Highlights: faster module load, the module console (Eruda) has a new Executions tab that records every command a WebUI runs as root, with its output, exit code and duration.

✨ New

  • Executions tab: when Enable console debug is on for a module, its console now has an Executions tab. It lists every ksu.exec and ksu.spawn call the WebUI makes, showing the time, the command, a ✓ / ✗ / … status, the exit code and how long it took. Calls that are still running update live.
  • Call details: tap a call to see the full command, its options, stdout and stderr. Copy command and Copy output buttons are included.
  • Search, sort and filter: search across commands and output, switch between Newest first and Oldest first (your choice is remembered), and filter to Failed calls only.
  • Export and clear: Export saves all calls as a text file named KsuWebUI-SN_execution-DD-MM-YYYY_HH-MM.txt. Clear empties the list.

🔁 Changed

  • Faster module list: module cards are now prepared in the background right after the app opens, so the list scrolls more smoothly the first time.
  • Console debug off: nothing is recorded and the Executions tab is not added, so modules without console debug are unaffected.

⚙️ Under the hood

For developers ⚠️ (Click to expand)

Execution log (ExecLog.kt, new)

  • ExecLog(enabled): an in-memory log, one per WebUI session. start, out, err and end record events, and every method returns immediately when enabled is false.
  • Limits: it keeps at most 200 calls, 5,000,000 characters per call and 30,000,000 in total. The oldest calls are dropped first, and a call that hits its cap gets a trunc event.
  • ExecLogInterface: exposed to JS as ksu_exec_log with events(after) (returns events newer than a sequence number) and clear(). It is only added when console debug is on for the module.

WebView bridge (WebViewInterface.kt, WebViewHelper.kt)

  • WebViewInterface(state, log): now takes an ExecLog. Both exec variants and spawn log the start, stdout, stderr and exit code. spawnLabel(command, args) builds the display text for spawned commands.
  • initWebView: reads KEY_CONSOLE_MODULES from the settings prefs to decide whether the module has console debug on. It creates the ExecLog from that and adds ksu_exec_log only when it is on.
  • Injection: erudaJs("executions") is added to the Eruda startup script after theme.

Eruda panel (assets/eruda/executions.js, new)

  • Tool: an eruda.Tool subclass named Executions that polls ksu_exec_log.events(lastSeq) every 600 ms, only while the tab is visible.
  • UI: search, order toggle (kept in localStorage as ksu-exec-order), All / Failed filter, Export and Clear. The tab is moved ahead of Elements, and Elements moves next to Settings.
  • Export: builds the text file and saves it through ksu_download.save.

Card prewarming (MainActivity.kt)

  • prewarmCards(): uses a Looper idle handler to create 6 card view holders and put them in the RecyclerView pool. It is called from onCreate before the first refresh and stops if the activity is destroyed.