Skip to content

Latest commit

 

History

History
241 lines (191 loc) · 11.1 KB

README.md

File metadata and controls

241 lines (191 loc) · 11.1 KB

Contributors Forks Stargazers Issues MIT License


PJAIT Class Schedule Sync

Sync your calendar with PJAIT's schedule

Run on Google Cloud
For help with the deployment see Deploy to Google Cloud Platform (GCP) section

Table of Contents
  1. About The Project
  2. Deploy to Google Cloud Platform (GCP) section
  3. Setup
  4. Options
  5. Contributing
  6. License
  7. Contact

About The Project

PJAIT's schedule page allows only to download the schedule in iCal format, but doesn't offer periodical syncing and integration with calendar apps. This project aims to solve this by creating a simple proxy that stands between the calendar apps and the PJAIT's page.
It logs you in, downloads the schedule in iCal format, fixes the format (as the exported file doesn't confront to iCal's specification hence eg. Apple Calendar on the iPhone doesn't want to sync it) as well as the issue with offsetted events in the day the time changes.

(back to top)

Deploy to Google Cloud Platform (GCP)

  1. Log in to your Google Account
  2. Go to https://console.cloud.google.com/projectcreate to create a project (You can leave all of the settings default)
  3. Set up billing account on GCP https://console.cloud.google.com/billing/create
    IMPORTANT! The GCP has a free tier for the Cloud Run functions which we'll be using. This application will definitely not exceed this tier.
    NOTE: This software and guide are provided "as is", without warranty of any kind.
  4. Click on the button below and follow the instructions. This process can take up to a few minutes.
  1. Add the calendar subscription to your calendar app of choice. The url for the subscription will be presented in GCP as

    [ ✓ ] Your application is now live here:
            https://pjatk-ical-sync-abcdefghi.a.run.app
    

    For additional options to this endpoint please see the Options section

(back to top)

Setup

This project is fully dockerized and can be deployed in the matter of minutes. The Docker section describes how to do it.

Alternatively you can run the whole app on the host. This is described in the Host section.

Docker

Prerequisites

Name Earliest tested version
Docker 20.0

Usage

  1. Create a .env file in the following format
USERNAME="USERNAME" # Your PJAIT username (sXXXXX)
PASSWORD="PASSWORD" # Your PJAIT password
CALENDAR_PASSWORD="CALENDAR_PASSWORD" # Password for the subscription endpoint. Set only if you want to have it
  1. Duplicate and rename docker-compose.local.yml to docker-compose.yml and adjust it to your needs.

  2. Run docker-compose up (please note that the app has to be constantly running and be available for the sync to be working)

  3. Add the calendar subscription to your calendar app of choice. The url for the subscription is http://localhost:3000. For additional options to this endpoint please see the Options section

    For additional options to this endpoint please see the Options section

(back to top)

Host

Prerequisites

Name Earliest tested version
Node 16.14.0
Yarn 1.22.17
  1. Install the npm dependencies
yarn install
  1. Create a .env file in the following format
USERNAME="USERNAME" # Your PJAIT username (sXXXXX)
PASSWORD="PASSWORD" # Your PJAIT password
CALENDAR_PASSWORD="CALENDAR_PASSWORD" # Password for the subscription endpoint. Set only if you want to have it
  1. Build the app using
yarn build
  1. Start the app using
yarn start
  1. Add the calendar subscription to your calendar app of choice. The url for the subscription is http://localhost:3000. For additional options to this endpoint please see the Options section.

(back to top)

Options

The subscription endpoint accepts the following query parameters (so you can call the endpoint with eg. http://localhost:3000/?password=CALENDAR_PASSWORD&from=2020-01-01)

Option Description Type Default value
from Specifies the start date from which the data from PJAIT schedule page will be downloaded. Date string in format YYYY-MM-DD One year back
to Specifies the end date to which the data from PJAIT schedule page will be downloaded. Date string in format YYYY-MM-DD One year forward
password Used when CALENDAR_PASSWORD variable is set. Needed for authentication to the endpoint. String Empty

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development

The project is build using TypeScript hence needs the transpilation to JavaScript to be able to be run using Node.js. The yarn dev command runs the esbuild in a watch mode and starts the app with node using nodemon which provides automatic restarts when the files change.

(back to top)

License

Distributed under the MIT License. See LICENSE.md for more information.

(back to top)

Contact

Bartek Legięć - @bibix1999 - legiec.io

Project Link: https://github.com/bibixx/pjatk-ical-sync

(back to top)