dandelion_s0 0.1.0
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 +7 -0
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +3 -0
- data/lib/dandelion_s0.rb +64 -0
- metadata +107 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ea07472ecc55020d0fd33111c2a197752c1a7cc8
|
4
|
+
data.tar.gz: 1d6548aef2f772a42ddc9843956856f2df28aa43
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3a170091fc8b3ed02e3e5a2e712e258cbbd1b09896b843defd17c94b42f6b7655446dd744e4742eacae16329bbbc93f6e6d52216f321a10192ab5c0ba112055a
|
7
|
+
data.tar.gz: e55a5f140077567d69ef1e0b783b581448a27fffb1470fa7387c113939ff9ce8ccc68e463bdca112974e18e5259d5478d67bc25a72a624670c70f3f169c07177
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
data/lib/dandelion_s0.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: dandelion_s0.rb
|
4
|
+
|
5
|
+
require 'rack-rscript'
|
6
|
+
require 'simple-config'
|
7
|
+
|
8
|
+
|
9
|
+
class DandelionS0 < RackRscript
|
10
|
+
|
11
|
+
def initialize(opts={})
|
12
|
+
|
13
|
+
h = {root: 'www'}.merge(opts)
|
14
|
+
|
15
|
+
access_list = h[:access]
|
16
|
+
@app_root = Dir.pwd
|
17
|
+
|
18
|
+
#@access_list = {'/do/r/hello3' => 'user'}
|
19
|
+
|
20
|
+
h2 = SimpleConfig.new(access_list).to_h
|
21
|
+
conf_access = h2[:body] || h2
|
22
|
+
@access_list = conf_access.inject({}) \
|
23
|
+
{|r,x| k,v = x; r.merge(k.to_s => v.split)}
|
24
|
+
|
25
|
+
h3 = %i(log pkg_src rsc_host rsc_package_src root static debug)\
|
26
|
+
.inject({}) {|r,x| r.merge(x => h[x])}
|
27
|
+
|
28
|
+
super(h3)
|
29
|
+
end
|
30
|
+
|
31
|
+
def call(e)
|
32
|
+
|
33
|
+
request = e['REQUEST_PATH']
|
34
|
+
r = @access_list.detect {|k,v| request =~ Regexp.new(k)}
|
35
|
+
private_user = r ? r.last : nil
|
36
|
+
|
37
|
+
if private_user.nil? then
|
38
|
+
super(e)
|
39
|
+
elsif private_user.is_a? String and private_user == e['REMOTE_USER']
|
40
|
+
super(e)
|
41
|
+
elsif private_user.is_a? Array and
|
42
|
+
private_user.any? {|x| x == e['REMOTE_USER']}
|
43
|
+
super(e)
|
44
|
+
else
|
45
|
+
request = '/unauthorised/'
|
46
|
+
content, content_type, status_code = run_route(request)
|
47
|
+
content_type ||= 'text/html'
|
48
|
+
[status_code=401, {"Content-Type" => content_type}, [content]]
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_routes(env, params)
|
54
|
+
|
55
|
+
super(env, params)
|
56
|
+
|
57
|
+
get '/unauthorised/' do
|
58
|
+
'unauthorised user'
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dandelion_s0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwNzIyMT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Pp+68FxhfVDoz5T0AnBm6SMni5tN0X
|
30
|
+
qdy1qHpF86UlLNBmmx73PgTZ8V0DzOHK+RC4mOtNtBOHuA4W5KKw5VeLMVSH/vlx
|
31
|
+
BbU=
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2018-07-22 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rack-rscript
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.1'
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.1.2
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - "~>"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '1.1'
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.1.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simple-config
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.6.4
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0.6'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.6.4
|
75
|
+
description:
|
76
|
+
email: james@jamesrobertson.eu
|
77
|
+
executables: []
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files: []
|
80
|
+
files:
|
81
|
+
- lib/dandelion_s0.rb
|
82
|
+
homepage: https://github.com/jrobertson/dandelion_s0
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.6.13
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: A kind of Rack-Rscript web server which facilitates static files, basic authentication,
|
106
|
+
and private pages.
|
107
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
(3�FDF�ؗ��
|