Skip to content

Commit a380a48

Browse files
authored
Add mieru plugin (#49)
1 parent 9bce443 commit a380a48

20 files changed

+176
-1
lines changed

app_mieru/build.gradle.kts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
plugins {
2+
id("com.android.application")
3+
id("org.jetbrains.kotlin.android")
4+
}
5+
6+
setupAll()
7+
8+
android {
9+
defaultConfig {
10+
applicationId = "moe.matsuri.exe.mieru"
11+
versionCode = 1
12+
versionName = "2.2.0"
13+
splits.abi {
14+
reset()
15+
include("arm64-v8a", "x86_64")
16+
}
17+
}
18+
}
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="moe.matsuri.exe.mieru"
5+
android:installLocation="internalOnly"
6+
tools:ignore="MissingLeanbackLauncher">
7+
8+
<uses-feature
9+
android:name="android.software.leanback"
10+
android:required="false" />
11+
<uses-feature
12+
android:name="android.hardware.touchscreen"
13+
android:required="false" />
14+
15+
<application
16+
android:allowBackup="false"
17+
android:extractNativeLibs="true"
18+
android:icon="@mipmap/ic_launcher"
19+
android:label="Mieru For NekoBox"
20+
android:roundIcon="@mipmap/ic_launcher_round">
21+
<provider
22+
android:name=".BinaryProvider"
23+
android:authorities="moe.matsuri.exe.mieru.BinaryProvider"
24+
android:directBootAware="true"
25+
android:exported="true"
26+
tools:ignore="ExportedContentProvider">
27+
<intent-filter>
28+
<action android:name="io.nekohasekai.sagernet.plugin.ACTION_NATIVE_PLUGIN" />
29+
</intent-filter>
30+
<intent-filter>
31+
<action android:name="io.nekohasekai.sagernet.plugin.ACTION_NATIVE_PLUGIN" />
32+
<data
33+
android:host="moe.matsuri.lite"
34+
android:path="/mieru-plugin"
35+
android:scheme="plugin" />
36+
</intent-filter>
37+
38+
<meta-data
39+
android:name="io.nekohasekai.sagernet.plugin.id"
40+
android:value="mieru-plugin" />
41+
<meta-data
42+
android:name="io.nekohasekai.sagernet.plugin.executable_path"
43+
android:value="libmieru.so" />
44+
</provider>
45+
</application>
46+
47+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/******************************************************************************
2+
* Copyright (C) 2022 by nekohasekai <[email protected]> *
3+
* *
4+
* This program is free software: you can redistribute it and/or modify *
5+
* it under the terms of the GNU General Public License as published by *
6+
* the Free Software Foundation, either version 3 of the License, or *
7+
* (at your option) any later version. *
8+
* *
9+
* This program is distributed in the hope that it will be useful, *
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12+
* GNU General Public License for more details. *
13+
* *
14+
* You should have received a copy of the GNU General Public License *
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
16+
* *
17+
******************************************************************************/
18+
19+
package moe.matsuri.exe.mieru
20+
21+
import android.net.Uri
22+
import android.os.ParcelFileDescriptor
23+
import io.nekohasekai.sagernet.plugin.NativePluginProvider
24+
import io.nekohasekai.sagernet.plugin.PathProvider
25+
import java.io.File
26+
import java.io.FileNotFoundException
27+
28+
class BinaryProvider : NativePluginProvider() {
29+
override fun populateFiles(provider: PathProvider) {
30+
provider.addPath("mieru-plugin", 0b111101101)
31+
}
32+
33+
override fun getExecutable() = context!!.applicationInfo.nativeLibraryDir + "/libmieru.so"
34+
override fun openFile(uri: Uri): ParcelFileDescriptor = when (uri.path) {
35+
"/mieru-plugin" -> ParcelFileDescriptor.open(
36+
File(getExecutable()),
37+
ParcelFileDescriptor.MODE_READ_ONLY
38+
)
39+
else -> throw FileNotFoundException()
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="405"
6+
android:viewportHeight="172.80006">
7+
<group
8+
android:scaleX="0.46"
9+
android:scaleY="0.19626674"
10+
android:translateX="109.35"
11+
android:translateY="75.69858">
12+
<group android:translateY="106.12804">
13+
<path
14+
android:pathData="M41.3125,-104L4.171875,-104L4.171875,-97.21875L6.90625,-97.21875C15.109375,-97.078125,17.84375,-96.640625,18.859375,-95.203125C19.859375,-93.90625,19.859375,-93.765625,19.859375,-86.265625L19.859375,-31.109375C19.859375,-11.515625,17.125,-7.484375,3.15625,-6.765625L3.15625,-0L44.203125,-0L44.203125,-6.765625C30.375,-7.484375,27.640625,-11.515625,27.640625,-31.109375L27.640625,-94.765625L61.90625,-0L67.671875,-0L99.78125,-94.765625L99.78125,-17.703125C99.78125,-10.359375,99.78125,-10.078125,98.921875,-8.640625C97.765625,-7.1875,95.03125,-6.765625,86.828125,-6.765625L84.234375,-6.765625L84.234375,-0L131.46875,-0L131.46875,-6.765625L128.875,-6.765625C120.65625,-6.765625,117.921875,-7.1875,116.78125,-8.640625C115.90625,-10.078125,115.90625,-10.21875,115.90625,-17.703125L115.90625,-86.265625C115.90625,-93.625,115.90625,-93.90625,116.78125,-95.203125C117.921875,-96.640625,120.65625,-97.078125,128.875,-97.21875L131.46875,-97.21875L131.46875,-104L95.3125,-104L68.96875,-27.21875L41.3125,-104Z"
15+
android:fillColor="#FFFFFF" />
16+
<path
17+
android:pathData="M165.65625,-67.125L138.57812,-65.546875L138.57812,-59.34375L145.92188,-59.34375C151.40625,-59.203125,152.125,-58.34375,152.125,-52.140625L152.125,-17.71875L152.125,-10.9375C151.96875,-8.78125,151.82812,-7.921875,151.25,-7.1875C150.25,-5.890625,147.51562,-5.328125,141.3125,-5.171875L140.3125,-5.171875L140.3125,0L177.60938,0L177.60938,-5.171875L176.59375,-5.171875C166.95312,-5.46875,165.65625,-6.1875,165.65625,-11.375L165.65625,-17.71875L165.65625,-67.125ZM158.89062,-103C154.28125,-103,150.53125,-99.25,150.53125,-94.640625C150.53125,-90.03125,154.28125,-86.28125,158.75,-86.28125C163.5,-86.28125,167.23438,-90.03125,167.23438,-94.640625C167.23438,-99.25,163.5,-103,158.89062,-103Z"
18+
android:fillColor="#FFFFFF" />
19+
<path
20+
android:pathData="M247.95312,-32C248.09375,-53.671875,235.85938,-69,218.28125,-69C199.85938,-69,186.03125,-52.953125,186.03125,-31.28125C186.03125,-11.40625,199.14062,2,218.57812,2C232.40625,2,242.04688,-4.765625,247.95312,-18.171875L242.90625,-20.859375C237,-10,230.95312,-5.765625,221.3125,-5.765625C213.96875,-5.765625,208.64062,-8.734375,204.89062,-15.078125C202.29688,-19.296875,201.15625,-24.234375,201.29688,-32L247.95312,-32ZM201.4375,-38.1875C201.4375,-42.671875,202.01562,-45.859375,203.45312,-49.90625C206.48438,-58.609375,211.09375,-62.796875,218.14062,-62.796875C226.78125,-62.796875,232.54688,-55.125,232.54688,-43.390625C232.54688,-39.34375,231.25,-38.1875,226.64062,-38.1875L201.4375,-38.1875Z"
21+
android:fillColor="#FFFFFF" />
22+
<path
23+
android:pathData="M281.5,-66.828125L256.01562,-65.25L256.01562,-59.078125L261.92188,-59.078125C267.39062,-58.9375,268.10938,-58.078125,268.10938,-51.921875L268.10938,-17.640625L268.10938,-10.90625C267.96875,-8.75,267.82812,-7.890625,267.25,-7.171875C266.23438,-5.890625,263.35938,-5.3125,257.17188,-5.171875L256.59375,-5.171875L256.59375,0L295.04688,0L295.04688,-5.171875L292.45312,-5.171875C282.79688,-5.453125,281.5,-6.171875,281.5,-11.328125L281.5,-17.640625L281.5,-19.078125C281.64062,-43.171875,290.28125,-61.53125,301.51562,-62.09375C299.5,-59.796875,298.92188,-58.375,298.92188,-55.640625C298.92188,-51.0625,302.23438,-47.75,306.84375,-47.75C312.17188,-47.75,315.625,-51.625,315.625,-57.359375C315.625,-64.390625,310.73438,-69,303.10938,-69C294.03125,-69,286.25,-61.8125,281.5,-49.046875L281.5,-66.828125Z"
24+
android:fillColor="#FFFFFF" />
25+
<path
26+
android:pathData="M376.3125,1.015625L402.53125,0L402.53125,-6.171875L398.92188,-6.171875C390.57812,-6.46875,389.85938,-7.328125,389.85938,-16.671875L389.85938,-67L362.78125,-65.40625L362.78125,-59.21875L370.125,-59.21875C375.59375,-59.078125,376.3125,-58.21875,376.3125,-52.03125L376.3125,-34.359375C376.3125,-26.15625,375.45312,-21.265625,373.29688,-16.671875C370.26562,-10.359375,364.51562,-6.78125,357.45312,-6.78125C352.98438,-6.78125,349.25,-8.359375,347.375,-11.21875C345.5,-13.9375,345.21875,-15.375,345.21875,-23.265625L345.21875,-67L320.01562,-65.40625L320.01562,-59.234375L325.48438,-59.234375C330.95312,-59.09375,331.6875,-58.234375,331.6875,-52.078125L331.6875,-21.109375C331.6875,-13.796875,332.25,-10.5,334.42188,-7.203125C338.29688,-1.296875,345.21875,2,353.85938,2C363.35938,2,369.98438,-1.875,376.3125,-11.078125L376.3125,1.015625Z"
27+
android:fillColor="#FFFFFF" />
28+
</group>
29+
</group>
30+
</vector>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5+
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
6+
</adaptive-icon>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
4+
<background android:drawable="@color/ic_launcher_background" />
5+
<foreground android:drawable="@drawable/ic_launcher_foreground" />
6+
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
7+
</adaptive-icon>
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="ic_launcher_background">#E91E63</color>
4+
</resources>

download.sh

+20
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ unzip_naive() {
3838
rm -rf tmp*
3939
}
4040

41+
unzip_mieru() {
42+
rm -rf tmp
43+
mkdir -p tmp
44+
tar -xf tmp.tar.gz -C tmp
45+
46+
mv tmp/mieru "$1"/libmieru.so
47+
rm -rf tmp*
48+
}
49+
4150
download_xray() {
4251
VERSION="v1.7.5"
4352
mkdir_libs "app_xray/libs"
@@ -119,4 +128,15 @@ download_naive() {
119128
unzip_naive x86_64
120129
}
121130

131+
download_mieru() {
132+
TAG="v2.2.0"
133+
VERSION="2.2.0"
134+
mkdir_libs "app_mieru/libs"
135+
136+
curl -Lso tmp.tar.gz "https://github.com/enfein/mieru/releases/download/${TAG}/mieru_${VERSION}_android_arm64.tar.gz"
137+
unzip_mieru arm64-v8a
138+
curl -Lso tmp.tar.gz "https://github.com/enfein/mieru/releases/download/${TAG}/mieru_${VERSION}_android_amd64.tar.gz"
139+
unzip_mieru x86_64
140+
}
141+
122142
download_"$1"

js/make.sh

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -e
55
[ $1 == "tuic" ] && exit
66
[ $1 == "tuic5" ] && exit
77
[ $1 == "naive" ] && exit
8+
[ $1 == "mieru" ] && exit
89

910
HTML=../app_$1/html
1011
SRC=./plugin_$1

settings.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ include ':app_hysteria'
1717
include ':app_tuic'
1818
include ':app_tuic5'
1919
include ':app_juicity'
20-
include ':app_naive'
20+
include ':app_naive'
21+
include ':app_mieru'

0 commit comments

Comments
 (0)