iceburn 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/iceburn/filters.rb +10 -8
- data/lib/iceburn/railtie.rb +5 -0
- data/lib/iceburn/version.rb +1 -1
- data/lib/iceburn/whitelist.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a79b92788b7e450df00428879d8d7dd0ca3e167b
|
4
|
+
data.tar.gz: 6be5570ba58214811d2f6de1a24054611e741e59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75d359fc1d953c7cb4d02861436ab11cf6cc3bae559434e6cc31c855cefd2aacc120a6e82f71c79538536e5e5dc384666424f7a2de3bd3223ada3c08cd8f4996
|
7
|
+
data.tar.gz: 9597602fbc7fc5bfb8cf3f45cfa126f7b874f03f8d610dfba4a14ac72f318836b3ab8e163b4821c36df8a45084e46decb1f533c0493f465517ea1f7bf3629323
|
data/Gemfile.lock
CHANGED
data/lib/iceburn/filters.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
|
-
require 'iceburn/whitelist'
|
2
|
-
|
3
1
|
# The before_filter used to handle HTML requests that aren't caught by
|
4
|
-
# the main application routes.
|
2
|
+
# the main application routes. Can also be used in conjunction with
|
3
|
+
# Iceburn::Whitelist.
|
5
4
|
|
6
5
|
module Iceburn
|
7
6
|
module Filters
|
8
|
-
include Whitelist
|
9
|
-
|
10
7
|
# Return blank on all requests to the root path.
|
11
8
|
def index
|
12
9
|
handle_html_requests
|
@@ -14,15 +11,20 @@ module Iceburn
|
|
14
11
|
|
15
12
|
protected
|
16
13
|
def handle_html_requests
|
17
|
-
|
18
|
-
return if request.xhr?
|
19
|
-
render text: '', layout: 'application' and return # block the rest of the chain
|
14
|
+
render text: '', layout: 'application' and return unless skip?
|
20
15
|
end
|
21
16
|
|
22
17
|
private
|
18
|
+
def skip?
|
19
|
+
json_request? || xhr_request? || whitelisted?
|
20
|
+
end
|
23
21
|
|
24
22
|
def json_request?
|
25
23
|
"#{params[:format]}" == 'json'
|
26
24
|
end
|
25
|
+
|
26
|
+
def xhr_request?
|
27
|
+
request.xhr?
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
data/lib/iceburn/railtie.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
+
require 'iceburn/filters'
|
2
|
+
require 'iceburn/routes'
|
3
|
+
require 'iceburn/whitelist'
|
4
|
+
|
1
5
|
module Iceburn
|
2
6
|
# Hook into Rails.
|
3
7
|
class Railtie < Rails::Railtie
|
4
8
|
initializer 'iceburn.add_filters' do
|
5
9
|
ActionController::Base.class_eval do
|
10
|
+
include Iceburn::Whitelist
|
6
11
|
include Iceburn::Filters
|
7
12
|
end
|
8
13
|
end
|
data/lib/iceburn/version.rb
CHANGED
data/lib/iceburn/whitelist.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iceburn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Scott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|