Skip to content

KsuWebUI-SN 1.2-53

Choose a tag to compare

@dnascorpionofficial dnascorpionofficial released this 16 Nov 02:29
· 21 commits to main since this release
c093785

Tip

Highlights: this release adds a new Export tab to the module's Eruda console. Pick what you want (local storage, session storage, cookies, IndexedDB, Cache Storage, executions, network requests and console logs) and save it all as one ZIP file. Pressing back on a module's WebUI now asks before it closes, so you can't leave by accident. All Eruda console texts are now English only.

✨ New

  • Export tab: open the module's Eruda console and use the new Export tab (placed right after Executions). It shows a short description and an Export button.
  • Choose what to export: tapping Export opens a checklist with nothing ticked, so you decide what leaves the device. The items are Local storage, Session storage, Cookies, IndexedDB, Cache storage, Executions, Network requests and Console logs. There is also a Select all row.
  • Items with no data: they are listed last, dimmed and marked Not found, and can't be selected.
  • One ZIP, one file per item: every ticked item is saved as its own file inside a single ZIP named KsuWebUI-SN_export-<date>_<time>.zip. An info.json file in the ZIP lists the exported items, the time, the page address and any item that failed.
  • Readable storage files: local storage and session storage are written in an easy to read layout and split into Eruda settings and module data. Values that are JSON are shown as JSON instead of one long escaped line.
  • Network requests: you get a network.json list of all requests plus the response body of each request as its own file in a network folder.
  • Exit confirmation: pressing back in a module's WebUI still goes back through the pages first. When there is no page left to go back to, a dialog asks Exit this module WebUI? with Yes and No. The new text is translated in Arabic, French, Polish, Japanese and Simplified Chinese with DeepL.

🔁 Changed

  • Executions export moved: the Export button is gone from the Executions tab. Executions are now exported from the new Export tab together with everything else.
  • Eruda console texts are English only: all texts in the Eruda console and its dialogs and messages (Add, Edit, Key, Value, the clear and restore items, Live reload, Copy response body, Open Editor, the reload dialog, and the Copied, Refreshed, Styles updated and Page reloaded messages) are now always shown in English, whatever the app language is. The Enable console debug and Disable console debug menu items are not part of the Eruda console and stay translated.
  • Better buttons: the buttons in the Executions tab are bigger and easier to see and tap, and the Open Editor button in the Editor tab is now a filled button. Both tabs also look correct when an Eruda console theme doesn't provide its colors.
  • Module cards: tapping the bottom row of a module card no longer opens its WebUI. This covers the empty space around the settings icon, the size and date chips and the switch, the card edges and the space below them, so a missed tap can't open the module by accident. The rest of the card still opens the WebUI as before.

🧹 Removed

  • Eruda console translations: the Arabic, French, Polish, Japanese and Simplified Chinese translations of 27 Eruda console texts were deleted. The English text of these 27 Eruda console texts is now built into the app instead of being stored in the English strings file.

⚙️ Under the hood

For developers ⚠️ (Click to expand)

Export tab (new)

  • assets/eruda/export.js (new): injected with erudaJs("export") after executions and before editor in the Eruda console setup. It registers an Export tool in Eruda and moves its tab after Executions (before elements if that tab is missing), then calls updateSlider(). All of it is wrapped in try/catch and skipped if it was already added. Cost: it is only loaded together with the console (Eruda), so modules with the console off are not affected.
  • Picker: pressing Export checks every item in parallel (has functions, a failed check counts as not found), unticks everything, puts found items first and disables the rest. Select all only affects found items. If nothing is ticked, an alert asks to select at least one item.
  • Collectors:
    • Local and session storage: keys starting with eruda-, eruda_, ksu- or ksu_ go to eruda, all others to module, sorted by key. Values that look like JSON are parsed and plain quoted strings are unquoted.
    • Cookies: read from document.cookie (cookies that are visible to JavaScript) and URL-decoded when possible.
    • IndexedDB: uses indexedDB.databases(). For each database it writes the version and every store with keyPath, autoIncrement, indexes and all rows. Dates, Maps, Sets, typed arrays, ArrayBuffers and Blobs/Files are encoded with a __type marker (binary as base64). It stops at depth 30 and marks circular references.
    • Cache storage: lists every cache with the URL, method, status, content type and length of each entry (the bodies are not exported).
    • Executions: the log text from window.__ksuExecText().
    • Network requests: read from eruda.get('network').requests(). Bodies are saved as network/NNN-<name>.<ext>, with the name cleaned and cut to 60 characters and the extension taken from the response sub type. JSON bodies are pretty printed.
    • Console logs: read from the rendered log items of the Eruda console, each line starting with its type such as [error] or [warn], and stack lines indented.
  • Failures: an item that throws doesn't stop the export. It is written as <file>.error.txt and listed under failed in info.json.
  • ZIP writer: built in the page with no library. Names are UTF-8 (flag 0x0800), every file has a CRC-32, and files over 64 bytes are compressed with CompressionStream('deflate-raw') when it exists and the result is smaller, otherwise they are stored. No ZIP64, so it is meant for normal sized exports.
  • Saving: the ZIP is turned into base64 and passed to ksu_download.save(base64, name, 'application/zip'), the same bridge the old Executions export used.

Executions

  • assets/eruda/executions.js: exportLog() and its Export button were removed. The text is now built by buildLogText() and exposed as window.__ksuExecText(), which polls first and returns an empty string when there are no entries.
  • Styles: colors use fallbacks (var(--foreground, inherit), var(--accent, #4a8cff), var(--console-error-foreground, #f44336)) and neutral rgba(128,128,128,…) backgrounds and borders instead of --border, --background and --darker-background. .kx-btn got more padding, a larger radius, a stronger background and an :active state.

Eruda console texts

  • WebViewHelper.kt: new ERUDA_TEXT_JS constant (a plain English window.ksuText = {…} object, now with the 19 export texts added to the existing keys), used in place of Context.erudaTextJs(), which was removed together with the unused org.json.JSONObject import. The native Eruda console dialogs now use English literals (Copy, View, Edit, Key, Value) and so do the toasts (Copied, Refreshed, Styles updated, Page reloaded).
  • res/layout/dialog_reload.xml: Reload, Reload table and Reload WebUI are now literal texts instead of string resources.
  • assets/eruda/editor.js: the Open Editor button is a filled accent button and its colors have fallbacks.
  • Strings: the Eruda console strings were removed from every strings.xml: reload_title, reload_table, reload_webui, copy_title, view_title, edit_title, choose_key, choose_value, copied, refreshed, eruda_add, eruda_value_for, eruda_exists, eruda_exists_hint, eruda_delete_item, eruda_clear_local, eruda_clear_session, eruda_clear_console, eruda_clear_network, eruda_restore_defaults, eruda_bg_scroll, eruda_live_reload, eruda_copy_body, eruda_open_editor, eruda_editor_hint, live_reload_styles and live_reload_reloaded. The two strings console_enable and console_disable are unchanged in all languages.

Exit confirmation

  • WebUIActivity.kt: the back callback is now the field backCallback. It calls goBack() while the WebView has history, otherwise confirmExit(). confirmExit() does nothing if the dialog is already showing. It inflates DialogConfirmBinding with the new title, hides the message, and uses ThemeOverlay_KsuWebUI_ButtonDialog. No dismisses the dialog. Yes dismisses it, sets backCallback.isEnabled = false and calls onBackPressedDispatcher.onBackPressed(). The dialog is dismissed in onDestroy.
  • Strings: new confirm_exit_webui in English, Arabic, French, Polish, Japanese and Simplified Chinese. There are no TODO translate markers.

Module cards

  • res/layout/item_module.xml: the bottom row (settings button, chips and switch) got the id actions_row. It now reaches the edges of the card with layout_marginStart and layout_marginEnd of -20dp and carries its own padding: 20dp at the start and end, 8dp at the top (this replaces its old layout_marginTop) and 16dp at the bottom. The same 16dp bottom padding was removed from the parent container, which got clipToPadding="false", so the card looks exactly the same as before.
  • MainActivity.kt: ViewHolder sets the existing consumeTouch listener (the one the chips already use) on binding.actionsRow. Touches that no child handles are consumed by the row, so they never reach the card's click listener that opens the WebUI. The settings button and the switch still handle their own taps first.