fix: change user agent to Firefox on google to enable loging in

This commit is contained in:
Jonathan Rainville 2020-10-07 15:28:45 -04:00 committed by Iuri Matias
parent 03769fbb6e
commit 803b287766

View File

@ -101,27 +101,27 @@ Rectangle {
} }
StyledButton { StyledButton {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding anchors.bottomMargin: Style.current.padding
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
label: qsTr("Allow") label: qsTr("Allow")
onClicked: { onClicked: {
postMessage(true); postMessage(true);
accessDialog.close(); accessDialog.close();
} }
} }
StyledButton { StyledButton {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding anchors.bottomMargin: Style.current.padding
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
label: qsTr("Deny") label: qsTr("Deny")
onClicked: { onClicked: {
postMessage(false); postMessage(false);
accessDialog.close(); accessDialog.close();
} }
} }
} }
@ -251,6 +251,13 @@ Rectangle {
property QtObject defaultProfile: WebEngineProfile { property QtObject defaultProfile: WebEngineProfile {
storageName: "Profile" storageName: "Profile"
offTheRecord: false offTheRecord: false
httpUserAgent: {
if (addressBar.text.indexOf("google.") > -1) {
// Google doesn't let you connect if the user agent is Chrome-ish and doesn't satisfy some sort of hidden requirement
return "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0"
}
return ""
}
useForGlobalCertificateVerification: true useForGlobalCertificateVerification: true
userScripts: [ userScripts: [
WebEngineScript { WebEngineScript {
@ -264,6 +271,7 @@ Rectangle {
property QtObject otrProfile: WebEngineProfile { property QtObject otrProfile: WebEngineProfile {
offTheRecord: true offTheRecord: true
persistentCookiesPolicy: WebEngineProfile.NoPersistentCookies persistentCookiesPolicy: WebEngineProfile.NoPersistentCookies
httpUserAgent: defaultProfile.httpUserAgent
userScripts: [ userScripts: [
WebEngineScript { WebEngineScript {
injectionPoint: WebEngineScript.DocumentCreation injectionPoint: WebEngineScript.DocumentCreation