From cfe79328273f2eb43e6312511e1e3268bd284c77 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Tue, 5 May 2020 19:41:14 -0700 Subject: [PATCH] Added authenticate_clients server option --- .efrocachemap | 24 ++++++++++---------- assets/src/ba_data/python/_ba.py | 10 +++++++- assets/src/ba_data/python/ba/_servermode.py | 2 ++ assets/src/ba_data/python/bastd/ui/gather.py | 10 ++++++++ tools/bacommon/servermanager.py | 5 ++++ 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index c51747d2..f084286a 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4132,16 +4132,16 @@ "assets/build/windows/x64/python.exe": "https://files.ballistica.net/cache/ba1/25/a7/dc87c1be41605eb6fefd0145144c", "assets/build/windows/x64/python37.dll": "https://files.ballistica.net/cache/ba1/b9/e4/d912f56e42e9991bcbb4c804cfcb", "assets/build/windows/x64/pythonw.exe": "https://files.ballistica.net/cache/ba1/6c/bb/b6f52c306aa4e88061510e96cefe", - "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c4/f0/cb3af7a3fa02f7c1b3e54e20683b", - "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3c/ba/89bd9412e2135d27cc453fd46468", - "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/28/4d/3a87860937b9f1ca10a83059df49", - "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/49/b6/29845aba5751453418959eaa1f8f", - "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/42/a8/c62b10953a9a5c1108e4422df7f3", - "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ea/ba/647189d4a98d97a12f6ebb1da86b", - "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ce/6b/0a76ff71b67b5de3e20308700709", - "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4c/f4/da86c0c5c0cdfe5d7bf14dd60e00", - "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/57/0b/e0aeb2c3538114bc4d93fdc76f21", - "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/7f/06/922ac6ebf93586c3b743165a7d72", - "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/16/75/cad275443b1c9b181a1bdd976dee", - "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/0b/7b/103cbcf0f05b7cd67ff9b43fe4a3" + "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/69/4c/039dc398ab53d82c2cb22e98c0d8", + "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c8/af/0f496b474262aea9ee0f91145177", + "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/98/f9/f1f09b634610cc771ac346b16840", + "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/2f/ee/38fac529e6e1fc418334e3c5a96f", + "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/28/55/ea881bf6fb479751bc9caaf5e8af", + "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/81/b5/72bb876e9a7e88cbd2c828b7b1a9", + "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/35/5f/61e8b74618a1fe1af75ecbbb72dc", + "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/80/b7/ac34c7c602b40a1f4f095b2bd5df", + "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/38/c6/a526b7950d0327337199d7945025", + "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/9c/80/9c83c52e7f86cede3aa7cdc1d057", + "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ac/f2/95c05a0fbd4782925a6d3b830584", + "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/f2/82/d7d57d96f9e8e3dab865bef1b5c3" } \ No newline at end of file diff --git a/assets/src/ba_data/python/_ba.py b/assets/src/ba_data/python/_ba.py index 6b787470..c896bf5e 100644 --- a/assets/src/ba_data/python/_ba.py +++ b/assets/src/ba_data/python/_ba.py @@ -34,7 +34,7 @@ NOTE: This file was autogenerated by gendummymodule; do not edit by hand. """ # (hash we can use to see if this file is out of date) -# SOURCES_HASH=171068487782712697710052472999562586311 +# SOURCES_HASH=244232883360612053934546020264848527679 # I'm sorry Pylint. I know this file saddens you. Be strong. # pylint: disable=useless-suppression @@ -3321,6 +3321,14 @@ def set_analytics_screen(screen: str) -> None: return None +def set_authenticate_clients(enable: bool) -> None: + """set_authenticate_clients(enable: bool) -> None + + (internal) + """ + return None + + def set_debug_speed_exponent(speed: int) -> None: """set_debug_speed_exponent(speed: int) -> None diff --git a/assets/src/ba_data/python/ba/_servermode.py b/assets/src/ba_data/python/ba/_servermode.py index acdabadc..6fbf25dc 100644 --- a/assets/src/ba_data/python/ba/_servermode.py +++ b/assets/src/ba_data/python/ba/_servermode.py @@ -332,6 +332,8 @@ class ServerController: app.teams_series_length = self._config.teams_series_length app.ffa_series_length = self._config.ffa_series_length + _ba.set_authenticate_clients(self._config.authenticate_clients) + # Call set-enabled last (will push state to the cloud). _ba.set_public_party_max_size(self._config.max_party_size) _ba.set_public_party_name(self._config.party_name) diff --git a/assets/src/ba_data/python/bastd/ui/gather.py b/assets/src/ba_data/python/bastd/ui/gather.py index 1e91325c..1ba440bc 100644 --- a/assets/src/ba_data/python/bastd/ui/gather.py +++ b/assets/src/ba_data/python/bastd/ui/gather.py @@ -1804,6 +1804,11 @@ class GatherWindow(ba.Window): cfg.commit() ba.playsound(ba.getsound('shieldUp')) _ba.set_public_party_enabled(True) + + # In GUI builds we want to authenticate clients only when hosting + # public parties. + _ba.set_authenticate_clients(True) + self._do_internet_status_check() ba.buttonwidget( edit=self._internet_host_toggle_button, @@ -1856,6 +1861,11 @@ class GatherWindow(ba.Window): def _on_stop_internet_advertising_press(self) -> None: _ba.set_public_party_enabled(False) + + # In GUI builds we want to authenticate clients only when hosting + # public parties. + _ba.set_authenticate_clients(False) + ba.playsound(ba.getsound('shieldDown')) text = self._internet_host_status_text if text: diff --git a/tools/bacommon/servermanager.py b/tools/bacommon/servermanager.py index d10b9d2a..6db74377 100644 --- a/tools/bacommon/servermanager.py +++ b/tools/bacommon/servermanager.py @@ -40,6 +40,11 @@ class ServerConfig: # Otherwise it will still be joinable via LAN or connecting by IP address. party_is_public: bool = True + # If True, all connecting clients will be authenticated through the master + # server to screen for fake account info. Generally this should always + # be enabled unless you are hosting on a LAN with no internet connection. + authenticate_clients: bool = True + # UDP port to host on. Change this to work around firewalls or run multiple # servers on one machine. # 43210 is the default and the only port that will show up in the LAN