Skip to content

Commit 24855e9

Browse files
committed
.
1 parent 1a3e62a commit 24855e9

File tree

16 files changed

+3096
-0
lines changed

16 files changed

+3096
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy Website
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- website
8+
paths:
9+
- '.github/workflows/deploy-website.yml'
10+
- '**'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
# Build job
24+
build:
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: ./website
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
- name: Setup Node
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 20
38+
cache: yarn
39+
cache-dependency-path: website/yarn.lock
40+
- name: Setup Pages
41+
uses: actions/configure-pages@v5
42+
- name: Install dependencies
43+
run: yarn install --frozen-lockfile
44+
- name: Build with VitePress
45+
run: |
46+
yarn docs:build
47+
touch docs/.vitepress/dist/.nojekyll
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: website/docs/.vitepress/dist
52+
53+
deploy:
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
needs: build
58+
runs-on: ubuntu-latest
59+
name: Deploy
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*
131+
132+
# from: https://github.com/vuejs/vitepress/blob/main/.gitignore
133+
/coverage
134+
/src/client/shared.ts
135+
/src/node/shared.ts
136+
*.log
137+
*.tgz
138+
.DS_Store
139+
.idea
140+
.temp
141+
.vite_opt_cache
142+
.vscode
143+
dist
144+
cache
145+
examples-temp
146+
node_modules
147+
pnpm-global
148+
TODOs.md
149+
150+
cache

docs/.vitepress/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig, SiteConfig } from 'vitepress'
2+
import locales from './locales'
3+
4+
export default defineConfig( {
5+
title: 'MMRL',
6+
locales: locales.locales,
7+
sitemap: {
8+
hostname: 'https://mmrlapp.github.io'
9+
},
10+
})

docs/.vitepress/locales/en.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { createRequire } from 'module'
2+
import { defineConfig } from 'vitepress'
3+
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
8+
lang: 'en-US',
9+
description: 'Build your own modules repository',
10+
11+
themeConfig: {
12+
nav: nav(),
13+
14+
lastUpdatedText: 'last Updated',
15+
16+
sidebar: {
17+
'/guide/': sidebarGuide(),
18+
'/home/': sidebarHome()
19+
},
20+
21+
socialLinks: [
22+
{ icon: 'github', link: 'https://github.com/MMRLApp/MMRL' },
23+
{ icon: 'googleplay', link: 'https://play.google.com/store/apps/details?id=com.dergoogler.mmrl' }
24+
],
25+
26+
footer: {
27+
message: 'Released under the GPL3 License.',
28+
copyright: 'Copyright © 2022-present Der_Googler and its contributors'
29+
},
30+
31+
editLink: {
32+
pattern: 'https://github.com/MMRLApp/MMRLApp.github.io/edit/master/docs/:path',
33+
text: 'Edit this page on GitHub'
34+
}
35+
}
36+
})
37+
38+
function nav() {
39+
return [
40+
{ text: 'Home', link: '/home/repositories' },
41+
{ text: 'Guide', link: '/guide/index' },
42+
]
43+
}
44+
45+
function sidebarGuide() {
46+
return [
47+
{
48+
text: 'Guide',
49+
items: [
50+
{ text: 'Module WebUI', link: '/guide/module-webui.md' },
51+
{ text: 'FAQ', link: '/guide/faq' },
52+
]
53+
}
54+
]
55+
}
56+
57+
58+
function sidebarHome() {
59+
return [
60+
{
61+
text: 'Home',
62+
items: [
63+
{ text: 'Repositories', link: '/home/repositories' },
64+
]
65+
}
66+
]
67+
}

docs/.vitepress/locales/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from 'vitepress'
2+
import en from './en'
3+
4+
export default defineConfig({
5+
locales: {
6+
root: {
7+
label: 'English',
8+
lang: en.lang,
9+
themeConfig: en.themeConfig,
10+
description: en.description
11+
}
12+
}
13+
})

docs/guide/faq.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# FAQ
2+
3+
## How to enable JavaScript APIs in MMR?
4+
5+
**above v5.32.43**
6+
Go to Settings > Modules & Permission > {module} > Check any of the both options
7+
8+
**below v5.32.43**
9+
Go to Settings > Security > Allow JavaScript API > {module} > Check any of the both options

docs/guide/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_Nothing to see here bro 🤓_

docs/guide/module-webui.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Module WebUI
2+
3+
In addition to executing boot scripts and modifying system files, KernelSU's modules also support displaying UI interfaces and interacting with users.
4+
5+
The module can write HTML + CSS + JavaScript pages through any web technology. KernelSU's manager will display these pages through WebView. It also provides some APIs for interacting with the system, such as executing shell commands.
6+
7+
## `webroot` directory
8+
9+
Web resource files should be placed in the `webroot` subdirectory of the module root directory, and there **MUST** be a file named `index.html`, which is the module page entry. The simplest module structure containing a web interface is as follows:
10+
11+
```txt
12+
❯ tree .
13+
.
14+
|-- module.prop
15+
`-- webroot
16+
`-- index.html
17+
```
18+
19+
:::warning
20+
When installing the module, KernelSU will automatically set the permissions and SELinux context of this directory. If you do not know what you are doing, please do not set the permissions of this directory yourself!
21+
:::
22+
23+
If your page contains CSS and JavaScript, you need to place it in this directory as well.
24+
25+
## JavaScript API
26+
27+
If it is just a display page, it is no different from a normal web page. More importantly, KernelSU provides a series of system API that allows you to implement the unique functions of the module.
28+
29+
KernelSU provides a JavaScript library and [publishes it on npm](https://www.npmjs.com/package/kernelsu), which you can use in the JavaScript code of your web pages.
30+
MMRL also provides a JavaScript library and [publishes it on npm](https://www.npmjs.com/package/mmrl)
31+
32+
For example, you can execute a shell command to obtain a specific configuration or modify a property:
33+
34+
```JavaScript
35+
import { exec } from 'kernelsu';
36+
37+
const { errno, stdout } = exec("getprop ro.product.model");
38+
```
39+
40+
```JavaScript
41+
import { MMRLInterfaceFactory } from "mmrl";
42+
43+
const module = MMRLInterfaceFactory("net-switch");
44+
module.injectStyleSheets();
45+
console.log(module.manager);
46+
```
47+
48+
For another example, you can make the web page display full screen, or display a toast.
49+
50+
[API documentation](https://www.npmjs.com/package/kernelsu).
51+
52+
If you find that the existing API does not meet your needs or is inconvenient to use, you are welcome to give us suggestions [here](https://github.com/tiann/KernelSU/issues)!
53+
54+
## Some tips
55+
56+
1. You can use `localStorage` normally to store some data, but it will be lost after the manager app is uninstalled. If you need to save persistently, you can write data to a custom directory yourself.
57+
2. For simple pages, I recommend you use [parceljs](https://parceljs.org/) for packaging. It requires zero configuration and is very convenient to use. However, if you are a front-end master or have your own preferences, then just choose the one you like!

0 commit comments

Comments
 (0)