Picomm
An IRC-like internet messenger
I've made a messenger app for the picotron.
You can change your nick, a channel and chat with people there.
There are +- unlimited amount of channels (gui only allows for 16 characters, but API works with larger numbers)
Libraries used:
It doesn't work in the browser :(
This project is still in a pretty early stage of a development but it works and you
can chat with people and have some confidence that your messages will arrive to others.
This cartridge ships with a chat_api.lua
file and it gives users two functions:
- send_message_channel(user, channel, message)
- get_messages_channel(channel)
First function sends a message to the channel and second function receives 10 last messages sent to the channel, as an array of strings in form of "<nick> message".
Both functions are blocking (so the execution will stop until everything is sent) but you can wrap them with coroutines.
So you are more than welcome to make your own gui (because current is somewhat lacking in prettiness).
Server shenanigans
The only way to send any data from picotron is to use fetch()
function with http/https url as a path. Then it sends a GET request to the server. So the only thing we can do is send the data in the URL of a request.
Additionaly picotron only let us send requests to sites with url shorter than 256 (or 128?) characters.
With this in mind I've made a protocol which let us send arbitrary amount of data to the server.
Firstly, I'm using pod(value,0x4)
to pack a value in some URL-friendly format. Then I'm slicing the data into 25-character long chunks and sending them in separate requests, numbering them etc.
Then on the server I'm receiving them, merging in the correct order and decode from pod. Then I can just do whatever I want with this data and send some other data back to the picotron by responding to the last request.
I will leave the server running.
I'm planning to add file-sharing, private messages and maybe some authorization? So people wouldn't be able to impersonate others.
this is so cool! would it be possible to share the server configuration, that way people could make their own servers, or even use this as a base for projects that connect over the network?
The code is an unreadable garbage and it probably has several RCEs but why not xd
For some time the server will be down so i can move it to more secure environment.
[Please log in to post a comment]