middleman-gibberish 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzcyMTY3ZWYxZTMzZGI2NGMxNjhkZDUzYTRlYTcyNmM1N2M2NGI3Yw==
4
+ ZjY3YWU2OTM4YjE5MDhhZDY4NzRmZjM1ZDkwNTQ2ZTViZDA4ZWRmNA==
5
5
  data.tar.gz: !binary |-
6
- MThlMGEwNmEwYjIyYWZiMzk2YjIzYTFmNmFjNTQ5NTk4OGUyYTEyZg==
6
+ MDU2NzVkN2VmMGZmMWQ5ODBmMTc1ZTQ1NmFmZGFhMzljOWM4N2Y5Zg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODU3ZDg1YjMxMDAxNjRmNzliYmM1ZWEwNGUwMDU5YTJlNTUyY2Y5MTRhMjkx
10
- NTE3NDgyZmQ1ZGZlMTA4ZGZiYjQ2ZTNkODFkNGE5NDhmNWMyMTVlMWNmNzZl
11
- MjEzZmQ5YTJiZWM3MDk5NzcwYTZlMTJhMTgxZjdjNTU2YjMzYTQ=
9
+ MjExNWVhZTQyNDllMTdhMzY1NTI1NzI5ZGEwZDRjODM4OWJhOTcxMjM2YmM4
10
+ YzQyNWEzNmU4NTcyOTRmZGNkYTRlNTYyODI2NzNhZmNmNWQyMjZhZDMyNjkx
11
+ NWEzM2NjNzhlNTA1MzI3OThhNmJmMGQ2ZmI0MWZiYzNhZmI1MzA=
12
12
  data.tar.gz: !binary |-
13
- ODJjN2FkOWE4ZThhZjg4ZTQyMGIxYWRkNDgyMTNkNmFhNzhlZmZhNTNiZDJj
14
- ZmFlYmU5NWI3YTZhMmU5MjFjMDczMDI0YTA0NDNhNjhlOTM0NzlkNWIwZDYx
15
- NmRhMzI3M2IyMGNkYWIxMzQxMzM5ZjAwYzVjN2JjOTVlMGFhODA=
13
+ ODg1YWFiNzlkOGRhYTIwZjBlZTlhOGE5NWU0NmU0YTc4YzkxZWI2Mjk2MzQz
14
+ OWZkMjgxOWI5OTA3OGE5YTk5MjA5Y2NmMGQ5OTUxZTgyOGQ3MGQ1ZDQ5Yzk2
15
+ OTEwMWNjZTU4MGVmM2FjNGY5NTU3NmZhNGZhZGQ2ZTM2NThiZTk=
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  NAME
2
2
  ----
3
- middlenam-gibberish
3
+ middleman-gibberish
4
4
 
5
5
 
6
6
  SYNOPSIS
@@ -11,7 +11,7 @@ the implementation is serverless and works even on s3.
11
11
 
12
12
  DESCRIPTION
13
13
  -----------
14
- middlenam-gibberish encrypts senstive content at build time, before
14
+ middleman-gibberish encrypts senstive content at build time, before
15
15
  deployment, and wraps it with a teeny script that will prompt the user to
16
16
  enter a password in order to decrypt and display it. it relies on the
17
17
  excellent, openssl compatible, gibberish implementations for ruby and
@@ -66,7 +66,11 @@ PSEUDO-CODE
66
66
 
67
67
  INSTALL
68
68
  ------
69
- gem install middlenam-gibberish
69
+ `gem install middleman-gibberish`
70
+
71
+ EXAMPLES
72
+ --------
73
+ http://ahoward.github.io/middleman-gibberish/
70
74
 
71
75
 
72
76
  USAGE
@@ -114,7 +118,7 @@ NOTES
114
118
  ```
115
119
  if you activated directory indexes.
116
120
 
117
- - gibberish encrypts *only* in the build directory via and
121
+ - gibberish encrypts *only* in the build directory via an
118
122
  <code>after_build</code> callback. this means you won't see encrypted
119
123
  content in development mode running <code>middleman server</code>: you will
120
124
  only see encrypted content in the build directory after running
@@ -130,26 +134,25 @@ NOTES
130
134
 
131
135
  DEPENDENCIES
132
136
  ------------
133
- middlenam-gibberish relies on the gibberish gem, and that is handled the
137
+ middleman-gibberish relies on the gibberish gem, and that is handled the
134
138
  normal/rubygem way.
135
139
 
136
- middlenam-gibberish also relies on the following three javascript libs at
140
+ middleman-gibberish also relies on the following three javascript libs at
137
141
  runtime for it to function
138
142
 
139
143
  - jquery.js
140
144
  - jquery.cookie.js
141
145
  - gibberish.js
142
146
 
143
- all three are included in this repo. if you are application has checked them
144
- into sourc/javascripts *then they will be used*, otherwise the lib uses
145
- versions hosted on github's CDN here
147
+ all three are included in this repo. if your application has checked them
148
+ into source/gibberish/javascripts *then they will be used*, otherwise the lib
149
+ uses versions hosted on github's CDN here:
146
150
 
147
151
  - http://ahoward.github.io/middleman-gibberish/assets/jquery.js
148
152
  - http://ahoward.github.io/middleman-gibberish/assets/jquery.cookie.js
149
153
  - http://ahoward.github.io/middleman-gibberish/assets/gibberish.js
150
154
 
151
- if you decide to use local copies make sure the names match *exactly*, that is
152
- to say you must have *jquery.js* and not *jquery-1.2.3.4.js* in
155
+ if you decide to use local copies, make sure the names match *exactly*, that is
156
+ to say, you must have *jquery.js* and not *jquery-1.2.3.4.js* in
153
157
  source/javascripts. if you aren't in the habbit of using symlinks it'd be a
154
158
  good time to figure that out.
155
-
@@ -3,7 +3,7 @@ require 'gibberish'
3
3
 
4
4
  module ::Middleman
5
5
  class Gibberish < Middleman::Extension
6
- Version = '0.4.2'
6
+ Version = '0.5.0'
7
7
 
8
8
  def Gibberish.version
9
9
  Version
@@ -124,10 +124,10 @@ module ::Middleman
124
124
 
125
125
  srcs =
126
126
  libs.map do |lib|
127
- script = File.join(source_dir, 'javascripts', lib)
127
+ script = File.join(source_dir, 'gibberish', 'javascripts', lib)
128
128
 
129
129
  if test(?s, script)
130
- "/javascripts/#{ lib }"
130
+ "/gibberish/javascripts/#{ lib }"
131
131
  else
132
132
  asset_url + lib
133
133
  end
@@ -135,38 +135,101 @@ module ::Middleman
135
135
 
136
136
  template =
137
137
  <<-__
138
- <% srcs.each do |src| %>
138
+ <html>
139
+ <head>
140
+ <style>
141
+ .gibberish {
142
+ margin: auto;
143
+ color: #999;
144
+ text-align: center;
145
+ }
139
146
 
140
- <script src='<%= src %>'></script>
147
+ .gibberish-instructions,
148
+ .gibberish-password,
149
+ .gibberish-message
150
+ {
151
+ margin-bottom: 1em;
152
+ }
153
+
154
+ .gibberish-password {
155
+ border: 1px solid #ccc;
156
+ }
157
+
158
+ .gibberish-message {
159
+ margin: auto;
160
+ color: #633;
161
+ }
162
+ </style>
163
+ </head>
164
+
165
+ <body style='width:100%;'>
166
+ <br>
167
+ <br>
168
+ <br>
169
+ <div class='gibberish'>
170
+
171
+ <div class='gibberish-instructions'>
172
+ enter password and press &lt;enter&gt;
173
+ </div>
174
+
175
+ <input id='gibberish-password' name='gibberish-password' type='password' class='gibberish-password'/>
176
+
177
+ <div class='gibberish-message'>
178
+ </div>
141
179
 
180
+ </div>
181
+ </body>
182
+ </html>
183
+
184
+
185
+ <% srcs.each do |src| %>
186
+ <script src='<%= src %>'></script>
142
187
  <% end %>
143
188
 
144
189
  <script>
145
190
  var encrypted = #{ encrypted.to_json };
146
191
  var cookie = #{ glob.to_json };
192
+ var options = {path: "/", expires: 1};
147
193
 
148
- while(true){
149
- var password = (jQuery.cookie(cookie) || prompt('PLEASE ENTER THE PASSWORD'));
150
194
 
151
- try{
152
- var decrypted = GibberishAES.dec(encrypted, password);
195
+ jQuery(function(){
196
+ var password = jQuery('.gibberish-password');
197
+ var message = jQuery('.gibberish-message');
153
198
 
154
- document.write(decrypted);
199
+ password.focus();
200
+ message.html('');
155
201
 
156
- try{
157
- jQuery.cookie(cookie, password, {expires: 1});
158
- } catch(e) {
159
- };
202
+ password.keyup(function(e){
203
+ var code = e.which;
204
+
205
+ e.preventDefault();
160
206
 
161
- break;
162
- } catch(e) {
163
- if(confirm('BLARGH - WRONG PASSWORD! TRY AGAIN?')){
164
- 42;
207
+ var _password = (jQuery.cookie(cookie) || password.val());
208
+
209
+ if(code==13 && !_password==""){
210
+ try{
211
+ var decrypted = GibberishAES.dec(encrypted, _password);
212
+
213
+ document.write(decrypted);
214
+
215
+ try{
216
+ jQuery.cookie(cookie, _password, options);
217
+ } catch(e) {
218
+ };
219
+ } catch(e) {
220
+ try{
221
+ jQuery.removeCookie(cookie, options);
222
+ } catch(e) {
223
+ };
224
+ message.html("sorry, wrong password - try again.");
225
+ };
165
226
  } else {
166
- break
167
- }
168
- };
169
- };
227
+ message.html("");
228
+ };
229
+
230
+ return(false);
231
+ });
232
+ });
170
233
  </script>
171
234
  __
172
235
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "middleman-gibberish"
6
- spec.version = "0.4.2"
6
+ spec.version = "0.5.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "middleman-gibberish"
9
9
  spec.description = "password protect middleman pages - even on s3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-gibberish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-07 00:00:00.000000000 Z
11
+ date: 2014-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman