stats_lite 0.7.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a35be4defa796228cdf4eb28d2e54ec31647ec9932f4164117431721cf0ba5e3
4
- data.tar.gz: 51b9debcc22c6404f4109cc87d833fec91d76322dcc4902128fbcf56cbe45521
3
+ metadata.gz: 914b0c9c73995be9ca0b4dd1b50408955f0242c934e73fbab68d814492c2520c
4
+ data.tar.gz: e142c30b6ae19332505595f0fbe22257f4a3c173a8e31a0492eb96478879b4f4
5
5
  SHA512:
6
- metadata.gz: 900678bba4ff174f01f1a803bac037ffcb60d4354cef055e6fb538d12022da0feeb93d657d22fe74da1c719249b407941ef93594673e54dada073acbb09802a2
7
- data.tar.gz: 62eac74771af39c85ddae454cd6e1398df0486d208117867cb0845712d6b6e532c8c5c16a7a699265ee63c9925b608015f08a50e0c5c35f92a462274878bce55
6
+ metadata.gz: a2b66b329c319c8269ee982e4ef81ad525dfb3a52262765d07e52151761b39f59aa82f02097ef544e3f26b3ae2d2e48834f8c2294d29bcf95dc26f45970119d1
7
+ data.tar.gz: bb62ec07f02070ab4426f5a8909a64eadf27ff1d9d4955856528e651eb5fdb95fd772f8498bb75a42194d24b634c9bd7a273c9555ec4190673ed4b28ffc1471e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stats_lite (0.7.0)
4
+ stats_lite (0.7.1)
5
5
  filewatcher (~> 1.1.1)
6
6
  puma (>= 3.0.0, < 5.0.0)
7
7
  rack (>= 2.0.0, < 3.0.0)
data/exe/stats-lite CHANGED
@@ -6,8 +6,6 @@ require "stats_lite"
6
6
  arg = ARGV[0]
7
7
  return print "StatsLite V#{StatsLite::VERSION}\n" if arg == "-v"
8
8
  require "rack/handler/puma"
9
- require "filewatcher"
10
-
11
9
 
12
10
  print StatsLite::Log.yellow("\nStarting stats-lite\n")
13
11
 
@@ -23,11 +21,6 @@ load_config = -> do
23
21
  end
24
22
 
25
23
  load_config.call
26
- Thread.new do
27
- Filewatcher.new(StatsLite.configure.watch).watch do |filename, event|
28
- load_config.call
29
- end
30
- end
31
24
 
32
25
  app = Rack::Builder.new do
33
26
  use StatsLite::App
data/lib/stats_lite.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "sinatra/base"
3
+ require "sinatra"
4
4
  require "json"
5
5
  require "vidibus-sysinfo"
6
6
 
@@ -3,12 +3,23 @@
3
3
  module StatsLite
4
4
  class App < Sinatra::Base
5
5
  before do
6
- password = params[:password]
6
+ password = params[:password] || request.cookies["stats_lite_password"]
7
7
  conf_pass = StatsLite.configure.password
8
8
 
9
9
  if conf_pass && conf_pass != password
10
- halt 404, { "Content-Type" => "text/plain" }, ""
10
+ if session[:stats_lite_password]
11
+ session[:stats_lite_password] = nil
12
+ end
13
+ next halt 404, { "Content-Type" => "text/plain" }, ""
11
14
  end
15
+
16
+ unless session[:stats_lite_password]
17
+ set_session(password)
18
+ end
19
+ end
20
+
21
+ def set_session(password)
22
+ response.set_cookie "stats_lite_password", password
12
23
  end
13
24
 
14
25
  get "/" do
@@ -4,7 +4,6 @@ module StatsLite
4
4
  class Configuration
5
5
  def initialize
6
6
  @port = 9111
7
- @watch = ["config.rb"]
8
7
  end
9
8
 
10
9
  def port(_port = nil)
@@ -25,10 +24,6 @@ module StatsLite
25
24
  end
26
25
  end
27
26
 
28
- def watch(_paths = nil)
29
- _paths ? @watch = _paths : @watch
30
- end
31
-
32
27
  def password(_pass = nil)
33
28
  _pass ? @password = _pass : @password
34
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StatsLite
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stats_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sebi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2019-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler