Censorstrike

Censorstrike is a simple Rack Middleware that looks for a certain time window and then short-circuits your application to display a protest message. It was created to make it easy to "go on strike" for the Reddit-led January 18 protest against SOPA and PIPA.

Usage

Simply add the gem to your Gemfile:

gem 'censorstrike'

And then add it as a Rack Middleware in your application. For Rails apps you can create an initializer config/initializers/censorstrike.rb:

Rails.application.config.middleware.use Censorstrike::Middleware

For other Rack apps, you can just use the middleware:

use Censorstrike::Middleware

Configuration

By default you don't need to supply any arguments and this message will be displayed on January 18 from 8:00am EST to 8:00pm EST. However, you can customize the middleware by passing options like so:

use Censorstrike::Middleware,
  :begin => Time.now, # when to start the blackout
  :end => (Time.now + 500), # when to end the blackout
  :message => "My HTML", # custom HTML message
  :file => "/path/to/my/file" # custom HTML file message,
  :footer => "<p>My custom footer</p>" # a custom footer

License

Copyright (c) 2012 Intridea, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.