lib/roku_builder/inspector.rb in roku_builder-3.3.3 vs lib/roku_builder/inspector.rb in roku_builder-3.3.4
- old
+ new
@@ -13,16 +13,11 @@
# * dev_zip
def inspect(pkg:, password:)
# upload new key with password
path = "/plugin_inspect"
- conn = Faraday.new(url: @url) do |f|
- f.request :digest, @dev_username, @dev_password
- f.request :multipart
- f.request :url_encoded
- f.adapter Faraday.default_adapter
- end
+ conn = multipart_connection
payload = {
mysubmit: "Inspect",
passwd: password,
archive: Faraday::UploadIO.new(pkg, 'application/octet-stream')
}
@@ -33,16 +28,16 @@
creation_date = nil
dev_zip = nil
if app_name
app_name = app_name[1]
dev_id = /Dev ID:\s*<\/td>\s*<td>\s*<font[^>]*>([^<]*)<\/font>\s*<\/td>/.match(response.body)[1]
- creation_date = /new Date\(([^)]*)\)/.match(response.body.gsub("\n", ''))[1]
+ creation_date = /new Date\(([^)]*)\)/.match(response.body.delete("\n"))[1]
dev_zip = /dev.zip:\s*<\/td>\s*<td>\s*<font[^>]*>([^<]*)<\/font>\s*<\/td>/.match(response.body)[1]
else
app_name = /App Name:[^<]*<div[^>]*>([^<]*)<\/div>/.match(response.body)[1]
dev_id = /Dev ID:[^<]*<div[^>]*><font[^>]*>([^<]*)<\/font><\/div>/.match(response.body)[1]
- creation_date = /new Date\(([^\/]*)\)/.match(response.body.gsub("\n", ''))[1]
+ creation_date = /new Date\(([^\/]*)\)/.match(response.body.delete("\n"))[1]
dev_zip = /dev.zip:[^<]*<div[^>]*><font[^>]*>([^<]*)<\/font><\/div>/.match(response.body)[1]
end
return {app_name: app_name, dev_id: dev_id, creation_date: Time.at(creation_date.to_i).to_s, dev_zip: dev_zip}
@@ -50,16 +45,11 @@
# Capture a screencapture for the currently sideloaded app
# @return [Boolean] Success
def screencapture(out_folder:, out_file: nil)
path = "/plugin_inspect"
- conn = Faraday.new(url: @url) do |f|
- f.request :digest, @dev_username, @dev_password
- f.request :multipart
- f.request :url_encoded
- f.adapter Faraday.default_adapter
- end
+ conn = multipart_connection
payload = {
mysubmit: "Screenshot",
passwd: @dev_password,
archive: Faraday::UploadIO.new("/dev/null", 'application/octet-stream')
}
@@ -71,13 +61,10 @@
unless out_file
out_file = /time=([^"]*)">/.match(response.body)
out_file = "dev_#{out_file[1]}.jpg" if out_file
end
- conn = Faraday.new(url: @url) do |f|
- f.request :digest, @dev_username, @dev_password
- f.adapter Faraday.default_adapter
- end
+ conn = simple_connection
response = conn.get path
File.open(File.join(out_folder, out_file), "w") do |io|
io.write(response.body)