Code Monkey home page Code Monkey logo

chirp's Introduction

Chirp: Exploring GTK4-rs through Chat

wakatime

Chirp is my playground for exploring the world of GTK4-rs while working on a chat application. Currently, it's a practice project with a straightforward and functional UI.

Features

๐ŸŽจ User Interface: Chirp features an interface crafted using GTK4-rs.

๐ŸŒ Server: A WebSocket server created with actix-web the GUI can communicate with, allowing usage of multiple clients with auto-reconnecting.

๐Ÿ›ก๏ธ Security: The application incorporates several security measures, including TLS-encrypted server communication and token-based authentication for the GUI client.

๐Ÿ’ฌ Messaging: The app supports basic messaging capabilities including sending and deleting messages, adding new chat, and message synchronization upon startup.

๐Ÿ”’ Message Encryption: A combination of RSA and AES is used to add encryption to every single message and is decrypted locally to show it in the UI.

App Screenshots

Current Status

No further development is planned for the project as it served its purpose

Project Components

  • gui/: Contains the UI interface built with GTK4-rs along with all the logic and UI components to make it run.
  • server/: Hosts a WebSocket server created with actix-web, facilitating communication with the GUI and managing the DB.
  • migrations/: Contains DB migrations details, should be handled with diesel-rs

Explore the Project

  • Clone this project onto your local machine git clone https://github.com/TheRustyPickle/Chirp.git.
  • Ensure you have the required dependencies, including the latest GTK4, Libadwaita libraries, and Postgres.
  • Install diesel cli cargo install diesel_cli
  • Update Postgres credentials on .env file
  • Setup DB and run migrations
diesel setup
diesel migration run
  • Setup GTK Schema settings
mkdir -p $HOME/.local/share/glib-2.0/schemas
cp ./gui/src/com.github.therustypickle.chirp.gschema.xml $HOME/.local/share/glib-2.0/schemas/
glib-compile-schemas $HOME/.local/share/glib-2.0/schemas/
  • Start the server cargo run --bin chirp-server --release
  • Launch the GUI using the command cargo run --bin chirp-gui --release

License

Chirp is under the MIT License.

chirp's People

Contributors

aybeedee avatar dianesaur avatar therustypickle avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

chirp's Issues

Limit user name to 250 chars

Rough modifications needed for the issue:

  • Modify bind and edit_name functions on user_prompts.rs to ensure names with over 250 chars don't get accepted
  • If over 250, it should show an error text with the details, disable the confirm button, and add the error CSS to the entry
  • Perhaps the bind function should be separated for name and image editing for easier handling similar to bind_int for numbers

Add a new row on profile section showing connection status

It would be nice to have an indication on the profile section to see if it's connected to the server properly

  • Add a new row on user_profile.xml and add a relevant button or image or something to communicate the status
  • Bind the property to show the status with WSObject

Persist the same profile on gui restart

Currently on each restart it creates a new profile with a new user id. This should persist among launches and be able to reconnect to the WS using the previously saved User ID. gio::Settings schema can be used to save it.

Use a DB on server side to store data

Instead of storing everything on the memory, use a DB that should store

  • Created Users, ID, and their profile details. Completed on #36
  • All messages communicated

Show an indicator beside unsent messages

When the server is offline but messages are sent, it should show an indicator perhaps a spinner(?) to highlight that it has not been sent yet. Rough TODO

  • Update message_row.xml with the indicator
  • Update MessageObject with a var to save whether it was sent or not and bind that with the new indicator UI
  • Queue processor already works with the MessageObject. Update the object's sent variable

Maintain a queue with each userobject to communicate with the WS

In case of not being able to connect to the WS, it should continue to try to connect to it. Maintain a queue system in FIFO order. As soon as the WS is connected, it will start sending them, if there is anything to send. Channel could be a solution here. All WS function calls should be handled by a single function to unite them

Start issuing unique token to every unique user

With the current communication style, anyone can pretend to be someone else if they have the user ID. Generate a unique token that should be passed with every request to identify if it's the correct user.

Prerequisite: #31 should be implemented first.

Add a separate style on UserList if an inactive/non-selected user has message updates

Currently the users on userlist has 2 statuses. Selected or non-selected. Selected users has a blue CSS while non-selected has gray CSS. For non-selected users, if any message is received, it should show a separate style

  • Add the new CSS style that would be added on message update
  • handle_ws_message function needs to be updated to properly add the new CSS on message receive

Validate user input before accepting

  • Image link input needs to be verified on whether it's a valid link to an image
  • New Chat button input should be verified to ensure it's a proper number

Improve the gtk ui

The UI can still use some improvement such as

  • Improve color consistency
  • Improve CSS styling format
  • Anything that would improve the interface

Any contribution toward improving the UI is welcome!

Increase message deletion efficiency

Currently, any deletion attempt will loop the entire liststore, even if it doesn't exist. This should be verified before any deletion attempt is done

Allow deleting users from the chat/user list

As of now, only new chat/users can be added using the New Chat button but cannot be removed. Would be nice to be able to delete users. The functionality can be added on a mouse right click

  • Add options on right click on user_row.xml
  • Connect clicked signal to delete it from the users ListStore

Update sync message handling

Upon receiving a message ListStore is iterated for every single message which is highly inefficient. The same for finding the deletion target. This must be improved to prevent the UI from lagging when syncing a large amount of data.

  • Use binary search to lower the amount of iteration needed

Show a timestamp on each message to view when it was created

The UI currently doesn't show any time/date of when a message was created. It should be updated to show a timestamp

  • Update the message_row.xml UI to show the timer. As a label perhaps? This should be done carefully with a smaller text size
  • MessageObject already stores the timestamp. Only the UI needs to be connected to the variable.

Add some form of encryption to messages

Goals:

  • The server should not know what message was communicated
  • All sent messages should be encrypted with the receiver's key so it can be decrypted from the other side
  • All encryption decryption must happen on the GUI side

Fix proper ID updating when creating new user

When a new user is created but the server connection is not available and messages are sent in the queue, the message sending fails after the connection is established as it tries to send to User 0 which should not happen.

Add more sources of random images

Currently following APIs are used

  • Dicebear
  • Robohash

Would be nice to have more sources of random images. The following needs to be updated

  • Add a new function to generate a proper link to the new image source API on utils.rs
  • generate_random_avatar_link should be updated with an option to call the new function.

Allow deleting profile picture URL with a separate button

It should be possible to set an empty link on the profile section which would use the AdwAvatar fallback. Adding another button on the image link row to delete this should be good enough

  • Update user_profile.xml image link row with a new button. Perhaps the icon user-trash can be used on the button
  • Add the functionality on the button press
  • Update websocket communication on both gui and server side slightly to except a None/Null value on ImageUpdate

Allow deleting messages

Rough TODO to allow deleting message

  • Update message_row.xml with a menu that would open on right-click with an option to Delete Message.
  • On press, collect the message number, send it to the server for deletion, and remove it from the interface.
  • Update server side to handle the deletion and remove the relevant row from the DB

Allow resyncing messages

The server side already stores all message data. On connect/reconnect the server should send all relevant message data to the GUI so it can process and show them in the interface.

Update gui side's queue system

Each userobject currently uses RefCell to keep track of the queue. In certain cases, it can cause double borrow_mut and crash it. It should be updated to ensure this doesn't happen. Perhaps make use of mutex?

Convert message ListBox to ListView

In the current state, ListBox starts lagging with only 5k messages. Migrate from ListBox to ListView as ListView is designed to be more scalable than ListBox.

Convert user prompt MessageDialog to AdwWindow

Due to the usage of MessageDialog, the UI is restricted to simple actions. MessageDialog doesn't allow further verification after the input is given when adding a new chat and editing the image link. Converting it to AdwWindow will allow verifying everything before any prompt is accepted.

The converted UI should

  • Have a similar UI to MessageDialog
  • Make use of destructive and suggestive action styles on the buttons
  • Hide the close buttons

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.