Simple Python-based web application to allow UGM students to fill their QR presence list without having another device in hand.

Overview

Praesentia

Praesentia is a simple Python-based web application to allow UGM students to fill their QR presence list without having another device in hand.

How to use

You can use an image file containing a QR code (can be obtained using a screenshot). Alternatively, you can just directly use the camera.

FAQ

Demo?!

The demo is available at https://lcat.dev/praesentia. Don't expect a 99.99% uptime, the server is an old Raspberry Pi 3.

Background?

  • Many UGM students are required to use SIMASTER mobile app to scan QR codes to fill their presence list. This mostly means that a student needs at least two devices to make the mechanism works.
  • Two devices are not always available.

API Source?

I decompiled SIMASTER mobile app to get the source code. I also used interceptors to quickly recognize what was being sent and received.

How does it work?

It works just like scanning QR in the SIMASTER mobile app.

Side-effect?

I don't think there is any except that you will get logged out of your SIMASTER app on your phone (just re-login, it will work again). I have never done research about the API's rate-limiting or any possible ban.

Installation and Deployment

Installation of Praesentia is fairly straightforward. You just need at least Python 3.6.

Installing requirements

This app only requires flask (to serve the web) and requests library (to call the API). You can install both using pip.

pip install flask requests

It is recommended but not necessary to separate an app's environment by using a virtual environment (e.g. venv).

Deployment

There are many ways to deploy Praesentia. You can use the following (but not limited to) ways:

  • Gunicorn
gunicorn -b :6749 wsgi:app
  • Flask development server
python wsgi.py

Contribution

Contribution in any form will be highly appreciated.

License

This project is licensed under MIT License.

Comments
  • Add Scan QR code from clipboard

    Add Scan QR code from clipboard

    this PR close #2

    The idea is to use paste event and then grab the files object from event.clipboardData

    [praesentia.js]
    ....
    const target = document.querySelector('body');
    
    target.addEventListener('paste', (event) => {
        let paste = event.clipboardData || window.clipboardData;
    
        if(paste.files.length > 0) {
            html5QrcodeScanner.html5Qrcode.scanFile(paste.files[0], true)
            .then(decodedText => {
                processingDecodedText(decodedText)
            })
            .catch(err => {
                swal.fire('Error', 'Cannot read QR Code, Please make sure paste only the QR Code', 'error');
            });
        }
    });
    ....
    

    When the file object exist, call method scanFile from class html5Qrcode. it will return decodedText if successful and when fail will call swal.fire

    CAUTION

    html5Qrcode instance is private field from html5QrcodeScanner see this file on line (87). the problem can be solved by creating html5Qrcode directly (use Pro Mode as it says on the documentation)

    For demo visit this link

    enhancement 
    opened by raffifu 7
  • Screen sharing feature UI adjustment and code refactor

    Screen sharing feature UI adjustment and code refactor

    In this PR, I tried to tidy things up especially the UI. As a follow-up of #9, in sum, this PR have done the following things:

    • UI adjustment: added a select box for selecting a QR source and moved the auto submit checkbox to the bottom of the page
    • Auto submit checkbox state is now persistent by utilizing localStorage
    • Refactored praesentia.js
    • I also re-organized the static files for nimiq/qr-scanner as it looks quite messy (this should be in another PR, but I guess that's okay)
    opened by p4kl0nc4t 6
  • add share screen method

    add share screen method

    Using package called stream-display to getDisplayMedia that sends screen video feed as ImageData then changed to ImageBitmap so can be decoded with nimiq/qr-scanner

    For this PR, I add 2 features

    • Share Screen as mentioned in #1
    • Auto Submit (using share screen)
    opened by Noth3r 2
  • Implement a frontend framework like Vue or React

    Implement a frontend framework like Vue or React

    I am not really a fan of web designing, but I believe that the front-end side of Praesentia is getting a bit more overwhelming as the features increase.

    Implementing a front-end framework will make the code cleaner and easier to maintain. If someone could wire up a PR for it, I would really appreciate that!

    enhancement 
    opened by p4kl0nc4t 1
  • Unreliable QR scanning on a screenshot

    Unreliable QR scanning on a screenshot

    html5-qrcode seems unable to detect or locate QR code on some screenshot (including one from Google Meet) that actually do contain a single QR code. Cropping the image seems to fix the problem, but that isn't a solution.

    bug enhancement 
    opened by p4kl0nc4t 1
  • New feature: log in by using a session token

    New feature: log in by using a session token

    I have recently faced a problem where I have to share my username and password when trying to "ensure" my presence.

    This PR has mainly changed the logging in logic. This PR contains changes that made it possible to log in with a session token instead of a username and a password. This way, if in some scenario, a user won't have to share their credentials.

    A "session token" is actually just a string comprised of a logged in SimasterQRPresence instance's session_id and group_id. Some new methods (a way to serialize and deserialize a session token) have also been added to simaster.py file.

    From the front perspective, the home.html has also been changed. After logging in, there will be a small text displayed on the alert box that contains the last session token.

    opened by p4kl0nc4t 0
  • Fix bad logic flow in `processQrImage()`

    Fix bad logic flow in `processQrImage()`

    This PR fixes #17. It turns out that the bug is caused by a bad logic in the processQrImage() function. The function will always execute $('#btnStopScreenSharing').click(); which also triggers stopCapture(). If capture is not already initialized (by starting to share screen), the processQrImage() will always end up in an error.

    Summary

    1. processQrImage() function won't call $('#btnStopScreenSharing').click(); by itself
    2. processQrImage() function now returns a Promise that indicate the status of the QR scan
    3. To compensate point (1), small necessary adjustment is done to the scanVideoStream() function.
    opened by p4kl0nc4t 0
  • Scan by image file is not (always) working

    Scan by image file is not (always) working

    The QR scanning via image file is not working if a screen sharing has not started yet. This happens after the merging of #11.

    How to reproduce

    1. Open the main page
    2. Select a file that contains a QR code
    3. It should show an error box.
    4. Select screen sharing as a QR source, then start sharing and stop sharing right after it started.
    5. Change the QR code back to image file, then select the same file as in step 2.
    6. The QR data should be detected (no errors)
    bug 
    opened by p4kl0nc4t 0
  • Deploy Praesentia on Heroku

    Deploy Praesentia on Heroku

    This PR added some files needed to deploy Praesentia on Heroku platform. The README file is also updated to contain the new Heroku deployed version of Praesentia.

    Fixes: #15

    opened by p4kl0nc4t 0
  • Deploy the demo on a more reliable server

    Deploy the demo on a more reliable server

    I am thinking about moving the demo site to a much more reliable place. Platforms like Heroku or something else that's free may be a good idea. This is important because I myself relies on my unreliable Raspberry Pi home server. I think other users are also using the demo. Improving server reliability will definitely improve user experience.

    enhancement 
    opened by p4kl0nc4t 0
  • Change the QR scanning library to `nimiq/qr-scanner`

    Change the QR scanning library to `nimiq/qr-scanner`

    Summary

    As a follow-up of #5, this PR removes the implementation of mebjas/html5-qrcode due to its unreliability in scanning QR codes especially when the QR code is in a Google Meet screenshot. As its replacement, this PR implements nimiq/qr-scanner as advised in #5.

    Some tests have been performed on this implementation. Those tests have proved an increased reliablity when scanning QR code. All QR code that can't be scanned by mebjas/html5-qrcode can be scanned by `nimiq/qr-scanner

    As a consequence of this library switch, a significant portion of the UI have also been adjusted. The in-place camera scan (provided by default by the previous library) has also been removed and replaced by a classical file input (scanning by camera is still possible, just not directly in the browser).


    Fixes: #4 #5 Signed-off-by: Faiz Jazadi [email protected]

    opened by p4kl0nc4t 0
  • Allow scan by screen sharing to run lazily

    Allow scan by screen sharing to run lazily

    To compensate for #23, it would be nicer if one could easily scan QR through screen sharing lazily. The lazy feature is required because sometimes Praesentia mistakenly scans for the lecturer's QR code.

    To-do: only invoke stopCapture() when a QR is successfully scanned

    enhancement 
    opened by p4kl0nc4t 0
  • Problem: Valid QR code age is shrinking

    Problem: Valid QR code age is shrinking

    For the last few days, I noticed that I can't scan (using Praesentia) a QR code. It seems that the age of a QR code has been decreased, it lasts for appoximately 30 seconds before then becomes invalid (or shows a "galat" message).

    Temporary workaround

    The temporary warkaround to this problem is to scan the QR code faster. The use of the screen sharing method combined with auto-submit will improve the overall scanning speed.

    opened by p4kl0nc4t 0
  • Praesentia's Legality

    Praesentia's Legality

    When developing Praesentia, this question often arise: "Is it legal?"

    This project is initially meant to help UGM students, but its legality is still a concern. This project will be considered legal if it does not violate the UGM's regulations. If it is not legal, then there is no point of developing the project.

    If anyone could confirm the legality of this project or just wants to ask a question about the project, please don't hesitate to discuss it in this issue.

    documentation help wanted question 
    opened by p4kl0nc4t 0
  • Add a share feature

    Add a share feature

    Currently, Praesentia was only able to process a given QR code. I would like to propose a feature where one could share their QR code. The QR code is shared in the form of a URL, for example: https://lcat.dev/praesentia#thisIstheQRData Or, the QR data can just simply be copied to the clipboard (or maybe even an image of the QR code).

    This proposed feature will make it easier for someone to share a QR code.

    enhancement 
    opened by p4kl0nc4t 0
  • Idea: Browser (Firefox/Chromium) Extension with Google Meet Integration

    Idea: Browser (Firefox/Chromium) Extension with Google Meet Integration

    I have this little idea currently sparking in my head. Just wanted to share it here just in case someone might want to contribute or add their ideas.

    What if Praesentia was built as a browser extension that doesn't even need a server?

    I also wanted it to have some kind of integration with Google Meet (maybe Zoom too?). Integration that I meant is by automatically looking for a QR code (and scanning it if there is any) throughout the whole meeting session. If possible, I also want the extension to be cross-platform on at least Firefox and Chromium-based browsers.

    to-do 
    opened by p4kl0nc4t 0
Releases(v1.3.0)
  • v1.3.0(Feb 19, 2022)

    What's Changed

    • New feature: log in by using a session token by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/19
    • Remove excessive console.log and bump version by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/20

    Full Changelog: https://github.com/p4kl0nc4t/praesentia/compare/v1.2.1...v1.3.0

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Jan 15, 2022)

    What's Changed

    • Deploy Praesentia on Heroku by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/16
    • Fix bad logic flow in processQrImage() by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/18

    Full Changelog: https://github.com/p4kl0nc4t/praesentia/compare/v1.2.0...v1.2.1

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jan 8, 2022)

    What's Changed

    • Add share screen method by @Noth3r in https://github.com/p4kl0nc4t/praesentia/pull/11
    • Screen sharing feature UI adjustment and code refactor by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/12
    • Update version to v1.2.0 by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/13

    New Contributors

    • @Noth3r made their first contribution in https://github.com/p4kl0nc4t/praesentia/pull/11

    Full Changelog: https://github.com/p4kl0nc4t/praesentia/compare/v1.1.0...v1.2.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Dec 23, 2021)

    What's Changed

    • Add Scan QR code from clipboard by @raffifu in https://github.com/p4kl0nc4t/praesentia/pull/3
    • Remove awkward question mark and minor edit by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/7
    • Change the QR scanning library to nimiq/qr-scanner by @p4kl0nc4t in https://github.com/p4kl0nc4t/praesentia/pull/8

    New Contributors

    • @raffifu made their first contribution in https://github.com/p4kl0nc4t/praesentia/pull/3
    • @p4kl0nc4t made their first contribution in https://github.com/p4kl0nc4t/praesentia/pull/7

    Full Changelog: https://github.com/p4kl0nc4t/praesentia/compare/v1.0.0...v1.1.0

    Source code(tar.gz)
    Source code(zip)
Owner
loncat
Python isn't pseudocode.
loncat
A Classroom Engagement Platform

Project Introduction This is project introduction Setup Setting up Postgres This is the most tricky part when setting up the application. You will nee

Santosh Kumar Patro 1 Nov 18, 2021
Christmas tree on the desktop.

new-year-tree Christmas tree on the desktop. [Ссылка на статью habr]

Daniil Gorbenko 10 Dec 29, 2022
Show my read on kindle this year

Show my kindle status on GitHub

yihong 26 Jun 20, 2022
Blender Addon for Snapping a UV to a specific part of a Tilemap

UVGridSnapper A simple Blender Addon for easier texturing. A menu in the UV editor allows a square UV to be snapped to an Atlas texture, or Tilemap. P

2 Jul 17, 2022
Home Assistant integration for spanish electrical data providers (e.g., datadis)

homeassistant-edata Esta integración para Home Assistant te permite seguir de un vistazo tus consumos y máximas potencias alcanzadas. Para ello, se ap

VMG 163 Jan 05, 2023
A Snakemake workflow for standardised sc/snRNAseq analysis

single_snake_sequencing - sc/snRNAseq Snakemake Workflow A Snakemake workflow for standardised sc/snRNAseq analysis. Every single cell analysis is sli

IMS Bio2Core Facility 1 Nov 02, 2021
The Official Jaseci Code Repository

Jaseci Release Notes Version 1.2.2 Updates Added new built-ins for nodes and edges (context, info, and details) Fixed dot output Added reset command t

136 Dec 20, 2022
Site de gestion de cave à vin utilisant une BDD manipulée avec SQLite3 via Python

cave-vin Site de gestion de cave à vin utilisant une bdd manipulée avec MySQL ACCEDER AU SITE : Pour accéder à votre cave vous aurez besoin de lancer

Elouann Lucas 0 Jul 05, 2022
Replit theme sync; Github theme sync but in Replit.

This is a Replit theme sync, basically meaning that it keeps track of the current time (which may need to be edited later on), and if the time passes morning, afternoon, etc, the theme switches. The

Glitch 8 Jun 25, 2022
Script that creates graphical representations of Julia an Mandelbrot sets.

Julia and Mandelbrot Picture Maker This simple functions create simple plots of the Julia and Mandelbrot sets. The Julia set require the important par

Juan Riera Gomez 1 Jan 10, 2022
Bring A Trailer(BAT) is a popular online auction website for enthusiast cars. This traverse auction results and saves them as CSV

BaT Data Grabber Bring A Trailer(BAT) is a popular online auction website for enthusiast cars. This traverse auction results and saves them as CSV Bri

Elliot Weil 2 Oct 31, 2021
This module is for finding the execution time of a whole python program

exetime 3.8 This module is for finding the execution time of a whole program How to install $ pip install exetime Contents: General Information Instru

Saikat Das 4 Oct 18, 2021
Pymon is like nodemon but it is for python,

Pymon is like nodemon but it is for python,

Swaraj Puppalwar 2 Jun 11, 2022
Repo contains Python Code Reference to learn Python in a week, It also contains Machine Learning Algorithms and some examples for Practice, Also contains MySql, Tableau etc

DataScience_ML_and_Python Repo contains Python Code Reference to learn Python in a week, It also contains Machine Learning Algorithms and some example

Meerabo D Shah 1 Jan 17, 2022
dbt adapter for Firebolt

dbt-firebolt dbt adapter for Firebolt dbt-firebolt supports dbt 0.21 and newer Installation First, download the JDBC driver and place it wherever you'

23 Dec 14, 2022
An a simple sistem code in python

AMS OS An a simple code in python ⁕¿What is AMS OS? AMS OS is an a simple sistem code writed in python. This code helps you with the cotidian task, yo

1 Nov 10, 2021
This is some simple code to scrape vistbook's system to get an overview of the different cabins availability.

DNT_cabin_availability_system This is some simple code to scrape visbook's system to get an overview of the different cabins availability. The system

Andreas Lorentzen 1 Sep 25, 2022
Free version of Okuru selfbot, okuru.xyz

Indigo Selfbot Free OpenSource selfbot, Premium version can be found at https://okuru.xyz (5$.) Usage python[3] main.py Installation To install you ca

Dimitri Demarkus 31 Aug 07, 2022
A powerful and user-friendly binary analysis platform!

angr angr is a platform-agnostic binary analysis framework. It is brought to you by the Computer Security Lab at UC Santa Barbara, SEFCOM at Arizona S

6.3k Jan 02, 2023
A Powerful Tool For Making Combo List(All possible modes)

ComboMaker A Powerful Tool For Making Combo List Introduction Check out all possible Combo list build modes with this tool =) How to Install Open the

MasterBurnt 7 Jan 07, 2023