syntropy 0.8.3 → 0.9
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/CHANGELOG.md +11 -0
- data/TODO.md +10 -3
- data/lib/syntropy/module.rb +12 -4
- data/lib/syntropy/router.rb +2 -1
- data/lib/syntropy/version.rb +1 -1
- data/syntropy.gemspec +1 -1
- data/test/test_router.rb +27 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f518c3149bc64c3aca15ed4c9fa71f2237b05b1b5a98527c74b8be7e27186d0
|
4
|
+
data.tar.gz: e5755fc9bdf6a2e724b521b7ad5208225bdcf7d6c34a7a7777aecc41430cab6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '096b138421b221cbf3dd5e1b5738a43dbf12e9c458e9d68d35a7119f354c251d972411c77a6e2fce49d4ffafc901b55248d600e9b72abeede2085fcff64f8283'
|
7
|
+
data.tar.gz: b1bd235e429a7d474693edc2ae21260d4a9f3dc9483102ac9a9f321eae8fd4b9178e9bb3578f5a29058e81ebec92c5ca20debef51ac1bb74620f9a7bd10cdb1a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.9 2025-07-08
|
2
|
+
|
3
|
+
- Update TP2
|
4
|
+
- Add `Module.app` method for loading arbitrary apps
|
5
|
+
- Set `Module@machine`
|
6
|
+
|
7
|
+
## 0.8.4 2025-07-07
|
8
|
+
|
9
|
+
- Update TP2
|
10
|
+
- Fix Router#path_parent to not break on double slash
|
11
|
+
|
1
12
|
## 0.8.3 2025-07-06
|
2
13
|
|
3
14
|
- Correctly handle HEAD requests for template modules
|
data/TODO.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
-
|
1
|
+
- add support for applets
|
2
|
+
|
3
|
+
- can be implemented as separate gems
|
4
|
+
- can route requests to a different directory (i.e. inside the gem directory)
|
5
|
+
- simple way to instantiate and setup the applet
|
6
|
+
- as a first example, implement an auth/signin applet:
|
7
|
+
- session hook
|
8
|
+
- session persistence
|
9
|
+
- login page
|
10
|
+
- support for custom behaviour and custom workflows (2FA, signin using OTP etc.)
|
4
11
|
|
5
12
|
- Some standard middleware:
|
6
13
|
|
data/lib/syntropy/module.rb
CHANGED
@@ -67,6 +67,7 @@ module Syntropy
|
|
67
67
|
def prepare(loader:, env:)
|
68
68
|
@loader = loader
|
69
69
|
@env = env
|
70
|
+
@machine = env[:machine]
|
70
71
|
const_set(:MODULE, self)
|
71
72
|
end
|
72
73
|
|
@@ -90,10 +91,10 @@ module Syntropy
|
|
90
91
|
.reject { File.basename(it) =~ /^_/ }
|
91
92
|
.select { File.directory?(it) }
|
92
93
|
.each_with_object({}) { |fn, h|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
94
|
+
name = File.basename(fn)
|
95
|
+
opts = @env.merge(location: fn)
|
96
|
+
h[name] = Syntropy::App.new(opts[:machine], opts[:location], opts[:mount_path], opts)
|
97
|
+
}
|
97
98
|
|
98
99
|
map&.each do |k, v|
|
99
100
|
sites[k] = sites[v]
|
@@ -114,6 +115,13 @@ module Syntropy
|
|
114
115
|
{ atts:, markdown: }
|
115
116
|
}
|
116
117
|
end
|
118
|
+
|
119
|
+
def app(location = nil, mount_path = nil)
|
120
|
+
location ||= @env[:location]
|
121
|
+
mount_path ||= @env[:mount_path]
|
122
|
+
opts = @env.merge(location:, mount_path:)
|
123
|
+
Syntropy::App.new(opts[:machine], opts[:location], opts[:mount_path], opts)
|
124
|
+
end
|
117
125
|
end
|
118
126
|
end
|
119
127
|
end
|
data/lib/syntropy/router.rb
CHANGED
data/lib/syntropy/version.rb
CHANGED
data/syntropy.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency 'json', '2.12.2'
|
26
26
|
s.add_dependency 'papercraft', '1.4'
|
27
27
|
s.add_dependency 'qeweney', '0.21'
|
28
|
-
s.add_dependency 'tp2', '0.
|
28
|
+
s.add_dependency 'tp2', '0.14'
|
29
29
|
s.add_dependency 'uringmachine', '0.16'
|
30
30
|
|
31
31
|
s.add_dependency 'listen', '3.9.0'
|
data/test/test_router.rb
CHANGED
@@ -24,7 +24,7 @@ class RouterTest < Minitest::Test
|
|
24
24
|
File.join(APP_ROOT, fn)
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def test_routing
|
28
28
|
# entry = @router['/']
|
29
29
|
# assert_equal :not_found, entry[:kind]
|
30
30
|
|
@@ -50,6 +50,9 @@ class RouterTest < Minitest::Test
|
|
50
50
|
assert_equal :module, entry[:kind]
|
51
51
|
assert_equal full_path('api+.rb'), entry[:fn]
|
52
52
|
|
53
|
+
entry = @router['/test/api//foo/bar']
|
54
|
+
assert_equal :not_found, entry[:kind]
|
55
|
+
|
53
56
|
entry = @router['/test/api/foo/../bar']
|
54
57
|
assert_equal :not_found, entry[:kind]
|
55
58
|
|
@@ -87,4 +90,27 @@ class RouterTest < Minitest::Test
|
|
87
90
|
ensure
|
88
91
|
IO.write(@tmp_fn, orig_body) if orig_body
|
89
92
|
end
|
93
|
+
|
94
|
+
def test_malformed_path_routing
|
95
|
+
entry = @router['//xmlrpc.php?rsd']
|
96
|
+
assert_equal :not_found, entry[:kind]
|
97
|
+
|
98
|
+
entry = @router['/test//xmlrpc.php?rsd']
|
99
|
+
assert_equal :not_found, entry[:kind]
|
100
|
+
|
101
|
+
entry = @router['/test///xmlrpc.php?rsd']
|
102
|
+
assert_equal :not_found, entry[:kind]
|
103
|
+
|
104
|
+
entry = @router['/test///xmlrpc.php?rsd']
|
105
|
+
assert_equal :not_found, entry[:kind]
|
106
|
+
|
107
|
+
entry = @router['/test/./qsdf']
|
108
|
+
assert_equal :not_found, entry[:kind]
|
109
|
+
|
110
|
+
entry = @router['/test/../../lib/syntropy.rb']
|
111
|
+
assert_equal :not_found, entry[:kind]
|
112
|
+
|
113
|
+
entry = @router['/../../lib/syntropy.rb']
|
114
|
+
assert_equal :not_found, entry[:kind]
|
115
|
+
end
|
90
116
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syntropy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
@@ -71,14 +71,14 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
74
|
+
version: '0.14'
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - '='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
81
|
+
version: '0.14'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: uringmachine
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|