forked from OpenNeo/impress
camo the emotes on the campaign show page
This commit is contained in:
parent
5d2c226357
commit
4a18f22571
3 changed files with 20 additions and 2 deletions
|
@ -214,5 +214,19 @@ module ApplicationHelper
|
||||||
:contributions_link_url => user_contributions_path(user),
|
:contributions_link_url => user_contributions_path(user),
|
||||||
:user_points => user.points
|
:user_points => user.points
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def camo_image_url(image_url)
|
||||||
|
if CAMO_KEY
|
||||||
|
hexdigest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), CAMO_KEY, image_url)
|
||||||
|
uri = Addressable::URI.parse("#{CAMO_HOST}/#{hexdigest}")
|
||||||
|
uri.query_values = { 'url' => image_url, 'repo' => '', 'path' => '' }
|
||||||
|
uri.to_s
|
||||||
|
else
|
||||||
|
uri = Addressable::URI.parse(image_url)
|
||||||
|
query_values = uri.query_values || {}
|
||||||
|
uri.query_values = query_values.merge(NO_CAMO_CONFIG: nil)
|
||||||
|
uri.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
However, there are a few important bits of legal whatnot to keep in mind.
|
However, there are a few important bits of legal whatnot to keep in mind.
|
||||||
(Mostly, it's the list of things that we expect to do but in no legally
|
(Mostly, it's the list of things that we expect to do but in no legally
|
||||||
binding way promise to do. Just in case
|
binding way promise to do. Just in case
|
||||||
<img src="http://images.neopets.com/neoboards/smilies/tongue.gif" />)
|
<img src="#{camo_image_url 'http://images.neopets.com/neoboards/smilies/tongue.gif'}" />)
|
||||||
|
|
||||||
Featuring your outfit is a thank-you gift that we like to give our donors;
|
Featuring your outfit is a thank-you gift that we like to give our donors;
|
||||||
it is *not* a purchased service. We make no guarantee that we'll post your
|
it is *not* a purchased service. We make no guarantee that we'll post your
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
Posting an obscene outfit then requesting a refund once we take it down is
|
Posting an obscene outfit then requesting a refund once we take it down is
|
||||||
*not* acting in good faith, and we don't want our refund policy to
|
*not* acting in good faith, and we don't want our refund policy to
|
||||||
encourage that behavior
|
encourage that behavior
|
||||||
<img src="http://images.neopets.com/neoboards/smilies/tongue.gif" />
|
<img src="#{camo_image_url 'http://images.neopets.com/neoboards/smilies/tongue.gif'}" />
|
||||||
We determine "good faith" at our sole discretion—not limited to those
|
We determine "good faith" at our sole discretion—not limited to those
|
||||||
examples—but we're generally pretty understanding.)
|
examples—but we're generally pretty understanding.)
|
||||||
|
|
||||||
|
|
4
config/initializers/camo.rb
Normal file
4
config/initializers/camo.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# For the openneo-camo.herokuapps.com server, which proxies assets through HTTPS.
|
||||||
|
# If you have no config, that's okay; we'll just serve the regular URL instead of the Camo URL.
|
||||||
|
CAMO_HOST = ENV['CAMO_HOST']
|
||||||
|
CAMO_KEY = ENV['CAMO_KEY']
|
Loading…
Reference in a new issue