mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(devicedescriptors): fix UA in DeviceDescriptors (#2741)
This patch: - updates `utils/fetch_devices.js` script to format UAs for Chrome UAs and to add iPhone 6/7/8 as separate devices. - re-generates `DeviceDescriptors.js` with the new script Fixes #2730.
This commit is contained in:
parent
ddfdaf97c5
commit
cd8d750628
@ -137,7 +137,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Galaxy S5',
|
'name': 'Galaxy S5',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 360,
|
'width': 360,
|
||||||
'height': 640,
|
'height': 640,
|
||||||
@ -149,7 +149,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Galaxy S5 landscape',
|
'name': 'Galaxy S5 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 640,
|
'width': 640,
|
||||||
'height': 360,
|
'height': 360,
|
||||||
@ -161,7 +161,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPad',
|
'name': 'iPad',
|
||||||
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 768,
|
'width': 768,
|
||||||
'height': 1024,
|
'height': 1024,
|
||||||
@ -173,7 +173,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPad landscape',
|
'name': 'iPad landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 1024,
|
'width': 1024,
|
||||||
'height': 768,
|
'height': 768,
|
||||||
@ -185,7 +185,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPad Mini',
|
'name': 'iPad Mini',
|
||||||
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 768,
|
'width': 768,
|
||||||
'height': 1024,
|
'height': 1024,
|
||||||
@ -197,7 +197,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPad Mini landscape',
|
'name': 'iPad Mini landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 1024,
|
'width': 1024,
|
||||||
'height': 768,
|
'height': 768,
|
||||||
@ -209,7 +209,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPad Pro',
|
'name': 'iPad Pro',
|
||||||
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 1024,
|
'width': 1024,
|
||||||
'height': 1366,
|
'height': 1366,
|
||||||
@ -221,7 +221,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPad Pro landscape',
|
'name': 'iPad Pro landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 1366,
|
'width': 1366,
|
||||||
'height': 1024,
|
'height': 1024,
|
||||||
@ -233,7 +233,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 4',
|
'name': 'iPhone 4',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 320,
|
'width': 320,
|
||||||
'height': 480,
|
'height': 480,
|
||||||
@ -245,7 +245,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 4 landscape',
|
'name': 'iPhone 4 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 480,
|
'width': 480,
|
||||||
'height': 320,
|
'height': 320,
|
||||||
@ -257,7 +257,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 5',
|
'name': 'iPhone 5',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 320,
|
'width': 320,
|
||||||
'height': 568,
|
'height': 568,
|
||||||
@ -269,7 +269,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 5 landscape',
|
'name': 'iPhone 5 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 568,
|
'width': 568,
|
||||||
'height': 320,
|
'height': 320,
|
||||||
@ -281,7 +281,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 6',
|
'name': 'iPhone 6',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 375,
|
'width': 375,
|
||||||
'height': 667,
|
'height': 667,
|
||||||
@ -293,7 +293,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 6 landscape',
|
'name': 'iPhone 6 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 667,
|
'width': 667,
|
||||||
'height': 375,
|
'height': 375,
|
||||||
@ -305,7 +305,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 6 Plus',
|
'name': 'iPhone 6 Plus',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 414,
|
'width': 414,
|
||||||
'height': 736,
|
'height': 736,
|
||||||
@ -317,7 +317,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone 6 Plus landscape',
|
'name': 'iPhone 6 Plus landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 736,
|
'width': 736,
|
||||||
'height': 414,
|
'height': 414,
|
||||||
@ -327,6 +327,126 @@ module.exports = [
|
|||||||
'isLandscape': true
|
'isLandscape': true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 7',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 375,
|
||||||
|
'height': 667,
|
||||||
|
'deviceScaleFactor': 2,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 7 landscape',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 667,
|
||||||
|
'height': 375,
|
||||||
|
'deviceScaleFactor': 2,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 7 Plus',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 414,
|
||||||
|
'height': 736,
|
||||||
|
'deviceScaleFactor': 3,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 7 Plus landscape',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 736,
|
||||||
|
'height': 414,
|
||||||
|
'deviceScaleFactor': 3,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 8',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 375,
|
||||||
|
'height': 667,
|
||||||
|
'deviceScaleFactor': 2,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 8 landscape',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 667,
|
||||||
|
'height': 375,
|
||||||
|
'deviceScaleFactor': 2,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 8 Plus',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 414,
|
||||||
|
'height': 736,
|
||||||
|
'deviceScaleFactor': 3,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone 8 Plus landscape',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 736,
|
||||||
|
'height': 414,
|
||||||
|
'deviceScaleFactor': 3,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone SE',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 320,
|
||||||
|
'height': 568,
|
||||||
|
'deviceScaleFactor': 2,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'iPhone SE landscape',
|
||||||
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
|
||||||
|
'viewport': {
|
||||||
|
'width': 568,
|
||||||
|
'height': 320,
|
||||||
|
'deviceScaleFactor': 2,
|
||||||
|
'isMobile': true,
|
||||||
|
'hasTouch': true,
|
||||||
|
'isLandscape': true
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name': 'iPhone X',
|
'name': 'iPhone X',
|
||||||
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||||
@ -377,7 +497,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'LG Optimus L70',
|
'name': 'LG Optimus L70',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 384,
|
'width': 384,
|
||||||
'height': 640,
|
'height': 640,
|
||||||
@ -389,7 +509,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'LG Optimus L70 landscape',
|
'name': 'LG Optimus L70 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 640,
|
'width': 640,
|
||||||
'height': 384,
|
'height': 384,
|
||||||
@ -437,7 +557,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 10',
|
'name': 'Nexus 10',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 4.3; Nexus 10 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 800,
|
'width': 800,
|
||||||
'height': 1280,
|
'height': 1280,
|
||||||
@ -449,7 +569,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 10 landscape',
|
'name': 'Nexus 10 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 4.3; Nexus 10 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 1280,
|
'width': 1280,
|
||||||
'height': 800,
|
'height': 800,
|
||||||
@ -461,7 +581,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 4',
|
'name': 'Nexus 4',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 384,
|
'width': 384,
|
||||||
'height': 640,
|
'height': 640,
|
||||||
@ -473,7 +593,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 4 landscape',
|
'name': 'Nexus 4 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 640,
|
'width': 640,
|
||||||
'height': 384,
|
'height': 384,
|
||||||
@ -485,7 +605,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 5',
|
'name': 'Nexus 5',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 360,
|
'width': 360,
|
||||||
'height': 640,
|
'height': 640,
|
||||||
@ -497,7 +617,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 5 landscape',
|
'name': 'Nexus 5 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 640,
|
'width': 640,
|
||||||
'height': 360,
|
'height': 360,
|
||||||
@ -509,7 +629,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 5X',
|
'name': 'Nexus 5X',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 412,
|
'width': 412,
|
||||||
'height': 732,
|
'height': 732,
|
||||||
@ -521,7 +641,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 5X landscape',
|
'name': 'Nexus 5X landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 732,
|
'width': 732,
|
||||||
'height': 412,
|
'height': 412,
|
||||||
@ -533,7 +653,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 6',
|
'name': 'Nexus 6',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 412,
|
'width': 412,
|
||||||
'height': 732,
|
'height': 732,
|
||||||
@ -545,7 +665,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 6 landscape',
|
'name': 'Nexus 6 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 732,
|
'width': 732,
|
||||||
'height': 412,
|
'height': 412,
|
||||||
@ -557,7 +677,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 6P',
|
'name': 'Nexus 6P',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 412,
|
'width': 412,
|
||||||
'height': 732,
|
'height': 732,
|
||||||
@ -569,7 +689,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 6P landscape',
|
'name': 'Nexus 6P landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 732,
|
'width': 732,
|
||||||
'height': 412,
|
'height': 412,
|
||||||
@ -581,7 +701,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 7',
|
'name': 'Nexus 7',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 600,
|
'width': 600,
|
||||||
'height': 960,
|
'height': 960,
|
||||||
@ -593,7 +713,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Nexus 7 landscape',
|
'name': 'Nexus 7 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 960,
|
'width': 960,
|
||||||
'height': 600,
|
'height': 600,
|
||||||
@ -653,7 +773,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Pixel 2',
|
'name': 'Pixel 2',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 411,
|
'width': 411,
|
||||||
'height': 731,
|
'height': 731,
|
||||||
@ -665,7 +785,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Pixel 2 landscape',
|
'name': 'Pixel 2 landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 731,
|
'width': 731,
|
||||||
'height': 411,
|
'height': 411,
|
||||||
@ -677,7 +797,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Pixel 2 XL',
|
'name': 'Pixel 2 XL',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 411,
|
'width': 411,
|
||||||
'height': 823,
|
'height': 823,
|
||||||
@ -689,7 +809,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Pixel 2 XL landscape',
|
'name': 'Pixel 2 XL landscape',
|
||||||
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Mobile Safari/537.36',
|
'userAgent': 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3452.0 Mobile Safari/537.36',
|
||||||
'viewport': {
|
'viewport': {
|
||||||
'width': 823,
|
'width': 823,
|
||||||
'height': 411,
|
'height': 411,
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
const util = require('util');
|
const util = require('util');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const puppeteer = require('..');
|
||||||
const DEVICES_URL = 'https://raw.githubusercontent.com/ChromeDevTools/devtools-frontend/master/front_end/emulated_devices/module.json';
|
const DEVICES_URL = 'https://raw.githubusercontent.com/ChromeDevTools/devtools-frontend/master/front_end/emulated_devices/module.json';
|
||||||
|
|
||||||
const template = `/**
|
const template = `/**
|
||||||
@ -37,7 +38,7 @@ const template = `/**
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = %s;
|
module.exports = %s;
|
||||||
for (let device of module.exports)
|
for (const device of module.exports)
|
||||||
module.exports[device.name] = device;
|
module.exports[device.name] = device;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -71,6 +72,9 @@ if (!outputPath) {
|
|||||||
main(url);
|
main(url);
|
||||||
|
|
||||||
async function main(url) {
|
async function main(url) {
|
||||||
|
const browser = await puppeteer.launch();
|
||||||
|
const chromeVersion = (await browser.version()).split('/').pop();
|
||||||
|
await browser.close();
|
||||||
console.log('GET ' + url);
|
console.log('GET ' + url);
|
||||||
const text = await httpGET(url);
|
const text = await httpGET(url);
|
||||||
let json = null;
|
let json = null;
|
||||||
@ -83,11 +87,22 @@ async function main(url) {
|
|||||||
const devicePayloads = json.extensions.filter(extension => extension.type === 'emulated-device').map(extension => extension.device);
|
const devicePayloads = json.extensions.filter(extension => extension.type === 'emulated-device').map(extension => extension.device);
|
||||||
let devices = [];
|
let devices = [];
|
||||||
for (const payload of devicePayloads) {
|
for (const payload of devicePayloads) {
|
||||||
const device = createDevice(payload, false);
|
let names = [];
|
||||||
const landscape = createDevice(payload, true);
|
if (payload.title === 'iPhone 6/7/8')
|
||||||
devices.push(device);
|
names = ['iPhone 6', 'iPhone 7', 'iPhone 8'];
|
||||||
if (landscape.viewport.width !== device.viewport.width || landscape.viewport.height !== device.viewport.height)
|
else if (payload.title === 'iPhone 6/7/8 Plus')
|
||||||
devices.push(landscape);
|
names = ['iPhone 6 Plus', 'iPhone 7 Plus', 'iPhone 8 Plus'];
|
||||||
|
else if (payload.title === 'iPhone 5/SE')
|
||||||
|
names = ['iPhone 5', 'iPhone SE'];
|
||||||
|
else
|
||||||
|
names = [payload.title];
|
||||||
|
for (const name of names) {
|
||||||
|
const device = createDevice(chromeVersion, name, payload, false);
|
||||||
|
const landscape = createDevice(chromeVersion, name, payload, true);
|
||||||
|
devices.push(device);
|
||||||
|
if (landscape.viewport.width !== device.viewport.width || landscape.viewport.height !== device.viewport.height)
|
||||||
|
devices.push(landscape);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
devices = devices.filter(device => device.viewport.isMobile);
|
devices = devices.filter(device => device.viewport.isMobile);
|
||||||
devices.sort((a, b) => a.name.localeCompare(b.name));
|
devices.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
@ -100,16 +115,18 @@ async function main(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param {string} chromeVersion
|
||||||
|
* @param {string} deviceName
|
||||||
* @param {*} descriptor
|
* @param {*} descriptor
|
||||||
* @param {boolean} landscape
|
* @param {boolean} landscape
|
||||||
* @return {!Object}
|
* @return {!Object}
|
||||||
*/
|
*/
|
||||||
function createDevice(descriptor, landscape) {
|
function createDevice(chromeVersion, deviceName, descriptor, landscape) {
|
||||||
const devicePayload = loadFromJSONV1(descriptor);
|
const devicePayload = loadFromJSONV1(descriptor);
|
||||||
const viewportPayload = landscape ? devicePayload.horizontal : devicePayload.vertical;
|
const viewportPayload = landscape ? devicePayload.horizontal : devicePayload.vertical;
|
||||||
return {
|
return {
|
||||||
name: descriptor.title + (landscape ? ' landscape' : ''),
|
name: deviceName + (landscape ? ' landscape' : ''),
|
||||||
userAgent: devicePayload.userAgent,
|
userAgent: devicePayload.userAgent.includes('%s') ? util.format(devicePayload.userAgent, chromeVersion) : devicePayload.userAgent,
|
||||||
viewport: {
|
viewport: {
|
||||||
width: viewportPayload.width,
|
width: viewportPayload.width,
|
||||||
height: viewportPayload.height,
|
height: viewportPayload.height,
|
||||||
|
Loading…
Reference in New Issue
Block a user