wrap_it_ruby 0.3.1 → 0.3.2
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/app/assets/javascripts/wrap_it_ruby/interception.js +12 -4
- data/lib/wrap_it_ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa2cef76d046309295713f567c31c703aad9b7856b3349e9a65900f864940f90
|
|
4
|
+
data.tar.gz: ad16cee91fa318b565cfda5b0eececb3c85ccdfca93745704f933591a7036b89
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce33cc961a1b61b8a70fb5f8732d5e48b2442622998518d83f02cbef72e417cf7d31c9eaa369eb708e7cec6f0a33a08b8374b0d889c54688eac80074347efab7
|
|
7
|
+
data.tar.gz: e499fa0de180cf977f94c9c7ab800298ec3dbee57a4d375ebdb9c2940f7c24478527e13e86f101f5f462d447820cf2e7aa522d7d31ad5be4e285de2e6d0ce562
|
|
@@ -49,7 +49,9 @@
|
|
|
49
49
|
if (!link) return
|
|
50
50
|
|
|
51
51
|
const raw = link.getAttribute('href')
|
|
52
|
-
const url = raw.startsWith('/') ?
|
|
52
|
+
const url = raw.startsWith('/_proxy/') ? raw
|
|
53
|
+
: raw.startsWith('/') ? `/_proxy/${window.__proxyHost}${raw}`
|
|
54
|
+
: rewriteUrl(raw)
|
|
53
55
|
|
|
54
56
|
event.preventDefault()
|
|
55
57
|
window.location.href = url
|
|
@@ -59,7 +61,9 @@
|
|
|
59
61
|
event.preventDefault()
|
|
60
62
|
const form = event.target
|
|
61
63
|
const raw = form.getAttribute('action') || ''
|
|
62
|
-
const url = raw.startsWith('/') ?
|
|
64
|
+
const url = raw.startsWith('/_proxy/') ? raw
|
|
65
|
+
: raw.startsWith('/') ? `/_proxy/${window.__proxyHost}${raw}`
|
|
66
|
+
: rewriteUrl(raw)
|
|
63
67
|
|
|
64
68
|
form.setAttribute('action', url)
|
|
65
69
|
event.target.submit()
|
|
@@ -160,7 +164,9 @@
|
|
|
160
164
|
} catch {
|
|
161
165
|
// Relative URL — prefix with proxy host
|
|
162
166
|
if (raw.startsWith('/')) {
|
|
163
|
-
return
|
|
167
|
+
return raw.startsWith('/_proxy/')
|
|
168
|
+
? `wss://${window.__hostingSite}${raw}`
|
|
169
|
+
: `wss://${window.__hostingSite}/_proxy/${PROXY_HOST}${raw}`
|
|
164
170
|
}
|
|
165
171
|
return raw
|
|
166
172
|
}
|
|
@@ -183,7 +189,9 @@
|
|
|
183
189
|
if (_EventSource) {
|
|
184
190
|
window.EventSource = function (url, dict) {
|
|
185
191
|
const raw = typeof url === 'string' ? url : url.href
|
|
186
|
-
const rewritten = raw.startsWith('/') ?
|
|
192
|
+
const rewritten = raw.startsWith('/_proxy/') ? raw
|
|
193
|
+
: raw.startsWith('/') ? `/_proxy/${PROXY_HOST}${raw}`
|
|
194
|
+
: rewriteUrl(raw)
|
|
187
195
|
return new _EventSource(rewritten, dict)
|
|
188
196
|
}
|
|
189
197
|
window.EventSource.prototype = _EventSource.prototype
|
data/lib/wrap_it_ruby/version.rb
CHANGED