Git Product home page Git Product logo

ical-filter-proxy's Introduction

ical-filter-proxy

Build Status

Got an iCal feed full of nonsense that you don't need? Does your calendar client have piss-poor filtering options (looking at your Google Calendar)?

Use ical-filter-proxy to (you guessed it) proxy and filter your iCal feed. Define your source calendar and filtering options in config.yml and you're good to go.

In addition, display alarms can be created or cleared.

Configuration

my_calendar_name:
   ical_url: https://source-calendar.com/my_calendar.ics # Source calendar
   api_key: myapikey # (optional) append ?key=myapikey to your URL to grant access
   timezone: Europe/London # (optional) ensure all time comparisons are done in this TZ
   rules:
      - field: start_time # start_time and end_time supported
        operator: not-equals # equals and not-equals supported
        val: "09:00" # A time in 24hour format, zero-padded
      - field: summary # summary and description supported
        operator: startswith # (not-)startswith, (not-)equals and (not-)includes supported
        val: # array of values also supported
          - Planning
          - Daily Standup
      - field: summary # summary and description supported
        operator: matches # match against regex pattern
        val: # array of values also supported
          - '/Team A/i'
   alarms: # (optional) create/clear alarms for filtered events
     clear_existing: true # (optional) if true, existing alarms will be removed, default: false 
     triggers: # (optional) triggers for new alarms. Description will be the alarm summary, action is 'DISPLAY'
       - '-P1DT0H0M0S' # iso8061 supported
       - 2 days # supports full day[s], hour[s], minute[s], no combination in one trigger

Variable substitution

It might be useful to inject configuration values as environment variable.
Variables are substituted if they begin with ICAL_FILTER_PROXY_<value> and are defined in the configuration like ${ICAL_FILTER_PROXY_<value>}.

Example:

  api_key: ${ICAL_FILTER_PROXY_API_KEY}

If a placeholder is defined but environment variable is missing, it is substituted with an empty string!

Additional Rules

At the moment rules are pretty simple, supporting only start times, end times, equals and not-equals as that satisfies my use case. To add support for additional rules please extend lib/ical_filter_proxy/filter_rule.rb. Pull requests welcome.

Installing/Running

After you've created a config.yml simply bundle and run rackup.

bundle install
bundle exec rackup -p 8000

Voila! Your calendar will now be available at http://localhost:8000/my_calendar_name?key=myapikey.

I'd recommend running it behind something like nginx, but you can do what you like.

Docker

Create a config.yml as shown above.

docker build -t ical-filter-proxy .
docker run -d --name ical-filter-proxy -v $(pwd)/config.yml:/app/config.yml -p 8000:8000 ical-filter-proxy

Lambda

ical-filter-proxy can be run as an AWS Lambda process using their API Gateway.

Create a new API Gateway in the AWS Console and link to to a new Lambda process. This should create all of the permissions required in AWS land.

Next we need to package the app up ready for Lambda. First of all, craft your config.yml and place it in the root of the source directory. A handy rake task is included which will fetch any dependencies and zip them up ready to be uploaded.

bundle exec rake lamba:build

This task will output the file ical-filter-proxy.zip. Note that you must have the zip utility installed locally to use this task.

When prompted during the Lambda setup, provide this zip file and set the handler to lambda.handle.

That's it! Your calendar should now be available at https://aws-api-gateway-host/default/gateway_name?calendar=my_calendar_name&key=my_api_key

ical-filter-proxy's People

Contributors

darkphnx avatar dependabot[bot] avatar johnbhall avatar odin568 avatar crazypython avatar

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.