Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

juicity: update juicity to v0.4.3 #58

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app_juicity/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ setupAll()
android {
defaultConfig {
applicationId = "moe.matsuri.plugin.juicity"
versionCode = 2
versionName = "v0.3.0"
versionCode = 3
versionName = "v0.4.3"
splits.abi {
reset()
include("arm64-v8a")
Expand Down
4 changes: 3 additions & 1 deletion app_juicity/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<application
android:allowBackup="false"
android:extractNativeLibs="true"
android:label="Juicity For NekoBox">
android:icon="@mipmap/ic_launcher"
android:label="Juicity For NekoBox"
android:roundIcon="@mipmap/ic_launcher_round">
<provider
android:name=".BinaryProvider"
android:authorities="moe.matsuri.plugin.juicity.BinaryProvider"
Expand Down
5 changes: 5 additions & 0 deletions app_juicity/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app_juicity/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#D9D9D9</color>
</resources>
2 changes: 1 addition & 1 deletion download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ download_tuic5() {
}

download_juicity() {
VERSION="v0.3.0"
VERSION="v0.4.3"
mkdir_libs "app_juicity/libs"

curl -Lso tmp.zip "https://github.com/juicity/juicity/releases/download/"$VERSION"/juicity-android-arm64.zip"
Expand Down
13 changes: 13 additions & 0 deletions js/common/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,17 @@ export var translates = {
wireguardMTU: {
"": "MTU",
},

// Juicity
juicityCongestionControl: {
"zh_CN": "拥塞控制",
"": "Congestion Control",
},
juicitySNI: {
"": "SNI",
},
juicityPinnedCertchainSha256: {
"zh_CN": "固定证书链 SHA256 (可选)",
"": "Pinned Certchain SHA256 (Optional)"
},
}
47 changes: 40 additions & 7 deletions js/plugin_juicity/juicity.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class juicityClass {
this.defaultSharedStorage.serverAddress = "127.0.0.1";
this.defaultSharedStorage.serverPort = "1080";
// end of default keys
this.defaultSharedStorage.uuid = "00000000-0000-0000-0000-000000000000";
this.defaultSharedStorage.uuid = "";
this.defaultSharedStorage.password = "";
this.defaultSharedStorage.sni = "";
this.defaultSharedStorage.allowInsecure = false;
this.defaultSharedStorage.congestionControl = "bbr";
this.defaultSharedStorage.pinnedCertchainSha256 = "";

for (var k in this.defaultSharedStorage) {
let v = this.defaultSharedStorage[k];
Expand Down Expand Up @@ -58,6 +59,9 @@ class juicityClass {
if (this.sharedStorage.allowInsecure) {
builder.searchParams.set("allow_insecure", "1")
}
if (this.sharedStorage.pinnedCertchainSha256) {
builder.searchParams.set("pinned_certchain_sha256", this.sharedStorage.pinnedCertchainSha256)
}
this.sharedStorage.shareLink = builder.toString()
}

Expand All @@ -84,28 +88,42 @@ class juicityClass {
"type": "EditTextPreference",
"key": "uuid",
"icon": "ic_baseline_person_24",
"title": TR("serverUserId"),
},
{
"type": "EditTextPreference",
"key": "password",
"icon": "ic_settings_password",
"summaryProvider": "PasswordSummaryProvider",
"title": TR("serverPassword"),
},
//
{
"type": "EditTextPreference",
"key": "sni",
"icon": "ic_action_copyright"
"icon": "ic_action_copyright",
"title": TR("juicitySNI"),
},
{
"type": "SwitchPreference",
"key": "allowInsecure",
"icon": "ic_notification_enhanced_encryption",
"title": TR("serverAllowInsecure"),
},
{
"type": "EditTextPreference",
"type": "SimpleMenuPreference",
"key": "congestionControl",
"icon": "ic_baseline_stream_24",
"entries": {
"bbr": "bbr"
},
"title": TR("juicityCongestionControl"),
},
{
"type": "EditTextPreference",
"key": "pinnedCertchainSha256",
"icon": "ic_baseline_vpn_key_24",
"title": TR("juicityPinnedCertchainSha256")
},
],
},
Expand Down Expand Up @@ -136,6 +154,8 @@ class juicityClass {
neko.listenOnPreferenceChanged(key)
this2._onPreferenceChanged(key, this2.sharedStorage[key])
}

listenOnPreferenceChangedNow("pinnedCertchainSha256")
}

// 保存时调用(混合编辑后的值)
Expand All @@ -154,6 +174,13 @@ class juicityClass {
}

_onPreferenceChanged(key, newValue) {
if (key == "pinnedCertchainSha256") {
try {
this.common.setKV(key, decodeURIComponent(newValue))
} catch (error) {
neko.logError(error.toString());
}
}
}

// Interface
Expand All @@ -169,7 +196,7 @@ class juicityClass {

var serverAddress = util.unwrapIpv6(url.hostname)
this.sharedStorage.serverAddress = serverAddress
this.sharedStorage.serverPort = url.host.replace(serverAddress, "").substringAfter(":")
this.sharedStorage.serverPort = url.port
this.sharedStorage.uuid = url.username
this.sharedStorage.password = url.password
this.sharedStorage.name = decodeURIComponent(url.hash.substringAfter("#"))
Expand All @@ -181,7 +208,10 @@ class juicityClass {
this.sharedStorage.sni = it
})
util.ifNotNull(url.searchParams.get("allow_insecure"), (it) => {
if (it == "1" || it == "true") this.sharedStorage.allowInsecure = it
if (it == "1" || it == "true") this.sharedStorage.allowInsecure = true
})
util.ifNotNull(url.searchParams.get("pinned_certchain_sha256"), (it) => {
this.sharedStorage.pinnedCertchainSha256 = it
})

this._onSharedStorageUpdated()
Expand All @@ -201,15 +231,18 @@ class juicityClass {
"sni": ss.sni,
"allow_insecure": ss.allowInsecure,
"congestion_control": ss.congestionControl,
"pinned_certchain_sha256": ss.pinnedCertchainSha256,
"log_level": "info",
"protect_path": "protect_path"
};

let uniqueConfigName = 'config-' + Math.random().toString(36).slice(2) + Date.now() + '.json';

let v = {};
v.nekoCommands = ["%exe%", "run", "-c", "config.json"];
v.nekoCommands = ["%exe%", "run", "-c", uniqueConfigName];
v.nekoRunConfigs = [
{
name: "config.json",
name: uniqueConfigName,
content: JSON.stringify(configObject),
},
];
Expand Down
3 changes: 1 addition & 2 deletions js/plugin_juicity/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ export function nekoProtocol(protocolId) {
}

export function nekoAbout() {
return "早期测试版本,上游版本 v0.3.0\n" +
return "早期测试版本,上游版本 v0.4.3\n" +
"1 目前不兼容链式代理\n" +
"2 目前无法使用域名,请使用 IP 地址类型的服务器\n" +
"这个插件是实验性的。如果在使用过程中遇到任何问题,请自行解决。"
}

Expand Down