Add persistent web chat log

This commit is contained in:
Tanner committed 2026-11-14 22:02:08 +00:00
1 parent 9be381c2de
commit 492238aa22
12 files changed
+506 -51

No files matched your search

+15 -1
View File
@@ -69,7 +69,7 @@ class TestWebInventoryAPI(unittest.TestCase):
key: self.g.get(key) for key in
('connected', 'game', 'inv', 'chest_viewers', 'time', 'time_base',
'weather', 'rain_level', 'thunder_level', 'chunks', 'pos', 'yaw',
'path')
'path', 'chat_log')
}
self.game = FakeGame()
self.g.connected = True
@@ -187,6 +187,20 @@ class TestWebInventoryAPI(unittest.TestCase):
self.assertEqual(data['radius_x'], 48)
self.assertEqual(data['radius_z'], 36)
def test_global_api_exposes_chat_log_events(self):
self.g.chat_log = [{
'id': '123', 'timestamp': 123.0, 'type': 'join',
'sender': 'tanner', 'message': 'tanner joined the game',
}]
response = self.client.get('/api/global')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.get_json()['chat_log'][0], {
'id': '123', 'timestamp': 123.0, 'type': 'join',
'sender': 'tanner', 'message': 'tanner joined the game',
})
def test_global_api_exposes_world_time_ticks(self):
self.g.time = 12345.5
self.g.time_base = 12345.5