Git Product home page Git Product logo

douly20 / slotnotifier Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 554 KB

An easy to use chrome extension to find & notify the available Vaccine slots on CoWin, once they are available in your area.

License: MIT License

JavaScript 70.13% CSS 15.74% HTML 14.13%
vaccine-tracker vaccine-slot-tracker vaccine-availability cowin-vaccine-tracker cowin-notifier cowin-alerts chrome-extension chrome-api desktop-notifications cowin

slotnotifier's Introduction

CoWin Vaccine Slot Notifier

icon

It is a chrome extension which can simplify your vaccine slot hunt, and notify you via desktop notifications (and a ringtone ..tada ๐Ÿ˜›) once they are available.

Features

  • Search vaccines by your pin code.
  • Get desktop notifications when vaccines slots are available
  • Get updated data for slots every 1-minute.
  • Find vaccines even after shutting down your chrome, once extension has been set to check.

Installation

Download the code as .zip file from the latest release and extract into your folder.

Open your chrome extensions page from chrome://extensions/
You can open it alternatively by going to Chrome settings -> More Tools -> Extensions

On the right top corner turn on the developer mode (yayy ๐Ÿ˜)

Out of three tabs displayed in the bottom tray , click Load unpacked.

Now choose your destination path as the folder where you have cloned/downloaded the SlotNotifier repository.

That's it.!! ๐Ÿ‘

You have installed the extension and you should be able to see it in your extensions page.

(Note: Since this is an unpublished extension , it can be used only in developer mode. Try it on your own risk)

Usage

Open the extension. In the pop up box you can put the pin code of the area for which you wish to check the slots. Click on Submit.

Create screen

The script for checking the slots has been triggered. It will keep on running in background checking the slots ..while you can continue sipping your coffee ๐Ÿ˜›

View screen

You will get notifications when slots in your area are available.

You can open the extension anytime and check the current pincode for which slots are being checked. Also, you have the option to stop the script anytime you wish.

These are desktop notifications,so even when you are using other apps on your system,you will receive them.If you are using Windows, you can also access them from your system tray.

Notifications In Windows

Windows notification

Notifications In Linux

Ubuntu notification

If you like the concept, please not only clone it, but also star mark โญ the repository as it motivates us to do better everyday


Technical Details

Now as I have your attention, since you have scrolled this far..I assume you would be interested in knowing how this extension written in Javscript works. For the people already familiar with the development of chrome extension & chrome apis ..thats not hard to figure out. For the newbies I can explain in detail. Since this is a chrome extension , I have exploited few APIs provided by chrome for serving our purpose.

Storage Api

Since we needed to store the user information so that the background script can keep on picking that data.Also, when user opens the extension to check the running status, we needed to show the previously entered information.We have utilised the chrome local storage for this. Chrome provides an api to store and retreive data on local storage.They can be used in the following manner:

 chrome.storage.local.set({ 'userData': data }, () => {
        if (chrome.runtime.lastError)
            console.log('Error setting');
        console.log('Stored name: ' , data);
    });

Alarms Api

The alarms api is at the heart of the background running script. The prime requirement was to have the slot checking script triggered every once in a while.With async await this could have been done but only till the user kept the extension open. Other alternative was to mark the background script as persistent. Marking a script persitent means the script would keep on running in the background forever consuming resources all the time.It is generally not advised to use a persistent background script. The alarms api can set trigger for your background script. You can add an event handler that can handle the alarm event, and further process your background task.

 chrome.alarms.create('vaccineSlots', { periodInMinutes: 1 });
 chrome.alarms.onAlarm.addListener((alarm) => {
    if(alarm.name === 'vaccineSlots') {
        getUserDataFromLocalStorage().then((data)=> {
            if(data) {
                getVaccineSlots(data);
            } else {
                console.log('No pin code saved');
            }
        });
    }  
});

NOTE

This extension is made solely for the puprpose of learning & the author does not endorse in any form automating monitoring task.The author should not be held responsible for any legal issue if ever. Please use it at your own risk.


slotnotifier's People

Contributors

coder-nobody avatar douly20 avatar pushpakb3096 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

slotnotifier's Issues

Validation issue fix for pincode input

Validation should be properly handled while submitting the data to SlotNotifier.

The Submit button should be disabled till a valid pincode is entered. Once user inputs a valid pincode of 6 digits, the Submit button should be enabled and the user should be able to submit data

Search vaccine slots by district

User should be given an option to search vaccine slots either through pincode or by District.The feature to search slots by pincode needs to be introduced.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.