Update AngConfigManager.kt
Added remark for single config subscription Removed unnecessary code in multiple config subscription update
This commit is contained in:
1 parent
376882d975
commit
9142b9cfb4
1 file changed
+3
-6
@@ -1008,18 +1008,16 @@ object AngConfigManager {
|
|||||||
if (serverList.isNotEmpty()) {
|
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) {
|
|
||||||
val config = ServerConfig.create(EConfigType.CUSTOM)
|
val config = ServerConfig.create(EConfigType.CUSTOM)
|
||||||
config.remarks = srv.remarks
|
config.remarks = srv.remarks
|
||||||
?: "%04d-".format(count + 1) + System.currentTimeMillis()
|
?: ("%04d-".format(count + 1) + System.currentTimeMillis()
|
||||||
.toString()
|
.toString())
|
||||||
config.subscriptionId = subid
|
config.subscriptionId = subid
|
||||||
config.fullConfig = srv
|
config.fullConfig = srv
|
||||||
val key = MmkvManager.encodeServerConfig("", config)
|
val key = MmkvManager.encodeServerConfig("", config)
|
||||||
serverRawStorage?.encode(key, gson.toJson(srv))
|
serverRawStorage?.encode(key, gson.toJson(srv))
|
||||||
count += 1
|
count += 1
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -1030,8 +1028,7 @@ object AngConfigManager {
|
|||||||
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)
|
||||||
config.remarks = System.currentTimeMillis().toString()
|
config.remarks = config.fullConfig?.remarks ?: System.currentTimeMillis().toString()
|
||||||
//config.remarks = config.fullConfig?.remarks ?: System.currentTimeMillis().toString()
|
|
||||||
val key = MmkvManager.encodeServerConfig("", config)
|
val key = MmkvManager.encodeServerConfig("", config)
|
||||||
serverRawStorage?.encode(key, server)
|
serverRawStorage?.encode(key, server)
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in new issue
Block a user