From b454fb49225910257799d5ebba5e5fc389667f1d Mon Sep 17 00:00:00 2001 From: Dmitry Makarenko Date: Wed, 10 Jun 2026 10:57:24 +0300 Subject: [PATCH] Add IUpdateRequestsParamsProvider to allow passing additional url params to the update checker --- framework/update/CMakeLists.txt | 1 + .../update/internal/appupdateservice.cpp | 12 ++++++ framework/update/internal/appupdateservice.h | 2 + .../update/iupdaterequestparamsprovider.h | 38 +++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 framework/update/iupdaterequestparamsprovider.h diff --git a/framework/update/CMakeLists.txt b/framework/update/CMakeLists.txt index 7f02d6cb04..d0df426801 100644 --- a/framework/update/CMakeLists.txt +++ b/framework/update/CMakeLists.txt @@ -26,6 +26,7 @@ target_sources(muse_update PRIVATE updatetypes.h updateerrors.h iupdateconfiguration.h + iupdaterequestparamsprovider.h iappupdatescenario.h iappupdateservice.h diff --git a/framework/update/internal/appupdateservice.cpp b/framework/update/internal/appupdateservice.cpp index a067e810ae..a28ec5fe02 100644 --- a/framework/update/internal/appupdateservice.cpp +++ b/framework/update/internal/appupdateservice.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "update/updateerrors.h" @@ -134,6 +135,17 @@ Promise > AppUpdateService::checkForUpdate() } QUrl url = QString::fromStdString(configuration()->checkForAppUpdateUrl()); + if (requestParamsProvider()) { + QUrlQuery query(url); + for (const auto& [key, value] : requestParamsProvider()->updateRequestParams()) { + query.addQueryItem(QString::fromStdString(key), QString::fromStdString(value)); + } + + if (!query.isEmpty()) { + url.setQuery(query); + } + } + RequestHeaders headers = prepareHeaders(historyRv.val); auto buff = std::make_shared(); diff --git a/framework/update/internal/appupdateservice.h b/framework/update/internal/appupdateservice.h index 8586fd334a..958bb5d7eb 100644 --- a/framework/update/internal/appupdateservice.h +++ b/framework/update/internal/appupdateservice.h @@ -32,6 +32,7 @@ #include "network/inetworkmanagercreator.h" #include "update/iupdateconfiguration.h" +#include "update/iupdaterequestparamsprovider.h" namespace muse::update { class AppUpdateService : public IAppUpdateService, public Contextable, public async::Asyncable @@ -39,6 +40,7 @@ class AppUpdateService : public IAppUpdateService, public Contextable, public as GlobalInject fileSystem; GlobalInject systemInfo; GlobalInject configuration; + GlobalInject requestParamsProvider; GlobalInject networkManagerCreator; GlobalInject application; diff --git a/framework/update/iupdaterequestparamsprovider.h b/framework/update/iupdaterequestparamsprovider.h new file mode 100644 index 0000000000..3787e6c027 --- /dev/null +++ b/framework/update/iupdaterequestparamsprovider.h @@ -0,0 +1,38 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore/Audacity CLA applies + * + * Copyright (C) 2026 MuseScore/Audacity and others + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include + +#include "modularity/imoduleinterface.h" + +namespace muse::update { +class IUpdateRequestParamsProvider : MODULE_GLOBAL_INTERFACE +{ + INTERFACE_ID(IUpdateRequestParamsProvider) + +public: + virtual ~IUpdateRequestParamsProvider() = default; + + virtual std::vector > updateRequestParams() const = 0; +}; +}