Skip to content

med1001/Privora

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Privora

A distributed chat application with a C-based client/server and a Python (Flask) authentication system.

Lines of Code GitHub issues GitHub stars GitHub pull requests GitHub license

Directory Structure

  • client/ - C client code.
  • server/ - C server code.
  • flask_auth/ - Flask authentication system for user management.
  • include/ - Header files for the C application.
  • build/ - Compiled binaries.
  • logs/ - Log files (optional).
  • assets/ - Project assets (e.g., images, logos).
  • .gitignore - Specifies files and directories to ignore in Git.
  • README.md - This file.

How to Clone the Project

Run the following command to clone the repository:

git clone https://github.com/med1001/Privora.git
cd Privora

How to Build and Run the C Chat Application

Prerequisites

Ensure that you have GCC and Make installed. If not, install them using:

sudo apt update && sudo apt install build-essential

Before building the project, ensure that the libcurl is installed using the following command on Ubuntu-based systems:

sudo apt-get install libcurl4-openssl-dev

Building the Server & Client

  1. Navigate to the server/ directory and compile the server:
    cd server
    make  # Builds the server
  2. Navigate to the client/ directory and compile the client:
    cd ../client
    make  # Builds the client

Running the Chat Application

After building, you can run the client and server from the build/ directory in both client and server:

cd build # cd to the server build repo (Privora/server/build)
./server &  # Start the server in the background
./client  # Start the client # after cd to the client build repo (Privora/client/build)

Setting Up Flask Authentication

The Flask authentication system handles user account creation and private messaging authentication.

Prerequisites

Ensure you have Python 3.8+ installed. If not, install it using:

sudo apt install python3 python3-venv python3-pip

Setting Up the Virtual Environment

  1. Navigate to the flask_auth/ directory:
    cd flask_auth
  2. Create and activate a virtual environment:
     python3 -m venv venv
     source venv/bin/activate  
  3. Install dependencies:
    pip install -r requirements.txt

Configuring the .env File

Before running the Flask authentication server, you need to properly set up the .env file. This file contains important environment variables required for the application to work, such as SMTP credentials for sending confirmation emails.

Steps:

  1. Locate the .env.example File: In the Privora/flask_auth directory, there is a hidden file named .env.example. This file contains an example structure for the .env file, but without sensitive values.

  2. Create the .env File: Copy .env.example to create your actual .env file:

    cp .env.example .env
  3. Edit the .env File: Open the .env file and replace the placeholder values with your actual SMTP credentials. The required environment variables are:

    SMTP_SERVER=smtp.gmail.com
    SMTP_PORT=587
    [email protected]
    SMTP_PASSWORD=your_smtp_password
    [email protected]
    
    • SMTP_SERVER: The address of your SMTP server (e.g., smtp.gmail.com for Gmail).
    • SMTP_PORT: The port to use for the SMTP connection (e.g., 587 for Gmail).
    • SMTP_USERNAME: Your email address used to send emails.
    • SMTP_PASSWORD: Your SMTP password (or App Password if using Gmail with two-factor authentication).
    • FROM_EMAIL: The email address to appear as the sender for confirmation and recovery emails.
  4. Security Note:

    • Do not push the .env file to public repositories to protect sensitive information like your SMTP credentials.
    • Make sure that the .env file is added to your .gitignore file to prevent accidental commits:
      .env

Running the Flask Server

Start the authentication server with:

python auth_server.py

By default, Flask runs on http://127.0.0.1:5000/.


How to Clean the C Build

To remove compiled binaries and build artifacts, run:

make clean

Run this command separately in both server/ and client/ directories if needed.


Next Steps

  • Add private chat functionality between two users.

Contributing

Feel free to contribute! Fork the repo, make your changes, and submit a pull request.


License

This project is open-source and available under the GNU General Public License v3.0.

About

a distributed chat application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •