oembed_proxy 0.2.6 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/oembed_proxy/first_party.rb +16 -2
- data/lib/oembed_proxy/version.rb +1 -1
- data/lib/providers/first_party.yml +1 -1
- data/oembed_proxy.gemspec +2 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f604c0cdfb884bf07cf33db2c1cba4f3b3eb36a123cd2dcf795bee46bf2b17af
|
4
|
+
data.tar.gz: 66d599d359c6e28debd6adaf532008bed4cae542b51623aa6be78bf1e67f2f25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d6ca0159d8d1d4bc194b607cbd84d52cc42a753490f6d68c3ae4fbc4e16aef972407217f8e14310f5bfbce0cbcaff982166f8d993f8336ee604a76e2954da60
|
7
|
+
data.tar.gz: cb1d181ea1d5f04fbd97938c4ad592ac3d8f2e364f8ed9edc8914476810bf96db967c2c401de7ca933c518a602c58713ec96a8f55344ea903cfcb39da43f8cf5
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# oEmbed Proxy Changelog
|
2
2
|
|
3
|
+
## [`0.3`] (2023-08-24)
|
4
|
+
|
5
|
+
[`0.3`]: https://github.com/APMG/oembed_proxy/compare/v0.2.6...v0.3
|
6
|
+
|
7
|
+
* Update Spotify API URI
|
8
|
+
* Updated redirect handling to take more obscure types of redirects into account.
|
9
|
+
|
3
10
|
## [`0.2.6`] (2020-12-15)
|
4
11
|
|
5
12
|
[`0.2.6`]: https://github.com/APMG/oembed_proxy/compare/v0.2.5...v0.2.6
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# OembedProxy
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.
|
3
|
+
[![Build Status](https://travis-ci.com/APMG/oembed_proxy.svg?branch=master)](https://app.travis-ci.com/github/APMG/oembed_proxy)
|
4
4
|
|
5
5
|
Library to manage multiple oEmbed providers, including officially supported oEmbeds, custom implemented "fauxembeds", and Embed.ly providers.
|
6
6
|
|
@@ -66,8 +66,8 @@ module OembedProxy
|
|
66
66
|
case res
|
67
67
|
when Net::HTTPSuccess
|
68
68
|
JSON[res.body]
|
69
|
-
when Net::
|
70
|
-
fetch(
|
69
|
+
when Net::HTTPRedirection, Net::HTTPFound
|
70
|
+
fetch(redirect_location(uri, res['location']), times_recursed: (times_recursed + 1))
|
71
71
|
else
|
72
72
|
raise OembedException, (ERROR_CLASS_MAPPING[res.class] || "Unknown response: #{res.class}")
|
73
73
|
end
|
@@ -75,6 +75,20 @@ module OembedProxy
|
|
75
75
|
return nil # rubocop:disable Style/RedundantReturn
|
76
76
|
end
|
77
77
|
|
78
|
+
def redirect_location(original_uri, new_location)
|
79
|
+
# Absolute URL
|
80
|
+
return URI(new_location) if new_location.start_with?('http')
|
81
|
+
|
82
|
+
# Relative path starting at root
|
83
|
+
return URI("#{original_uri.scheme}://#{original_uri.host}#{new_location}") if new_location.start_with?('/')
|
84
|
+
|
85
|
+
# Relative path starting at directory of original request (yuck)
|
86
|
+
|
87
|
+
base_path = Pathname.new(original_uri.path).parent.to_s # Get the current directory
|
88
|
+
base_path = '' if base_path == '/' # Special case, avoiding double slash in URL
|
89
|
+
URI("#{original_uri.scheme}://#{original_uri.host}#{base_path}/#{new_location}")
|
90
|
+
end
|
91
|
+
|
78
92
|
def request_builder(uri)
|
79
93
|
req = Net::HTTP::Get.new(uri)
|
80
94
|
req['User-Agent'] = USER_AGENT
|
data/lib/oembed_proxy/version.rb
CHANGED
@@ -83,7 +83,7 @@ instagram:
|
|
83
83
|
pattern_list: ["#\\Ahttps?://(?:www\\.)?instagr(?:\\.am|am\\.com)/p/.+#i"]
|
84
84
|
|
85
85
|
spotify:
|
86
|
-
endpoint: "https://embed.spotify.com/oembed
|
86
|
+
endpoint: "https://embed.spotify.com/oembed"
|
87
87
|
pattern_list: ["#\\Ahttps?://(?:open|play)\\.spotify\\.com/.+#i"]
|
88
88
|
|
89
89
|
audio-api:
|
data/oembed_proxy.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oembed_proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- APM Digital Products Group
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,8 +58,8 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.0'
|
61
|
-
description:
|
62
|
-
email:
|
61
|
+
description:
|
62
|
+
email:
|
63
63
|
executables: []
|
64
64
|
extensions: []
|
65
65
|
extra_rdoc_files: []
|
@@ -99,7 +99,7 @@ homepage: https://github.com/APMG/oembed_proxy
|
|
99
99
|
licenses:
|
100
100
|
- MIT
|
101
101
|
metadata: {}
|
102
|
-
post_install_message:
|
102
|
+
post_install_message:
|
103
103
|
rdoc_options: []
|
104
104
|
require_paths:
|
105
105
|
- lib
|
@@ -107,15 +107,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '2.7'
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
118
|
-
signing_key:
|
117
|
+
rubygems_version: 3.2.33
|
118
|
+
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Simple library to manage first party, embedly, and custom oembeds
|
121
121
|
test_files: []
|