Merge branch 'bugfix/server-stats' into 'dev'

Check for string response on server ping

See merge request crafty-controller/crafty-4!614
This commit is contained in:
Iain Powrie 2023-09-02 13:44:44 +00:00
commit 242ba7899b
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ TBD
### Bug fixes
- PWA: Removed the custom offline page in favour of browser default ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/607))
- Fix hidden servers appearing visible on public mobile status page ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/612))
- Correctly handle if a server returns a string instead of json data on socket ping ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/614))
### Tweaks
- Polish/Enhance display for InApp Documentation ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/613))
### Lang

View File

@ -16,6 +16,12 @@ logger = logging.getLogger(__name__)
class Server:
def __init__(self, data):
if isinstance(data, str):
logger.error(
"Failed to calculate stats. Expected object. "
f"Server returned string: {data}"
)
return
self.description = data.get("description")
# print(self.description)
if isinstance(self.description, dict):