Repository navigation
KsuWebUI-SN 1.2-40
·
34 commits
to main
since this release
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,.mjsor.cssfile in the module'swebrootreloads 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 thewebrootfolder, 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: aRootServicethat exposesIFileWatcher(start(root, listener)andstop(listener)). It walks thewebroot(maxDepth(6), at most 100 directories) and puts aFileObserveron each folder with the maskCLOSE_WRITE | MOVED_TO | CREATE. Only files ending inhtml,htm,js,mjsorcsscall the listener. A dead listener is stopped when a call throwsRemoteException.- AIDL: new
IFileWatcher.aidland aonewayIFileChangeListener.aidl(onChanged()). LiveReload.kt: holdsenabled(aMutableStateFlow) and a conflatedChannel.watch()binds the root service whileenabledis 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 callsreload().WebViewHelper.kt:initWebViewcreates aLiveReloadforwebroot.watch()runs inlifecycleScope, andreloadOnChange { state.webView?.reload() }runs insiderepeatOnLifecycle(STARTED), so reloads only happen while the activity is visible. The JS side tells Kotlin about the switch throughprompt('__ksu_livereload__', '1' | '0')(PROMPT_LIVE_RELOAD), which setsliveReload.enabled.assets/eruda/livereload.js: creates the configksu-livereload(liveReload: false), adds a switch to the Eruda Settings tab withwindow.ksuText.liveReload, and sends the current value on change and on startup. It is injected witherudaJs("livereload")afterscrolland beforetheme.- Strings: new
eruda_live_reload, passed to the page asliveReloadinksuText.
Console scroll and swipe
scroll.js: when the console is open and Background Scroll/Swipe is off,touchstart,touchmove,touchend,touchcanceland the matching pointer events on#erudaare stopped from propagating if they come from inside.eruda-dev-tools. The resizer,luna-data-grid-resizerand entry button are excluded. The stringeruda_bg_scrollnow reads "WebUI Background Scroll/Swipe".ux.js:hScrollable()was split intoswipeBlocked()(inputs, textareas, content-editable,luna-tab) andscrollers().scrollers()records thescrollLeftof every sideways-scrollable ancestor (overflow wider than 40 px, stopping at.eruda-dev-toolsand skipping the Sources panel) attouchstart. Ontouchendthe swipe is dropped if any of them moved, otherwise the 70 px / 1.8 ratio rule applies as before.ux.jsstyles and clicks: extra CSS removes the setting-row hover highlight and tap highlight, and hides horizontal overflow in#eruda-sources. A capturingclicklistener on the shadow root toggles the checkbox of a.luna-setting-item-checkboxrow when you tap the row outside the input.
Other
executions.js: the export stamp adds seconds (HH-MM-SS).MainActivity.kt:ViewHolder.initsets anOnTouchListenerthat returnstrueonsize,date,moduleUpdate,statusDisabled,statusHiddenandstatusUpdate.- Translations:
eruda_live_reloadand the updatederuda_bg_scrollare present in English, Arabic, French, Polish, Japanese and Simplified Chinese.check_strings.pypasses and there are noTODO translatemarkers.