superbot-teleport 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f14455a955fe9e85587e70aac5f615d4850b15ce26eaaa96394c6f66fdef2763
4
- data.tar.gz: 44b3896d9971be48dd607e5ce0c7a5d2914c6da92a899deaaab610681cc57ba3
3
+ metadata.gz: 460516238c53716d903af8436e2e442f8f52f3840af2af2f888bf8b0ffaaa9f7
4
+ data.tar.gz: 9abe7372a22813a125c7ba96bddbe883ef7e1f98e0ae28ab0024467fe95291f0
5
5
  SHA512:
6
- metadata.gz: 0e5753ac512359cce5e0b511c6e1b3a24c30bc02447932cddfc29e2e7272c3920ce06f05377489ffa0a36f01542c906ae82f07e7f881bc48725c363b25c3d25d
7
- data.tar.gz: 82c60fd35c22829c54a3ac77bacc6c321b31ed8defebfbfc85a80b3f6d15416dc379b8b682739fcfa6b3bd677d1d5995ab1fc6b46a6809e01e5f0fe5011b7ef7
6
+ metadata.gz: df098d2b7632447d0337755e686db56d67289e241c24e50ada2a12665c70f5cac6db533a0e5932d7ba9f975b2ef118c7dfc37a490a1415711541d242ccec9d97
7
+ data.tar.gz: 5bf5b7f9164a5c25e3b13795500a55f2d75450285003205b1ae91feca10439cbbd7ed12738f7517e2c684b473c2bf80892974cdf7c6e9b0da627e286f027ec00
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbot-teleport (0.3.2)
4
+ superbot-teleport (0.3.3)
5
5
  excon
6
6
 
7
7
  GEM
@@ -18,9 +18,10 @@ module Superbot
18
18
  option ['--org'], "ORGANIZATION", "Name of organization to take action on", environment_variable: "SUPERBOT_ORG", attribute_name: :organization, default: Superbot::Cloud.credentials&.fetch(:organization, nil)
19
19
 
20
20
  option ['--ignore-delete'], :flag, "Reuse existing session"
21
- option ['--keep-session'], :flag, "Keep session when teleport closing"
21
+ option ['--keep-session'], :flag, "Keep session after teleport is closed"
22
22
  option ['--session'], 'SESSION', "Session to use in teleport"
23
23
  option ['--base-url'], 'BASE_URL', "Base project URL"
24
+ option ['--source'], 'SOURCE', environment_variable: "SUPERBOT_SOURCE"
24
25
 
25
26
  def execute
26
27
  validate_teleport_options(browser, organization, session)
@@ -38,7 +39,8 @@ module Superbot
38
39
  ignore_delete: session || ignore_delete?,
39
40
  keep_session: session || keep_session?,
40
41
  session: session,
41
- base_url: base_url
42
+ base_url: base_url,
43
+ source: source
42
44
  )
43
45
 
44
46
  at_exit do
@@ -1,5 +1,5 @@
1
1
  module Superbot
2
2
  module Teleport
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
@@ -15,7 +15,7 @@ module Superbot
15
15
  headers: { 'Authorization' => Superbot::Cloud.authorization_header },
16
16
  connect_timeout: 3,
17
17
  read_timeout: 500,
18
- write_timeout: 500,
18
+ write_timeout: 500
19
19
  )
20
20
 
21
21
  sinatra.helpers do
@@ -61,10 +61,11 @@ module Superbot
61
61
 
62
62
  parsed_body['organization_name'] = settings.teleport_options[:organization]
63
63
 
64
- if settings.teleport_options[:region] && parsed_body.dig('desiredCapabilities', 'superOptions', 'region').nil?
64
+ if settings.teleport_options[:region] || settings.teleport_options[:source]
65
65
  parsed_body['desiredCapabilities'] ||= {}
66
66
  parsed_body['desiredCapabilities']['superOptions'] ||= {}
67
67
  parsed_body['desiredCapabilities']['superOptions']['region'] ||= settings.teleport_options[:region]
68
+ parsed_body['desiredCapabilities']['superOptions']['source'] ||= settings.teleport_options[:source]
68
69
  end
69
70
 
70
71
  session_response = proxy(
@@ -81,12 +82,13 @@ module Superbot
81
82
  respond session_response
82
83
  end
83
84
  else
84
- base_url = settings.teleport_options[:base_url]
85
- if base_url
86
- # TODO parse navigation command and apply base url if set
87
- parsed_body = safe_parse_json request.body, on_error: {}
85
+ parsed_body = safe_parse_json request.body, on_error: {}
86
+
87
+ if settings.teleport_options[:base_url] && parsed_body['url']
88
+ parsed_body['url'] = URI.join(settings.teleport_options[:base_url], parsed_body['url']).to_s
88
89
  end
89
- respond proxy(:post, params, headers: headers, body: request.body)
90
+
91
+ respond proxy(:post, params, headers: headers, body: parsed_body.to_json)
90
92
  end
91
93
  end
92
94
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbot-teleport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Superbot HQ