diff options
author | Bart Ribbers <bribbers@disroot.org> | 2022-02-19 11:40:34 +0100 |
---|---|---|
committer | Bart Ribbers <bribbers@disroot.org> | 2022-02-19 11:40:34 +0100 |
commit | 1cb797ff48bc4f19ae17275da604a140b94b3237 (patch) | |
tree | 81ee17fdd707c9964cd17fb8f046554370983cef | |
parent | b5c29c7257a758b4411266fc1e63725c4448654b (diff) |
community/plasma-desktop: backport upstream requested patch
-rw-r--r-- | community/plasma-desktop/0001-Only-trust-the-expiration-date-if-its-less-than-24-hours.patch | 43 | ||||
-rw-r--r-- | community/plasma-desktop/APKBUILD | 7 |
2 files changed, 48 insertions, 2 deletions
diff --git a/community/plasma-desktop/0001-Only-trust-the-expiration-date-if-its-less-than-24-hours.patch b/community/plasma-desktop/0001-Only-trust-the-expiration-date-if-its-less-than-24-hours.patch new file mode 100644 index 00000000000..bafd18c3ce9 --- /dev/null +++ b/community/plasma-desktop/0001-Only-trust-the-expiration-date-if-its-less-than-24-hours.patch @@ -0,0 +1,43 @@ +From b85cf34298c274b5f16cb6c2aead7b87f0dabbb8 Mon Sep 17 00:00:00 2001 +From: Dan Leinir Turthra Jensen <admin@leinir.dk> +Date: Wed, 9 Feb 2022 09:23:50 +0000 +Subject: [PATCH] Only trust the expiration date if it's less than 24 hours + +--- + attica-kde/kdeplugin/kdeplatformdependent.cpp | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/attica-kde/kdeplugin/kdeplatformdependent.cpp b/attica-kde/kdeplugin/kdeplatformdependent.cpp +index fbc15ec4e..3cad87b36 100644 +--- a/attica-kde/kdeplugin/kdeplatformdependent.cpp ++++ b/attica-kde/kdeplugin/kdeplatformdependent.cpp +@@ -125,6 +125,26 @@ QNetworkRequest KdePlatformDependent::addOAuthToRequest(const QNetworkRequest &r + const QString bearer = bearer_format.arg(token); + notConstReq.setRawHeader("Authorization", bearer.toUtf8()); + } ++ notConstReq.setAttribute(QNetworkRequest::Http2AllowedAttribute, true); ++ ++ // Add cache preference in a granular fashion (we will almost certainly want more of these, but...) ++ static const QStringList preferCacheEndpoints{QLatin1String{"/content/categories"}}; ++ for (const QString &endpoint : preferCacheEndpoints) { ++ if (notConstReq.url().toString().endsWith(endpoint)) { ++ QNetworkCacheMetaData cacheMeta{m_accessManager->cache()->metaData(notConstReq.url())}; ++ if (cacheMeta.isValid()) { ++ // If the expiration date is valid, but longer than 24 hours, don't trust that things ++ // haven't changed and check first, otherwise just use the cached version to relieve ++ // server strain and reduce network traffic. ++ const QDateTime tomorrow{QDateTime::currentDateTime().addDays(1)}; ++ if (cacheMeta.expirationDate().isValid() && cacheMeta.expirationDate() < tomorrow) { ++ notConstReq.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); ++ } ++ } ++ break; ++ } ++ } ++ + return notConstReq; + } + +-- +GitLab + diff --git a/community/plasma-desktop/APKBUILD b/community/plasma-desktop/APKBUILD index 81e357096e9..c6c3d1324f4 100644 --- a/community/plasma-desktop/APKBUILD +++ b/community/plasma-desktop/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Bart Ribbers <bribbers@disroot.org> pkgname=plasma-desktop pkgver=5.23.5 -pkgrel=0 +pkgrel=1 pkgdesc="KDE Plasma Desktop" # armhf blocked by qt5-qtdeclarative # s390x and mips64 blocked by ibus @@ -68,7 +68,9 @@ case "$pkgver" in *.90*) _rel=unstable;; *) _rel=stable;; esac -source="https://download.kde.org/$_rel/plasma/$pkgver/plasma-desktop-$pkgver.tar.xz" +source="https://download.kde.org/$_rel/plasma/$pkgver/plasma-desktop-$pkgver.tar.xz + 0001-Only-trust-the-expiration-date-if-its-less-than-24-hours.patch + " subpackages="$pkgname-dbg $pkgname-doc $pkgname-lang knetattach" options="!check" # Requires running dbus @@ -101,4 +103,5 @@ knetattach() { } sha512sums=" 14cd20b24e265ef9cc4e4ebbfc743151cf5f9ba0a94fbc19e44571c7e68db61d68bab17dd1feea6f4e0844ab448110010fbfe85212b426c1e12232b73bd1c531 plasma-desktop-5.23.5.tar.xz +909b4bcc2ac04df4db1a95eab19c49e5a08ef0fc0c0c042849740119221475b98398f2bf9a9ce02f2800ca60f9b7184bf4dc9f20b47df59cceda280418979cdf 0001-Only-trust-the-expiration-date-if-its-less-than-24-hours.patch " |