Skip to content

Commit beb41f4

Browse files
committed
Update WebUI X documentation and improve index page details
1 parent d25ce51 commit beb41f4

File tree

4 files changed

+41
-230
lines changed

4 files changed

+41
-230
lines changed

docs/.vitepress/config/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function sidebarGuide() {
118118
{ text: "PackageManagerInterface", link: "/guide/webuix/api/PackageManagerInterface" },
119119
],
120120
},
121-
{ text: "What is WebUI X", link: "/guide/webuix" },
121+
{ text: "Why WebUI X", link: "/guide/webuix/" },
122122
{ text: "Index Setup", link: "/guide/webuix/index-setup" },
123123
{ text: "Application Info Flags", link: "/guide/webuix/application-info-flags" },
124124
{ text: "Config", link: "/guide/webuix/config" },

docs/en/guide/webuix/index.md

Lines changed: 37 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,189 +1,50 @@
1-
# What is WebUI X?
1+
# Why WebUI X?
22

3-
WebUI X is an innovative way to manage WebUIs across different managers like KernelSU, MMRL, APatch, and more.
3+
WebUI X is the next-generation framework for building modular, secure, and high-performance WebUI applications. It offers significant improvements over Legacy KernelSU WebUI, making it the ideal choice for developers. Below are the key reasons to switch:
44

5-
The KernelSU developers first introduced this feature in [v0.8.1](https://github.com/tiann/KernelSU/releases/tag/v0.8.1), providing developers with a new way to configure their modules.
5+
## 🚀 **Key Advantages**
66

7-
MMRL extended WebUI support in [v32666](https://github.com/MMRLApp/MMRL/releases/tag/v5.27.36), adding features like dynamic theming (Monet), file system access, and many more.
7+
### 1. **Enhanced Security**
8+
- **Content Security Policy (CSP):** Restricts unsafe scripts and resources, preventing XSS attacks.
9+
- **Kill Shell:** Automatically terminates background processes to block unauthorized code execution.
10+
- **Strict Isolation:** Plugins and modules run in controlled environments, reducing vulnerabilities.
811

9-
## Setting Up WebUI X in a Manager
12+
### 2. **Superior Performance**
13+
- **Smart Caching:** Configurable `Cache Max Age` and resource caching improve load times.
14+
- **Optimized Rendering:** Features like `Window Resize` and `Auto Style StatusBars` ensure smooth UI adaptation.
1015

11-
To use WebUI X, your manager must support Jetpack Compose. Without Compose, WebUI X will not function.
16+
### 3. **Powerful Debugging Tools**
17+
- **Built-in Eruda Console:** Auto-injected for real-time debugging.
18+
- **Remote URL Debugging:** Test locally via `http://localhost` for faster iterations.
19+
- **Developer Mode:** Reveals module IDs and advanced metrics for troubleshooting.
1220

13-
### Add Required Dependencies
21+
### 4. **Extensibility & Customization**
22+
- **Plugin Ecosystem:** Supports APK and DEX plugins (e.g., [WXU](https://github.com/MMRLApp/WXU)) for limitless functionality.
23+
- **SPA-Friendly:** `History Fallback` ensures seamless navigation in single-page apps.
24+
- **UI Control:** Customize back-button behavior, refresh interceptors, and exit confirmations.
1425

15-
Add the following dependencies to your project:
26+
### 5. **Modern UX Features**
27+
- **Pull-to-Refresh:** User-friendly reloading (beta).
28+
- **Dynamic Theming:** Match status bars to app themes for visual consistency.
1629

17-
```kts
18-
implementation("com.github.MMRLApp.MMRL:platform:a0c8fd3785")
19-
implementation("com.github.MMRLApp.MMRL:webui:a0c8fd3785")
20-
```
30+
### 6. **Cross-Platform Compatibility**
31+
- Works with **KernelSU (Next), SukiSU Ultra, Magisk, APatch**, and even **non-rooted devices**.
2132

22-
> **Note:**
23-
> The `a0c8fd3785` is a commit hash used to fetch the dependencies.
24-
> You can also choose other builds from [JitPack](https://jitpack.io/#MMRLApp/MMRL/).
33+
## 🔍 **Comparison with Legacy KernelSU WebUI**
2534

26-
---
35+
| Feature | WebUI X | Legacy KernelSU WebUI |
36+
|------------------------|---------------------------------|-----------------------------|
37+
| **Security** | CSP, Kill Shell, Isolation | Basic sandboxing |
38+
| **Debugging** | Eruda, Remote URL | Limited dev tools |
39+
| **Plugins** | APK/DEX support | N/A |
40+
| **Performance** | Smart caching, UI optimizations | N/A |
41+
| **SPA Support** | History fallback | Manual routing |
2742

28-
## Setting Up the Activity
43+
## 🛠️ **Getting Started**
44+
1. **Install WebUI X** via GitHub or Google Play Store.
45+
2. Explore your installed modules like `App Nuker` and `bindhosts`.
46+
3. Tweak settings in `Developer Mode` for advanced control.
2947

30-
If your manager is a root manager, you may need to build a custom provider, similar to KernelSU/Next. You can configure it according to your requirements.
48+
> 💡 **Tip:** Enable `Auto Open Eruda` in the settings to debug WebUIs instantly!
3149
32-
### Example Code
33-
34-
Below is an example implementation of `WebUIActivity` and a custom provider (`KsuLibSuProvider`):
35-
36-
::: code-group
37-
38-
```kotlin [WebUIActivity.kt]
39-
package com.rifsxd.ksunext.ui.webui
40-
41-
import android.annotation.SuppressLint
42-
import android.app.ActivityManager
43-
import android.os.Build
44-
import android.os.Bundle
45-
import android.webkit.WebView
46-
import androidx.activity.ComponentActivity
47-
import androidx.activity.compose.setContent
48-
import androidx.activity.enableEdgeToEdge
49-
import androidx.compose.foundation.isSystemInDarkTheme
50-
import androidx.compose.runtime.LaunchedEffect
51-
import androidx.compose.runtime.getValue
52-
import androidx.compose.runtime.mutableStateOf
53-
import androidx.compose.runtime.remember
54-
import androidx.compose.runtime.setValue
55-
import androidx.lifecycle.lifecycleScope
56-
import com.dergoogler.mmrl.platform.Platform
57-
import com.dergoogler.mmrl.platform.service.ServiceManagerCompat
58-
import com.dergoogler.mmrl.webui.component.Loading
59-
import com.dergoogler.mmrl.webui.model.JavaScriptInterface
60-
import com.dergoogler.mmrl.webui.screen.WebUIScreen
61-
import com.dergoogler.mmrl.webui.util.rememberWebUIOptions
62-
import com.rifsxd.ksunext.BuildConfig
63-
import com.rifsxd.ksunext.ui.theme.KernelSUTheme
64-
import com.rifsxd.ksunext.ui.util.KsuLibSuProvider
65-
import kotlinx.coroutines.delay
66-
import kotlinx.coroutines.launch
67-
68-
@SuppressLint("SetJavaScriptEnabled")
69-
class WebUIActivity : ComponentActivity() {
70-
private lateinit var webviewInterface: WebViewInterface
71-
private lateinit var webView: WebView
72-
73-
override fun onCreate(savedInstanceState: Bundle?) {
74-
super.onCreate(savedInstanceState)
75-
enableEdgeToEdge()
76-
77-
webView = WebView(this)
78-
79-
lifecycleScope.launch {
80-
Platform.init {
81-
context = baseContext
82-
platform = Platform.KsuNext
83-
fromProvider = ServiceManagerCompat.from(
84-
KsuLibSuProvider(
85-
context = baseContext,
86-
platform = Platform.KsuNext
87-
)
88-
)
89-
}
90-
}
91-
92-
val moduleId = intent.getStringExtra("id")!!
93-
val name = intent.getStringExtra("name")!!
94-
95-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
96-
@Suppress("DEPRECATION")
97-
setTaskDescription(ActivityManager.TaskDescription("KernelSU - $name"))
98-
} else {
99-
val taskDescription = ActivityManager.TaskDescription.Builder()
100-
.setLabel("KernelSU - $name")
101-
.build()
102-
setTaskDescription(taskDescription)
103-
}
104-
105-
val prefs = getSharedPreferences("settings", MODE_PRIVATE)
106-
107-
setContent {
108-
KernelSUTheme {
109-
var isLoading by remember { mutableStateOf(true) }
110-
111-
LaunchedEffect(Platform.isAlive) {
112-
while (!Platform.isAlive) {
113-
delay(1000)
114-
}
115-
isLoading = false
116-
}
117-
118-
if (isLoading) {
119-
Loading()
120-
return@KernelSUTheme
121-
}
122-
123-
val webDebugging = prefs.getBoolean("enable_web_debugging", false)
124-
val dark = isSystemInDarkTheme()
125-
126-
val options = rememberWebUIOptions(
127-
modId = moduleId,
128-
debug = webDebugging,
129-
appVersionCode = BuildConfig.VERSION_CODE,
130-
isDarkMode = dark,
131-
)
132-
133-
WebUIScreen(
134-
webView = webView,
135-
options = options,
136-
interfaces = listOf(
137-
JavaScriptInterface(
138-
name = "ksu",
139-
instance = WebViewInterface(
140-
context = this@WebUIActivity,
141-
webView = webView,
142-
modDir = "/data/adb/modules/$moduleId"
143-
),
144-
)
145-
)
146-
)
147-
}
148-
}
149-
}
150-
}
151-
```
152-
153-
```kotlin [KsuLibSuProvider.kt]
154-
package com.rifsxd.ksunext.ui.util
155-
156-
import android.content.Context
157-
import android.content.ServiceConnection
158-
import com.dergoogler.mmrl.platform.Platform
159-
import com.dergoogler.mmrl.platform.service.IProvider
160-
import com.dergoogler.mmrl.platform.service.ServiceManagerCompat.getPlatformIntent
161-
import com.topjohnwu.superuser.Shell
162-
import com.topjohnwu.superuser.ipc.RootService
163-
import kotlinx.coroutines.suspendCancellableCoroutine
164-
165-
class KsuLibSuProvider(
166-
private val context: Context,
167-
private val platform: Platform,
168-
) : IProvider {
169-
override val name = "KsuLibSu"
170-
171-
override fun isAvailable() = true
172-
173-
override suspend fun isAuthorized() = rootAvailable()
174-
175-
override fun bind(connection: ServiceConnection) {
176-
RootService.bind(getPlatformIntent(context, platform), connection)
177-
}
178-
179-
override fun unbind(connection: ServiceConnection) {
180-
RootService.stop(getPlatformIntent(context, platform))
181-
}
182-
}
183-
```
184-
185-
:::
186-
187-
---
188-
189-
This guide should help you set up WebUI X in your manager with ease. If you encounter any issues, refer to the official documentation or community forums for support.
50+
**Ready to upgrade?** WebUI X delivers **security, speed, and flexibility** — making it the future of Android WebUI frameworks.

docs/en/guide/webuix/why-webui-x.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

docs/en/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ hero:
2222

2323
features:
2424
- title: Comprehensive Root Manager Support
25-
details: Full compatibility with Magisk, KernelSU, and APatch for diverse root management options.
26-
- title: WebUI X Support
27-
details: Includes <span class="vp-doc"><a href="https://developer.android.com/develop/ui/compose/layouts/insets">Edge-to-Edge</a></span> support and dynamic app themes for a seamless user experience.
25+
details: Full compatibility with Magisk, KernelSU (Next), APatch SukiSU Ultra for diverse root management options.
26+
- title: Powerful WebUI
27+
details: <span class="vp-doc">MMRL brings you <strong>WebUI X</strong>, one of the most powerful WebUI frameworks ever built. It offers developers and end-users advanced tools and a <a href="https://developer.android.com/develop/ui/compose/layouts/insets">true edge-to-edge experience</a> that feels completely native. Prefer not to use HTML, CSS, or JavaScript? Build real native UIs with Plugins powered by <a href="Jetpack Compose">Jetpack Compose</a>. <a href="/guide/webuix/">Learn more →</a></span>
2828
- title: Bulk Installation Support
2929
details: Effortlessly install modules in bulk, both online and locally.
3030
- title: Magisk Modules Repositories

0 commit comments

Comments
 (0)