1
0
Fork 0
mirror of https://github.com/cytech-ing-2023-2026/lab-ihm-server.git synced 2026-06-03 21:22:05 +02:00
No description
  • C++ 67.2%
  • Shell 23.5%
  • CMake 5.5%
  • Dockerfile 3.8%
Find a file
2026-05-05 17:06:10 +02:00
cmake feat: Cross-compilation with Docker & AppImage (#1) 2026-05-05 17:02:07 +02:00
scripts feat: Cross-compilation with Docker & AppImage (#1) 2026-05-05 17:02:07 +02:00
.clang-format feat: Add model 2026-04-28 17:09:22 +02:00
.dockerignore feat: Cross-compilation with Docker & AppImage (#1) 2026-05-05 17:02:07 +02:00
.gitignore feat: Cross-compilation with Docker & AppImage (#1) 2026-05-05 17:02:07 +02:00
CMakeLists.txt feat: Cross-compilation with Docker & AppImage (#1) 2026-05-05 17:02:07 +02:00
docker-compose.yml feat: Cross-compilation with Docker & AppImage (#1) 2026-05-05 17:02:07 +02:00
Dockerfile feat: Cross-compilation with Docker & AppImage (#1) 2026-05-05 17:02:07 +02:00
main.cpp feat: Add base chat system 2026-05-05 12:27:54 +02:00
model.cpp feat: Polish chat, add history and user deletion 2026-05-05 16:50:28 +02:00
model.hpp feat: Polish chat, add history and user deletion 2026-05-05 16:50:28 +02:00
README.md docs: Add docker/X-compilation 2026-05-05 17:06:10 +02:00
run.sh feat: Add base chat system 2026-05-05 12:27:54 +02:00
server.cpp feat: Polish chat, add history and user deletion 2026-05-05 16:50:28 +02:00
server.hpp feat: Polish chat, add history and user deletion 2026-05-05 16:50:28 +02:00
setup.sql feat: Polish chat, add history and user deletion 2026-05-05 16:50:28 +02:00

Lab IHM Server

A C++ TCP chat server built with Qt, SQLite, and libsodium for secure messaging.

Overview

This project implements a backend server for a chat application as part of the IHM (Interface Homme-Machine) lab. It provides user authentication, message storage, and real-time messaging capabilities over TCP connections using JSON-based communication.

Features

  • User authentication with Argon2id password hashing
  • SQLite database for persistent storage
  • TCP server handling JSON messages
  • Session management for connected clients
  • Message history and user management
  • Admin user support

Dependencies

  • Qt6 or Qt5 (Core, Sql, Network)
  • libsodium (for cryptography)
  • CMake (for building)

Building

  1. Ensure you have Qt and libsodium installed on your system.
  2. Create a build directory:
    mkdir build
    cd build
    
  3. Configure with CMake:
    cmake ..
    
  4. Build the project:
    make
    

Running

Use the provided script:

./run.sh

Or run directly:

./lab-ihm-server

The server will start listening on port 8080.

Cross compilation

We use Docker to build the app into an ARM64 AppImage. The artifact will be built in the dist directory.

docker compose run --rm --build bundle

Database Setup

The server uses SQLite with a database file database.sqlite. The schema includes:

  • users table: user information with hashed passwords
  • messages table: message storage with sender/receiver relationships

Default users are created on first run:

  • admin (password: admin)
  • jordan (password: admin)
  • francois (password: admin)

API

The server communicates via JSON messages over TCP. Supported client message types:

  • LOGIN: User authentication
  • SEND: Send a message
  • DELETE: Delete a message
  • ERROR: Error handling

Testing

You can test the server using telnet:

telnet localhost 8080

Project Structure

  • main.cpp: Application entry point and server setup
  • server.cpp/hpp: Server logic and session management
  • model.cpp/hpp: Data structures and message handling
  • setup.sql: Database schema and initial data
  • CMakeLists.txt: Build configuration
  • run.sh: Convenience script for building and running