Skip to content

KsuWebUI-SN 1.2-40

Choose a tag to compare

@dnascorpionofficial dnascorpionofficial released this 12 Nov 23:24
· 34 commits to main since this release
cbeb729

Tip

Highlights: the module console (Eruda) has a new Live reload switch that reloads a WebUI by itself whenever you edit its web files, plus smoother swiping and scrolling inside the console.

✨ New

  • Live reload: in the module console, open the Settings tab and turn on Live reload. While it is on, saving, creating or moving an .html, .htm, .js, .mjs or .css file in the module's webroot reloads the WebUI automatically. Several quick saves are merged into one reload. The switch is remembered per module and is off by default. It only reloads while the WebUI is on screen, and it only watches the webroot folder, up to 6 levels deep and 100 folders.

🔁 Changed

  • Background Scroll/Swipe: the console setting is now called WebUI Background Scroll/Swipe. When it is off, touching or swiping inside the console panel no longer reaches the WebUI behind it. The resize handle, column resizers and the console button still work.
  • Settings toggles: tapping anywhere on a switch row in the console Settings tab now flips it, and the rows no longer flash a highlight when touched.
  • Sources tab: the Sources tab no longer scrolls sideways.
  • Executions export: the exported file name now includes seconds, KsuWebUI-SN_execution-DD-MM-YYYY_HH-MM-SS.txt, so two exports in the same minute no longer share a name.
  • Module cards: the size, date and status chips are no longer touch targets. Touching them is ignored instead of reacting like a button.
  • Translations: the new Live reload text and the renamed Background Scroll/Swipe text are translated in Arabic, French, Polish, Japanese and Simplified Chinese.

🛠️ Fixed

  • Swiping between console tools: a sideways swipe used to be ignored anywhere there was content that can scroll sideways. It is now only ignored when that content actually scrolled during the swipe, so swiping between tools works on those panels too.

⚙️ Under the hood

For developers ⚠️ (Click to expand)

Live reload (new)

  • FileWatchService.kt: a RootService that exposes IFileWatcher (start(root, listener) and stop(listener)). It walks the webroot (maxDepth(6), at most 100 directories) and puts a FileObserver on each folder with the mask CLOSE_WRITE | MOVED_TO | CREATE. Only files ending in html, htm, js, mjs or css call the listener. A dead listener is stopped when a call throws RemoteException.
  • AIDL: new IFileWatcher.aidl and a oneway IFileChangeListener.aidl (onChanged()).
  • LiveReload.kt: holds enabled (a MutableStateFlow) and a conflated Channel. watch() binds the root service while enabled is true and always stops the watcher and unbinds on cancel. reloadOnChange(reload) waits for a change, debounces for 300 ms, drops the extra events and calls reload().
  • WebViewHelper.kt: initWebView creates a LiveReload for webroot. watch() runs in lifecycleScope, and reloadOnChange { state.webView?.reload() } runs inside repeatOnLifecycle(STARTED), so reloads only happen while the activity is visible. The JS side tells Kotlin about the switch through prompt('__ksu_livereload__', '1' | '0') (PROMPT_LIVE_RELOAD), which sets liveReload.enabled.
  • assets/eruda/livereload.js: creates the config ksu-livereload (liveReload: false), adds a switch to the Eruda Settings tab with window.ksuText.liveReload, and sends the current value on change and on startup. It is injected with erudaJs("livereload") after scroll and before theme.
  • Strings: new eruda_live_reload, passed to the page as liveReload in ksuText.

Console scroll and swipe

  • scroll.js: when the console is open and Background Scroll/Swipe is off, touchstart, touchmove, touchend, touchcancel and the matching pointer events on #eruda are stopped from propagating if they come from inside .eruda-dev-tools. The resizer, luna-data-grid-resizer and entry button are excluded. The string eruda_bg_scroll now reads "WebUI Background Scroll/Swipe".
  • ux.js: hScrollable() was split into swipeBlocked() (inputs, textareas, content-editable, luna-tab) and scrollers(). scrollers() records the scrollLeft of every sideways-scrollable ancestor (overflow wider than 40 px, stopping at .eruda-dev-tools and skipping the Sources panel) at touchstart. On touchend the swipe is dropped if any of them moved, otherwise the 70 px / 1.8 ratio rule applies as before.
  • ux.js styles and clicks: extra CSS removes the setting-row hover highlight and tap highlight, and hides horizontal overflow in #eruda-sources. A capturing click listener on the shadow root toggles the checkbox of a .luna-setting-item-checkbox row when you tap the row outside the input.

Other

  • executions.js: the export stamp adds seconds (HH-MM-SS).
  • MainActivity.kt: ViewHolder.init sets an OnTouchListener that returns true on size, date, moduleUpdate, statusDisabled, statusHidden and statusUpdate.
  • Translations: eruda_live_reload and the updated eruda_bg_scroll are present in English, Arabic, French, Polish, Japanese and Simplified Chinese. check_strings.py passes and there are no TODO translate markers.