13 months agoLOC-1 - forgot to include the server component in the earlier commit
B Tasker []
LOC-1 - forgot to include the server component in the earlier commit

13 months agoUpdate help text
B Tasker []
Update help text

13 months agoLOC-1 Only users authorised on a room may grant access to others
B Tasker []
LOC-1 Only users authorised on a room may grant access to others

Was originally going to make it admin only, but decided it was better to push a notification in instead.

13 months agoLOC-3 Room Owners can now kick (and ban) users from the room
B Tasker []
LOC-3 Room Owners can now kick (and ban) users from the room

To kick a user out of the room, the owner can do

/kick [user]

To kick them and remove their ability to return, do

/ban [user]

13 months agoAdding help output. SC-2 v0.0.1a
B Tasker []
Adding help output. SC-2

This brings us (more or less) up to the point of a PoC for SC-2.

Although there's currently no E2E encryption and the auto-room purging isn't in place (apart from when a new user joins a room), messages can now flow back and forth.

It's not currently possible to close a room either, that needs to come soon.

But, there's enough functionality in place that it seems worth setting up a JIRA project for future adjustments/improvements. Auth is going to need doing at some point soon and it'd be good to have the decisions made on that properly documented.

This commit will be tagged as being v0.0.1a

13 months agoAdded the ability to invite users into room.
B Tasker []
Added the ability to invite users into room.

/room invite [roomname] [roompass] [[user]]

There's a known issue here where the backend will allow anyone to invite anyone into a room, even if the original user *isn't* actually invited into the room themselves.

That should be considered a big TODO

13 months agoClient can now create room
B Tasker []
Client can now create room

/room create [roomname] [roompass] [[user]]

If the user is currently in another room and they don't explicity set a user to be used as owner, then whatever username they're using in the current room will be re-used for the new room

13 months agoDo not re-use message IDs
B Tasker []
Do not re-use message IDs

Without this, polling breaks as we look for IDs > our last. When key re-use is permitted the latest ID may well be less than the most recent one we've seen

13 months agoImplement ability to leave room
B Tasker []
Implement ability to leave room

Room will get a message to note the user left

Command is /leave

13 months agoDon't repeatedly spam server went away messages
B Tasker []
Don't repeatedly spam server went away messages

13 months agoFix colouring.
B Tasker []
Fix colouring.

Messages sent by the local user should appear blue, whilst from other users should be green.

Had left the check using a global though, so the deciding factor for blue was - is the upstream user called "ben2"?

13 months agoOnly allow a user to poll for messages, or send messages for a room after they've actually joined it
B Tasker []
Only allow a user to poll for messages, or send messages for a room after they've actually joined it

13 months agoOlder messages will now be purged when a user joins the room
B Tasker []
Older messages will now be purged when a user joins the room

The aim of this is to prevent the new user from dumping out the entire stored history of a chat. Although the client will honour "last" they could conceivably override it to 0 and grab everything.

So, when they join, we now remove any messages older than 10 seconds.

At the moment, it's a little meaningless as you don't need to join in order to do pollMsg. That will obviously need to change.

13 months agoClient is no longer in a room by default, and must join by supplying username, roomname and room password
B Tasker []
Client is no longer in a room by default, and must join by supplying username, roomname and room password

Command format is

/join [user] [roomname] [password]

The password isn't currently used at all on either the front-end or the backend.

Backend component will, however, ensure that the user given is permitted to connect to the specified room.

If the user joins successfully a system message will be pushed into the room.

13 months agoSending a message from the client now works.
B Tasker []
Sending a message from the client now works.

Own messages will appear blue, whilst messages from other users are green.

Next step is probably to look at building in the join room functionality

13 months agoRegular poll now prints the messages as they should appear.
B Tasker []
Regular poll now prints the messages as they should appear.

What's missing at the moment is upstream user data - it's not in the current test payloads I'm using, so haven't put anything in to extract it yet. Once I've built the send message functionality into the interface I'll look at updating

13 months agoInterface now polls for new messages in the background
B Tasker []
Interface now polls for new messages in the background

With it running, if the following are run (in a seperate terminal) it correctly displays the expected output

curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"sendMsg","payload":"{\"roomName\":\"BenTest\", \"msg\":\"ENCRYPTED-DATA3\",\"user\":\"ben2\"}"}'
curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"sendMsg","payload":"{\"roomName\":\"BenTest\", \"msg\":\"ENCRYPTED-DATA4\",\"user\":\"ben2\"}"}'
curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"sendMsg","payload":"{\"roomName\":\"BenTest\", \"msg\":\"ENCRYPTED-DATA5\",\"user\":\"ben2\"}"}'

However, the caveat is that the test curls do not contain a JSON structure within the msg payload, so there's currently no functionality implemented to show time and sending user.

13 months agoAdding a poached urwid template to create the client interface
B Tasker []
Adding a poached urwid template to create the client interface

13 months agoImplemented ability to fetch all messages since last check.
B Tasker []
Implemented ability to fetch all messages since last check.

If you setup a room and stage some messages with the following:

# Create Room
curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"createRoom","payload":"{\"roomName\":\"BenTest\",\"owner\":\"ben\",\"passhash\":\"abcdefg\"}"}'

# Subscribe User
curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"inviteUser","payload":"{\"roomName\":\"BenTest\",\"user\":\"ben2\"}"}'

# Send a message
curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"sendMsg","payload":"{\"roomName\":\"BenTest\", \"msg\":\"ENCRYPTED-DATA\",\"user\":\"ben2\"}"}'

# Send another
curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"sendMsg","payload":"{\"roomName\":\"BenTest\", \"msg\":\"ENCRYPTED-DATA2\",\"user\":\"ben2\"}"}'

You can then fetch those messages with the following call

curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"pollMsg","payload":"{\"roomName\":\"BenTest\", \"mylast\":0,\"user\":\"ben2\"}"}'

This means we now have the basic components in place:

* Rooms can be created
* Users can be subscribed to the room
* Messages can be sent
* Clients can check for updated messages

Course, there's no auth yet, but it's probably better to try and build a working client first (as debugging is easier without a complex auth system in the way)

13 months agoImplemented ability to push messages into room.
B Tasker []
Implemented ability to push messages into room.

So the following flow will now create a room, add a user to it and then push a message by that user into the rooms table

curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"createRoom","payload":"{\"roomName\":\"BenTest\",\"owner\":\"ben\",\"passhash\":\"abcdefg\"}"}'

curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"inviteUser","payload":"{\"roomName\":\"BenTest\",\"user\":\"ben2\"}"}'

curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"sendMsg","payload":"{\"roomName\":\"BenTest\", \"msg\":\"ENCRYPTED-DATA\",\"user\":\"ben2\"}"}'

13 months agoOwner is now automatically subscribed into the room
B Tasker []
Owner is now automatically subscribed into the room

13 months agoImplemented the ability to link a user into a room
B Tasker []
Implemented the ability to link a user into a room

Means you can essentially do the following

curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"createRoom","payload":"{\"roomName\":\"BenTest\",\"owner\":\"ben\",\"passhash\":\"abcdefg\"}"}'
curl -v -X POST http://127.0.0.1:8090/ -H "Content-Type: application/json" --data '{"action":"inviteUser","payload":"{\"roomName\":\"BenTest\",\"user\":\"ben2\"}"}'

Which would allow user "ben2" to enter the room "BenTest"

What is missing, at the moment, is automatically linking the owner into the room at creation time. Will add that next

13 months agoImplemented basic schema for creating a room
B Tasker []
Implemented basic schema for creating a room

13 months agoCreating basic flask template as a starting point
B Tasker []
Creating basic flask template as a starting point