mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-18 22:20:06 +08:00
support fp share link
This commit is contained in:
parent
7354a1f9ad
commit
dc1515d04d
@ -186,6 +186,10 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
|
||||
encryption = it
|
||||
}
|
||||
}
|
||||
|
||||
url.queryParameter("fp")?.let {
|
||||
utlsFingerprint = it
|
||||
}
|
||||
}
|
||||
|
||||
// 不确定是谁的格式
|
||||
@ -266,7 +270,8 @@ fun parseV2RayN(link: String): VMessBean {
|
||||
|
||||
bean.name = json.getStr("ps") ?: ""
|
||||
bean.sni = json.getStr("sni") ?: bean.host
|
||||
bean.security = json.getStr("tls")
|
||||
bean.security = json.getStr("tls") ?: "none"
|
||||
bean.utlsFingerprint = json.getStr("fp") ?: ""
|
||||
|
||||
if (json.optInt("v", 2) < 2) {
|
||||
when (bean.type) {
|
||||
@ -354,7 +359,8 @@ data class VmessQRCode(
|
||||
var path: String = "",
|
||||
var tls: String = "",
|
||||
var sni: String = "",
|
||||
var alpn: String = ""
|
||||
var alpn: String = "",
|
||||
var fp: String = "",
|
||||
)
|
||||
|
||||
fun VMessBean.toV2rayN(): String {
|
||||
@ -379,6 +385,7 @@ fun VMessBean.toV2rayN(): String {
|
||||
tls = if (this@toV2rayN.security == "tls") "tls" else ""
|
||||
sni = this@toV2rayN.sni
|
||||
scy = this@toV2rayN.encryption
|
||||
fp = this@toV2rayN.utlsFingerprint
|
||||
}.let {
|
||||
NGUtil.encode(Gson().toJson(it))
|
||||
}
|
||||
@ -438,7 +445,12 @@ fun StandardV2RayBean.toUri(standard: Boolean = true): String {
|
||||
if (certificates.isNotBlank()) {
|
||||
builder.addQueryParameter("cert", certificates)
|
||||
}
|
||||
if (allowInsecure) builder.addQueryParameter("allowInsecure", "1")
|
||||
if (allowInsecure) {
|
||||
builder.addQueryParameter("allowInsecure", "1")
|
||||
}
|
||||
if (utlsFingerprint.isNotBlank()) {
|
||||
builder.addQueryParameter("fp", utlsFingerprint)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package io.nekohasekai.sagernet.group
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.net.Uri
|
||||
import io.nekohasekai.sagernet.R
|
||||
import io.nekohasekai.sagernet.database.*
|
||||
@ -30,6 +31,7 @@ import java.io.StringReader
|
||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||
object RawUpdater : GroupUpdater() {
|
||||
|
||||
@SuppressLint("Recycle")
|
||||
override suspend fun doUpdate(
|
||||
proxyGroup: ProxyGroup,
|
||||
subscription: SubscriptionBean,
|
||||
@ -283,6 +285,8 @@ object RawUpdater : GroupUpdater() {
|
||||
"h2" -> bean.type = "http"
|
||||
}
|
||||
}
|
||||
"client-fingerprint" -> bean.utlsFingerprint =
|
||||
opt.value as String
|
||||
"tls" -> bean.security =
|
||||
if (opt.value?.toString() == "true") "tls" else ""
|
||||
"skip-cert-verify" -> bean.allowInsecure =
|
||||
@ -354,6 +358,8 @@ object RawUpdater : GroupUpdater() {
|
||||
"server" -> bean.serverAddress = opt.value as String
|
||||
"port" -> bean.serverPort = opt.value.toString().toInt()
|
||||
"password" -> bean.password = opt.value?.toString()
|
||||
"client-fingerprint" -> bean.utlsFingerprint =
|
||||
opt.value as String
|
||||
"sni" -> bean.sni = opt.value?.toString()
|
||||
"skip-cert-verify" -> bean.allowInsecure =
|
||||
opt.value?.toString() == "true"
|
||||
|
||||
@ -46,7 +46,7 @@ fun Project.requireFlavor(): String {
|
||||
fun Project.requireMetadata(): Properties {
|
||||
if (!::metadata.isInitialized) {
|
||||
metadata = Properties().apply {
|
||||
load(rootProject.file("sager.properties").inputStream())
|
||||
load(rootProject.file("nb4a.properties").inputStream())
|
||||
}
|
||||
}
|
||||
return metadata
|
||||
|
||||
Loading…
Reference in New Issue
Block a user