Skip to content

KsuWebUI-SN 1.2-47

Choose a tag to compare

@dnascorpionofficial dnascorpionofficial released this 14 Nov 13:24
· 27 commits to main since this release
4061003

Tip

Highlights: this release only changes the module console (Eruda) and translations. Live reload now swaps changed CSS in place without reloading the page, the console Network tab can copy just a response body, and the console panel no longer jumps off the screen when the keyboard opens. The new texts are translated in all five languages, and the translation script can now edit existing strings and pick up new ones.

✨ New

  • Live reload for styles: when you save only .css files, the WebUI swaps the changed stylesheet in place instead of reloading the page, so your scroll position, open dialogs and typed text stay as they are. This works for stylesheets added with <link rel="stylesheet">. If a changed file is not loaded that way (for example @import or an inline <style>), or you saved other file types together with the CSS, it falls back to a normal full reload.
  • Reload messages: Live reload now shows a short message after each update, Styles updated for a style swap and Page reloaded for a full reload.
  • Copy response body: open a request in the console Network tab and use the new { } button next to the copy-response icon. It copies only the response body to the clipboard (JSON is pretty-printed) and shows Copied.

🔁 Changed

  • Live reload batching: the app now keeps every changed file from a quick burst of saves instead of only the last signal, so it can tell a CSS-only save from a mixed one. Several quick saves are still merged into one update.
  • Copy message: every copy button in the console now shows the same system Copied message that the app already uses, so it follows the app language and looks the same everywhere.
  • No Eruda notifications: Eruda's own in-page notifications are gone, including their unused code and styles, and the console is a little smaller.
  • Refreshed message: the refresh buttons in the Elements, Storage, Cookie and Sources tools show the app's own Refreshed message, the same way copy buttons show Copied. In Storage it appears after choosing the table refresh.
  • Translations: the new Styles updated, Page reloaded, Refreshed and Copy response body texts are translated in Arabic, French, Polish, Japanese and Simplified Chinese with DeepL.

🛠️ Fixed

  • Console and keyboard: tapping a text box in the console, such as the Executions search, opened the keyboard and pushed the whole panel up so its title bar, tabs and search box went off the screen. The panel now shrinks to fit above the keyboard and everything stays visible.

⚙️ Under the hood

For developers ⚠️ (Click to expand)

Live reload styles (new)

  • IFileChangeListener.aidl: onChanged() is now onChanged(String path).
  • FileWatchService.kt: each FileObserver reports the changed file as a path relative to webroot (the folder's relativeTo(rootDir) prefix plus the file name). The mask, the watched extensions (html, htm, js, mjs, css), the 6 levels depth and the 100 folder limit are unchanged.
  • LiveReload.kt: changes is now a Channel<String>(UNLIMITED) instead of a conflated Channel<Unit>. watch() drains old paths when the switch is turned on. reloadOnChange(swapStyles, reload) collects the unique paths during the 300 ms debounce. If every path ends with .css (case-insensitive) it calls swapStyles(paths) and skips the reload when that returns true, otherwise it calls reload().
  • WebViewHelper.kt: new WebView.swapStyles(paths) suspend function. It reads assets/livereload_css.js, replaces PATHS_JSON with the paths as a JSONArray, runs it with evaluateJavascript and resumes with result == "true". initWebView shows the live_reload_styles or live_reload_reloaded toast after a swap or a reload.
  • assets/livereload_css.js (new): finds every link[rel~="stylesheet"][href] on the same host whose decoded path equals / + the changed path. For each match it clones the <link> with a ksulr=<timestamp> query parameter, inserts the clone after the old one, removes the old one on load and removes the clone on error. It returns false if any changed path has no matching <link>, which makes the caller do a full reload.

Network response body (new)

  • assets/eruda/network.js: injected with erudaJs("network") after livereload and before theme. It adds padding-right: 72px to .eruda-network .eruda-detail .eruda-control, inserts a span.eruda-copy-body ({ }) before .eruda-copy-res, and takes the text from eruda.get('network')._detail._detailData.resTxt (objects go through JSON.stringify(..., null, 2)). The text is sent with prompt('__ksu_copy__', text), which the existing PROMPT_COPY handler copies to the clipboard with the copied toast. A MutationObserver adds the button again when the detail view re-renders, and the script looks for the detail container every 250 ms, up to 40 times. Cost: the script is only loaded together with the console (Eruda), so it does nothing for modules that have the console off. The 250 ms search stops as soon as the container is found, or after 10 seconds at most. The observer watches only the direct children of that one container and only wakes up when request details change, so an idle console uses no battery.
  • WebViewHelper.kt: ksuText has a new copyBody entry.

Eruda notifications removed

  • assets/eruda.min.js: the 7 notify("Copied", ...) calls (Console, Network response and curl, Elements, Storage, Cookie, Info) now call window.prompt("__ksu_copied__", ""). The 7 notify("Refreshed", ...) calls (Elements, Storage, Cookie, Sources script, stylesheet, iframe and image) now call window.prompt("__ksu_refreshed__", ""). The dead notification code is removed: the luna-notification module (2556) and its import, DevTools.notify, _initNotification and its call, the empty <div class="notification"> in the panel template, and the .luna-notification* rules in the console stylesheet. The embedded luna-notification stylesheet (module 5259, with its icon font) is emptied.
  • assets/eruda/storage.js: the storage refresh button is intercepted, so the stock handler never runs. After the table refresh it now sends prompt('__ksu_refreshed__', ''). The WebUI reload choice reloads the page and shows no message.
  • WebViewHelper.kt: new PROMPT_COPIED. It shares one branch with PROMPT_COPY: PROMPT_COPY still writes the clipboard first, PROMPT_COPIED only shows the existing copied toast. New PROMPT_REFRESHED has its own branch that shows the new refreshed toast.

Console and keyboard

  • assets/eruda/inset.js: the injected rule for .eruda-dev-tools now also sets max-height: calc(100vh - var(--safe-area-inset-bottom,0px) - var(--safe-area-inset-top,0px)) !important. The panel's bottom is pinned to --safe-area-inset-bottom, which includes the keyboard height, and the panel is 80% of the screen tall by default, so with the keyboard open its top used to end up above the screen.

Strings and tooling

  • Strings: new eruda_copy_body, live_reload_styles, live_reload_reloaded and refreshed in English, Arabic, French, Polish, Japanese and Simplified Chinese. check_strings.py passes and there are no TODO translate markers.
  • scripts/add_language.py: running it again for an existing language first adds any new English strings (marked TODO translate) and then continues with the marked ones. New --edit [name ...] mode shows the English and the current text of one, several or all strings and asks for a new one, where Enter keeps the current text. --create-only was removed. The READMEs in all six languages describe the new commands. None of this changes the app.