Skip to content

Commit 9bce443

Browse files
xchacha20-poly1305Misaka-blog
authored andcommitted
add naive plugin
1 parent 8888124 commit 9bce443

25 files changed

+446
-185
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121
- name: Gradle cache
22-
uses: actions/cache@v2
22+
uses: actions/cache@v3
2323
with:
2424
path: ~/.gradle
2525
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
@@ -31,7 +31,7 @@ jobs:
3131
APK=$(find . -name '*arm64-v8a*.apk')
3232
APK=$(dirname $APK)
3333
echo "APK=$APK" >> $GITHUB_ENV
34-
- uses: actions/upload-artifact@v2
34+
- uses: actions/upload-artifact@v3
3535
with:
3636
name: APKs
3737
path: ${{ env.APK }}
@@ -42,17 +42,29 @@ jobs:
4242
needs: build
4343
steps:
4444
- name: Checkout
45-
uses: actions/checkout@v2
45+
uses: actions/checkout@v4
4646
- name: Donwload Artifacts
47-
uses: actions/download-artifact@v2
47+
uses: actions/download-artifact@v3
4848
with:
4949
name: APKs
5050
path: artifacts
51-
- name: Release
51+
- name: Find APKs
5252
run: |
53-
wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz
54-
tar -xvf ghr.tar.gz
55-
mv ghr*linux_amd64/ghr .
56-
mkdir apks
57-
find artifacts -name "*.apk" -exec cp {} apks \;
58-
./ghr -delete -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" apks
53+
mkdir -p apks/
54+
find artifacts/ -name "*.apk" -exec cp {} apks/ \;
55+
- name: Release
56+
uses: svenstaro/upload-release-action@v2
57+
with:
58+
repo_token: ${{ secrets.GITHUB_TOKEN }}
59+
tag: ${{ github.event.inputs.tag }}
60+
file: ./apks/*
61+
file_glob: true
62+
prerelease: true
63+
# - name: Release
64+
# run: |
65+
# wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.16.0/ghr_v0.16.0_linux_amd64.tar.gz
66+
# tar -xvf ghr.tar.gz
67+
# mv ghr*linux_amd64/ghr .
68+
# mkdir apks
69+
# find artifacts -name "*.apk" -exec cp {} apks \;
70+
# ./ghr -delete -prerelease -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" apks

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ local.properties
1313
/app_*/build
1414
/app_*/libs
1515
/app_*/html
16+
17+
/tmp

app_naive/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build
2+
/libs
3+
/html

app_naive/build.gradle.kts

Lines changed: 18 additions & 0 deletions
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.naive"
11+
versionCode = 1
12+
versionName = "118.0.5993.65-1"
13+
splits.abi {
14+
reset()
15+
include("arm64-v8a", "x86_64")
16+
}
17+
}
18+
}
Lines changed: 47 additions & 0 deletions
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.naive"
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="Naïve For NekoBox"
20+
android:roundIcon="@mipmap/ic_launcher_round">
21+
<provider
22+
android:name=".BinaryProvider"
23+
android:authorities="moe.matsuri.exe.naive.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="/naive-plugin"
35+
android:scheme="plugin" />
36+
</intent-filter>
37+
38+
<meta-data
39+
android:name="io.nekohasekai.sagernet.plugin.id"
40+
android:value="naive-plugin" />
41+
<meta-data
42+
android:name="io.nekohasekai.sagernet.plugin.executable_path"
43+
android:value="libnaive.so" />
44+
</provider>
45+
</application>
46+
47+
</manifest>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/******************************************************************************
2+
* *
3+
* Copyright (C) 2021 by nekohasekai <contact-sagernet@sekai.icu> *
4+
* *
5+
* This program is free software: you can redistribute it and/or modify *
6+
* it under the terms of the GNU General Public License as published by *
7+
* the Free Software Foundation, either version 3 of the License, or *
8+
* (at your option) any later version. *
9+
* *
10+
* This program is distributed in the hope that it will be useful, *
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13+
* GNU General Public License for more details. *
14+
* *
15+
* You should have received a copy of the GNU General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
* *
18+
******************************************************************************/
19+
20+
package moe.matsuri.exe.naive
21+
22+
import android.net.Uri
23+
import android.os.ParcelFileDescriptor
24+
import io.nekohasekai.sagernet.plugin.NativePluginProvider
25+
import io.nekohasekai.sagernet.plugin.PathProvider
26+
import java.io.File
27+
import java.io.FileNotFoundException
28+
29+
class BinaryProvider : NativePluginProvider() {
30+
override fun populateFiles(provider: PathProvider) {
31+
provider.addPath("naive-plugin", 0b111101101)
32+
}
33+
34+
override fun getExecutable() = context!!.applicationInfo.nativeLibraryDir + "/libnaive.so"
35+
override fun openFile(uri: Uri): ParcelFileDescriptor = when (uri.path) {
36+
"/naive-plugin" -> ParcelFileDescriptor.open(
37+
File(getExecutable()),
38+
ParcelFileDescriptor.MODE_READ_ONLY
39+
)
40+
else -> throw FileNotFoundException()
41+
}
42+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="108"
6+
android:viewportHeight="108"
7+
android:tint="#FFFFFF">
8+
<group android:scaleX="0.13877095"
9+
android:scaleY="0.13877095"
10+
android:translateX="29.16"
11+
android:translateY="42.010185">
12+
<group android:translateY="138.67206">
13+
<path android:pathData="M4.171875,-0L34.546875,-0L34.546875,-5.890625L25.90625,-7.046875L23.3125,-9.796875L23.3125,-82.125L78.1875,-0L87.6875,-0L87.6875,-87.328125L90.28125,-89.9375L98.921875,-91.234375L98.921875,-97L68.671875,-97L68.671875,-91.234375L77.3125,-89.9375L79.90625,-87.328125L79.90625,-19.34375L30.8125,-93.390625L30.8125,-97L3.734375,-97L3.734375,-91.234375L12.953125,-90.359375L15.546875,-88.34375L15.546875,-9.796875L12.953125,-7.046875L4.171875,-5.890625L4.171875,-0Z"
14+
android:fillColor="#FFFFFF"/>
15+
<path android:pathData="M151.09375,-8.375L152.95312,0L173.26562,0L173.26562,-5.171875L165.625,-5.90625L163.03125,-8.234375L163.03125,-50.3125C163.03125,-64.796875,156.70312,-71,141.57812,-71C123.4375,-71,112.5,-63.5,112.5,-54.75C112.5,-51.3125,113.640625,-50.3125,116.953125,-50.3125L126.890625,-50.3125L126.890625,-62.359375C130.78125,-63.9375,134.23438,-64.65625,137.84375,-64.65625C148.20312,-64.65625,151.09375,-59.921875,151.09375,-48.578125L151.09375,-44C122.28125,-37.0625,109.046875,-32.6875,109.046875,-17.546875C109.046875,-6.625,116.09375,1,127.46875,1C134.39062,1.015625,142.01562,-2.15625,151.09375,-8.375ZM151.09375,-13.328125C143.89062,-9.09375,137.98438,-6.765625,133.23438,-6.765625C126.03125,-6.765625,121.71875,-11.578125,121.71875,-18.703125C121.71875,-29.34375,130.78125,-33.265625,151.09375,-38.953125L151.09375,-13.328125Z"
16+
android:fillColor="#FFFFFF"/>
17+
<path android:pathData="M197.59375,-70L181.03125,-65L181.03125,-60.53125L191.10938,-60.53125L191.10938,-8.203125L188.65625,-5.90625L181.03125,-5.171875L181.03125,0L213.4375,0L213.4375,-5.171875L205.65625,-5.90625L203.20312,-8.203125L203.20312,-70L197.59375,-70ZM182.76562,-99.53125C178.73438,-99.53125,175.42188,-96.375,175.42188,-92.1875C175.42188,-88.15625,178.73438,-85,182.76562,-85C186.79688,-85,189.95312,-88.15625,189.95312,-92.1875C189.95312,-96.375,186.79688,-99.53125,182.76562,-99.53125ZM209.54688,-99.53125C205.51562,-99.53125,202.20312,-96.375,202.20312,-92.1875C202.20312,-88.15625,205.51562,-85,209.54688,-85C213.57812,-85,216.75,-88.15625,216.75,-92.1875C216.75,-96.375,213.57812,-99.53125,209.54688,-99.53125Z"
18+
android:fillColor="#FFFFFF"/>
19+
<path android:pathData="M215.26562,-69L215.26562,-63.671875L224.0625,-62.796875L247.23438,0L255.29688,0L280.5,-62.515625L289,-63.671875L289,-69L263.51562,-69L263.51562,-63.671875L271.28125,-63.09375L272.4375,-60.796875L254,-13.90625L237.15625,-60.796875L238.89062,-63.09375L246.51562,-63.671875L246.51562,-69L215.26562,-69Z"
20+
android:fillColor="#FFFFFF"/>
21+
<path android:pathData="M351.5,-15.5C343.29688,-10.0625,336.09375,-7.203125,328.89062,-7.203125C314.35938,-7.203125,304.70312,-18.078125,304.70312,-36.421875C304.70312,-36.84375,304.70312,-37.421875,304.70312,-38L351.35938,-38C351.5,-39.578125,351.5,-41.015625,351.5,-42.453125C351.5,-60.296875,341.28125,-71,325.57812,-71C306.28125,-71,292.3125,-56.09375,292.3125,-34.265625C292.3125,-13.21875,305.42188,1,324.4375,1C333.5,1,342.85938,-1.875,351.5,-7.625L351.5,-15.5ZM338.6875,-44.046875L305.42188,-44.046875C306.28125,-56.375,314.5,-64.515625,323.71875,-64.515625C333.35938,-64.515625,338.6875,-58.125,338.6875,-46.359375C338.6875,-45.640625,338.6875,-44.765625,338.6875,-44.046875Z"
22+
android:fillColor="#FFFFFF"/>
23+
</group>
24+
</group>
25+
</vector>
Lines changed: 6 additions & 0 deletions
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>
Lines changed: 6 additions & 0 deletions
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>
1.68 KB
Loading

0 commit comments

Comments
 (0)