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
This is a practice on Airflow, which is building virtual env, installing Airflow and constructing data pipeline (DAGs)

airflow-test This is a practice on Airflow, which is Builing virtualbox env and setting Airflow on that env Installing Airflow using python virtual en

Jaeyoung 1 Nov 01, 2021
Simple calculator made in python

calculator Uma alculadora simples feita em python CMD, PowerShell, Bash ✔️ Início 💻 apt-get update apt-get upgrade -y apt-get install python git git

Spyware 8 Dec 28, 2021
Datamol is a python library to work with molecules.

Datamol is a python library to work with molecules. It's a layer built on top of RDKit and aims to be as light as possible.

datamol 276 Dec 19, 2022
Multitrack exporter for OP-Z

Underbridge for OP-Z Multitrack exporter Description Exports patterns and projects individual audio tracks to seperate folders for use in your DAW. Py

Thomas Herrmann 71 Dec 25, 2022
Prop-based map editor for the Apex Legends mod, R5Reloaded

R5R Map Editor A tool to build maps out of props in the Apex Legends mod, R5Reloaded Instuctions Install R5R Download this program Get the prop spawne

7 Dec 16, 2022
200 LeetCode problems

LeetCode I classify 200 leetcode problems into some categories and upload my code to who concern WEEK 1 # Title Difficulty Array 15 3Sum Medium 1324 P

Hoang Cao Bao 108 Dec 08, 2022
A joke conlang with minimal semantics

SyntaxLang Reserved Defined Words Word Function fo Terminates a noun phrase or verb phrase tu Converts an adjective block or sentence to a noun to Ter

Leo Treloar 1 Dec 07, 2021
For my Philips Airpurifier AC3259/10

Philips-Airpurifier For my Philips Airpurifier AC3259/10 I will try to keep this code

AcidSleeper 7 Feb 26, 2022
This library is an ongoing effort towards bringing the data exchanging ability between Java/Scala and Python

PyJava This library is an ongoing effort towards bringing the data exchanging ability between Java/Scala and Python

Byzer 6 Oct 17, 2022
A person does not exist image bot

A person does not exist image bot

Fayas Noushad 3 Dec 12, 2021
Discovering local read-level DNA methylation patterns and DNA methylation heterogeneity in intermediately methylated regions

Discovering local read-level DNA methylation patterns and DNA methylation heterogeneity in intermediately methylated regions

1 Jan 11, 2022
Clackety Keyboards Powered by Python

KMK: Clackety Keyboards Powered by Python KMK is a feature-rich and beginner-friendly firmware for computer keyboards written and configured in Circui

KMK Firmware 780 Jan 03, 2023
The most hackable keyboard in all the land

MiRage Modular Keyboard © 2021 Zack Freedman of Voidstar Lab Licensed Creative Commons 4.0 Attribution Noncommercial Share-Alike The MiRage is a 60% o

Zack Freedman 558 Dec 30, 2022
A subleq VM/interpreter created by me for no reason

What is Dumbleq? Dumbleq is a dumb Subleq VM/interpreter implementation created by me for absolutely no reason at all. What is Subleq? If you haven't

Phu Minh 2 Nov 13, 2022
A python package for batch import of resume attachments to be parsed in HrFlow.

HrFlow Importer Description A python package for batch import of resume attachments to be parsed in HrFlow. hrflow-importer is an open-source project

HrFlow.ai (ex: Riminder.net) 3 Nov 15, 2022
Snek-test - An operating system kernel made in python and assembly

pythonOS An operating system kernel made in python and assembly Wait what? It us

TechStudent10 2 Jan 25, 2022
My Dotfiles of Arco Linux

Arco-DotFiles My Dotfiles of Arco Linux Apps Used Htop LightDM lightdm-webkit2-greeter Alacritty Qtile Cava Spotify nitrogen neofetch Spicetify Thunar

$BlueDev5 6 Dec 11, 2022
Render to print for blender 2.9+

render_to_print_blender_addon ** render2print: Blender AddOn for Blender 2.90.0+ ** Calculates camera parameters to allow printing a rendered image to

5 Nov 19, 2021
Cobalt Strike Sleep Python Bridge

This project is 'bridge' between the sleep and python language. It allows the control of a Cobalt Strike teamserver through python without the need for for the standard GUI client. NOTE: This project

Cobalt Strike 140 Jan 04, 2023
Delayed iteration for polling and retries.

Does Python need yet another retry / poll library? It needs at least one that isn't coupled to decorators and functions. Decorators prevent the caller

A. Coady 22 Dec 29, 2022