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
The purpose of this tool is to check RDP capabilities of a user on specific targets.

RDPChecker The purpose of this tool is to check RDP capabilities of a user on specific targets. Programming concept was taken from RDPassSpray and thu

Hypnoze57 57 Aug 04, 2022
A basic python project which replicates the functionalities on an 8 Ball.

Magic-8-Ball To the people who wish to make decisions using a Magic 8 Ball but can't get one? I gotchu. This is a basic python project which replicate

3 Jun 24, 2021
take home quiz

guess the correlation data inspection a pretty normal distribution train/val/test split splitting amount .dataset: 150000 instances ├─8

HR Wu 1 Nov 04, 2021
Code for the manim-generated scenes used in 3blue1brown videos

This project contains the code used to generate the explanatory math videos found on 3Blue1Brown. This almost entirely consists of scenes generated us

Grant Sanderson 4.1k Jan 02, 2023
An early stage integration of Hotwire Turbo with Django

Note: This is not ready for production. APIs likely to change dramatically. Please drop by our Slack channel to discuss!

Hotwire for Django 352 Jan 06, 2023
The RAP community of practice includes all analysts and data scientists who are interested in adopting the working practices included in reproducible analytical pipelines (RAP) at NHS Digital.

The RAP community of practice includes all analysts and data scientists who are interested in adopting the working practices included in reproducible analytical pipelines (RAP) at NHS Digital.

NHS Digital 50 Dec 22, 2022
Nuclei - Burp Extension allows to run nuclei scanner directly from burp and transforms json results into the issues

Nuclei - Burp Extension Simple extension that allows to run nuclei scanner directly from burp and transforms json results into the issues. Installatio

106 Dec 22, 2022
pythonOS: An operating system kernel made in python and assembly

pythonOS An operating system kernel made in python and assembly Wait what? It uses a custom compiler called snek that implements a part of python3.9 (

Abbix 69 Dec 23, 2022
This an Anki add on that automatically converts Notion notes into Anki flash cards. Currently in development!

NotionFlash This is an Anki add on in development that will allow automatically convert your Notion study notes into Anki flash cards. The Anki deck c

Neeraj Patel 10 Oct 07, 2022
The Official interpreter for the Pix programming language.

The official interpreter for the Pix programming language. Pix Pix is a programming language dedicated to readable syntax and usability Q) Is Pix the

Pix 6 Sep 25, 2022
Terrible python code from the "bubble that breaks maths" video.

Terrible python code from the "bubble that breaks maths" video.

Stand-up Maths 12 Oct 25, 2022
A modern message based async agent framework

Munggoggo A modern message based async agent framework An asyncio based agent platform written in Python and based on RabbitMQ. Agents are isolated pr

24 Dec 28, 2022
Script to automate the scanning of "old printed photos"

photoscanner Script to automate the scanning of "old printed photos" Just run: ./scan_photos.py The script is prepared to be run by fades. Otherw

Facundo Batista 2 Jan 21, 2022
Aesthetic NFT Generator

A E S T H E T I C Dependencies Pillow numpy OpenCV You can use pip to install any missing dependencies. Basic Usage Vaporwave artwork can be generated

Mentor Elezi 4 Mar 13, 2022
A python package that adds "docs" command to disnake

About This extension's purpose is of adding a "docs" command, its purpose is to help documenting in chat. How To Load It from disnake.ext import comma

7 Jan 03, 2023
Includes Chapters for Python Crash Course session.

python-crash-course Includes Chapters for Python Crash Course session. What will you learn: Python Essentials Creating Server Writing REST API Writing

Vineet Rao 3 Feb 17, 2021
A python program to detect rickrolls with just the youtube link.

rickroll_detector A python program to detect rickrolls with just the youtube link. Usage: clone this repo or download zip run the main.py file with py

Tricky 4 Nov 06, 2022
Easytile blender - Simple Blender 2.83 addon for tiling meshes easily

easytile_blender Dead simple, barebones Blender (2.83) addon for placing meshes as tiles. Installation In Blender, go to Edit Preferences Add-ons

Sam Gibson 6 Jul 19, 2022
A small project of two newbies, who wanted to learn something about Python language programming, via fun way.

HaveFun A small project of two newbies, who wanted to learn something about Python language programming, via fun way. What's this project about? Well.

Patryk Sobczak 2 Nov 24, 2021
MindF**k it's a programming language as BrainFuck, but with some cool features.

MindF**k Description MindF**k it's a programming language as BrainFuck, but with some cool features. Symbol What does symbol mean Next slot Previo

tixcode 0 Jun 15, 2022