From e5384ac588aa8e38ae4cd75b84fcd2cd575f0c51 Mon Sep 17 00:00:00 2001 From: Erin Nova Date: Sat, 24 Jul 2021 12:58:18 -0400 Subject: [PATCH] Remove API docs from readme as they're in wiki, seperate finished/unfinished feautures --- README.md | 109 ++++++------------------------------------------------ 1 file changed, 12 insertions(+), 97 deletions(-) diff --git a/README.md b/README.md index 8f0d21d..862e7d9 100644 --- a/README.md +++ b/README.md @@ -4,101 +4,7 @@ A simple chat system for built for maya's livestream. Provides a simple API for user authentication, and chat functions. Frontend & backend code stored here. -## Auth API Documentation - -Most API functions will return JSON in the following format: - -`status`: either `ok` if action succeeded, or `fail` otherwise. - -`reason`: More info about why the action failed. - -### Register & Login: - -`POST /api/register` with JSON body values of: `name`, `pin`, `pronouns`. - -Will return JSON with `status` and `reason`. - -`POST /api/login` with JSON body values of: `name`, `pin`. - -Will return JSON with `status` and `reason`. - -Will set a private cookie named `token` which is used for authentication. - -### Change User Information - -User information such as name, pin, and pronouns, can be changed currently one at a time. - -`POST /api/change` with JSON body values of: `name`, `changed_event`, `new_event`. - -`name` the user's current username. used for authentication. - -`changed_event` which event to change. value can be one of: `Name`, `Pin`, `Pronouns`. - -`new_event` the new value for the changed event. - -User is authenticated via token. - -### Check if User is Still Logged in - -Instead of having to save the pin and re-login every time to check wether they're logged in, you can just check via the token. - -`GET /api/token/` where `` is the current username. - -Will return JSON with `status` and `reason`. - -### Logout - -This API will remove the cookie from the client, as well as invalidating the token serverside. - -`POST /api/logout` with JSON body values of: `name`. - -Will use the current token as authentication. - -Will return JSON with `status` and `reason`. - -### Get Info About A User - -This API will return info about a user on success. - -`GET /api/users/` - -On success returns JSON in format: -``` -status: ok -user: - name: user's name - pronouns: user's pronouns - role: the users role, one of either 'Normal', 'Moderator', or 'Admin' -``` - -eg: - -``` -{ -status: "ok", -user: { - name: "example", - pronouns: "they/them", - role: "Normal", -}, -} -``` - -## Chat API Documentation - -`POST /api/message/send {"name":"username","body":"message body"}` Post a message with JSON body values of: `name` & `body` - -Will return JSON with `status` and `reason`. - -`GET /api/message/messages.json` Returns a json file of all the messages - -## Chat Planning - -Clientside js will register & check login of users, if login is correct will ask for a random token. -Backend will generate token, store it, and then send it to the client to set as a cookie. -Whenever user sends a message, client will send message & token and backend will check if token matches. - -## To-Do: +## Implemented Features: - [x] Basic auth API - [x] Return json instead of string @@ -108,7 +14,6 @@ Whenever user sends a message, client will send message & token and backend will - [x] Finish up `chat::create_message()` - [x] Create `chat::fetch_messages()` - [x] Use unix timestamp for date - - [ ] Create `chat::delete_message()` - [x] Switch to using sled database to store users - [x] Error handling - [x] Token generation & storage @@ -123,10 +28,20 @@ Whenever user sends a message, client will send message & token and backend will - [x] Set pronouns - [x] Change pronouns - [x] make changed_event Enum, use token instead of pin + +## To-Do: + +- [x] Better messaging system + - [ ] Use websockets for chat [issue#3](https://git.lavender.software/erin/lila-chat/issues/3) + - [ ] Create `chat::delete_message()` + - [ ] Display pronouns [issue#4](https://git.lavender.software/erin/lila-chat/issues/4) +- [ ] Various database improvements [issue#1](https://git.lavender.software/erin/lila-chat/issues/1) + - [ ] Improve error handling on write functions + - [ ] Allow for asyncronous reading/writing - [ ] Some form of plural support? - [ ] User management (banning, etc.) - [x] User roles (admin, mod, etc.) - - [ ] Commands to affect users + - [ ] Commands to affect users [issue#2](https://git.lavender.software/erin/lila-chat/issues/2) - [ ] Blacklist words from chat/names - [ ] More advanced chat features - [x] Different types of message events? eg. default, announcement, command