Skip to content

Commit 9744ca6

Browse files
aaa8806AnGgIt886
authored andcommitted
更新主页服务器地址ipv6隐藏效果 (#3615)
* Update MainRecyclerAdapter.kt * Update MainRecyclerAdapter.kt
1 parent 1258ce0 commit 9744ca6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/src/main/kotlin/com/neko/v2ray/ui/MainRecyclerAdapter.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
8484
}
8585
}
8686

87-
// 替换服务器地址的'.'之后的内容为'***',例如将'1.23.45.67'替换为'1.23.45.***'
88-
val modifiedServer = profile.server?.split('.')?.dropLast(1)?.joinToString(".", postfix = ".***")
89-
val strState = "$modifiedServer : ${profile.serverPort}"
87+
// 隐藏主页服务器地址为xxx:xxx:***/xxx.xxx.xxx.***
88+
val strState = "${profile.server?.let {
89+
if (it.contains(":"))
90+
it.split(":").take(2).joinToString(":") + ":***"
91+
else
92+
it.split('.').dropLast(1).joinToString(".", postfix = ".***") }} : ${profile.serverPort}"
9093

9194
holder.itemMainBinding.tvStatistics.text = strState
9295

0 commit comments

Comments
 (0)