README.md (3106B)
1 # blatherskite 2 > blath·er·skite ⬩ 3 > /ˈblaT͟Hərˌskīt/ 4 > - a person who talks at great length without making much sense. 5 > - foolish talk; nonsense. 6 7 # About 8 `blatherskite` is a drop-in chat backend for your messaging app. 9 10 # Dependencies 11 You'll need to install CassandraDB for this: you can do that by running: 12 ``` 13 brew install cassandra 14 brew install cassandra-cpp-driver 15 ``` 16 17 > **Warning** 18 > This is a little wonky on M1 Macs: you'll need to follow the advice 19 > of [this page](https://stackoverflow.com/q/69486339) when you face 20 > the inevitable JNA link error. Download for more recent JNA version is 21 > [here](https://search.maven.org/artifact/net.java.dev.jna/jna/5.8.0/jar). 22 23 You also need to install the Rust language: 24 ``` 25 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 26 ``` 27 28 # Usage 29 Start by launching the database in the background with 30 31 ``` 32 cassandra -f 33 ``` 34 35 Then, launch `chatterbox` - the service for sending/getting messages - and 36 `scuttlebutt` - the service for everything else. 37 38 ``` 39 cargo run -p chatterbox & 40 cargo run -p scuttlebutt & 41 ``` 42 43 ## Features 44 Beyond basic text messaging, `blatherskite` has support for: 45 - Discord-esque servers 46 - Threads 47 - Direct messages 48 - Basic permissioning (owner/admin/none) 49 50 ### Terminology 51 Here's a quick guide to to the terms used by the service (that you might see in 52 the `scuttlebutt` documentation): 53 54 - Users can create or be invited to *groups* which contain *channels*. 55 - Groups have: 56 - *members*, the users who are part of the group 57 - an *owner*, who made the group and is permitted to do specific 58 actions (like deleting it) 59 - *admin*, users who have elevated permissions for a group (like 60 adding/removing channels) 61 - *DMs* are a special kind of group that are made between users 62 directly and limit certain functionality. DMs only have one channel 63 and have no admin. 64 - Channels also have *members* (which can be a subset of the 65 group!). Channels by default are *public*, which means when a user 66 is invited to a group they will be added to the channel. You can set 67 them to *private* with another API call. 68 69 ## Scuttlebutt 70 Scuttlebutt is an HTTP service that handles the creation, deletion, and updating 71 of groups/channels/users as well as misc other actions. 72 73 The various methods and objects are documented at `localhost:3000`, and the 74 basic usage flow is something like: 75 - `POST /api/user` to make a user, which will return a User object (see Schemas 76 on the docs) 77 - `GET /api/login` to login with said user. This will return a JWT that you'll 78 use to authenticate future requests. This token will expire in a day! 79 - Whatever requests you'd like at that point! Authenticate by including a 80 `ScuttleKey` header with the token you got. 81 82 ## Chatterbox 83 Chatterbox is a websocket service used for sending and receiving messages: 84 - Connect to the websocket at `ws://localhost:3001/` 85 - Send authentication with `{"hash": "YOUR_PASSWORD_HASH", "id": "YOUR_ID"}` 86 - Then use the websocket as normal! 87 - Send message requests with `{"content": "whee", "channel": "CHANNEL_ID"}` 88 - Recieve messages!