mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Expose identify functionality. Shows a red screen with important data.
This commit is contained in:
parent
9c50c1bcdc
commit
ed5709aa04
6 changed files with 87 additions and 44 deletions
|
@ -12,38 +12,39 @@ var aliases = {
|
|||
|
||||
module.exports.applyData = function(device) {
|
||||
var model = device.model
|
||||
var match
|
||||
|
||||
match = deviceData[model]
|
||||
|
||||
if (!match) {
|
||||
if (aliases[model]) {
|
||||
match = deviceData[aliases[model]]
|
||||
}
|
||||
else {
|
||||
if (!match) {
|
||||
model = model.replace(/ /g, '_')
|
||||
match = deviceData[model]
|
||||
if (model) {
|
||||
var match = deviceData[model]
|
||||
|
||||
if (!match) {
|
||||
if (aliases[model]) {
|
||||
match = deviceData[aliases[model]]
|
||||
}
|
||||
else {
|
||||
if (!match) {
|
||||
model = model.replace(/_/g, '')
|
||||
model = model.replace(/ /g, '_')
|
||||
match = deviceData[model]
|
||||
|
||||
if (!match) {
|
||||
model = model.replace(/_/g, '')
|
||||
match = deviceData[model]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
device.name = match.name.id
|
||||
device.releasedAt = match.date
|
||||
device.image = match.image.s.replace(/^small\//, '')
|
||||
}
|
||||
else {
|
||||
log.warn(
|
||||
'Device database does not have a match for device "%s" (model "%s")'
|
||||
, device.serial
|
||||
, device.model
|
||||
)
|
||||
if (match) {
|
||||
device.name = match.name.id
|
||||
device.releasedAt = match.date
|
||||
device.image = match.image.s.replace(/^small\//, '')
|
||||
}
|
||||
else {
|
||||
log.warn(
|
||||
'Device database does not have a match for device "%s" (model "%s")'
|
||||
, device.serial
|
||||
, device.model
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return device
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue