Add chat history to REST API
Captured from Discord (thanks to @Raspberry), with minor adjustments:
REST API Suggestion: /server/chat the client (the one who's gonna send a request), would send something like:
GET /server/chat?filter=player&limit=50
- filter: filter by player name (accepting
tsn:,tsi:prefixing). Don't send this parameter to receive chat history from all players - limit: number of messages to return. Don't send this parameter to receive all chat history
and the server will respond with
{
"response": [
"chat",
"history",
"goes",
"here"
]
}
the first index on the list being the last message sent (chronological ordering)
Noting:
- We don't currently track chat history. This would need to be implemented, taking into consideration memory usage on long-running servers.
- It would probably be quite simple to tail the last n lines of the log file, however this would potentially expose command executions etc. and doesn't allow filtering.
We could just store chat as a datastructure or something. Memory is okay but long-term it would probably work best in a db?
We could just store chat as a datastructure or something. Memory is okay but long-term it would probably work best in a db?
yes, that could work but it would need to be accessible by the "REST API" so that would mean that the server would have to send information to the "REST" client, aka the database so if an unauthorized person accesses it then the person could steal information causing there to be an added security measure for the "REST API" software (EX; Passwords, Pins, ECT)