alexa_remotectl 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +4 -2
- data/lib/alexa_remotectl.rb +14 -9
- data.tar.gz.sig +3 -3
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 769f37b93490b3ab472fea0e8bc15dc1ce3c2e34cb3b4c01ce0ddc6c296fdff9
|
4
|
+
data.tar.gz: 66bdfb5add38d18635c34469ebd2a508a152daa76319c043ccfc81c67569781d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50ae6554ebe0f56317439880759316c90cfcd154d564cf45db4d517c5471115a10d0f4bad197e74090f96cc952fa9bf8f5f1dd43c0889285c78822022fd488ad
|
7
|
+
data.tar.gz: ab6a5c377f4575298d29dbe02592a7a3a20949a7a88326926ab968d725cd2a3e9ec7ccc3cf71aca1300f2fa56dd14964653aff09f9d501538031639ca04fe07f
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,4 @@
|
|
1
|
-
�t
|
2
|
-
|
1
|
+
.J���0 �Q��:�+��t#��{��= �jqo�( ��2ऊ��E_�%�o�)Q�9wƧ��
|
2
|
+
�(��'a?Vj-�H���A�L�|��!D%Ս\�˲���<_�R`�h��[1Y�tIOfsr�������f4��]���o ��Ե{
|
3
|
+
���69�jyR�/�F��n�}T�����bT��O̜3�`�1�hy�t�bs�D�A����v�&���#]Pz����鷜IZ�O8�C�1�B�̑��i9��[��SkiFG�#/� ��T籠�y�9�"�-Ω[�(�wdõ��+� q��
|
4
|
+
zI��������
|
data/lib/alexa_remotectl.rb
CHANGED
@@ -22,14 +22,15 @@ class CodeWizard
|
|
22
22
|
|
23
23
|
return 'no curl command found' unless s =~ /curl/
|
24
24
|
|
25
|
-
cookie, serialno, type = parse(s)
|
25
|
+
cookie, csrf, serialno, type = parse(s)
|
26
26
|
|
27
27
|
@s =<<EOF
|
28
28
|
require 'alexa_remotectl'
|
29
29
|
|
30
30
|
cookie = '#{cookie}'
|
31
|
+
csrf = '#{csrf}'
|
31
32
|
device = {serialno: '#{serialno}', type: '#{type}'}
|
32
|
-
alexa = AlexaRemoteCtl.new(cookie: cookie, device: device)
|
33
|
+
alexa = AlexaRemoteCtl.new(cookie: cookie, csrf: csrf, device: device)
|
33
34
|
alexa.pause
|
34
35
|
#alexa.play
|
35
36
|
EOF
|
@@ -50,18 +51,21 @@ EOF
|
|
50
51
|
serialno = s[/deviceSerialNumber=(\w+)/,1]
|
51
52
|
type = s[/deviceType=(\w+)/,1]
|
52
53
|
cookie = s[/Cookie: ([^']+)/,1]
|
54
|
+
csrf = s[/csrf: ([^']+)/,1]
|
53
55
|
|
54
|
-
[cookie, serialno, type]
|
56
|
+
[cookie, csrf, serialno, type]
|
55
57
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
59
61
|
class AlexaRemoteCtl
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
+
# note: Added the Cross-site request forgery (crsf) variable
|
64
|
+
#
|
65
|
+
def initialize(domain: 'alexa.amazon.co.uk', device: {}, cookie: '', customerid: '', csrf: '')
|
63
66
|
|
64
67
|
@domain, @device, @cookie, @customerid = domain, device, cookie, customerid
|
68
|
+
@csrf = csrf
|
65
69
|
|
66
70
|
end
|
67
71
|
|
@@ -226,7 +230,7 @@ class AlexaRemoteCtl
|
|
226
230
|
"AppleWebKit/537.36 (KHTML, like Gecko) " +
|
227
231
|
"Chrome/101.0.4951.64 Safari/537.36"
|
228
232
|
request["X-Requested-With"] = "XMLHttpRequest"
|
229
|
-
request["csrf"] =
|
233
|
+
request["csrf"] = @csrf
|
230
234
|
request["dnt"] = "1"
|
231
235
|
request["sec-ch-ua"] = "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"101\""
|
232
236
|
request["sec-ch-ua-mobile"] = "?0"
|
@@ -288,10 +292,11 @@ class AlexaDevices
|
|
288
292
|
# note: label can be any identifier you choose e.g. kitchen
|
289
293
|
#
|
290
294
|
def initialize(devicesx=[], devices: devicesx,
|
291
|
-
domain: 'alexa.amazon.co.uk', cookie: '', customerid: ''
|
295
|
+
domain: 'alexa.amazon.co.uk', cookie: '', customerid: '',
|
296
|
+
csrf: '')
|
292
297
|
|
293
298
|
@devices, @domain, @cookie = devices, domain, cookie
|
294
|
-
@customerid = customerid
|
299
|
+
@customerid, @csrf = customerid, csrf
|
295
300
|
|
296
301
|
end
|
297
302
|
|
@@ -351,7 +356,7 @@ class AlexaDevices
|
|
351
356
|
def get_alexa(device)
|
352
357
|
|
353
358
|
AlexaRemoteCtl.new(cookie: @cookie, device: device,
|
354
|
-
customerid: @customerid)
|
359
|
+
customerid: @customerid, csrf: @csrf)
|
355
360
|
end
|
356
361
|
|
357
362
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
d
|
3
|
-
|
1
|
+
�Z�?.
|
2
|
+
V�{��Ȏ��d��ïAr�Ѯp
|
3
|
+
�z�%7�9GA�A���f�y�8*a���y����R��
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|