Skip to content

Commit

Permalink
Add migrate2ProfileCustom
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Oct 31, 2024
1 parent 4f43c2c commit 341cdb5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/MigrateManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ object MigrateManager {
EConfigType.WIREGUARD.name.lowercase() -> migrate2ProfileWireguard(configOld)
EConfigType.HYSTERIA2.name.lowercase() -> migrate2ProfileHysteria2(configOld)

EConfigType.CUSTOM.name.lowercase() -> migrate2ProfileCustom(configOld)

else -> null
}
}
Expand Down Expand Up @@ -161,6 +163,18 @@ object MigrateManager {
return config
}

private fun migrate2ProfileCustom(configOld: ServerConfig): ProfileItem? {
val config = ProfileItem.create(EConfigType.CUSTOM)

val outbound = configOld.getProxyOutbound() ?: return null
config.remarks = configOld.remarks
config.server = outbound.getServerAddress()
config.serverPort = outbound.getServerPort().toString()

return config
}


private fun decodeServerConfigOld(guid: String): ServerConfig? {
if (guid.isBlank()) {
return null
Expand Down

0 comments on commit 341cdb5

Please sign in to comment.