Skip to content

Latest commit

 

History

233 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 ST Affichage

A seamless, real-time announcement platform for students of the ST Faculty (Univ Bejaïa).

Version Python Flask Tailwind

An independent student-led initiative to modernize university communications.


⚡ Overview

ST Affichage is a highly optimized, automated scraper and web application designed to bridge the gap between the university's Moodle e-learning platform and student accessibility.

Instead of forcing students to repeatedly log into a clunky web interface, this application autonomously monitors the university's announcement board in the background, extracts vital information (text, PDFs, images), and delivers it via a beautiful, native-feeling mobile interface with real-time push notifications.

✨ Key Features

  • 🔄 Autonomous Scraping Engine: Runs a continuous background thread that polls the Moodle HTML, intelligently extracting and cleaning data, links, and images while ignoring system UI junk.
  • 🔔 Push Notifications: Integrated with Firebase Cloud Messaging (FCM). When a new announcement is detected, a high-priority alert is instantly broadcasted to all users.
  • 📱 Premium Glassmorphism UI: A sleek, dark-mode-exclusive interface built with Tailwind CSS, featuring heavy background blurs (backdrop-filter), smooth hardware-accelerated animations, and modern typography (Inter & Syne).
  • 🔗 Hybrid Share System: Uses the native Web Share API on browsers, and automatically falls back to an intelligent Custom Share Sheet with deep-linking (tg://, whatsapp://) when running inside the Android APK WebView.
  • 🛡️ Hardening Measures: IP rate limiting (Flask-Limiter) and security headers (X-Frame-Options, X-Content-Type-Options, Strict-Transport-Security); announcement HTML is sanitized with bleach before display.

🛠️ Tech Stack

Backend Architecture

  • Python 3 (Core Logic)
  • Flask (API & Routing)
  • BeautifulSoup4 & Bleach (HTML Parsing & Sanitization)
  • Firebase Admin SDK (Push Notifications)
  • Gunicorn (Production WSGI Server)

Frontend Architecture

  • HTML5 / Vanilla JavaScript (Zero heavy frameworks, blazing fast)
  • Tailwind CSS (Utility-first styling)
  • Google Fonts (Syne for headings, Inter for readability)

🚀 How It Works

  1. Background Polling: Every 10 minutes, a daemon thread fetches the target Moodle URL.
  2. Parsing & Hashing: Beautiful Soup extracts li.activity nodes. The raw text is hashed via SHA-256 to create a unique ID.
  3. Sanitization: bleach safely strips malicious or broken HTML tags, preserving only safe formatting (<b>, <i>, <br>).
  4. State Comparison: If a new SHA-256 hash is detected that wasn't in the previous cycle, the app triggers the send_fcm_notification function.
  5. Client Fetch: The frontend dynamically fetches the /api/announcements endpoint and paints the UI using pure JavaScript DOM manipulation.

⚙️ Installation & Local Setup

If you wish to run this project locally for development or testing:

1. Clone the repository

git clone https://github.com/linuxcoding-ADAM/moodle-notifier.git
cd moodle-notifier

2. Create a Virtual Environment

python -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Environment Variables

Create a .env file (or set them in your hosting platform) with your Firebase Service Account JSON credentials and Moodle account:

FIREBASE_CREDENTIALS={"type": "service_account", "project_id": "...", ...}
MOODLE_USERNAME=your_moodle_username
MOODLE_PASSWORD=your_moodle_password
ADMIN_PASSWORD=your_secure_password
PORT=5000

5. Run the Application

python app.py

The app will be available at http://localhost:5000.


📡 API Reference

GET /api/announcements/<slug>

Returns the latest scraped announcements for a department (e.g. technologie, hydraulique, genie-civil, genie-mecanique, electrotechnique, ate) in JSON format, sorted by timestamp (newest first).

Response (Example):

[
  {
    "id": "e4d909c290d0fb1c",
    "title": "Avis aux étudiants des groupes H8, D6",
    "body": "Interrogation N° 02 du module de chimie 02...",
    "date": "16 Avril 2026",
    "timestamp": 1776340800.0,
    "images": ["https://elearning.univ-bejaia.dz/.../image.png"],
    "links": ["https://elearning.univ-bejaia.dz/.../document.pdf"],
    "source": "https://elearning.univ-bejaia.dz/course/view.php?id=19989#module-12345"
  }
]

👨‍💻 Developer & Credits

Designed, developed, and maintained independently by Adam Mila.

This application is an independent initiative to help students and is not officially affiliated with the administration of Université de Bejaïa.

For bug reports, feature requests, or collaboration, please reach out via Instagram or Email.


Built with ❤️ for the students.

About

Flask app that monitors the Univ Bejaïa Moodle announcement boards and pushes new notices to students via FCM notifications.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages