Skip to content

Commit

Permalink
tuic-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Jun 8, 2023
1 parent 448895b commit 70291d8
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 1 deletion.
14 changes: 14 additions & 0 deletions app_tuic5/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}

setupAll()

android {
defaultConfig {
applicationId = "moe.matsuri.exe.tuic5"
versionCode = 1
versionName = "1.0.0-1"
}
}
45 changes: 45 additions & 0 deletions app_tuic5/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="moe.matsuri.exe.tuic5"
android:installLocation="internalOnly"
tools:ignore="MissingLeanbackLauncher">

<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

<application
android:allowBackup="false"
android:extractNativeLibs="true"
android:label="TUIC(v5) Plugin">
<provider
android:name=".BinaryProvider"
android:authorities="moe.matsuri.exe.tuic5.BinaryProvider"
android:directBootAware="true"
android:exported="true"
tools:ignore="ExportedContentProvider">
<intent-filter>
<action android:name="io.nekohasekai.sagernet.plugin.ACTION_NATIVE_PLUGIN" />
</intent-filter>
<intent-filter>
<action android:name="io.nekohasekai.sagernet.plugin.ACTION_NATIVE_PLUGIN" />
<data
android:host="moe.matsuri.lite"
android:path="/tuic-v5-plugin"
android:scheme="plugin" />
</intent-filter>

<meta-data
android:name="io.nekohasekai.sagernet.plugin.id"
android:value="tuic-v5-plugin" />
<meta-data
android:name="io.nekohasekai.sagernet.plugin.executable_path"
android:value="libtuic.so" />
</provider>
</application>

</manifest>
23 changes: 23 additions & 0 deletions app_tuic5/src/main/java/moe/matsuri/exe/tuic/BinaryProvider.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package moe.matsuri.exe.tuic5

import android.net.Uri
import android.os.ParcelFileDescriptor
import io.nekohasekai.sagernet.plugin.NativePluginProvider
import io.nekohasekai.sagernet.plugin.PathProvider
import java.io.File
import java.io.FileNotFoundException

class BinaryProvider : NativePluginProvider() {
override fun populateFiles(provider: PathProvider) {
provider.addPath("tuic-v5-plugin", 0b111101101)
}

override fun getExecutable() = context!!.applicationInfo.nativeLibraryDir + "/libtuic.so"
override fun openFile(uri: Uri): ParcelFileDescriptor = when (uri.path) {
"/tuic-v5-plugin" -> ParcelFileDescriptor.open(
File(getExecutable()),
ParcelFileDescriptor.MODE_READ_ONLY
)
else -> throw FileNotFoundException()
}
}
12 changes: 11 additions & 1 deletion download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ download_singbox() {
}

dl_and_chmod() {
curl -Lso "$1" "$2" && chmod +x "$1"
curl -fLso "$1" "$2" && chmod +x "$1"
}

download_brook() {
Expand Down Expand Up @@ -75,4 +75,14 @@ download_tuic() {
dl_and_chmod x86_64/libtuic.so "https://github.com/MatsuriDayo/tuic/releases/download/rel/tuic-client-0.8.5-2-x86_64-android"
}

download_tuic5() {
VERSION="1.0.0"
mkdir_libs "app_tuic5/libs"

dl_and_chmod arm64-v8a/libtuic.so "https://github.com/MatsuriDayo/tuic/releases/download/rel/tuic-client-"$VERSION"-aarch64-linux-android"
dl_and_chmod armeabi-v7a/libtuic.so "https://github.com/MatsuriDayo/tuic/releases/download/rel/tuic-client-"$VERSION"-armv7-linux-androideabi"
dl_and_chmod x86/libtuic.so "https://github.com/MatsuriDayo/tuic/releases/download/rel/tuic-client-"$VERSION"-i686-linux-android"
dl_and_chmod x86_64/libtuic.so "https://github.com/MatsuriDayo/tuic/releases/download/rel/tuic-client-"$VERSION"-x86_64-linux-android"
}

download_"$1"
1 change: 1 addition & 0 deletions js/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -e
# moe.matsur.exe.* -> no js build
[ $1 == "hysteria" ] && exit
[ $1 == "tuic" ] && exit
[ $1 == "tuic5" ] && exit

HTML=../app_$1/html
SRC=./plugin_$1
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ include ':app_singbox'

include ':app_hysteria'
include ':app_tuic'
include ':app_tuic5'

0 comments on commit 70291d8

Please sign in to comment.