unpoly-rails 2.7.1.1 → 2.7.2.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.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/assets/unpoly/unpoly-bootstrap3.js +0 -2
- data/assets/unpoly/unpoly-bootstrap4.js +0 -2
- data/assets/unpoly/unpoly-bootstrap5.js +0 -5
- data/assets/unpoly/unpoly-migrate.js +15 -523
- data/assets/unpoly/unpoly.es5.js +162 -13118
- data/assets/unpoly/unpoly.es5.min.js +1 -1
- data/assets/unpoly/unpoly.es6.js +456 -14826
- data/assets/unpoly/unpoly.es6.min.js +1 -0
- data/assets/unpoly/unpoly.js +56 -13004
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/change/field.rb +5 -5
- data/lib/unpoly/rails/change/layer.rb +3 -3
- data/lib/unpoly/rails/util.rb +25 -0
- data/lib/unpoly/rails/version.rb +1 -1
- data/lib/unpoly-rails.rb +1 -0
- metadata +4 -2
@@ -50,7 +50,7 @@ module Unpoly
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def stringify(value)
|
53
|
-
value
|
53
|
+
Util.safe_json_encode(value)
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|
@@ -75,7 +75,7 @@ module Unpoly
|
|
75
75
|
|
76
76
|
def parse(raw)
|
77
77
|
if raw.present?
|
78
|
-
result =
|
78
|
+
result = Util.json_decode(raw)
|
79
79
|
else
|
80
80
|
result = {}
|
81
81
|
end
|
@@ -88,7 +88,7 @@ module Unpoly
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def stringify(value)
|
91
|
-
|
91
|
+
Util.safe_json_encode(value)
|
92
92
|
end
|
93
93
|
|
94
94
|
end
|
@@ -97,7 +97,7 @@ module Unpoly
|
|
97
97
|
|
98
98
|
def parse(raw)
|
99
99
|
if raw.present?
|
100
|
-
result =
|
100
|
+
result = Util.json_decode(raw)
|
101
101
|
else
|
102
102
|
result = []
|
103
103
|
end
|
@@ -106,7 +106,7 @@ module Unpoly
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def stringify(value)
|
109
|
-
|
109
|
+
Util.safe_json_encode(value)
|
110
110
|
end
|
111
111
|
|
112
112
|
end
|
@@ -40,14 +40,14 @@ module Unpoly
|
|
40
40
|
# TODO: Docs
|
41
41
|
def accept(value = nil)
|
42
42
|
overlay? or raise CannotClose, 'Cannot accept the root layer'
|
43
|
-
change.response.headers['X-Up-Accept-Layer'] = value
|
43
|
+
change.response.headers['X-Up-Accept-Layer'] = Util.safe_json_encode(value)
|
44
44
|
end
|
45
45
|
|
46
46
|
##
|
47
47
|
# TODO: Docs
|
48
48
|
def dismiss(value = nil)
|
49
49
|
overlay? or raise CannotClose, 'Cannot dismiss the root layer'
|
50
|
-
change.response.headers['X-Up-Dismiss-Layer'] = value
|
50
|
+
change.response.headers['X-Up-Dismiss-Layer'] = Util.safe_json_encode(value)
|
51
51
|
end
|
52
52
|
|
53
53
|
private
|
@@ -57,4 +57,4 @@ module Unpoly
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
|
-
end
|
60
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Unpoly
|
2
|
+
module Rails
|
3
|
+
class Util
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def json_decode(string)
|
7
|
+
ActiveSupport::JSON.decode(string)
|
8
|
+
end
|
9
|
+
|
10
|
+
# We build a lot of JSON that goes into HTTP header.
|
11
|
+
# High-ascii characters are not safe to transport over HTTP, but we
|
12
|
+
# can use JSON escape sequences (\u0012) to make them low-ascii.
|
13
|
+
def safe_json_encode(value)
|
14
|
+
json = ActiveSupport::JSON.encode(value)
|
15
|
+
escape_non_ascii(json)
|
16
|
+
end
|
17
|
+
|
18
|
+
def escape_non_ascii(unicode_string)
|
19
|
+
unicode_string.gsub(/[[:^ascii:]]/) { |char| "\\u" + char.ord.to_s(16).rjust(4, "0") }
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/unpoly/rails/version.rb
CHANGED
data/lib/unpoly-rails.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'memoized'
|
2
2
|
require_relative 'unpoly/rails/version'
|
3
3
|
require_relative 'unpoly/rails/error'
|
4
|
+
require_relative 'unpoly/rails/util'
|
4
5
|
require_relative 'unpoly/rails/engine'
|
5
6
|
require_relative 'unpoly/rails/request_echo_headers'
|
6
7
|
require_relative 'unpoly/rails/request_method_cookie'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unpoly-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- assets/unpoly/unpoly.es5.js
|
123
123
|
- assets/unpoly/unpoly.es5.min.js
|
124
124
|
- assets/unpoly/unpoly.es6.js
|
125
|
+
- assets/unpoly/unpoly.es6.min.js
|
125
126
|
- assets/unpoly/unpoly.js
|
126
127
|
- assets/unpoly/unpoly.min.css
|
127
128
|
- assets/unpoly/unpoly.min.js
|
@@ -137,6 +138,7 @@ files:
|
|
137
138
|
- lib/unpoly/rails/error.rb
|
138
139
|
- lib/unpoly/rails/request_echo_headers.rb
|
139
140
|
- lib/unpoly/rails/request_method_cookie.rb
|
141
|
+
- lib/unpoly/rails/util.rb
|
140
142
|
- lib/unpoly/rails/version.rb
|
141
143
|
homepage: https://github.com/unpoly/unpoly-rails
|
142
144
|
licenses:
|