Bug fix
This commit is contained in:
1 parent
eb75666c85
commit
ce2d1c5e0d
1 file changed
+18
-9
@@ -780,7 +780,8 @@ object AngConfigManager {
|
|||||||
dicQuery["reserved"] = Utils.urlEncode(
|
dicQuery["reserved"] = Utils.urlEncode(
|
||||||
Utils.removeWhiteSpace(outbound.settings?.reserved?.joinToString())
|
Utils.removeWhiteSpace(outbound.settings?.reserved?.joinToString())
|
||||||
.toString()
|
.toString()
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
dicQuery["address"] = Utils.urlEncode(
|
dicQuery["address"] = Utils.urlEncode(
|
||||||
Utils.removeWhiteSpace((outbound.settings?.address as List<*>).joinToString())
|
Utils.removeWhiteSpace((outbound.settings?.address as List<*>).joinToString())
|
||||||
.toString()
|
.toString()
|
||||||
@@ -986,23 +987,32 @@ object AngConfigManager {
|
|||||||
&& server.contains("outbounds")
|
&& server.contains("outbounds")
|
||||||
&& server.contains("routing")
|
&& server.contains("routing")
|
||||||
) {
|
) {
|
||||||
|
try {
|
||||||
val gson = GsonBuilder().setPrettyPrinting().create()
|
val gson = GsonBuilder().setPrettyPrinting().create()
|
||||||
val serverList: Array<V2rayConfig> = Gson().fromJson(server, Array<V2rayConfig>::class.java)
|
val serverList: Array<V2rayConfig> =
|
||||||
if (serverList.size > 0) {
|
Gson().fromJson(server, Array<V2rayConfig>::class.java)
|
||||||
|
if (serverList.isNotEmpty()) {
|
||||||
var count = 0
|
var count = 0
|
||||||
for (srv in serverList) {
|
for (srv in serverList) {
|
||||||
if (srv.inbounds != null && srv.outbounds != null && srv.routing != null) {
|
if (srv.inbounds != null && srv.outbounds != null && srv.routing != null) {
|
||||||
var config = ServerConfig.create(EConfigType.CUSTOM)
|
val config = ServerConfig.create(EConfigType.CUSTOM)
|
||||||
config.remarks = srv.remarks ?: "%04d-".format(count + 1) + System.currentTimeMillis().toString()
|
config.remarks = srv.remarks
|
||||||
|
?: ("%04d-".format(count + 1) + System.currentTimeMillis()
|
||||||
|
.toString())
|
||||||
config.subscriptionId = subid
|
config.subscriptionId = subid
|
||||||
config.fullConfig = srv
|
config.fullConfig = srv
|
||||||
var key = MmkvManager.encodeServerConfig("", config)
|
val key = MmkvManager.encodeServerConfig("", config)
|
||||||
serverRawStorage?.encode(key, gson.toJson(srv))
|
serverRawStorage?.encode(key, gson.toJson(srv))
|
||||||
count = count + 1
|
count += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count
|
return count
|
||||||
} else { // For compatibility
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
// For compatibility
|
||||||
val config = ServerConfig.create(EConfigType.CUSTOM)
|
val config = ServerConfig.create(EConfigType.CUSTOM)
|
||||||
config.subscriptionId = subid
|
config.subscriptionId = subid
|
||||||
config.fullConfig = Gson().fromJson(server, V2rayConfig::class.java)
|
config.fullConfig = Gson().fromJson(server, V2rayConfig::class.java)
|
||||||
@@ -1011,7 +1021,6 @@ object AngConfigManager {
|
|||||||
val key = MmkvManager.encodeServerConfig("", config)
|
val key = MmkvManager.encodeServerConfig("", config)
|
||||||
serverRawStorage?.encode(key, server)
|
serverRawStorage?.encode(key, server)
|
||||||
return 1
|
return 1
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user