Add some docs

This commit is contained in:
Christopher Cookman 2024-12-22 22:40:15 -07:00
parent 51382ddc39
commit e9f37775e3
3 changed files with 104 additions and 0 deletions

13
.env.example Normal file
View file

@ -0,0 +1,13 @@
DISCORD_TOKEN=DISCORD_BOT_TOKEN_HERE # Your discord bot token
ADMIN_GUILD=DISCORD_ADMIN_GUILD_ID # The guild ID of the guild you want to be the admin guild
REGISTER_COMMANDS=true/false # If you want to register commands on startup
RESET_ADMIN=true # If true, will delete all admin users and create user 'admin' with either a generated password or the password in DEV_PWD
DEV_PWD=admin # The password for the admin user if RESET_ADMIN is true, if unset will be a random password
DB_HOST=127.0.0.1 # MariaDB Host
DB_USER=ubs # MariaDB User
DB_PASS=ubs # MariaDB Password
DB_DATABASE=ubs # MariaDB Database
LOGFILE=access.log # Log file for API request logging
TRUST_PROXY=true # Whether to trust X-Forwarded-For as the IP address.
PROXY_IP=10.10.0.1 # IP of your reverse proxy (IPv4 only, will be converted from v6)
ROBLOSECURITY=ROBLOSECURITY_COOKIE # Your ROBLOSECURITY cookie. Not used as of now, but will be used for future features.

88
README.md Normal file
View file

@ -0,0 +1,88 @@
# RTECH Unified Ban System
## Features
- [X] MariaDB database for storing ban data
- [X] REST API for querying bans
- [ ] Web interface for querying bans
- [X] Admin web interface for managing bans
- [X] Mass import of bans
- [ ] Mass export of bans
- [ ] Ban appeal system
- [ ] Ban appeal system admin interface
- [ ] Discord integrations (Notifications, Appeals, Querying)
## Installation
1. Clone the repository
2. Run `npm install`
3. Configure the `.env` file with your database and API settings (see `.env.example`)
4. Run `node .` to start the server
## API Documentation
### 🔓 Unauthenticated Endpoints
`GET /health` - Healthcheck endpoint (For Uptime Kuma)
`GET /v1/myIP` - Get your IP address (As seen by the server. Useful for debugging)
`GET /v1/info` - Get information about the API (Version, All reason flags)
`GET /api/v1/bans` - Get all bans
`GET /api/v1/ban/roblox/:robloxId` - Get bans by Roblox ID
`GET /api/v1/ban/discord/:discordId` - Get bans by Discord ID
### 🔒 Authenticated Endpoints
`GET /admin` - Renders the admin dashboard.
`GET /admin/edit/:id` - Renders the edit ban page for a specific ban.
`GET /admin/create` - Renders the create ban page.
`POST /admin/create` - Creates a new ban.
**Post Data:**
```json
{
"robloxId": "string",
"discordId": "string",
"reason": "string",
"duration": "number"
}
```
`POST /admin/edit/:id` - Edits an existing ban.
**Post Data:**
```json
{
"reason": "string",
"duration": "number"
}
```
`GET /admin/import` - Renders the import page for uploading ban data.
`POST /admin/import` - Handles the import of ban data from a file.
**Post Data:**
- `fileInput`: File upload (CSV format)
- `fileType`: Type of the file being uploaded (e.g., 'csv', 'mfd')
`GET /admin/uploadStatus` - Renders the upload status page.
`GET /admin/api/bans` - Retrieves all bans.
`GET /admin/api/uploads/:id` - Retrieves the status of a specific upload.
`GET /admin/api/uploads` - Retrieves the status of all uploads.
`GET /admin/login` - Renders the admin login page.
`POST /admin/login` - Handles admin login.
**Post Data:**
```json
{
"username": "string",
"password": "string",
"totp": "string"
}
```
`ALL /admin/logout` - Logs out the admin.

3
TODO.md Normal file
View file

@ -0,0 +1,3 @@
# TODO List
- [ ] Add public ban query page based on either Roblox ID, Discord ID, or Ban ID
- [ ] Implement appeal system for banned users (Do we allow anybody to appeal with just a ban ID? Or do we use oauth?)