Skip to content

Commit

Permalink
Add: ability to blacklist certain servernames (#155)
Browse files Browse the repository at this point in the history
This is sadly enough needed to combat server-owners that are
using our server-listing as advertisement platform. Although
companies are absolutely free to rent out servers to play OpenTTD,
it is not okay to use our server-listing to advertise.
  • Loading branch information
TrueBrain authored Dec 30, 2022
1 parent 1a7ef21 commit 95101b8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions game_coordinator/application/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from openttd_protocol.protocol.coordinator import (
ConnectionType,
NetworkCoordinatorErrorType,
ServerGameType,
)

from .helpers.client import Client
Expand All @@ -27,6 +28,13 @@
_socks_proxy = None
_shared_secret = None

# List of words that result in your server not being listed.
# This to counter server-owners who use our server-listing as advertisement
# platform. Yes. This was really happening.
BLACKLISTED_SERVER_NAMES = [
"elitegameservers.net",
]


class Application:
def __init__(self, database):
Expand Down Expand Up @@ -278,6 +286,16 @@ async def receive_PACKET_COORDINATOR_SERVER_REGISTER(
async def receive_PACKET_COORDINATOR_SERVER_UPDATE(
self, source, protocol_version, newgrf_serialization_type, newgrfs, **info
):
# If the server-name is blacklisted, change the game-type to invite-only.
# This way, everyone that knows about the server can still use it, but
# it will no longer be publicly listed.
# And yes, this was sadly enough needed, as some server-owners decided
# to use our server-listing as advertisement platform.
server_name = info["name"].lower()
for blacklisted_server_name in BLACKLISTED_SERVER_NAMES:
if blacklisted_server_name in server_name:
source.server.game_type = ServerGameType.SERVER_GAME_TYPE_INVITE_ONLY

await source.server.update_newgrf(newgrf_serialization_type, newgrfs)
await source.server.update(info)

Expand Down

0 comments on commit 95101b8

Please sign in to comment.