Skip to content

Commit

Permalink
feat(alias): Continue mapping opera to chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
plesiecki authored and JakeChampion committed Jan 13, 2020
1 parent 56ad82e commit db37102
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 1 deletion.
22 changes: 21 additions & 1 deletion data.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,27 @@
"44": ["chrome", 57],
"45": ["chrome", 58],
"46": ["chrome", 59],
"47": ["chrome", 60]
"47": ["chrome", 60],
"48": ["chrome", 61],
"49": ["chrome", 62],
"50": ["chrome", 63],
"51": ["chrome", 64],
"52": ["chrome", 65],
"53": ["chrome", 66],
"54": ["chrome", 67],
"55": ["chrome", 68],
"56": ["chrome", 69],
"57": ["chrome", 70],
"58": ["chrome", 71],
"59": ["chrome", 72],
"60": ["chrome", 73],
"61": ["chrome", 74],
"62": ["chrome", 75],
"63": ["chrome", 76],
"64": ["chrome", 77],
"65": ["chrome", 78],
"66": ["chrome", 79],
"67": ["chrome", 80]
},

"googlebot": {
Expand Down
100 changes: 100 additions & 0 deletions lib/normalise-user-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,106 @@ function UA(uaString) {
this.ua.major = "60";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "48") {
this.ua.family = "chrome";
this.ua.major = "61";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "49") {
this.ua.family = "chrome";
this.ua.major = "62";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "50") {
this.ua.family = "chrome";
this.ua.major = "63";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "51") {
this.ua.family = "chrome";
this.ua.major = "64";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "52") {
this.ua.family = "chrome";
this.ua.major = "65";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "53") {
this.ua.family = "chrome";
this.ua.major = "66";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "54") {
this.ua.family = "chrome";
this.ua.major = "67";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "55") {
this.ua.family = "chrome";
this.ua.major = "68";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "56") {
this.ua.family = "chrome";
this.ua.major = "69";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "57") {
this.ua.family = "chrome";
this.ua.major = "70";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "58") {
this.ua.family = "chrome";
this.ua.major = "71";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "59") {
this.ua.family = "chrome";
this.ua.major = "72";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "60") {
this.ua.family = "chrome";
this.ua.major = "73";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "61") {
this.ua.family = "chrome";
this.ua.major = "74";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "62") {
this.ua.family = "chrome";
this.ua.major = "75";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "63") {
this.ua.family = "chrome";
this.ua.major = "76";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "64") {
this.ua.family = "chrome";
this.ua.major = "77";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "65") {
this.ua.family = "chrome";
this.ua.major = "78";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "66") {
this.ua.family = "chrome";
this.ua.major = "79";
this.ua.minor = "0";
}
if (this.ua.family === "opera" && this.ua.major === "67") {
this.ua.family = "chrome";
this.ua.major = "80";
this.ua.minor = "0";
}
}
if (this.ua.family === "googlebot") {
if (
Expand Down
100 changes: 100 additions & 0 deletions lib/normalise-user-agent.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,106 @@ sub normalise_user_agent_1_5_1 {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "60";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "48") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "61";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "49") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "62";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "50") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "63";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "51") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "64";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "52") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "65";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "53") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "66";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "54") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "67";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "55") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "68";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "56") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "69";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "57") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "70";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "58") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "71";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "59") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "72";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "60") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "73";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "61") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "74";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "62") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "75";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "63") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "76";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "64") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "77";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "65") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "78";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "66") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "79";
set req.http.normalized_user_agent_minor_version = "0";
}
if (req.http.normalized_user_agent_family == "opera" && req.http.normalized_user_agent_major_version == "67") {
set req.http.normalized_user_agent_family = "chrome";
set req.http.normalized_user_agent_major_version = "80";
set req.http.normalized_user_agent_minor_version = "0";
}
}
if (req.http.normalized_user_agent_family == "googlebot") {
Expand Down

0 comments on commit db37102

Please sign in to comment.