aboutsummaryrefslogtreecommitdiff
path: root/launcher/net/Upload.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-07-11 14:56:09 +0200
committerGitHub <noreply@github.com>2022-07-11 14:56:09 +0200
commit8f4d7ac655d3815605422c9fc620d5a0f97e41ef (patch)
treeb2a0c3fc3e12ac2d4ce7d8d6a8b24c256b500c57 /launcher/net/Upload.cpp
parentc5625d8d32f45b6ecb71cf7293176dfe7c6579a3 (diff)
parent87cbff391c28d78a5be3d96a0fd58e224d2ed72e (diff)
downloadPrismLauncher-8f4d7ac655d3815605422c9fc620d5a0f97e41ef.tar.gz
PrismLauncher-8f4d7ac655d3815605422c9fc620d5a0f97e41ef.tar.bz2
PrismLauncher-8f4d7ac655d3815605422c9fc620d5a0f97e41ef.zip
Merge pull request #678 from Scrumplex/improvements-around-proprietary-services
Diffstat (limited to 'launcher/net/Upload.cpp')
-rw-r--r--launcher/net/Upload.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp
index c9942a8d..12dd1e78 100644
--- a/launcher/net/Upload.cpp
+++ b/launcher/net/Upload.cpp
@@ -1,6 +1,38 @@
-//
-// Created by timoreo on 20/05/22.
-//
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PolyMC - Minecraft Launcher
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * 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 <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "Upload.h"
@@ -174,8 +206,9 @@ namespace Net {
}
request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8());
- if (request.url().host().contains("api.curseforge.com")) {
- request.setRawHeader("x-api-key", APPLICATION->getCurseKey().toUtf8());
+ if (APPLICATION->currentCapabilities() & Application::SupportsFlame
+ && request.url().host().contains("api.curseforge.com")) {
+ request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8());
}
//TODO other types of post requests ?
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");