Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chat history to REST API #2884

Open
QuiCM opened this issue Dec 28, 2022 · 2 comments
Open

Add chat history to REST API #2884

QuiCM opened this issue Dec 28, 2022 · 2 comments

Comments

@QuiCM
Copy link
Member

QuiCM commented Dec 28, 2022

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.
@hakusaro
Copy link
Member

We could just store chat as a datastructure or something. Memory is okay but long-term it would probably work best in a db?

@ghost
Copy link

ghost commented Oct 4, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants