Class: RokuBuilder::Keyer
Overview
Change or get dev key
Instance Method Summary collapse
-
#dev_id ⇒ String
Get the current dev id.
-
#rekey(keyed_pkg:, password:) ⇒ Boolean
Sets the key on the roku device.
Methods inherited from Util
#init, #initialize, #multipart_connection, options_parse, #simple_connection
Constructor Details
This class inherits a constructor from RokuBuilder::Util
Instance Method Details
#dev_id ⇒ String
Get the current dev id
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/roku_builder/keyer.rb', line 31 def dev_id path = "/plugin_package" conn = simple_connection response = conn.get path dev_id = /Your Dev ID:\s*<font[^>]*>([^<]*)<\/font>/.match(response.body) if dev_id dev_id = dev_id[1] else dev_id = /Your Dev ID:[^>]*<\/label> ([^<]*)/.match(response.body)[1] end dev_id end |
#rekey(keyed_pkg:, password:) ⇒ Boolean
Sets the key on the roku device
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/roku_builder/keyer.rb', line 10 def rekey(keyed_pkg:, password:) oldId = dev_id # upload new key with password path = "/plugin_inspect" conn = multipart_connection payload = { mysubmit: "Rekey", passwd: password, archive: Faraday::UploadIO.new(keyed_pkg, 'application/octet-stream') } conn.post path, payload # check key newId = dev_id @logger.info("Key did not change") unless newId != oldId newId != oldId end |