Skip to content

Commit

Permalink
feat(mindustry): Added better VPN error message
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Dec 6, 2023
1 parent ca1a225 commit d6fdc6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ import java.net.URL

val BLURPLE = Color(0x5865F2)

val DISCORD_INVITATION_LINK = URL("https://discord.gg/chaotic-neutral-519293558599974912")
val DISCORD_INVITATION_LINK = URL("https://discord.xpdustry.com")
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package com.xpdustry.imperium.mindustry.security

import com.xpdustry.imperium.common.misc.DISCORD_INVITATION_LINK
import com.xpdustry.imperium.common.misc.LoggerDelegate
import com.xpdustry.imperium.common.network.VpnDetection
import com.xpdustry.imperium.common.security.AddressWhitelist
Expand All @@ -30,7 +31,17 @@ class VpnGatekeeper(private val provider: VpnDetection, private val whitelist: A
}
val result = provider.isVpn(context.address)
if (result is VpnDetection.Result.Success) {
return if (result.vpn) GatekeeperResult.Failure("VPN detected")
// TODO Add proper command for ip unblocks, such as "/request unblock"
return if (result.vpn)
GatekeeperResult.Failure(
"""
[red]VPN detected.[]
[lightgray]If you think this is a false positive or using a VPN is necessary to you,
join our discord server at [accent]${DISCORD_INVITATION_LINK}[].
Then ask for an IP unblock in the [accent]#appeals[] channel.
[red]Warning: During the process, only share you IP address to an admin [orange](${context.address.hostAddress})[].[]
"""
.trimIndent())
else GatekeeperResult.Success
}
if (result is VpnDetection.Result.Failure) {
Expand Down

0 comments on commit d6fdc6b

Please sign in to comment.