~phablet-team/webbrowser-app/trunk

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright 2014-2017 Canonical Ltd.
 *
 * This file is part of webbrowser-app.
 *
 * webbrowser-app is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * webbrowser-app is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

.pragma library

// Note: when changing the values of these variables, all domains which
// use them must be carefully tested to ensure no regression.
var android_no_device_override = "Mozilla/5.0 (Linux; Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
var nexus5_override = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
var ubuntu_like_android_override = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
var no_android_token = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";

var overrides = [
    // Youtube (https://launchpad.net/bugs/1228415, https://launchpad.net/bugs/1415107, https://launchpad.net/bugs/1417258, https://launchpad.net/bugs/1499394, https://launchpad.net/bugs/1408760, https://launchpad.net/bugs/1437485)
    ["^https:\/\/(www|m)\.youtube\.com\/", android_no_device_override],

    // Gmail (https://launchpad.net/bugs/1375889)
    ["^https:\/\/mail\.google\.com\/", android_no_device_override],

    // Google plus (https://launchpad.net/bugs/1656310)
    ["^https:\/\/plus\.google\.com\/", ubuntu_like_android_override],

    // Google hangouts (https://launchpad.net/bugs/1565055)
    ["^https:\/\/hangouts\.google\.com\/", ubuntu_like_android_override],
    ["^https:\/\/talkgadget\.google\.com\/hangouts\/", ubuntu_like_android_override],
    ["^https:\/\/plus\.google\.com\/hangouts\/", ubuntu_like_android_override],

    // Google recaptcha (https://launchpad.net/bugs/1599146)
    ["^https:\/\/www\.google\.com\/recaptcha\/", ubuntu_like_android_override],

    // Google photos (https://launchpad.net/bugs/1665926)
    ["^https:\/\/photos\.google\.com\/", ubuntu_like_android_override],

    // Facebook (https://launchpad.net/bugs/1538056, https://launchpad.net/bugs/1457661)
    ["^https:\/\/(www|m)\.facebook\.com\/", nexus5_override],

    // Twitter (https://launchpad.net/bugs/1577834)
    ["^https:\/\/mobile\.twitter\.com\/", no_android_token],

    // meet.jit.si (https://launchpad.net/bugs/1635971)
    ["^https:\/\/meet\.jit\.si\/", ubuntu_like_android_override],

    // ESPN websites (https://launchpad.net/bugs/1316259)
    ["^http:\/\/(\w+\.)*espn\.(go\.)?com\/", ubuntu_like_android_override],

    // New York Times (https://launchpad.net/bugs/1573620)
    ["^https?:\/\/(mobile\.)?nytimes\.com\/", nexus5_override],

    // appear.in (https://launchpad.net/bugs/1659288)
    ["^https:\/\/appear\.in\/", no_android_token],
];