@@ -8,21 +8,36 @@ module HqTrivia
8
8
9
9
# Given a *country* it returns the required headers
10
10
def headers (country )
11
- HTTP ::Headers {
11
+ headers = HTTP ::Headers {
12
12
" Authorization" => " Bearer #{ token(country) } " ,
13
13
" x-hq-device" => " iPhone10,4" ,
14
- " x-hq-client" => " iOS/1.5.1 b157" ,
15
14
" accept-language" => " en-us" ,
16
15
" x-hq-stk" => " MQ==" ,
17
16
" x-hq-deviceclass" => " phone" ,
18
17
" x-hq-timezone" => " America/Chicago" ,
19
- " user-agent" => " HQ-iOS/157 CFNetwork/987.0.7 Darwin/18.7.0" ,
20
18
" x-hq-country" => country,
21
19
" x-hq-lang" => " en" ,
22
20
" Host" => " api-quiz.hype.space" ,
23
21
" Connection" => " Keep-Alive" ,
24
22
# "Accept-Encoding" => "gzip",
25
23
}
24
+
25
+ if build_number && version_number
26
+ headers.merge!({
27
+ " x-hq-client" => " iOS/#{ version_number } b#{ build_number } " ,
28
+ " user-agent" => " HQ-iOS/#{ build_number } CFNetwork/987.0.7 Darwin/18.7.0"
29
+ })
30
+ end
31
+
32
+ headers
33
+ end
34
+
35
+ private def build_number
36
+ HqTrivia .config.hq_build_number
37
+ end
38
+
39
+ private def version_number
40
+ HqTrivia .config.hq_version_number
26
41
end
27
42
end
28
43
end
0 commit comments