Class HTML::Pipeline::CamoFilter
In: lib/html/pipeline/camo_filter.rb
Parent: Filter

HTML Filter for replacing http image URLs with camo versions. See:

github.com/atmos/camo

All images provided in user content should be run through this filter so that http image sources do not cause mixed-content warnings in browser clients.

Context options:

  :asset_proxy (required) - Base URL for constructed asset proxy URLs.
  :asset_proxy_secret_key (required) - The shared secret used to encode URLs.
  :asset_proxy_whitelist - Array of host Strings or Regexps to skip
                           src rewriting.

This filter does not write additional information to the context.

Methods

Public Instance methods

Private: Return true if asset proxy filter should be enabled

Private: the host to use for generated asset proxied URLs.

The camouflaged URL for a given image URL.

Private: calculate the HMAC digest for a image source URL.

Hijacks images in the markup provided, replacing them with URLs that go through the github asset proxy.

Private: helper to hexencode a string. Each byte ends up encoded into two characters, zero padded value in the range [0-9a-f].

Implementation of validate hook. Errors should raise exceptions or use an existing validator.

[Validate]