url_tokenizer 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.sample +1 -0
- data/VERSION +1 -1
- data/lib/url_tokenizer/cdn77.rb +0 -10
- data/lib/url_tokenizer/limelight.rb +0 -4
- data/lib/url_tokenizer/provider.rb +10 -0
- data/lib/url_tokenizer/wowza.rb +48 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0986700f3d09a93ee40fa87e98b22bef740d65ee
|
4
|
+
data.tar.gz: 1d2d36c5d9dd5c8e64513acc3424e1582e8956cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c389214dec19186c62700876375ca0ba36edcb86fa1b2c92d8c98fd98a2d324ca91f3672833f5da2caa400bc31b7f5a8fef4a02577fca5e57857303a4bd7e2b8
|
7
|
+
data.tar.gz: d8d076a87f1fa00c205e39bcc3df0980172185c65c82f51c8a56086ceddd93a8a88083c8ba1e5ead5190e815770c7d4fac17a2f0cae97a8c73b835eea047d3f8
|
data/.env.sample
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.3
|
data/lib/url_tokenizer/cdn77.rb
CHANGED
@@ -20,19 +20,9 @@ module UrlTokenizer
|
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
23
|
-
def expiration_date(expires_in)
|
24
|
-
Time.now.utc.to_i + expires_in.to_i if expires_in
|
25
|
-
end
|
26
|
-
|
27
23
|
def digest(url)
|
28
24
|
md5 = Digest::MD5.digest url
|
29
25
|
Base64.urlsafe_encode64(md5)
|
30
26
|
end
|
31
|
-
|
32
|
-
def build_query(provider_options)
|
33
|
-
provider_options.reduce([]) do |query, (key, value)|
|
34
|
-
query << "#{ key }=#{ value }"
|
35
|
-
end.join '&'
|
36
|
-
end
|
37
27
|
end
|
38
28
|
end
|
@@ -11,5 +11,15 @@ module UrlTokenizer
|
|
11
11
|
|
12
12
|
private
|
13
13
|
attr_reader :key, :global_options
|
14
|
+
|
15
|
+
def build_query(provider_options)
|
16
|
+
provider_options.reduce([]) do |query, (key, value)|
|
17
|
+
query << "#{ key }=#{ value }"
|
18
|
+
end.join '&'
|
19
|
+
end
|
20
|
+
|
21
|
+
def expiration_date(expires_in)
|
22
|
+
Time.now.utc.to_i + expires_in.to_i if expires_in
|
23
|
+
end
|
14
24
|
end
|
15
25
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'digest'
|
3
|
+
require 'base64'
|
4
|
+
require_relative 'provider'
|
5
|
+
|
6
|
+
module UrlTokenizer
|
7
|
+
class Wowza < Provider
|
8
|
+
def call(input_url, **options)
|
9
|
+
options = global_options.merge options
|
10
|
+
uri = URI.parse input_url
|
11
|
+
|
12
|
+
folder_path = get_path uri
|
13
|
+
return if folder_path.empty? || folder_path == '/'
|
14
|
+
|
15
|
+
uri.query = encode_query folder_path, build_options(options)
|
16
|
+
uri.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def get_path(uri)
|
21
|
+
File.dirname(uri.path)[1..-1] # remove leading / or .
|
22
|
+
end
|
23
|
+
|
24
|
+
def digest(url)
|
25
|
+
sha256 = Digest::SHA256.digest url
|
26
|
+
Base64.urlsafe_encode64(sha256)
|
27
|
+
end
|
28
|
+
|
29
|
+
def build_options(token_options)
|
30
|
+
server_params = {
|
31
|
+
wowzatokenendtime: expiration_date(token_options[:expires_in])
|
32
|
+
}.delete_if { |k, v| v.nil? }
|
33
|
+
|
34
|
+
server_params
|
35
|
+
end
|
36
|
+
|
37
|
+
def encode_query(url, provider_options)
|
38
|
+
string_to_tokenize = [
|
39
|
+
"#{ url }?#{ key }",
|
40
|
+
build_query(provider_options)
|
41
|
+
].compact.join '&'
|
42
|
+
|
43
|
+
build_query provider_options.merge(
|
44
|
+
wowzatokenhash: digest(string_to_tokenize)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: url_tokenizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Paramonov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/url_tokenizer/cdn77.rb
|
117
117
|
- lib/url_tokenizer/limelight.rb
|
118
118
|
- lib/url_tokenizer/provider.rb
|
119
|
+
- lib/url_tokenizer/wowza.rb
|
119
120
|
- url_tokenizer.gemspec
|
120
121
|
homepage: http://github.com/AlexParamonov/url_tokenizer
|
121
122
|
licenses:
|