Skip to content

Commit 8917fd2

Browse files
authored
Merge pull request #81 from kryksyh/add_irequestparamsprovider
Add IUpdateRequestsParamsProvider to allow passing additional url params to…
2 parents 4fab538 + b454fb4 commit 8917fd2

4 files changed

Lines changed: 53 additions & 0 deletions

File tree

framework/update/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ target_sources(muse_update PRIVATE
2626
updatetypes.h
2727
updateerrors.h
2828
iupdateconfiguration.h
29+
iupdaterequestparamsprovider.h
2930
iappupdatescenario.h
3031
iappupdateservice.h
3132

framework/update/internal/appupdateservice.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <QJsonValue>
2929
#include <QJsonArray>
3030
#include <QJsonDocument>
31+
#include <QUrlQuery>
3132

3233
#include "update/updateerrors.h"
3334

@@ -134,6 +135,17 @@ Promise<RetVal<ReleaseInfo> > AppUpdateService::checkForUpdate()
134135
}
135136

136137
QUrl url = QString::fromStdString(configuration()->checkForAppUpdateUrl());
138+
if (requestParamsProvider()) {
139+
QUrlQuery query(url);
140+
for (const auto& [key, value] : requestParamsProvider()->updateRequestParams()) {
141+
query.addQueryItem(QString::fromStdString(key), QString::fromStdString(value));
142+
}
143+
144+
if (!query.isEmpty()) {
145+
url.setQuery(query);
146+
}
147+
}
148+
137149
RequestHeaders headers = prepareHeaders(historyRv.val);
138150
auto buff = std::make_shared<QBuffer>();
139151

framework/update/internal/appupdateservice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@
3232

3333
#include "network/inetworkmanagercreator.h"
3434
#include "update/iupdateconfiguration.h"
35+
#include "update/iupdaterequestparamsprovider.h"
3536

3637
namespace muse::update {
3738
class AppUpdateService : public IAppUpdateService, public Contextable, public async::Asyncable
3839
{
3940
GlobalInject<io::IFileSystem> fileSystem;
4041
GlobalInject<ISystemInfo> systemInfo;
4142
GlobalInject<IUpdateConfiguration> configuration;
43+
GlobalInject<IUpdateRequestParamsProvider> requestParamsProvider;
4244
GlobalInject<network::INetworkManagerCreator> networkManagerCreator;
4345
GlobalInject<IApplication> application;
4446

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* SPDX-License-Identifier: GPL-3.0-only
3+
* MuseScore/Audacity CLA applies
4+
*
5+
* Copyright (C) 2026 MuseScore/Audacity and others
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License version 3 as
9+
* published by the Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
20+
#pragma once
21+
22+
#include <string>
23+
#include <utility>
24+
#include <vector>
25+
26+
#include "modularity/imoduleinterface.h"
27+
28+
namespace muse::update {
29+
class IUpdateRequestParamsProvider : MODULE_GLOBAL_INTERFACE
30+
{
31+
INTERFACE_ID(IUpdateRequestParamsProvider)
32+
33+
public:
34+
virtual ~IUpdateRequestParamsProvider() = default;
35+
36+
virtual std::vector<std::pair<std::string, std::string> > updateRequestParams() const = 0;
37+
};
38+
}

0 commit comments

Comments
 (0)