First sweep moving URLs to a constants file
This commit is contained in:
parent
808ca76363
commit
979946b7bb
@ -303,6 +303,7 @@ logic/net/S3ListBucket.h
|
|||||||
logic/net/S3ListBucket.cpp
|
logic/net/S3ListBucket.cpp
|
||||||
logic/net/PasteUpload.h
|
logic/net/PasteUpload.h
|
||||||
logic/net/PasteUpload.cpp
|
logic/net/PasteUpload.cpp
|
||||||
|
logic/net/URLConstants.h
|
||||||
|
|
||||||
# Yggdrasil login stuff
|
# Yggdrasil login stuff
|
||||||
logic/auth/MojangAccount.h
|
logic/auth/MojangAccount.h
|
||||||
|
@ -76,6 +76,8 @@
|
|||||||
|
|
||||||
#include "logic/updater/DownloadUpdateTask.h"
|
#include "logic/updater/DownloadUpdateTask.h"
|
||||||
|
|
||||||
|
#include "logic/net/URLConstants.h"
|
||||||
|
|
||||||
#include "logic/BaseInstance.h"
|
#include "logic/BaseInstance.h"
|
||||||
#include "logic/InstanceFactory.h"
|
#include "logic/InstanceFactory.h"
|
||||||
#include "logic/MinecraftProcess.h"
|
#include "logic/MinecraftProcess.h"
|
||||||
@ -217,7 +219,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
{
|
{
|
||||||
auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
|
auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
|
||||||
auto action = CacheDownload::make(
|
auto action = CacheDownload::make(
|
||||||
QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name + ".png"),
|
QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"),
|
||||||
meta);
|
meta);
|
||||||
job->addNetAction(action);
|
job->addNetAction(action);
|
||||||
meta->stale = true;
|
meta->stale = true;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <logger/QsLog.h>
|
#include <logger/QsLog.h>
|
||||||
|
|
||||||
#include <logic/net/NetJob.h>
|
#include <logic/net/NetJob.h>
|
||||||
|
#include <logic/net/URLConstants.h>
|
||||||
|
|
||||||
#include <gui/dialogs/EditAccountDialog.h>
|
#include <gui/dialogs/EditAccountDialog.h>
|
||||||
#include <gui/dialogs/ProgressDialog.h>
|
#include <gui/dialogs/ProgressDialog.h>
|
||||||
@ -134,7 +135,7 @@ void AccountListDialog::addAccount(const QString& errMsg)
|
|||||||
{
|
{
|
||||||
auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
|
auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
|
||||||
auto action = CacheDownload::make(
|
auto action = CacheDownload::make(
|
||||||
QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name + ".png"),
|
QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"),
|
||||||
meta);
|
meta);
|
||||||
job->addNetAction(action);
|
job->addNetAction(action);
|
||||||
meta->stale = true;
|
meta->stale = true;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <quazipfile.h>
|
#include <quazipfile.h>
|
||||||
#include <JlCompress.h>
|
#include <JlCompress.h>
|
||||||
#include "logger/QsLog.h"
|
#include "logger/QsLog.h"
|
||||||
|
#include "logic/net/URLConstants.h"
|
||||||
|
|
||||||
LegacyUpdate::LegacyUpdate(BaseInstance *inst, bool only_prepare, QObject *parent)
|
LegacyUpdate::LegacyUpdate(BaseInstance *inst, bool only_prepare, QObject *parent)
|
||||||
: Task(parent), m_inst(inst), m_only_prepare(only_prepare)
|
: Task(parent), m_inst(inst), m_only_prepare(only_prepare)
|
||||||
@ -263,7 +264,7 @@ void LegacyUpdate::jarStart()
|
|||||||
|
|
||||||
QString version_id = inst->intendedVersionId();
|
QString version_id = inst->intendedVersionId();
|
||||||
QString localPath = version_id + "/" + version_id + ".jar";
|
QString localPath = version_id + "/" + version_id + ".jar";
|
||||||
QString urlstr = "http://s3.amazonaws.com/Minecraft.Download/versions/" + localPath;
|
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
|
||||||
|
|
||||||
auto dljob = new NetJob("Minecraft.jar for version " + version_id);
|
auto dljob = new NetJob("Minecraft.jar for version " + version_id);
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "OneSixLibrary.h"
|
#include "OneSixLibrary.h"
|
||||||
#include "OneSixRule.h"
|
#include "OneSixRule.h"
|
||||||
#include "OpSys.h"
|
#include "OpSys.h"
|
||||||
|
#include "logic/net/URLConstants.h"
|
||||||
|
|
||||||
void OneSixLibrary::finalize()
|
void OneSixLibrary::finalize()
|
||||||
{
|
{
|
||||||
@ -140,9 +141,9 @@ QJsonObject OneSixLibrary::toJson()
|
|||||||
libRoot.insert("MMC-absoluteUrl", m_absolute_url);
|
libRoot.insert("MMC-absoluteUrl", m_absolute_url);
|
||||||
if (m_hint.size())
|
if (m_hint.size())
|
||||||
libRoot.insert("MMC-hint", m_hint);
|
libRoot.insert("MMC-hint", m_hint);
|
||||||
if (m_base_url != "http://s3.amazonaws.com/Minecraft.Download/libraries/" &&
|
if (m_base_url != "http://" + URLConstants::AWS_DOWNLOAD_LIBRARIES &&
|
||||||
m_base_url != "https://s3.amazonaws.com/Minecraft.Download/libraries/" &&
|
m_base_url != "https://" + URLConstants::AWS_DOWNLOAD_LIBRARIES &&
|
||||||
m_base_url != "https://libraries.minecraft.net/")
|
m_base_url != "https://" + URLConstants::LIBRARY_BASE)
|
||||||
libRoot.insert("url", m_base_url);
|
libRoot.insert("url", m_base_url);
|
||||||
if (isNative() && m_native_suffixes.size())
|
if (isNative() && m_native_suffixes.size())
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "logic/net/URLConstants.h"
|
||||||
#include "OpSys.h"
|
#include "OpSys.h"
|
||||||
|
|
||||||
class Rule;
|
class Rule;
|
||||||
@ -30,7 +31,7 @@ class OneSixLibrary
|
|||||||
private:
|
private:
|
||||||
// basic values used internally (so far)
|
// basic values used internally (so far)
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_base_url = "https://libraries.minecraft.net/";
|
QString m_base_url = "https://" + URLConstants::LIBRARY_BASE;
|
||||||
QList<std::shared_ptr<Rule>> m_rules;
|
QList<std::shared_ptr<Rule>> m_rules;
|
||||||
|
|
||||||
// custom values
|
// custom values
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "OneSixLibrary.h"
|
#include "OneSixLibrary.h"
|
||||||
#include "OneSixInstance.h"
|
#include "OneSixInstance.h"
|
||||||
#include "net/ForgeMirrors.h"
|
#include "net/ForgeMirrors.h"
|
||||||
|
#include "net/URLConstants.h"
|
||||||
#include "assets/AssetsUtils.h"
|
#include "assets/AssetsUtils.h"
|
||||||
|
|
||||||
#include "pathutils.h"
|
#include "pathutils.h"
|
||||||
@ -131,8 +132,7 @@ void OneSixUpdate::versionFileStart()
|
|||||||
QLOG_INFO() << m_inst->name() << ": getting version file.";
|
QLOG_INFO() << m_inst->name() << ": getting version file.";
|
||||||
setStatus("Getting the version files from Mojang.");
|
setStatus("Getting the version files from Mojang.");
|
||||||
|
|
||||||
QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/");
|
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + targetVersion->descriptor() + "/" + targetVersion->descriptor() + ".json";
|
||||||
urlstr += targetVersion->descriptor() + "/" + targetVersion->descriptor() + ".json";
|
|
||||||
auto job = new NetJob("Version index");
|
auto job = new NetJob("Version index");
|
||||||
job->addNetAction(ByteArrayDownload::make(QUrl(urlstr)));
|
job->addNetAction(ByteArrayDownload::make(QUrl(urlstr)));
|
||||||
specificVersionDownloadJob.reset(job);
|
specificVersionDownloadJob.reset(job);
|
||||||
@ -202,7 +202,7 @@ void OneSixUpdate::assetIndexStart()
|
|||||||
OneSixInstance *inst = (OneSixInstance *)m_inst;
|
OneSixInstance *inst = (OneSixInstance *)m_inst;
|
||||||
std::shared_ptr<OneSixVersion> version = inst->getFullVersion();
|
std::shared_ptr<OneSixVersion> version = inst->getFullVersion();
|
||||||
QString assetName = version->assets;
|
QString assetName = version->assets;
|
||||||
QUrl indexUrl("http://s3.amazonaws.com/Minecraft.Download/indexes/" + assetName + ".json");
|
QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json";
|
||||||
QString localPath = assetName + ".json";
|
QString localPath = assetName + ".json";
|
||||||
auto job = new NetJob("Asset index for " + inst->name());
|
auto job = new NetJob("Asset index for " + inst->name());
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ void OneSixUpdate::assetIndexFinished()
|
|||||||
if ((!objectFile.isFile()) || (objectFile.size() != object.size))
|
if ((!objectFile.isFile()) || (objectFile.size() != object.size))
|
||||||
{
|
{
|
||||||
auto objectDL = MD5EtagDownload::make(
|
auto objectDL = MD5EtagDownload::make(
|
||||||
QUrl("http://resources.download.minecraft.net/" + objectName),
|
QUrl("http://" + URLConstants::RESOURCE_BASE + objectName),
|
||||||
objectFile.filePath());
|
objectFile.filePath());
|
||||||
dls.append(objectDL);
|
dls.append(objectDL);
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ void OneSixUpdate::jarlibStart()
|
|||||||
{
|
{
|
||||||
QString version_id = version->id;
|
QString version_id = version->id;
|
||||||
QString localPath = version_id + "/" + version_id + ".jar";
|
QString localPath = version_id + "/" + version_id + ".jar";
|
||||||
QString urlstr = "http://s3.amazonaws.com/Minecraft.Download/versions/" + localPath;
|
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
|
||||||
|
|
||||||
auto job = new NetJob("Libraries for instance " + inst->name());
|
auto job = new NetJob("Libraries for instance " + inst->name());
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <MultiMC.h>
|
#include <MultiMC.h>
|
||||||
#include <logic/auth/MojangAccount.h>
|
#include <logic/auth/MojangAccount.h>
|
||||||
|
#include <logic/net/URLConstants.h>
|
||||||
|
|
||||||
YggdrasilTask::YggdrasilTask(MojangAccount *account, QObject *parent)
|
YggdrasilTask::YggdrasilTask(MojangAccount *account, QObject *parent)
|
||||||
: Task(parent), m_account(account)
|
: Task(parent), m_account(account)
|
||||||
@ -38,7 +39,7 @@ void YggdrasilTask::executeTask()
|
|||||||
QJsonDocument doc(getRequestContent());
|
QJsonDocument doc(getRequestContent());
|
||||||
|
|
||||||
auto worker = MMC->qnam();
|
auto worker = MMC->qnam();
|
||||||
QUrl reqUrl("https://authserver.mojang.com/" + getEndpoint());
|
QUrl reqUrl("https://" + URLConstants::AUTH_BASE + getEndpoint());
|
||||||
QNetworkRequest netRequest(reqUrl);
|
QNetworkRequest netRequest(reqUrl);
|
||||||
netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "MinecraftVersionList.h"
|
#include "MinecraftVersionList.h"
|
||||||
#include "MultiMC.h"
|
#include "MultiMC.h"
|
||||||
|
#include "logic/net/URLConstants.h"
|
||||||
|
|
||||||
#include <QtXml>
|
#include <QtXml>
|
||||||
|
|
||||||
@ -28,10 +29,6 @@
|
|||||||
|
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
|
||||||
#define MCVLIST_URLBASE "http://s3.amazonaws.com/Minecraft.Download/versions/"
|
|
||||||
#define ASSETS_URLBASE "http://assets.minecraft.net/"
|
|
||||||
#define MCN_URLBASE "http://sonicrules.org/mcnweb.py"
|
|
||||||
|
|
||||||
MinecraftVersionList::MinecraftVersionList(QObject *parent) : BaseVersionList(parent)
|
MinecraftVersionList::MinecraftVersionList(QObject *parent) : BaseVersionList(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -144,7 +141,7 @@ void MCVListLoadTask::executeTask()
|
|||||||
{
|
{
|
||||||
setStatus("Loading instance version list...");
|
setStatus("Loading instance version list...");
|
||||||
auto worker = MMC->qnam();
|
auto worker = MMC->qnam();
|
||||||
vlistReply = worker->get(QNetworkRequest(QUrl(QString(MCVLIST_URLBASE) + "versions.json")));
|
vlistReply = worker->get(QNetworkRequest(QUrl("http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + "versions.json")));
|
||||||
connect(vlistReply, SIGNAL(finished()), this, SLOT(list_downloaded()));
|
connect(vlistReply, SIGNAL(finished()), this, SLOT(list_downloaded()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +267,7 @@ void MCVListLoadTask::list_downloaded()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Get the download URL.
|
// Get the download URL.
|
||||||
QString dlUrl = QString(MCVLIST_URLBASE) + versionID + "/";
|
QString dlUrl = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + versionID + "/";
|
||||||
|
|
||||||
// Now, we construct the version object and add it to the list.
|
// Now, we construct the version object and add it to the list.
|
||||||
std::shared_ptr<MinecraftVersion> mcVersion(new MinecraftVersion());
|
std::shared_ptr<MinecraftVersion> mcVersion(new MinecraftVersion());
|
||||||
|
@ -102,7 +102,6 @@ void S3ListBucket::processValidReply()
|
|||||||
};
|
};
|
||||||
|
|
||||||
// nothing went wrong...
|
// nothing went wrong...
|
||||||
QString prefix("http://s3.amazonaws.com/Minecraft.Resources/");
|
|
||||||
QByteArray ba = m_reply->readAll();
|
QByteArray ba = m_reply->readAll();
|
||||||
|
|
||||||
QString xmlErrorMsg;
|
QString xmlErrorMsg;
|
||||||
|
32
logic/net/URLConstants.h
Normal file
32
logic/net/URLConstants.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* Copyright 2013 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace URLConstants
|
||||||
|
{
|
||||||
|
const QString AWS_DOWNLOAD_BASE("s3.amazonaws.com/Minecraft.Download/");
|
||||||
|
const QString AWS_DOWNLOAD_VERSIONS(AWS_DOWNLOAD_BASE + "versions/");
|
||||||
|
const QString AWS_DOWNLOAD_LIBRARIES(AWS_DOWNLOAD_BASE + "libraries/");
|
||||||
|
const QString AWS_DOWNLOAD_INDEXES(AWS_DOWNLOAD_BASE + "indexes/");
|
||||||
|
const QString ASSETS_BASE("assets.minecraft.net/");
|
||||||
|
//const QString MCN_BASE("sonicrules.org/mcnweb.py");
|
||||||
|
const QString RESOURCE_BASE("resources.download.minecraft.net/");
|
||||||
|
const QString LIBRARY_BASE("libraries.minecraft.net/");
|
||||||
|
const QString SKINS_BASE("skins.minecraft.net/MinecraftSkins/");
|
||||||
|
const QString AUTH_BASE("authserver.mojang.com/");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user