deflectable 0.2.4 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -7
- data/lib/deflectable/version.rb +2 -2
- data/lib/deflectable/watcher.rb +1 -1
- data/lib/generators/deflectable/install_generator.rb +13 -0
- data/lib/generators/deflectable/templates/403.html +57 -0
- data/lib/generators/deflectable/templates/deflectable.yml +7 -0
- data/test/dummy/config/deflectable.yml +7 -0
- data/test/dummy/public/403.html +4 -5
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31fc88c369571805b7f60abcf04e748a3ae02d55
|
4
|
+
data.tar.gz: 460b80af74858b9b19d7c6e286231b7df1de9e85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 174d85bef6a21be23f48aab6361a01e39507ab913ccb2685ce6fadc99553e4712dc886e747569069fefb102170ed9e9eee58c4c46fc73deb435ab2a1aac163de
|
7
|
+
data.tar.gz: 44c2a299a3ad2613f05f3234b60e0b83c46fe515038e2313b62e4dd2d8e6cf77f8c4b51d239e539dda43cbe85da9f266f89515758ece99f34476558dd9407f1f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# deflectable
|
2
2
|
|
3
|
-
RailsアプリにIP制限 (
|
3
|
+
RailsアプリにIP制限 (ブラックリスト、ホワイトリスト)を適用
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -22,21 +22,18 @@ Or install it yourself as:
|
|
22
22
|
### Configure
|
23
23
|
|
24
24
|
```bash
|
25
|
-
# TODO:
|
26
|
-
# Not Yet implement
|
27
25
|
$ rails generate deflectable:install
|
28
26
|
```
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
In public/403.html
|
28
|
+
* generated 'config/deflectable.yml'
|
29
|
+
* generated 'public/403.html'
|
33
30
|
|
34
31
|
### Modified config.ru
|
35
32
|
|
36
33
|
```ruby
|
37
34
|
# config.ru
|
38
35
|
|
39
|
-
|
36
|
+
use Deflectable::Watcher
|
40
37
|
```
|
41
38
|
|
42
39
|
|
data/lib/deflectable/version.rb
CHANGED
data/lib/deflectable/watcher.rb
CHANGED
@@ -43,7 +43,7 @@ There was both a :blanklist and :whitelist.
|
|
43
43
|
|
44
44
|
def set_rails_configure!
|
45
45
|
return unless defined?(Rails)
|
46
|
-
conf = YAML.load_file(Rails.root.join('config/
|
46
|
+
conf = YAML.load_file(Rails.root.join('config/deflectable.yml'))
|
47
47
|
self.options = options.merge(conf).merge(:logger => Rails.logger)
|
48
48
|
rescue => e
|
49
49
|
log e.message
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Deflectable::Generators
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def copy_config_yaml
|
6
|
+
template "deflectable.yml", "config/deflectable.yml"
|
7
|
+
end
|
8
|
+
|
9
|
+
def copy_forbidden_page
|
10
|
+
template "403.html", "public/403.html"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end if defined?(Rails)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Access forbidden</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/403.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>Sorry...</h1>
|
54
|
+
<p>You did not have access to this site.</p>
|
55
|
+
</div>
|
56
|
+
</body>
|
57
|
+
</html>
|
data/test/dummy/public/403.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title>
|
4
|
+
<title>Access forbidden</title>
|
5
5
|
<style>
|
6
6
|
body {
|
7
7
|
background-color: #EFEFEF;
|
@@ -48,11 +48,10 @@
|
|
48
48
|
</head>
|
49
49
|
|
50
50
|
<body>
|
51
|
-
<!-- This file lives in public/
|
51
|
+
<!-- This file lives in public/403.html -->
|
52
52
|
<div class="dialog">
|
53
|
-
<h1>
|
54
|
-
<p>You
|
53
|
+
<h1>Sorry...</h1>
|
54
|
+
<p>You did not have access to this site.</p>
|
55
55
|
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
56
|
</body>
|
58
57
|
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deflectable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naohiro Sakuma
|
@@ -90,6 +90,9 @@ files:
|
|
90
90
|
- lib/deflectable/version.rb
|
91
91
|
- lib/deflectable/watcher.rb
|
92
92
|
- lib/deflectable.rb
|
93
|
+
- lib/generators/deflectable/install_generator.rb
|
94
|
+
- lib/generators/deflectable/templates/403.html
|
95
|
+
- lib/generators/deflectable/templates/deflectable.yml
|
93
96
|
- lib/tasks/deflectable_tasks.rake
|
94
97
|
- MIT-LICENSE
|
95
98
|
- Rakefile
|
@@ -110,6 +113,7 @@ files:
|
|
110
113
|
- test/dummy/config/boot.rb
|
111
114
|
- test/dummy/config/database.yml
|
112
115
|
- test/dummy/config/deflect.yml
|
116
|
+
- test/dummy/config/deflectable.yml
|
113
117
|
- test/dummy/config/environment.rb
|
114
118
|
- test/dummy/config/environments/development.rb
|
115
119
|
- test/dummy/config/environments/production.rb
|
@@ -189,6 +193,7 @@ test_files:
|
|
189
193
|
- test/dummy/config/boot.rb
|
190
194
|
- test/dummy/config/database.yml
|
191
195
|
- test/dummy/config/deflect.yml
|
196
|
+
- test/dummy/config/deflectable.yml
|
192
197
|
- test/dummy/config/environment.rb
|
193
198
|
- test/dummy/config/environments/development.rb
|
194
199
|
- test/dummy/config/environments/production.rb
|