Skip to content

Commit f571329

Browse files
committed
Update config.json documentation with detailed structure and properties
1 parent 84cf491 commit f571329

1 file changed

Lines changed: 149 additions & 8 deletions

File tree

docs/en/guide/webuix/config.md

Lines changed: 149 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,157 @@
1-
# WebUI X Config Documentation
1+
# `config.json`WebUI X Configuration
22

3-
The `WebUIConfig` class defines the configuration settings for the WebUI. Below is a detailed explanation of each property.
4-
5-
Location:
3+
`config.json` defines the configuration for the WebUI X modules in your system. It is parsed using [Moshi](https://github.com/square/moshi) into a strongly-typed Kotlin data class, allowing flexible and safe management of WebUI X behaviors, permissions, and dynamic dex loading.
64

75
- `/data/adb/modules/<ID>/webroot/config.json`
86
- `/data/adb/modules/<ID>/webroot/config.mmrl.json`
97

10-
::: code-group
8+
## Overview
9+
10+
The config file controls essential WebUI X features like:
11+
12+
- Minimum required versions and packages
13+
- Permissions granted to the UI
14+
- Window and navigation behavior
15+
- Security policies
16+
- Dynamic loading of additional dex or apk files
17+
- UI metadata like title and icon
18+
19+
## JSON Structure
20+
21+
```json
22+
{
23+
"modId": "string",
24+
"require": {
25+
"packages": [
26+
{
27+
"code": -1,
28+
"packageName": "string or array of strings",
29+
"supportText": "string",
30+
"supportLink": "string"
31+
}
32+
]
33+
},
34+
"permissions": ["string", "..."],
35+
"historyFallback": false,
36+
"title": "string",
37+
"icon": "string",
38+
"windowResize": true,
39+
"backHandler": true,
40+
"backInterceptor": null,
41+
"refreshInterceptor": "string",
42+
"exitConfirm": true,
43+
"pullToRefresh": false,
44+
"historyFallbackFile": "index.html",
45+
"autoStatusBarsStyle": true,
46+
"dexFiles": [
47+
{
48+
"type": "dex | apk",
49+
"path": "string",
50+
"className": "string",
51+
"cache": true,
52+
}
53+
],
54+
"killShellWhenBackground": true,
55+
"contentSecurityPolicy": "string",
56+
"caching": true,
57+
"cachingMaxAge": 86400
58+
}
59+
```
60+
61+
## Properties
62+
63+
### `require`
64+
65+
_object_ — Requirements for WebUI X compatibility.
66+
67+
- `packages` — List of required package sets with optional support info.
68+
69+
- `code` (int, default -1) — Status or error code associated.
70+
- `packageName` (string or string array) — Package(s) required.
71+
- `supportText` (string, optional) — Message to display regarding package.
72+
- `supportLink` (string, optional) — URL for more info on package requirements.
73+
74+
### `permissions`
75+
76+
_string\[]_ — List of permission strings granted to the WebUI X instance, e.g., `"wx.permission.ROOT_PATH"`.
77+
78+
### `historyFallback`
79+
80+
_boolean_ — If `true`, fallback to the `historyFallbackFile` when URL not found. Default `false`.
81+
82+
### `title`
83+
84+
_string_ — Title displayed in the WebUI X or shortcut.
85+
86+
### `icon`
87+
88+
_string_ — Path relative to the module's webroot pointing to the icon file used for shortcuts or UI.
89+
90+
### `windowResize`
91+
92+
_boolean_ — Enables window resizing behavior. Default `true`.
93+
94+
### `backHandler`
95+
96+
_boolean?_ — Enables handling back button presses internally. Default `true`.
97+
98+
### `backInterceptor`
99+
100+
_any_ — Custom logic or object for intercepting back presses. Usually null.
101+
102+
### `refreshInterceptor`
103+
104+
_string?_ — Type of refresh interceptor used; `"javascript"` or `"native"`.
105+
106+
### `exitConfirm`
107+
108+
_boolean_ — Enable confirmation dialog before exiting. Default `true`.
109+
110+
### `pullToRefresh`
111+
112+
_boolean_ — Enables pull-to-refresh gesture. Default `false`.
113+
114+
### `historyFallbackFile`
115+
116+
_string_ — Filename fallback for history navigation. Default `"index.html"`.
117+
118+
### `autoStatusBarsStyle`
119+
120+
_boolean_ — Automatically style Android status bars. Default `true`.
121+
122+
### `dexFiles` <Badge type="danger" text="Since v53"/> <Badge type="warning" text="Stable on v108"/>
123+
124+
_array of objects_ — Specifies external `.dex` or `.apk` files to load additional JavaScript interfaces dynamically.
125+
126+
Each object includes:
127+
128+
- `type`: `"dex"` or `"apk"` — File type.
129+
- `path`: Path to the `.dex` or `.apk` file (relative to module root).
130+
- `className`: Fully qualified Java class name to load from the dex/apk.
131+
- `cache`: Boolean to enable caching of loaded interface instances. Default `true`.
132+
- If you try to load any native library (`*.so`) be aware that you always need `cache` to `true`
133+
134+
### `killShellWhenBackground` <Badge type="warning" text="Since v96"/>
135+
136+
_boolean_ — Whether to terminate shell processes when app goes to background. Default `true`.
137+
138+
### `contentSecurityPolicy` <Badge type="warning" text="Since v181"/>
139+
140+
_string_ — Content Security Policy header for WebUI X. Supports placeholders like `{domain}`.
141+
142+
Default value:
143+
144+
```txt
145+
default-src 'self' data: blob: {domain};
146+
script-src 'self' 'unsafe-inline' 'unsafe-eval' {domain};
147+
style-src 'self' 'unsafe-inline' {domain};
148+
connect-src *
149+
```
150+
151+
### `caching` <Badge type="warning" text="Since v181"/>
11152

12-
<<< @/webui-x-types/config/Config.ts
153+
_boolean_ — Enables caching of WebUI X resources. Default `true`.
13154

14-
<<< @/webui-x-types/config/Require.ts
155+
### `cachingMaxAge` <Badge type="warning" text="Since v181"/>
15156

16-
:::
157+
_int_ — Maximum cache age in seconds. Default `86400` (24 hours).

0 commit comments

Comments
 (0)