add overwrite of some mojang urls
Signed-off-by: wohaopa <2411829240@qq.com>
This commit is contained in:
parent
e6cc3f1af1
commit
90599e8f73
@ -218,6 +218,12 @@ set(Launcher_DISCORD_URL "https://prismlauncher.org/discord" CACHE STRING "URL f
|
|||||||
# Subreddit URL
|
# Subreddit URL
|
||||||
set(Launcher_SUBREDDIT_URL "https://prismlauncher.org/reddit" CACHE STRING "URL for the subreddit.")
|
set(Launcher_SUBREDDIT_URL "https://prismlauncher.org/reddit" CACHE STRING "URL for the subreddit.")
|
||||||
|
|
||||||
|
# Minecraft Resources URL
|
||||||
|
set(Launcher_RESOURCE_BASE "https://resources.download.minecraft.net/" CACHE STRING "URL for the Minecraft resources.")
|
||||||
|
|
||||||
|
# Minecraft Libraries URL
|
||||||
|
set(Launcher_LIBRARY_BASE "https://libraries.minecraft.net/" CACHE STRING "URL for the Minecraft Libraries.")
|
||||||
|
|
||||||
# Builds
|
# Builds
|
||||||
set(Launcher_FORCE_BUNDLED_LIBS OFF CACHE BOOL "Prevent using system libraries, if they are available as submodules")
|
set(Launcher_FORCE_BUNDLED_LIBS OFF CACHE BOOL "Prevent using system libraries, if they are available as submodules")
|
||||||
set(Launcher_QT_VERSION_MAJOR "6" CACHE STRING "Major Qt version to build against")
|
set(Launcher_QT_VERSION_MAJOR "6" CACHE STRING "Major Qt version to build against")
|
||||||
|
@ -119,6 +119,9 @@ Config::Config()
|
|||||||
DISCORD_URL = "@Launcher_DISCORD_URL@";
|
DISCORD_URL = "@Launcher_DISCORD_URL@";
|
||||||
SUBREDDIT_URL = "@Launcher_SUBREDDIT_URL@";
|
SUBREDDIT_URL = "@Launcher_SUBREDDIT_URL@";
|
||||||
|
|
||||||
|
RESOURCE_BASE = "@Launcher_RESOURCE_BASE@";
|
||||||
|
LIBRARY_BASE = "@Launcher_LIBRARY_BASE@";
|
||||||
|
|
||||||
FMLLIBS_BASE_URL = "@Launcher_FMLLIBS_BASE_URL@";
|
FMLLIBS_BASE_URL = "@Launcher_FMLLIBS_BASE_URL@";
|
||||||
TRANSLATIONS_BASE_URL = "@Launcher_TRANSLATIONS_BASE_URL@";
|
TRANSLATIONS_BASE_URL = "@Launcher_TRANSLATIONS_BASE_URL@";
|
||||||
}
|
}
|
||||||
|
@ -143,8 +143,8 @@ class Config {
|
|||||||
QString DISCORD_URL;
|
QString DISCORD_URL;
|
||||||
QString SUBREDDIT_URL;
|
QString SUBREDDIT_URL;
|
||||||
|
|
||||||
QString RESOURCE_BASE = "https://resources.download.minecraft.net/";
|
QString RESOURCE_BASE;
|
||||||
QString LIBRARY_BASE = "https://libraries.minecraft.net/";
|
QString LIBRARY_BASE;
|
||||||
QString AUTH_BASE = "https://authserver.mojang.com/";
|
QString AUTH_BASE = "https://authserver.mojang.com/";
|
||||||
QString IMGUR_BASE_URL = "https://api.imgur.com/3/";
|
QString IMGUR_BASE_URL = "https://api.imgur.com/3/";
|
||||||
QString FMLLIBS_BASE_URL;
|
QString FMLLIBS_BASE_URL;
|
||||||
|
@ -676,6 +676,21 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
if (!metaUrl.isValid() || (metaUrl.scheme() != "http" && metaUrl.scheme() != "https"))
|
if (!metaUrl.isValid() || (metaUrl.scheme() != "http" && metaUrl.scheme() != "https"))
|
||||||
m_settings->reset("MetaURLOverride");
|
m_settings->reset("MetaURLOverride");
|
||||||
}
|
}
|
||||||
|
// Some custom urls from Mojang
|
||||||
|
{
|
||||||
|
// Resource Base Url
|
||||||
|
m_settings->registerSetting("MinecraftResourceURLOverride", "");
|
||||||
|
// Libraries Base Url
|
||||||
|
m_settings->registerSetting("MinecraftLibrariesURLOverride", "");
|
||||||
|
|
||||||
|
QUrl resourceUrl(m_settings->get("MinecraftResourceURLOverride").toString());
|
||||||
|
QUrl librariesUrl(m_settings->get("MinecraftLibrariesURLOverride").toString());
|
||||||
|
|
||||||
|
if (!resourceUrl.isValid() || (resourceUrl.scheme() != "http" && resourceUrl.scheme() != "https"))
|
||||||
|
m_settings->reset("MinecraftResourceURLOverride");
|
||||||
|
if (!librariesUrl.isValid() || (librariesUrl.scheme() != "http" && resourceUrl.scheme() != "https"))
|
||||||
|
m_settings->reset("MinecraftLibrariesURLOverride");
|
||||||
|
}
|
||||||
|
|
||||||
m_settings->registerSetting("CloseAfterLaunch", false);
|
m_settings->registerSetting("CloseAfterLaunch", false);
|
||||||
m_settings->registerSetting("QuitAfterGameStop", false);
|
m_settings->registerSetting("QuitAfterGameStop", false);
|
||||||
|
@ -297,7 +297,12 @@ QString AssetObject::getLocalPath()
|
|||||||
|
|
||||||
QUrl AssetObject::getUrl()
|
QUrl AssetObject::getUrl()
|
||||||
{
|
{
|
||||||
|
QString resourceOverride = APPLICATION->settings()->get("MinecraftResourceURLOverride").toString();
|
||||||
|
if (resourceOverride.isEmpty()) {
|
||||||
return BuildConfig.RESOURCE_BASE + getRelPath();
|
return BuildConfig.RESOURCE_BASE + getRelPath();
|
||||||
|
} else {
|
||||||
|
return resourceOverride + getRelPath();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AssetObject::getRelPath()
|
QString AssetObject::getRelPath()
|
||||||
|
@ -172,7 +172,12 @@ QList<NetAction::Ptr> Library::getDownloads(const RuntimeContext& runtimeContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_repositoryURL.isEmpty()) {
|
if (m_repositoryURL.isEmpty()) {
|
||||||
|
QString librariesOverride = APPLICATION->settings()->get("MinecraftLibrariesURLOverride").toString();
|
||||||
|
if (librariesOverride.isEmpty()) {
|
||||||
return BuildConfig.LIBRARY_BASE + raw_storage;
|
return BuildConfig.LIBRARY_BASE + raw_storage;
|
||||||
|
} else {
|
||||||
|
return librariesOverride + raw_storage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_repositoryURL.endsWith('/')) {
|
if (m_repositoryURL.endsWith('/')) {
|
||||||
|
@ -76,11 +76,15 @@ APIPage::APIPage(QWidget* parent) : QWidget(parent), ui(new Ui::APIPage)
|
|||||||
updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex());
|
updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex());
|
||||||
// NOTE: this allows http://, but we replace that with https later anyway
|
// NOTE: this allows http://, but we replace that with https later anyway
|
||||||
ui->metaURL->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->metaURL));
|
ui->metaURL->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->metaURL));
|
||||||
|
ui->resourceURL->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->resourceURL));
|
||||||
|
ui->librariesURL->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->librariesURL));
|
||||||
ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry));
|
ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry));
|
||||||
ui->msaClientID->setValidator(new QRegularExpressionValidator(validMSAClientID, ui->msaClientID));
|
ui->msaClientID->setValidator(new QRegularExpressionValidator(validMSAClientID, ui->msaClientID));
|
||||||
ui->flameKey->setValidator(new QRegularExpressionValidator(validFlameKey, ui->flameKey));
|
ui->flameKey->setValidator(new QRegularExpressionValidator(validFlameKey, ui->flameKey));
|
||||||
|
|
||||||
ui->metaURL->setPlaceholderText(BuildConfig.META_URL);
|
ui->metaURL->setPlaceholderText(BuildConfig.META_URL);
|
||||||
|
ui->resourceURL->setPlaceholderText(BuildConfig.RESOURCE_BASE);
|
||||||
|
ui->librariesURL->setPlaceholderText(BuildConfig.LIBRARY_BASE);
|
||||||
ui->userAgentLineEdit->setPlaceholderText(BuildConfig.USER_AGENT);
|
ui->userAgentLineEdit->setPlaceholderText(BuildConfig.USER_AGENT);
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@ -137,6 +141,10 @@ void APIPage::loadSettings()
|
|||||||
ui->msaClientID->setText(msaClientID);
|
ui->msaClientID->setText(msaClientID);
|
||||||
QString metaURL = s->get("MetaURLOverride").toString();
|
QString metaURL = s->get("MetaURLOverride").toString();
|
||||||
ui->metaURL->setText(metaURL);
|
ui->metaURL->setText(metaURL);
|
||||||
|
QString resourceURL = s->get("MinecraftResourceURLOverride").toString();
|
||||||
|
ui->resourceURL->setText(resourceURL);
|
||||||
|
QString librariesURL = s->get("MinecraftLibrariesURLOverride").toString();
|
||||||
|
ui->librariesURL->setText(librariesURL);
|
||||||
QString flameKey = s->get("FlameKeyOverride").toString();
|
QString flameKey = s->get("FlameKeyOverride").toString();
|
||||||
ui->flameKey->setText(flameKey);
|
ui->flameKey->setText(flameKey);
|
||||||
QString modrinthToken = s->get("ModrinthToken").toString();
|
QString modrinthToken = s->get("ModrinthToken").toString();
|
||||||
@ -165,8 +173,34 @@ void APIPage::applySettings()
|
|||||||
if (!metaURL.isEmpty() && metaURL.scheme() == "http") {
|
if (!metaURL.isEmpty() && metaURL.scheme() == "http") {
|
||||||
metaURL.setScheme("https");
|
metaURL.setScheme("https");
|
||||||
}
|
}
|
||||||
|
|
||||||
s->set("MetaURLOverride", metaURL.toString());
|
s->set("MetaURLOverride", metaURL.toString());
|
||||||
|
|
||||||
|
QUrl resourceURL(ui->resourceURL->text());
|
||||||
|
// Add required trailing slash
|
||||||
|
if (!resourceURL.isEmpty() && !resourceURL.path().endsWith('/')) {
|
||||||
|
QString path = resourceURL.path();
|
||||||
|
path.append('/');
|
||||||
|
resourceURL.setPath(path);
|
||||||
|
}
|
||||||
|
// HTTP may not be allowed either?
|
||||||
|
if (!resourceURL.isEmpty() && resourceURL.scheme() == "http") {
|
||||||
|
resourceURL.setScheme("https");
|
||||||
|
}
|
||||||
|
s->set("MinecraftResourceURLOverride", resourceURL.toString());
|
||||||
|
|
||||||
|
QUrl librariesURL(ui->librariesURL->text());
|
||||||
|
// Add required trailing slash
|
||||||
|
if (!librariesURL.isEmpty() && !librariesURL.path().endsWith('/')) {
|
||||||
|
QString path = librariesURL.path();
|
||||||
|
path.append('/');
|
||||||
|
librariesURL.setPath(path);
|
||||||
|
}
|
||||||
|
// HTTP may not be allowed either?
|
||||||
|
if (!librariesURL.isEmpty() && librariesURL.scheme() == "http") {
|
||||||
|
librariesURL.setScheme("https");
|
||||||
|
}
|
||||||
|
s->set("MinecraftLibrariesURLOverride", librariesURL.toString());
|
||||||
|
|
||||||
QString flameKey = ui->flameKey->text();
|
QString flameKey = ui->flameKey->text();
|
||||||
s->set("FlameKeyOverride", flameKey);
|
s->set("FlameKeyOverride", flameKey);
|
||||||
QString modrinthToken = ui->modrinthToken->text();
|
QString modrinthToken = ui->modrinthToken->text();
|
||||||
|
@ -130,6 +130,42 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_minecraft">
|
||||||
|
<property name="title">
|
||||||
|
<string>Minecraft Resource Server</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>When certain urls in Minecraft change, you can set new urls here.</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="resourceURL">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="librariesURL">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user