]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/helpers/UserAgentHelper.cpp
Add search engine options.
[PrivacyBrowserPC.git] / src / helpers / UserAgentHelper.cpp
1 /*
2  * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
3  *
4  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
5  *
6  * Privacy Browser PC is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Privacy Browser PC is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Privacy Browser PC.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 // Application headers.
21 #include "UserAgentHelper.h"
22
23 // The default constructor.
24 UserAgentHelper::UserAgentHelper() {};
25
26 QString UserAgentHelper::getUserAgent(const QString &userAgentName)
27 {
28     if (userAgentName == "Privacy Browser")  // Privacy Browser.
29     {
30         return "PrivacyBrowser/1.0";
31     }
32     else if (userAgentName == "Firefox Linux")  // Firefox Linux.
33     {
34         return "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0";
35     }
36     else if (userAgentName == "Chromium Linux")  // Chromium Linux.
37     {
38         return "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36";
39     }
40     else if (userAgentName == "Firefox Windows")  // Firefox Windows.
41     {
42         return "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0";
43     }
44     else if (userAgentName == "Chrome Windows")  // Chrome Windows.
45     {
46         return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36";
47     }
48     else if (userAgentName == "Edge Windows")  // Edge Windows.
49     {
50         return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34";
51     }
52     else if (userAgentName == "Safari macOS")  // Safari macOS.
53     {
54         return "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15";
55     }
56     else
57     {
58         // Return the custom user agent.
59         return userAgentName;
60     }
61 }