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 tool to allow New World players to calculate the best place to put their Attribute Points for their build and level

New World Damage Simulator A tool designed to take a characters base stats including armor and weapons, level, and base damage of their items (slash d

Joseph P Langford 31 Nov 1, 2022
A Python application that helps users determine their calorie intake, and automatically generates customized weekly meal and workout plans based on metrics computed using their physical parameters

A Python application that helps users determine their calorie intake, and automatically generates customized weekly meal and workout plans based on metrics computed using their physical parameters

Anam Iqbal 1 Jan 13, 2022
A web-based chat application that enables multiple users to interact with one another

A web-based chat application that enables multiple users to interact with one another, in the same chat room or different ones according to their choosing.

null 3 Apr 22, 2022
This repository containing cross-section cut and fill calculations using Python programming language.

cross-section This repository is containing cut and fill calculations for cross-section using Python programming language. This codes is made to calcu

null 3 Jun 15, 2022
Connect Playground - easy way to fill in your account with production-like objects

Just set of scripts to initialise accpunt with production-like data: A - Basic Distributor Account Initialization INPUT Distributor Account Token ACTI

CloudBlue 5 Jun 25, 2021
Academic planner application designed for students and counselors.

Academic planner application designed for students and counselors.

Ali bagheri 2 Dec 31, 2021
This is a simple python script for checking A/L Examination results of srilankan students

AL-Result-Checker This is a simple python script for checking A/L Examination results of srilankan students INSTALLATION [Termux] [Linux] : apt-get up

Razor Kenway 8 Oct 24, 2022
Developed a website to analyze and generate report of students based on the curriculum that represents student’s academic performance.

Developed a website to analyze and generate report of students based on the curriculum that represents student’s academic performance. We have developed the system such that, it will automatically parse data onto the database from excel file, which will in return reduce time consumption of analysis of data.

VIJETA CHAVHAN 3 Nov 8, 2022
Easily map device and application controls to a midi controller

pymidicontroller Introduction Easily map device and application controls to a midi controller

Tane Barriball 24 May 16, 2022
This application demonstrates IoTVAS device discovery and security assessment API integration with the Rapid7 InsightVM.

Introduction This repository hosts a sample application that demonstrates integrating Firmalyzer's IoTVAS API with the Rapid7 InsightVM platform. This

Firmalyzer BV 4 Nov 9, 2022
Advanced python code - For students in my advanced python class

advanced_python_code For students in my advanced python class Week Topic Recordi

Ariel Avshalom 3 May 27, 2022
A web UI for managing your 351ELEC device ROMs.

351ELEC WebUI A web UI for managing your 351ELEC device ROMs. Requirements Python 3 or Python 2.7 are required. If the ftfy package is installed, it w

Ben Phelps 5 Sep 26, 2022
An app to automatically take attendance by scanning students' bar coded ID card as they enter the classroom.

Auto Classroom Attendance This application may be run on a PC to automatically scan students' ID card using a generic bar code scanner and output the

null 1 Nov 10, 2021
An educational platform for students

Watch N Learn About Watch N Learn is an educational platform for students. Watch N Learn incentivizes students to learn with fun activities and reward

Brian Law 3 May 4, 2022
A project to empower needy-students.

Happy Project ?? A project to empower needy-students. Happy Project is a non-profit initiation founded by IT people from Jaffna, Sri Lanka. This is to

null 1 Mar 14, 2022
Tools for teachers and students using nng (Natural Number Game)

nngtools Usage Place your nngsave.json to the directory in which you want to extract the level files. Place nngmap.json on the same directory. Run nng

Thanos Tsouanas 1 Dec 12, 2021
AIO solution for SSIS students

ssis.bit AIO solution for SSIS students Hardware CircuitPython supports more than 200 different boards. Locally available is the TTGO T8 ESP32-S2 ST77

null 3 Jun 5, 2022
Simple utlity for sniffing decrypted HTTP/HTTPS traffic on a jailbroken iOS device into an HAR format.

Description iOS devices contain a hidden feature for sniffing decrypted HTTP/HTTPS traffic from all processes using the CFNetwork framework into an HA

null 83 Dec 25, 2022