-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy path固件验证查询-V2.0.js
36 lines (32 loc) · 1005 Bytes
/
固件验证查询-V2.0.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var version = $device.info.version
var model = $device.info.model
var API = "https://ipsw.me/api/ios/v3/device/"
var signed = false
$ui.loading(true)
function output(information, versions) {
$ui.alert({
title: "•••【温馨提示】•••",
message: "当前固件:" + information + "\n可验证固件:" + versions
})
}
function matchVersion(data){
var firmwares = data[model].firmwares.map(function(item) { return item.signed ? item.version : '' })
return firmwares
}
function match(versions) {
$http.get({
url: API + model + "/" + version + "/info.json",
handler: function(resp) {
$ui.loading(false)
data = matchVersion(resp.data)
for (const key in data) {if(data[key] == version){signed = true;break;}}
output(version + (signed ? " (可以验证)" : " (不可验证)"), versions)
}
})
}
$http.get({
url: API + model,
handler: function(resp) {
match(matchVersion(resp.data).filter(function(n){return n}).join(", "))
}
})