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
Encode stuff with ducks!

Duckify Encoder Usage Download main.py and run it. main.py has an encoded version in encoded_main.py.txt. As A Module Download the duckify folder (or

Jeremiah 2 Nov 15, 2021
Programmatic startup/shutdown of ASGI apps.

asgi-lifespan Programmatically send startup/shutdown lifespan events into ASGI applications. When used in combination with an ASGI-capable HTTP client

Florimond Manca 129 Dec 27, 2022
Scripts for BGC analysis in large MAGs and results of their application to soil metagenomes within Chernevaya Taiga RSF-funded project

Scripts for BGC analysis in large MAGs and results of their application to soil metagenomes within Chernevaya Taiga RSF-funded project

1 Dec 06, 2021
Pyjiting is a experimental Python-JIT compiler, which is the product of my undergraduate thesis

Pyjiting is a experimental Python-JIT compiler, which is the product of my undergraduate thesis. The goal is to implement a light-weight miniature general-purpose Python JIT compiler.

Lance.Moe 10 Apr 17, 2022
Banking management project using Tkinter GUI in python.

Bank-Management Banking management project using Tkinter GUI in python. Packages required Tkinter - Tkinter is the standard GUI library for Python. sq

Anjali Kumawat 7 Jul 03, 2022
🎉 🎉 PyComp - Java Code compiler written in python.

🎉 🎉 PyComp Java Code compiler written in python. This is yet another compiler meant for babcock students project which was created using pure python

Alumona Benaiah 5 Nov 30, 2022
Simulation simplifiée du fonctionnement du protocole RIP

ProjetRIPlay v2 Simulation simplifiée du fonctionnement du protocole RIP par Eric Buonocore le 18/01/2022 Sur la base de l'exercice 5 du sujet zéro du

Eric Buonocore 2 Feb 15, 2022
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
An html wrapper for python

MessySoup What is it? MessySoup is a python wrapper for html elements. While still a ways away, the main goal is to be able to build a wesbite straigh

4 Jan 05, 2022
Code for ML, domain generation, graph generation of ABC dataset

This is the repository for codes for ML, domain generation, graph generation of Asymmetric Buckling Columns (ABC) dataset in the paper "Learning Mechanically Driven Emergent Behavior with Message Pas

Peerasait Prachaseree (Jeffrey) 0 Jan 28, 2022
Extremely unfinished animation toolset for Blender 3.

AbraTools Alpha IMPORTANT: Code is a mess. Be careful using it in production. Bug reports, feature requests and PRs are appreciated. Download AbraTool

Abra 15 Dec 17, 2022
A tool to help calculate how to split conveyors in Satisfactory into specific ratios.

Satisfactory Splitter Calculator A tool to help calculate how to split conveyors in Satisfactory into specific ratios. Dependencies Python 3.9 PyYAML

RobotiCat 5 Dec 22, 2022
msImpersonate - User account impersonation written in pure Python3

msImpersonate v1.0 msImpersonate is a Python-native user impersonation tool that is capable of impersonating local or network user accounts with valid

Joe Helle 90 Dec 16, 2022
This repository contains Python games that I've worked on. You'll learn how to create python games with AI. I try to focus on creating board games without GUI in Jupyter-notebook.

92_Python_Games 🎮 Introduction 👋 This repository contains Python games that I've worked on. You'll learn how to create python games with AI. I try t

Milaan Parmar / Милан пармар / _米兰 帕尔马 166 Jan 01, 2023
Solves Maths24 problems for you!

maths24-solver Solves Maths24 problems for you! Enjoy this open scource project! You can edit modify and share! My wishes is for you to use this proje

6 Nov 07, 2021
This script can be used to get unlimited Gb for WARP.

Warp-Unlimited-GB This script can be used to get unlimited Gb for WARP. How to use Change the value of the 'referrer' to warp id of yours You can down

Anix Sam Saji 1 Feb 14, 2022
Live tracking, flight database and competition framework

SkyLines SkyLines is a web platform where pilots can share their flights with others after, or even during flight via live tracking. SkyLines is a sor

SkyLines 367 Dec 27, 2022
Ergonomic option parser on top of dataclasses, inspired by structopt.

oppapī Ergonomic option parser on top of dataclasses, inspired by structopt. Usage from typing import Optional from oppapi import from_args, oppapi @

yukinarit 4 Jul 19, 2022
Contains a Jupyter Notebook for calculating remaining plants required based on field/lathhouse data.

Davis-Sunflowers-Su21 Project goals: Plants influence their reproduction and mating system in many ways. Various factors such as time of flowering, ab

1 Feb 10, 2022
MDAnalysis tool to calculate membrane curvature.

The MDAkit for membrane curvature analysis is part of the Google Summer of Code program and it is linked to a Code of Conduct.

MDAnalysis 19 Oct 20, 2022