Skip to content

Commit

Permalink
Restored and renamed _check_version to _check_user_agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Miko committed Oct 3, 2020
1 parent e21242b commit a321937
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/lobbyconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,16 @@ def _set_user_agent_and_version(self, user_agent, version):
metrics.user_agent_version.labels(str(version)).inc()
self._version = version

async def _check_user_agent(self):
if not self.user_agent or "downlords-faf-client" not in self.user_agent:
await self.send_warning(
"You are using an unofficial client version! "
"Some features might not work as expected. "
"If you experience any problems please download the latest "
"version of the official client from "
f'<a href="{config.WWW_URL}">{config.WWW_URL}</a>'
)

async def check_policy_conformity(self, player_id, uid_hash, session, ignore_result=False):
if not config.USE_POLICY_SERVER:
return True
Expand Down Expand Up @@ -698,6 +708,7 @@ async def command_ask_session(self, message):
user_agent = message.get("user_agent")
version = message.get("version")
self._set_user_agent_and_version(user_agent, version)
await self._check_user_agent()
await self.send({"command": "session", "session": self.session})

async def command_avatar(self, message):
Expand Down

0 comments on commit a321937

Please sign in to comment.