commit
dd7632d314
@ -0,0 +1,54 @@
|
||||
From 693a2ea3926400b1482888a2df2c532852b8f971 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Lohnau <alexander.lohnau@gmx.de>
|
||||
Date: Sun, 20 Mar 2022 20:29:51 +0100
|
||||
Subject: [PATCH 10/15] Do not set user-visible name as additional agent
|
||||
information
|
||||
|
||||
Instead we want the filename, which is more useful as an identifier anyways, because
|
||||
we would otherwise have to check which user-visible names originate from which knsrc file.
|
||||
|
||||
BUG: 451165
|
||||
---
|
||||
src/core/engine.cpp | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/engine.cpp b/src/core/engine.cpp
|
||||
index e7abfde8..72af9c83 100644
|
||||
--- a/src/core/engine.cpp
|
||||
+++ b/src/core/engine.cpp
|
||||
@@ -145,6 +145,7 @@ public:
|
||||
QString busyMessage;
|
||||
QString useLabel;
|
||||
bool uploadEnabled = false;
|
||||
+ QString configFileName;
|
||||
};
|
||||
|
||||
Engine::Engine(QObject *parent)
|
||||
@@ -224,6 +225,7 @@ bool Engine::init(const QString &configfile)
|
||||
conf.reset(new KConfig(configfile));
|
||||
qCWarning(KNEWSTUFFCORE) << "Using a deprecated location for the knsrc file" << configfile
|
||||
<< " - please contact the author of the software which provides this file to get it updated to use the new location";
|
||||
+ configFileName = QFileInfo(configfile).baseName();
|
||||
} else if (isRelativeConfig && actualConfig.isEmpty()) {
|
||||
configFileName = QFileInfo(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("knsrcfiles/%1").arg(configfile))).baseName();
|
||||
conf.reset(new KConfig(QStringLiteral("knsrcfiles/%1").arg(configfile), KConfig::FullConfig, QStandardPaths::GenericDataLocation));
|
||||
@@ -234,6 +236,7 @@ bool Engine::init(const QString &configfile)
|
||||
configFileName = configFileInfo.baseName();
|
||||
conf.reset(new KConfig(configfile));
|
||||
}
|
||||
+ d->configFileName = configFileName;
|
||||
|
||||
if (conf->accessMode() == KConfig::NoAccess) {
|
||||
Q_EMIT signalErrorCode(KNSCore::ConfigFileError, i18n("Configuration file exists, but cannot be opened: \"%1\"", configfile), configfile);
|
||||
@@ -425,7 +428,7 @@ void Engine::slotProviderFileLoaded(const QDomDocument &doc)
|
||||
|
||||
QSharedPointer<KNSCore::Provider> provider;
|
||||
if (isAtticaProviderFile || n.attribute(QStringLiteral("type")).toLower() == QLatin1String("rest")) {
|
||||
- provider.reset(new AtticaProvider(m_categories, d->name));
|
||||
+ provider.reset(new AtticaProvider(m_categories, d->configFileName));
|
||||
connect(provider.data(), &Provider::categoriesMetadataLoded, this, [this](const QList<Provider::CategoryMetadata> &categories) {
|
||||
d->categoriesMetadata = categories;
|
||||
Q_EMIT signalCategoriesMetadataLoded(categories);
|
||||
--
|
||||
2.35.1
|
||||
|
@ -1,58 +0,0 @@
|
||||
From 4e7a1a65d0872bc905bd1355670397f4993b86b1 Mon Sep 17 00:00:00 2001
|
||||
From: Troy Dawson <tdawson@redhat.com>
|
||||
Date: Fri, 18 Mar 2022 10:54:00 -0700
|
||||
Subject: [PATCH] providersurl-cache
|
||||
|
||||
---
|
||||
src/core/engine.cpp | 4 ++++
|
||||
src/core/jobs/httpworker.cpp | 12 +++++++++++-
|
||||
2 files changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/engine.cpp b/src/core/engine.cpp
|
||||
index 428af1b..9c2990c 100644
|
||||
--- a/src/core/engine.cpp
|
||||
+++ b/src/core/engine.cpp
|
||||
@@ -265,6 +265,10 @@ bool Engine::init(const QString &configfile)
|
||||
Q_EMIT uploadEnabledChanged();
|
||||
|
||||
m_providerFileUrl = group.readEntry("ProvidersUrl");
|
||||
+ if (m_providerFileUrl == QLatin1String("https://download.kde.org/ocs/providers.xml")) {
|
||||
+ m_providerFileUrl = QStringLiteral("https://autoconfig.kde.org/ocs/providers.xml");
|
||||
+ qCWarning(KNEWSTUFFCORE) << "Please make sure" << configfile << "has ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml";
|
||||
+ }
|
||||
if (group.readEntry("UseLocalProvidersFile", "false").toLower() == QLatin1String{"true"}) {
|
||||
// The local providers file is called "appname.providers", to match "appname.knsrc"
|
||||
m_providerFileUrl = QUrl::fromLocalFile(QLatin1String("%1.providers").arg(configFullPath.left(configFullPath.length() - 6))).toString();
|
||||
diff --git a/src/core/jobs/httpworker.cpp b/src/core/jobs/httpworker.cpp
|
||||
index b81edd2..d4dd8a2 100644
|
||||
--- a/src/core/jobs/httpworker.cpp
|
||||
+++ b/src/core/jobs/httpworker.cpp
|
||||
@@ -41,7 +41,6 @@ public:
|
||||
return nam.get(request);
|
||||
}
|
||||
|
||||
-private:
|
||||
QNetworkDiskCache cache;
|
||||
};
|
||||
|
||||
@@ -102,6 +101,17 @@ static void addUserAgent(QNetworkRequest &request)
|
||||
agentHeader += QStringLiteral("-%1/%2").arg(QCoreApplication::instance()->applicationName(), QCoreApplication::instance()->applicationVersion());
|
||||
}
|
||||
request.setHeader(QNetworkRequest::UserAgentHeader, agentHeader);
|
||||
+
|
||||
+ // Assume that no cache expiration time will be longer than a week, but otherwise prefer the cache
|
||||
+ // This is mildly hacky, but if we don't do this, we end up with infinite cache expirations in some
|
||||
+ // cases, which of course isn't really acceptable... See ed62ee20 for a situation where that happened.
|
||||
+ QNetworkCacheMetaData cacheMeta{s_httpWorkerNAM->cache.metaData(request.url())};
|
||||
+ if (cacheMeta.isValid()) {
|
||||
+ const QDateTime nextWeek{QDateTime::currentDateTime().addDays(7)};
|
||||
+ if (cacheMeta.expirationDate().isValid() && cacheMeta.expirationDate() < nextWeek) {
|
||||
+ request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
void HTTPWorker::startRequest()
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1 +1 @@
|
||||
SHA512 (knewstuff-5.90.0.tar.xz) = d80b743691eb9665e0df196a69db3cee2247bbfe6c34ea5e9511c94558d2e807c9aca867aef6cd4344eaae6f252d9fff6b3e7a31c152b8a8b69b8d54813ede28
|
||||
SHA512 (knewstuff-5.96.0.tar.xz) = 5fffe90a25adbe5d0f9d69694beba5f9fe0418656d190bdb99c1495b7338cec5c0374e8f38d4fe3801cbea18a7596494d0e651fdb628c9d4e13932627fe60a26
|
||||
|
@ -0,0 +1 @@
|
||||
knewstuff
|
Loading…
Reference in new issue