A decent chat server implementation in C++

haskal 5570eed169 Merge branch 'fix-cors' of alex/decent-cpp into master 6 years ago
Simple-Web-Server @ 1056bd2e70 06cef8aee3 Initial commit, set up basics 6 years ago
Simple-WebSocket-Server @ fcc631b4d6 06cef8aee3 Initial commit, set up basics 6 years ago
cmake 06cef8aee3 Initial commit, set up basics 6 years ago
json @ 8d104e6fe3 06cef8aee3 Initial commit, set up basics 6 years ago
optional-lite @ 86ee3d2d4b bdacf9b6b6 Sessions 6 years ago
.clang-format 06cef8aee3 Initial commit, set up basics 6 years ago
.gitignore a61d7fc9b1 Add cert files to gitignore 6 years ago
.gitmodules bdacf9b6b6 Sessions 6 years ago
CMakeLists.txt 1192eda469 Remove boost log for alex 6 years ago
LICENSE 06cef8aee3 Initial commit, set up basics 6 years ago
README.md 73155a2289 Update readme with building instructions 6 years ago
crypto.cpp 0f00e592be Lower argon2 params 6 years ago
crypto.h 89ea0a7191 Make custom stdint.h to deal with platform-dependent memery 6 years ago
data.cpp 2b81519ee0 roles -> roleIDs; give empty array instead of null if no channels 6 years ago
data.h 89ea0a7191 Make custom stdint.h to deal with platform-dependent memery 6 years ago
dcstdint.h 89ea0a7191 Make custom stdint.h to deal with platform-dependent memery 6 years ago
http.cpp cb0320bcfa Add X-Session-ID to CORS allowed headers 6 years ago
http.h ef9be4b546 Add USE_HTTPS flag 6 years ago
main.cpp 1192eda469 Remove boost log for alex 6 years ago
util.cpp 89ea0a7191 Make custom stdint.h to deal with platform-dependent memery 6 years ago
util.h 89ea0a7191 Make custom stdint.h to deal with platform-dependent memery 6 years ago
ws.cpp 380a14d87e Implement unreads 6 years ago
ws.h 380a14d87e Implement unreads 6 years ago

README.md

decent-cpp

A decent server implementation in C++, using eidheim/Simple-Web-Server, eidheim/Simple-WebSocket-Server, and SQLite3.

Why?

Node.js is bloated and slow. This server is designed to be blazingly fast, fearlessly concurrent, and guarantee data safety.

Building

Dependencies (install with your favorite package manager)

  • GNU Readline >=7.0
  • SQLite3 >=3.19.3
  • libsodium, some version xd
  • Boost >=1.54
  • OpenSSL, some version xd

Older versions of dependencies will probably still work, but it's untested.

git clone --recursive https://notabug.org/haskal/decent-cpp.git
cd decent-cpp
mkdir build
cd build
cmake ..
make

Running

./decent-cpp

Windows

Use MSYS MinGW64, and use cmake -G"MSYS Makefiles" ..

Status

Currently Mega Unstable™, do not use!

Items of the decent api that are currently implemented:

HTTP Endpoints

Status Endpoint
DONE Retrieve server version [GET /api]
DONE Retrieve all settings [GET /api/settings]
DONE Modify settings [PATCH /api/settings]
WIP Upload an image [POST /api/upload-image]
WIP List emotes [GET /api/emotes]
WIP Add a new emote [POST /api/emotes]
WIP View an emote [GET /api/emotes/:shortcode]
WIP Delete an existing emote [DELETE /api/emotes/:shortcode]
DONE Fetch the current user’s sessions [GET /api/sessions]
DONE Login [POST /api/sessions]
DONE Fetch session details [GET /api/sessions/:id]
DONE Logout [DELETE /api/sessions/:id]
DONE Send a message [POST /api/messages]
DONE Retrieve a message [GET /api/messages/:id]
WIP Edit a message [PATCH /api/messages/:id]
WIP Delete a message [DELETE /api/messages/:id]
DONE Get list of channels [GET /api/channels]
DONE Create a channel [POST /api/channels]
DONE Retrieve a channel [GET /api/channels/:id]
DONE Rename a channel [PATCH /api/channels/:id]
DONE Delete a channel [DELETE /api/channels/:id]
DONE Mark a channel as read [POST /api/channels/:id/mark-read]
DONE Get messages in channel [GET /api/channels/:id/messages]
DONE Update channel-specific role permissions [PATCH /api/channels/:id/role-permissions]
DONE Get channel-specific role permissions [GET /api/channels/:id/role-permissions]
WIP Retrieve all pinned messages [GET /api/channels/:id/pins]
WIP Pin a message [POST /api/channels/:id/pins]
WIP Unpin a message [DELETE /api/channels/:channelID/pins/:messageID]
DONE Fetch users [GET /api/users]
DONE Register (create new user) [POST /api/users]
DONE Retrieve a user by ID [GET /api/users/:id]
DONE List mentions of a user [GET /api/users/:id/mentions]
WIP Get a user's permissions [GET /api/users/:id/permissions]
WIP Update user details [PATCH /api/users/:id]
WIP Delete a user [DELETE /api/users/:id]
WIP Check if a username is available [GET /api/username-available/:username]
DONE List roles [GET /api/roles]
DONE Add a new role [POST /api/roles]
DONE Update a role [PATCH /api/roles/:id]
DONE Delete a role [DELETE /api/emotes/:id]

Websocket events

Status Event
DONE pingdata
DONE pongdata
DONE server-settings/update
DONE message/new
WIP message/edit
WIP message/delete
WIP channel/new
PARTIAL channel/update
WIP channel/pins/add
WIP channel/pins/remove
WIP channel/delete
WIP user/new
WIP user/delete
DONE user/online
DONE user/offline
WIP user/update
DONE user/mentions/add
WIP user/mentions/remove
WIP emote/new
WIP emote/delete
DONE role/new
DONE role/update
DONE role/delete

Sample Text

Donate tendies