repost 0.5.2 → 0.5.3
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/README.md +1 -1
- data/lib/repost/senpai.rb +10 -1
- data/lib/repost/version.rb +1 -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: 41b967cb4d60089de6bdb34b27fa765201b3216186c7da3d0259b4ed18694ac4
|
|
4
|
+
data.tar.gz: a348d14926f1b1df688dd7d8bca93ad3f721f7f4259f366e6075447e48d63882
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcf88d8239d00a462d962b4659f6cb29c1ed85027941a73d96b06d014e76d019745318fb2a5d535d1c52051b3ed69f86f7fa7430066d12b8eaed38a4ce11fa32
|
|
7
|
+
data.tar.gz: b1e9ac130d2b5e8d2ae213da35ce40a3a5b6ffe468a7b536a9390935792cbb00d15d3a414f530810578ff515139101e74976c5915b18f79f56c8a551c64fa969
|
data/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Gem **Repost** implements Redirect using POST method.
|
|
|
14
14
|
Implementation story and some details in the following article [Redirect using POST in Rails](https://medium.com/@momlookhowican/redirect-using-post-in-rails-5748da354343).
|
|
15
15
|
|
|
16
16
|
[](https://badge.fury.io/rb/repost)
|
|
17
|
-
[](https://github.com/vergilet/repost/actions/workflows/ci.yml)
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
data/lib/repost/senpai.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'cgi'
|
|
2
|
+
require 'json'
|
|
2
3
|
require 'securerandom'
|
|
3
4
|
|
|
4
5
|
module Repost
|
|
@@ -108,11 +109,19 @@ module Repost
|
|
|
108
109
|
"repost-#{SecureRandom.hex(8)}"
|
|
109
110
|
end
|
|
110
111
|
|
|
112
|
+
# Calls the prototype's submit() so a param named "submit" (which the
|
|
113
|
+
# browser exposes as form.submit, shadowing the method) can't break it.
|
|
111
114
|
def auto_submit_script
|
|
112
115
|
nonce_attr = %Q( nonce="#{escape(autosubmit_nonce)}") if autosubmit_nonce
|
|
113
116
|
%Q(<script#{nonce_attr}>
|
|
114
|
-
document.getElementById(
|
|
117
|
+
HTMLFormElement.prototype.submit.call(document.getElementById(#{js_string(form_id)}));
|
|
115
118
|
</script>)
|
|
116
119
|
end
|
|
120
|
+
|
|
121
|
+
# A JS string literal that is also safe inside an HTML <script> element.
|
|
122
|
+
# HTML escaping is wrong here: entities are not decoded inside <script>.
|
|
123
|
+
def js_string(value)
|
|
124
|
+
JSON.generate(value.to_s).gsub(/[<>&
]/) { |char| format('\u%04x', char.ord) }
|
|
125
|
+
end
|
|
117
126
|
end
|
|
118
127
|
end
|
data/lib/repost/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: repost
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- YaroslavO
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
76
|
version: '0'
|
|
77
77
|
requirements: []
|
|
78
|
-
rubygems_version: 3.
|
|
78
|
+
rubygems_version: 3.5.22
|
|
79
79
|
signing_key:
|
|
80
80
|
specification_version: 4
|
|
81
81
|
summary: Gem implements Redirect using POST method
|