git » signon-ui.git » commit 5545c75

Fake user agent to bypass Google's qtwebengine blacklist

author Antonio Rojas
2020-02-17 15:46:01 UTC
committer Antonio Rojas
2020-02-17 15:46:01 UTC
parent 8ce37bf26119703d32c1104860ea8b6d335811c4

Fake user agent to bypass Google's qtwebengine blacklist

PKGBUILD +11 -6
fake-user-agent.patch +12 -0

diff --git a/PKGBUILD b/PKGBUILD
index 2ea2ca9..d6107a7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,32 +4,37 @@
 
 pkgname=signon-ui
 pkgver=0.17+20171022
-pkgrel=1
+pkgrel=2
 _commit=4368bb77d9d1abc2978af514225ba4a42c29a646
 pkgdesc='UI component responsible for handling the user interactions which can happen during the login process of an online account'
 arch=(x86_64)
 url="https://launchpad.net/online-accounts-signon-ui"
 license=(GPL)
 depends=(libaccounts-qt qt5-webengine signond libnotify)
-source=("https://gitlab.com/accounts-sso/signon-ui/repository/archive.tar.gz?ref=$_commit")
-sha256sums=('58aa8f7a16e56d20c47471f08ae63ac8dce6a3c8cda8274dfdc233041d541145')
+source=($pkgname-$pkgver.tar.gz::"https://gitlab.com/accounts-sso/signon-ui/repository/archive.tar.gz?ref=$_commit"
+         fake-user-agent.patch)
+sha256sums=('58aa8f7a16e56d20c47471f08ae63ac8dce6a3c8cda8274dfdc233041d541145'
+            '5eb7782c6472e51a8107a25324d1d30052bac5d8e9050907cd957c89568fa577')
 
 prepare() {
-  cd signon-ui-*
+  mv signon-ui-$_commit-$_commit $pkgname-$pkgver
+  cd $pkgname-$pkgver
 
   # Do not install tests
   sed -e 's|src \\|src|' -e '/tests/d' -i signon-ui.pro
+  # Fake user ID to bypass Google blacklist
+  patch -p1 -i ../fake-user-agent.patch
 }
 
 build() {
-  cd signon-ui-*
+  cd $pkgname-$pkgver
 
   qmake-qt5 PREFIX=/usr LIBDIR=/usr/lib
   make
 }
 
 package() {
-  cd signon-ui-*
+  cd $pkgname-$pkgver
 
   make INSTALL_ROOT="$pkgdir" install
 }
diff --git a/fake-user-agent.patch b/fake-user-agent.patch
new file mode 100644
index 0000000..b8021b4
--- /dev/null
+++ b/fake-user-agent.patch
@@ -0,0 +1,12 @@
+diff --git a/src/qml/WebView.qml b/src/qml/WebView.qml
+index 33462b8..b720111 100644
+--- a/src/qml/WebView.qml
++++ b/src/qml/WebView.qml
+@@ -25,6 +25,7 @@ WebEngineView {
+     profile: WebEngineProfile {
+         cachePath: rootDir
+         persistentStoragePath: rootDir
++        httpUserAgent: "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/77.0"
+     }
+ 
+     ProgressBar {