feat: add High DPI and Low DPI Desktop device descriptors (#7531)
This commit is contained in:
parent
cf0fb33540
commit
86b21d5299
|
|
@ -1140,5 +1140,110 @@
|
||||||
"isMobile": true,
|
"isMobile": true,
|
||||||
"hasTouch": true,
|
"hasTouch": true,
|
||||||
"defaultBrowserType": "chromium"
|
"defaultBrowserType": "chromium"
|
||||||
|
},
|
||||||
|
"Desktop Chrome HiDPI": {
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4543.0 Safari/537.36",
|
||||||
|
"screen": {
|
||||||
|
"width": 1792,
|
||||||
|
"height": 1120
|
||||||
|
},
|
||||||
|
"viewport": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
},
|
||||||
|
"deviceScaleFactor": 2,
|
||||||
|
"isMobile": false,
|
||||||
|
"hasTouch": false,
|
||||||
|
"defaultBrowserType": "chromium"
|
||||||
|
},
|
||||||
|
"Desktop Edge HiDPI": {
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4543.0 Safari/537.36 Edg/93.0.4543.0",
|
||||||
|
"screen": {
|
||||||
|
"width": 1792,
|
||||||
|
"height": 1120
|
||||||
|
},
|
||||||
|
"viewport": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
},
|
||||||
|
"deviceScaleFactor": 2,
|
||||||
|
"isMobile": false,
|
||||||
|
"hasTouch": false,
|
||||||
|
"defaultBrowserType": "chromium"
|
||||||
|
},
|
||||||
|
"Desktop Firefox HiDPI": {
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0 Gecko/20100101 Firefox/90.0",
|
||||||
|
"screen": {
|
||||||
|
"width": 1792,
|
||||||
|
"height": 1120
|
||||||
|
},
|
||||||
|
"viewport": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
},
|
||||||
|
"deviceScaleFactor": 2,
|
||||||
|
"isMobile": false,
|
||||||
|
"hasTouch": false,
|
||||||
|
"defaultBrowserType": "firefox"
|
||||||
|
},
|
||||||
|
"Desktop Safari": {
|
||||||
|
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.2 Safari/605.1.15",
|
||||||
|
"screen": {
|
||||||
|
"width": 1792,
|
||||||
|
"height": 1120
|
||||||
|
},
|
||||||
|
"viewport": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
},
|
||||||
|
"deviceScaleFactor": 2,
|
||||||
|
"isMobile": false,
|
||||||
|
"hasTouch": false,
|
||||||
|
"defaultBrowserType": "webkit"
|
||||||
|
},
|
||||||
|
"Desktop Chrome": {
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4543.0 Safari/537.36",
|
||||||
|
"screen": {
|
||||||
|
"width": 1920,
|
||||||
|
"height": 1080
|
||||||
|
},
|
||||||
|
"viewport": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
},
|
||||||
|
"deviceScaleFactor": 1,
|
||||||
|
"isMobile": false,
|
||||||
|
"hasTouch": false,
|
||||||
|
"defaultBrowserType": "chromium"
|
||||||
|
},
|
||||||
|
"Dekstop Edge": {
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4543.0 Safari/537.36 Edg/93.0.4543.0",
|
||||||
|
"screen": {
|
||||||
|
"width": 1920,
|
||||||
|
"height": 1080
|
||||||
|
},
|
||||||
|
"viewport": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
},
|
||||||
|
"deviceScaleFactor": 1,
|
||||||
|
"isMobile": false,
|
||||||
|
"hasTouch": false,
|
||||||
|
"defaultBrowserType": "chromium"
|
||||||
|
},
|
||||||
|
"Desktop Firefox": {
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0 Gecko/20100101 Firefox/90.0",
|
||||||
|
"screen": {
|
||||||
|
"width": 1920,
|
||||||
|
"height": 1080
|
||||||
|
},
|
||||||
|
"viewport": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
},
|
||||||
|
"deviceScaleFactor": 1,
|
||||||
|
"isMobile": false,
|
||||||
|
"hasTouch": false,
|
||||||
|
"defaultBrowserType": "firefox"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
7
types/types.d.ts
vendored
7
types/types.d.ts
vendored
|
|
@ -11425,6 +11425,13 @@ type Devices = {
|
||||||
"Pixel 5 landscape": DeviceDescriptor;
|
"Pixel 5 landscape": DeviceDescriptor;
|
||||||
"Moto G4": DeviceDescriptor;
|
"Moto G4": DeviceDescriptor;
|
||||||
"Moto G4 landscape": DeviceDescriptor;
|
"Moto G4 landscape": DeviceDescriptor;
|
||||||
|
"Desktop Chrome HiDPI": DeviceDescriptor;
|
||||||
|
"Desktop Edge HiDPI": DeviceDescriptor;
|
||||||
|
"Desktop Firefox HiDPI": DeviceDescriptor;
|
||||||
|
"Desktop Safari": DeviceDescriptor;
|
||||||
|
"Desktop Chrome": DeviceDescriptor;
|
||||||
|
"Dekstop Edge": DeviceDescriptor;
|
||||||
|
"Desktop Firefox": DeviceDescriptor;
|
||||||
[key: string]: DeviceDescriptor;
|
[key: string]: DeviceDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,14 @@ async function run() {
|
||||||
devicesDescriptors[deviceName].userAgent = devicesDescriptors[deviceName].userAgent.replace(
|
devicesDescriptors[deviceName].userAgent = devicesDescriptors[deviceName].userAgent.replace(
|
||||||
/(.*Chrome\/)(.*?)( .*)/,
|
/(.*Chrome\/)(.*?)( .*)/,
|
||||||
`$1${versions.chromium}$3`
|
`$1${versions.chromium}$3`
|
||||||
|
).replace(
|
||||||
|
/(.*Edg\/)(.*?)$/,
|
||||||
|
`$1${versions.chromium}`
|
||||||
)
|
)
|
||||||
break;
|
break;
|
||||||
case 'firefox':
|
case 'firefox':
|
||||||
devicesDescriptors[deviceName].userAgent = devicesDescriptors[deviceName].userAgent.replace(
|
devicesDescriptors[deviceName].userAgent = devicesDescriptors[deviceName].userAgent.replace(
|
||||||
/(.*Firefox\/)(.*?)( .*)/,
|
/^(.*Firefox\/)(.*?)( .*?)?$/,
|
||||||
`$1${versions.firefox}$3`
|
`$1${versions.firefox}$3`
|
||||||
).replace(/(.*rv:)(.*)\)(.*?)/, `$1${versions.firefox}$3`)
|
).replace(/(.*rv:)(.*)\)(.*?)/, `$1${versions.firefox}$3`)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue