solutus 0.1.4 → 0.1.5

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/solutus.rb +20 -3
  3. data/resources/index.html +0 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 435bfbba6ee0bbf0d94cc46048475f2c97392b37444912473d03c691c41b88e4
4
- data.tar.gz: 60d55368ad0c6785c53156990c1dc5924a50d42c8bda559167c51689ad4d2052
3
+ metadata.gz: 313bb0615e645bf70f602be1bd1c14614bb4a2f549b991121200269847b44da0
4
+ data.tar.gz: ece8ccd1d6877a54b2f27ea2195b782706f7132b4e0833b0cd68ddf6d40c7634
5
5
  SHA512:
6
- metadata.gz: 7024ced5ab758fcbd133472a0a1a238563b9d5b11d91aee0588342326566f11d43085a1de9791f34c4c711bfeb64d402bccb592c1de2baab7802d8ebb507dba7
7
- data.tar.gz: 6fc781fde575954a42defbffc30019ca43e4ab74485147bfc43c5930b057ed33072b52ca708a6bc3ef169801a92163c7fc8c52938697fa224f942102fb192307
6
+ metadata.gz: f06c51ad34c07a1bb5183a28a938b564b32abe04557365fc2d068f3a9e0d5282c52c14ca6aef66d693e41e28235f54f88c4fcd427fdb3d1b59dadb30d7873cc9
7
+ data.tar.gz: f570f7003e7c75fdd85b56a4e673d8e3ccb91dd2297beaf7255ab1beedb21617f3bcb0082e946f537347187a1549fb984d93d6a63bc7ef71d625d7ca5b7d65e7
data/lib/solutus.rb CHANGED
@@ -30,7 +30,9 @@ class Solutus
30
30
  PASSWORD_FILE = "password.txt"
31
31
  DAY_ENDINGS = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "st"]
32
32
 
33
- VERSION = '0.1.4'
33
+ VERSION = '0.1.5'
34
+
35
+ LOG_FILE = 'log'
34
36
 
35
37
  @@blog_urls = Hash.new
36
38
  @@page_urls = Array.new
@@ -88,9 +90,11 @@ class Solutus
88
90
  puts given_password_hash.to_s
89
91
  puts "password on file:" + password.to_s
90
92
  if given_password_hash.to_s == password.to_s
93
+ write_log("Logged in from #{request.ip}")
91
94
  session[:verified] = true
92
95
  redirect "/edit"
93
96
  else
97
+ write_log("Wrong password from #{request.ip}")
94
98
  render_login("Wrong password")
95
99
  end
96
100
  end
@@ -203,6 +207,7 @@ class Solutus
203
207
  f = File.open(path, 'w')
204
208
  f.write(content)
205
209
  f.close
210
+ write_log("Edited #{path} from #{request.ip}")
206
211
  'saved'
207
212
  end
208
213
 
@@ -232,7 +237,19 @@ class Solutus
232
237
  else
233
238
  send_404
234
239
  end
235
- end
240
+ end
241
+
242
+ def write_log(stuff)
243
+ times = Time.now.getlocal('-07:00')
244
+ if !File.file?(LOG_FILE)
245
+ f = File.new(LOG_FILE, 'w')
246
+ f.write("#{times} (PST) Creating log file\n")
247
+ f.close
248
+ end
249
+ f = File.open(LOG_FILE, 'a')
250
+ f.write("#{times} #{stuff}")
251
+ f.close
252
+ end
236
253
 
237
254
  def render_edit_file(path)
238
255
  #TODO: do smth diff for YML files...
@@ -359,7 +376,7 @@ class Solutus
359
376
  result += "<optgroup label='#{dir}'>"
360
377
  files = Dir.entries(dir).select {|f| !File.directory? f}
361
378
  files.each do |filename|
362
- if !['password.txt', '.gitignore'].include?(filename)
379
+ if !['password.txt', '.gitignore', 'nohup.out', 'log'].include?(filename)
363
380
  path = File.join(dir, filename)
364
381
  result += "<option value=\"#{path}\">#{filename}</option>\n"
365
382
  end
data/resources/index.html CHANGED
@@ -35,7 +35,6 @@
35
35
  </fieldset>
36
36
  </form>
37
37
  </p>
38
- {{/advanced}}
39
38
  <p>
40
39
  <form method="post" action="/newpost">
41
40
  <fieldset>
@@ -54,7 +53,6 @@
54
53
  </fieldset>
55
54
  </form>
56
55
  </p>
57
- {{^advanced}}
58
56
  <p>
59
57
  <button type="button" id="publish">Publish to web</button>
60
58
  <span id="status"></span>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solutus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerome Wei