@@ -48,28 +51,48 @@ MSALoginDialog::MSALoginDialog(QWidget* parent) : QDialog(parent), ui(new Ui::MS
{
ui->setupUi(this);
- ui->cancel->setEnabled(false);
- ui->link->setVisible(false);
- ui->copy->setVisible(false);
- ui->progressBar->setVisible(false);
+ // make font monospace
+ QFont font;
+ font.setPixelSize(ui->code->fontInfo().pixelSize());
+ font.setFamily(APPLICATION->settings()->get("ConsoleFont").toString());
+ font.setStyleHint(QFont::Monospace);
+ font.setFixedPitch(true);
+ ui->code->setFont(font);
- connect(ui->cancel, &QPushButton::pressed, this, &QDialog::reject);
- connect(ui->copy, &QPushButton::pressed, this, &MSALoginDialog::copyUrl);
+ connect(ui->copyCode, &QPushButton::clicked, this, [this] { QApplication::clipboard()->setText(ui->code->text()); });
+ ui->qr->setPixmap(QIcon((":/documents/login-qr.svg")).pixmap(QSize(150, 150)));
+ connect(ui->loginButton, &QPushButton::clicked, this, [this] {
+ if (m_url.isValid()) {
+ if (!DesktopServices::openUrl(m_url)) {
+ QApplication::clipboard()->setText(m_url.toString());
+ }
+ }
+ });
}
int MSALoginDialog::exec()
{
// Setup the login task and start it
m_account = MinecraftAccount::createBlankMSA();
- m_task = m_account->login(m_using_device_code);
- connect(m_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
- connect(m_task.get(), &Task::succeeded, this, &MSALoginDialog::onTaskSucceeded);
- connect(m_task.get(), &Task::status, this, &MSALoginDialog::onTaskStatus);
- connect(m_task.get(), &AuthFlow::authorizeWithBrowser, this, &MSALoginDialog::authorizeWithBrowser);
- connect(m_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
- connect(ui->cancel, &QPushButton::pressed, m_task.get(), &Task::abort);
- connect(&m_external_timer, &QTimer::timeout, this, &MSALoginDialog::externalLoginTick);
- m_task->start();
+ m_authflow_task = m_account->login(false);
+ connect(m_authflow_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
+ connect(m_authflow_task.get(), &Task::succeeded, this, &QDialog::accept);
+ connect(m_authflow_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
+ connect(m_authflow_task.get(), &Task::status, this, &MSALoginDialog::onTaskStatus);
+ connect(m_authflow_task.get(), &AuthFlow::authorizeWithBrowser, this, &MSALoginDialog::authorizeWithBrowser);
+ connect(m_authflow_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
+ connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_authflow_task.get(), &Task::abort);
+
+ m_devicecode_task.reset(new AuthFlow(m_account->accountData(), AuthFlow::Action::DeviceCode, this));
+ connect(m_devicecode_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
+ connect(m_devicecode_task.get(), &Task::succeeded, this, &QDialog::accept);
+ connect(m_devicecode_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
+ connect(m_devicecode_task.get(), &Task::status, this, &MSALoginDialog::onTaskStatus);
+ connect(m_devicecode_task.get(), &AuthFlow::authorizeWithBrowser, this, &MSALoginDialog::authorizeWithBrowser);
+ connect(m_devicecode_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
+ connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_devicecode_task.get(), &Task::abort);
+ QMetaObject::invokeMethod(m_authflow_task.get(), &Task::start, Qt::QueuedConnection);
+ QMetaObject::invokeMethod(m_devicecode_task.get(), &Task::start, Qt::QueuedConnection);
return QDialog::exec();
}
@@ -79,9 +102,12 @@ MSALoginDialog::~MSALoginDialog()
delete ui;
}
-void MSALoginDialog::onTaskFailed(const QString& reason)
+void MSALoginDialog::onTaskFailed(QString reason)
{
// Set message
+ m_authflow_task->disconnect();
+ m_devicecode_task->disconnect();
+ ui->stackedWidget->setCurrentIndex(0);
auto lines = reason.split('\n');
QString processed;
for (auto line : lines) {
@@ -91,91 +117,53 @@ void MSALoginDialog::onTaskFailed(const QString& reason)
processed += "
";
}
}
- ui->message->setText(processed);
-}
-
-void MSALoginDialog::onTaskSucceeded()
-{
- QDialog::accept();
-}
-
-void MSALoginDialog::onTaskStatus(const QString& status)
-{
- ui->message->setText(status);
- ui->cancel->setEnabled(false);
- ui->link->setVisible(false);
- ui->copy->setVisible(false);
- ui->progressBar->setVisible(false);
-}
-
-// Public interface
-MinecraftAccountPtr MSALoginDialog::newAccount(QWidget* parent, QString msg, bool usingDeviceCode)
-{
- MSALoginDialog dlg(parent);
- dlg.m_using_device_code = usingDeviceCode;
- dlg.ui->message->setText(msg);
- if (dlg.exec() == QDialog::Accepted) {
- return dlg.m_account;
+ ui->status->setText(processed);
+ auto task = m_authflow_task;
+ if (task->failReason().isEmpty()) {
+ task = m_devicecode_task;
}
- return nullptr;
+ if (task) {
+ ui->loadingLabel->setText(task->getStatus());
+ }
+ disconnect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_authflow_task.get(), &Task::abort);
+ disconnect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_devicecode_task.get(), &Task::abort);
+ connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &MSALoginDialog::reject);
}
void MSALoginDialog::authorizeWithBrowser(const QUrl& url)
{
- ui->cancel->setEnabled(true);
- ui->link->setVisible(true);
- ui->copy->setVisible(true);
- DesktopServices::openUrl(url);
- ui->link->setText(url.toDisplayString());
- ui->message->setText(
- tr("Browser opened to complete the login process."
- "
"
- "If your browser hasn't opened, please manually open the below link in your browser:"));
-}
-
-void MSALoginDialog::copyUrl()
-{
- QClipboard* cb = QApplication::clipboard();
- cb->setText(ui->link->text());
+ ui->stackedWidget->setCurrentIndex(1);
+ ui->loginButton->setToolTip(QString("%1
").arg(url.toString()));
+ m_url = url;
}
void MSALoginDialog::authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn)
{
- m_external_elapsed = 0;
- m_external_timeout = expiresIn;
+ ui->stackedWidget->setCurrentIndex(1);
- m_external_timer.setInterval(1000);
- m_external_timer.setSingleShot(false);
- m_external_timer.start();
-
- ui->progressBar->setMaximum(expiresIn);
- ui->progressBar->setValue(m_external_elapsed);
-
- QString linkString = QString("%2").arg(url, url);
- if (url == "https://www.microsoft.com/link" && !code.isEmpty()) {
- url += QString("?otc=%1").arg(code);
- ui->message->setText(tr("Please login in the opened browser. If no browser was opened, please open up %1 in "
- "a browser and put in the code %2 to proceed with login.
")
- .arg(linkString, code));
+ const auto linkString = QString("%2").arg(url, url);
+ ui->code->setText(code);
+ auto isDefaultUrl = url == "https://www.microsoft.com/link";
+ ui->qr->setVisible(isDefaultUrl);
+ if (isDefaultUrl) {
+ ui->qrMessage->setText(tr("Open %1 or scan the QR and enter the above code.").arg(linkString));
} else {
- ui->message->setText(
- tr("Please open up %1 in a browser and put in the code %2 to proceed with login.
").arg(linkString, code));
+ ui->qrMessage->setText(tr("Open %1 and enter the above code.").arg(linkString));
}
- ui->cancel->setEnabled(true);
- ui->link->setVisible(true);
- ui->copy->setVisible(true);
- ui->progressBar->setVisible(true);
- DesktopServices::openUrl(url);
- ui->link->setText(code);
}
-void MSALoginDialog::externalLoginTick()
+void MSALoginDialog::onTaskStatus(QString status)
{
- m_external_elapsed++;
- ui->progressBar->setValue(m_external_elapsed);
- ui->progressBar->repaint();
+ ui->stackedWidget->setCurrentIndex(0);
+ ui->status->setText(status);
+}
- if (m_external_elapsed >= m_external_timeout) {
- m_external_timer.stop();
+// Public interface
+MinecraftAccountPtr MSALoginDialog::newAccount(QWidget* parent)
+{
+ MSALoginDialog dlg(parent);
+ if (dlg.exec() == QDialog::Accepted) {
+ return dlg.m_account;
}
+ return nullptr;
}
\ No newline at end of file
diff --git a/launcher/ui/dialogs/MSALoginDialog.h b/launcher/ui/dialogs/MSALoginDialog.h
index cef647ee4..70f480ca9 100644
--- a/launcher/ui/dialogs/MSALoginDialog.h
+++ b/launcher/ui/dialogs/MSALoginDialog.h
@@ -32,29 +32,23 @@ class MSALoginDialog : public QDialog {
public:
~MSALoginDialog();
- static MinecraftAccountPtr newAccount(QWidget* parent, QString message, bool usingDeviceCode = false);
+ static MinecraftAccountPtr newAccount(QWidget* parent);
int exec() override;
private:
explicit MSALoginDialog(QWidget* parent = 0);
protected slots:
- void onTaskFailed(const QString& reason);
- void onTaskSucceeded();
- void onTaskStatus(const QString& status);
+ void onTaskFailed(QString reason);
+ void onTaskStatus(QString status);
void authorizeWithBrowser(const QUrl& url);
void authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn);
- void copyUrl();
- void externalLoginTick();
private:
Ui::MSALoginDialog* ui;
MinecraftAccountPtr m_account;
- shared_qobject_ptr m_task;
+ shared_qobject_ptr m_devicecode_task;
+ shared_qobject_ptr m_authflow_task;
- int m_external_elapsed;
- int m_external_timeout;
- QTimer m_external_timer;
-
- bool m_using_device_code = false;
+ QUrl m_url;
};
diff --git a/launcher/ui/dialogs/MSALoginDialog.ui b/launcher/ui/dialogs/MSALoginDialog.ui
index df1b32044..c6821782f 100644
--- a/launcher/ui/dialogs/MSALoginDialog.ui
+++ b/launcher/ui/dialogs/MSALoginDialog.ui
@@ -6,87 +6,345 @@
0
0
- 491
- 208
+ 440
+ 430
-
-
- 0
- 0
-
+
+
+ 0
+ 430
+
Add Microsoft Account
-
+
-
-
-
-
- 0
- 0
-
-
-
-
- 500
- 500
-
-
-
-
-
-
- Qt::RichText
-
-
- true
-
-
- true
-
-
- Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+ 1
+
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+
+ 16
+ 75
+ true
+
+
+
+ Please wait...
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+
+ -
+
+
+ Status
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 250
+ 40
+
+
+
+ Sign in with Microsoft
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 16
+
+
+
+ Or
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Horizontal
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 150
+ 150
+
+
+
+
+ 150
+ 150
+
+
+
+
+
+
+ true
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 30
+ 75
+ true
+
+
+
+ IBeamCursor
+
+
+ CODE
+
+
+ Qt::AlignCenter
+
+
+ Qt::TextBrowserInteraction
+
+
+
+ -
+
+
+ Copy code to clipboard
+
+
+
+
+
+
+ ..
+
+
+
+ 22
+ 22
+
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Info
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+ true
+
+
+ Qt::TextBrowserInteraction
+
+
+
+
+
-
-
-
-
-
-
- false
-
-
-
- -
-
-
-
-
-
-
- ..
-
-
-
-
-
- -
-
-
- 24
-
-
- false
-
-
-
- -
-
-
- Cancel
+
+
+ QDialogButtonBox::Cancel
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index 082b16101..90d3b79a9 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
@@ -145,6 +145,7 @@ void ResourceDownloadDialog::confirm()
confirm_dialog->retranslateUi(resourcesString());
QHash dependencyExtraInfo;
+ QStringList depNames;
if (auto task = getModDependenciesTask(); task) {
connect(task.get(), &Task::failed, this,
[&](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->exec(); });
@@ -167,8 +168,10 @@ void ResourceDownloadDialog::confirm()
QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection);
return;
} else {
- for (auto dep : task->getDependecies())
+ for (auto dep : task->getDependecies()) {
addResource(dep->pack, dep->version);
+ depNames << dep->pack->name;
+ }
dependencyExtraInfo = task->getExtraInfo();
}
}
@@ -193,6 +196,9 @@ void ResourceDownloadDialog::confirm()
}
this->accept();
+ } else {
+ for (auto name : depNames)
+ removeResource(name);
}
}
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index 8d0b66004..041b8faff 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -130,20 +130,7 @@ void AccountListPage::listChanged()
void AccountListPage::on_actionAddMicrosoft_triggered()
{
- QMessageBox box(this);
- box.setWindowTitle(tr("Add account"));
- box.setText(tr("How do you want to login?"));
- box.setIcon(QMessageBox::Question);
- auto deviceCode = box.addButton(tr("Legacy"), QMessageBox::ButtonRole::YesRole);
- auto authCode = box.addButton(tr("Recommended"), QMessageBox::ButtonRole::NoRole);
- auto cancel = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::RejectRole);
- box.setDefaultButton(authCode);
- box.exec();
- if ((box.clickedButton() != deviceCode && box.clickedButton() != authCode) || box.clickedButton() == cancel)
- return;
- MinecraftAccountPtr account = MSALoginDialog::newAccount(
- this, tr("Please enter your Mojang account email and password to add your account."), box.clickedButton() == deviceCode);
-
+ auto account = MSALoginDialog::newAccount(this);
if (account) {
m_accounts->addAccount(account);
if (m_accounts->count() == 1) {
diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp
index 72a571754..3f7c7a45f 100644
--- a/launcher/ui/pages/global/LauncherPage.cpp
+++ b/launcher/ui/pages/global/LauncherPage.cpp
@@ -204,6 +204,7 @@ void LauncherPage::applySettings()
s->set("NumberOfConcurrentTasks", ui->numberOfConcurrentTasksSpinBox->value());
s->set("NumberOfConcurrentDownloads", ui->numberOfConcurrentDownloadsSpinBox->value());
s->set("NumberOfManualRetries", ui->numberOfManualRetriesSpinBox->value());
+ s->set("RequestTimeout", ui->timeoutSecondsSpinBox->value());
// Console settings
s->set("ShowConsole", ui->showConsoleCheck->isChecked());
@@ -261,6 +262,7 @@ void LauncherPage::loadSettings()
ui->numberOfConcurrentTasksSpinBox->setValue(s->get("NumberOfConcurrentTasks").toInt());
ui->numberOfConcurrentDownloadsSpinBox->setValue(s->get("NumberOfConcurrentDownloads").toInt());
ui->numberOfManualRetriesSpinBox->setValue(s->get("NumberOfManualRetries").toInt());
+ ui->timeoutSecondsSpinBox->setValue(s->get("RequestTimeout").toInt());
// Console settings
ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui
index 2f7ee47d1..0e3b6b58d 100644
--- a/launcher/ui/pages/global/LauncherPage.ui
+++ b/launcher/ui/pages/global/LauncherPage.ui
@@ -252,6 +252,13 @@
Miscellaneous
+ -
+
+
+ 1
+
+
+
-
@@ -273,21 +280,31 @@
- -
-
-
- 1
+
-
+
+
+ Seconds to wait until the requests are terminated
+
+
+ Timeout for HTTP requests
- -
+
-
+
+
+ s
+
+
+
+ -
Number of manual retries
- -
+
-
0
diff --git a/launcher/ui/pages/modplatform/ImportPage.cpp b/launcher/ui/pages/modplatform/ImportPage.cpp
index 38208f5b0..1efc6199e 100644
--- a/launcher/ui/pages/modplatform/ImportPage.cpp
+++ b/launcher/ui/pages/modplatform/ImportPage.cpp
@@ -104,7 +104,7 @@ void ImportPage::updateState()
return;
}
if (ui->modpackEdit->hasAcceptableInput()) {
- QString input = ui->modpackEdit->text();
+ QString input = ui->modpackEdit->text().trimmed();
auto url = QUrl::fromUserInput(input);
if (url.isLocalFile()) {
// FIXME: actually do some validation of what's inside here... this is fake AF
diff --git a/launcher/updater/PrismExternalUpdater.cpp b/launcher/updater/PrismExternalUpdater.cpp
index dc1aae872..69774dc04 100644
--- a/launcher/updater/PrismExternalUpdater.cpp
+++ b/launcher/updater/PrismExternalUpdater.cpp
@@ -85,6 +85,11 @@ PrismExternalUpdater::~PrismExternalUpdater()
}
void PrismExternalUpdater::checkForUpdates()
+{
+ checkForUpdates(true);
+}
+
+void PrismExternalUpdater::checkForUpdates(bool triggeredByUser)
{
QProgressDialog progress(tr("Checking for updates..."), "", 0, 0, priv->parent);
progress.setCancelButton(nullptr);
@@ -160,7 +165,7 @@ void PrismExternalUpdater::checkForUpdates()
switch (exit_code) {
case 0:
// no update available
- {
+ if (triggeredByUser) {
qDebug() << "No update available";
auto msgBox = QMessageBox(QMessageBox::Information, tr("No Update Available"), tr("You are running the latest version."),
QMessageBox::Ok, priv->parent);
@@ -288,7 +293,7 @@ void PrismExternalUpdater::disconnectTimer()
void PrismExternalUpdater::autoCheckTimerFired()
{
qDebug() << "Auto update Timer fired";
- checkForUpdates();
+ checkForUpdates(false);
}
void PrismExternalUpdater::offerUpdate(const QString& version_name, const QString& version_tag, const QString& release_notes)
diff --git a/launcher/updater/PrismExternalUpdater.h b/launcher/updater/PrismExternalUpdater.h
index bfe94c149..b88676028 100644
--- a/launcher/updater/PrismExternalUpdater.h
+++ b/launcher/updater/PrismExternalUpdater.h
@@ -41,6 +41,7 @@ class PrismExternalUpdater : public ExternalUpdater {
* Check for updates manually, showing the user a progress bar and an alert if no updates are found.
*/
void checkForUpdates() override;
+ void checkForUpdates(bool triggeredByUser);
/*!
* Indicates whether or not to check for updates automatically.
diff --git a/launcher/updater/prismupdater/PrismUpdater.cpp b/launcher/updater/prismupdater/PrismUpdater.cpp
index 83d8efa22..6b9754864 100644
--- a/launcher/updater/prismupdater/PrismUpdater.cpp
+++ b/launcher/updater/prismupdater/PrismUpdater.cpp
@@ -244,8 +244,9 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
auto updater_executable = QCoreApplication::applicationFilePath();
- if (BuildConfig.BUILD_ARTIFACT.toLower() == "macos")
- showFatalErrorMessage(tr("MacOS Not Supported"), tr("The updater does not support installations on MacOS"));
+#ifdef Q_OS_MACOS
+ showFatalErrorMessage(tr("MacOS Not Supported"), tr("The updater does not support installations on MacOS"));
+#endif
if (updater_executable.startsWith("/tmp/.mount_")) {
m_isAppimage = true;
@@ -327,6 +328,19 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
// on command line
adjustedBy = "Command line";
m_dataPath = dirParam;
+#ifndef Q_OS_MACOS
+ if (QDir(FS::PathCombine(m_rootPath, "UserData")).exists()) {
+ m_isPortable = true;
+ }
+ if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
+ m_isPortable = true;
+ }
+#endif
+ } else if (auto dataDirEnv =
+ QProcessEnvironment::systemEnvironment().value(QString("%1_DATA_DIR").arg(BuildConfig.LAUNCHER_NAME.toUpper()));
+ !dataDirEnv.isEmpty()) {
+ adjustedBy = "System environment";
+ m_dataPath = dataDirEnv;
#ifndef Q_OS_MACOS
if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
m_isPortable = true;
@@ -338,7 +352,11 @@ PrismUpdaterApp::PrismUpdaterApp(int& argc, char** argv) : QApplication(argc, ar
adjustedBy = "Persistent data path";
#ifndef Q_OS_MACOS
- if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
+ if (auto portableUserData = FS::PathCombine(m_rootPath, "UserData"); QDir(portableUserData).exists()) {
+ m_dataPath = portableUserData;
+ adjustedBy = "Portable user data path";
+ m_isPortable = true;
+ } else if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
m_dataPath = m_rootPath;
adjustedBy = "Portable data path";
m_isPortable = true;
@@ -580,12 +598,6 @@ void PrismUpdaterApp::run()
return exit(result ? 0 : 1);
}
- if (BuildConfig.BUILD_ARTIFACT.toLower() == "linux" && !m_isPortable) {
- showFatalErrorMessage(tr("Updating Not Supported"),
- tr("Updating non-portable linux installations is not supported. Please use your system package manager"));
- return;
- }
-
if (need_update || m_forceUpdate || !m_userSelectedVersion.isEmpty()) {
GitHubRelease update_release = latest;
if (!m_userSelectedVersion.isEmpty()) {
@@ -787,6 +799,10 @@ QList PrismUpdaterApp::validReleaseArtifacts(const GitHubRel
if (BuildConfig.BUILD_ARTIFACT.isEmpty())
qWarning() << "Build platform is not set!";
for (auto asset : release.assets) {
+ if (asset.name.endsWith(".zsync")) {
+ qDebug() << "Rejecting zsync file" << asset.name;
+ continue;
+ }
if (!m_isAppimage && asset.name.toLower().endsWith("appimage")) {
qDebug() << "Rejecting" << asset.name << "because it is an AppImage";
continue;
@@ -1020,7 +1036,7 @@ void PrismUpdaterApp::performInstall(QFileInfo file)
FS::write(changelog_path, m_install_release.body.toUtf8());
logUpdate(tr("Updating from %1 to %2").arg(m_prismVersion).arg(m_install_release.tag_name));
- if (m_isPortable || file.suffix().toLower() == "zip") {
+ if (m_isPortable || file.fileName().endsWith(".zip") || file.fileName().endsWith(".tar.gz")) {
write_lock_file(update_lock_path, QDateTime::currentDateTime(), m_prismVersion, m_install_release.tag_name, m_rootPath, m_dataPath);
logUpdate(tr("Updating portable install at %1").arg(m_rootPath));
unpackAndInstall(file);
@@ -1094,7 +1110,7 @@ void PrismUpdaterApp::backupAppDir()
if (file_list.isEmpty()) {
// best guess
- if (BuildConfig.BUILD_ARTIFACT.toLower() == "linux") {
+ if (BuildConfig.BUILD_ARTIFACT.toLower().contains("linux")) {
file_list.append({ "PrismLauncher", "bin", "share", "lib" });
} else { // windows by process of elimination
file_list.append({
diff --git a/program_info/org.prismlauncher.PrismLauncher.desktop.in b/program_info/org.prismlauncher.PrismLauncher.desktop.in
index a2846b06e..c0e4e9458 100644
--- a/program_info/org.prismlauncher.PrismLauncher.desktop.in
+++ b/program_info/org.prismlauncher.PrismLauncher.desktop.in
@@ -1,13 +1,13 @@
[Desktop Entry]
Version=1.0
-Name=Prism Launcher
+Name=@Launcher_DisplayName@
Comment=Discover, manage, and play Minecraft instances
Type=Application
Terminal=false
Exec=@Launcher_APP_BINARY_NAME@ %U
StartupNotify=true
-Icon=org.prismlauncher.PrismLauncher
+Icon=org.@Launcher_APP_BINARY_NAME@.@Launcher_CommonName@
Categories=Game;ActionGame;AdventureGame;Simulation;
Keywords=game;minecraft;mc;
-StartupWMClass=PrismLauncher
-MimeType=application/zip;application/x-modrinth-modpack+zip;x-scheme-handler/curseforge;
+StartupWMClass=@Launcher_CommonName@
+MimeType=application/zip;application/x-modrinth-modpack+zip;x-scheme-handler/curseforge;x-scheme-handler/@Launcher_APP_BINARY_NAME@;
diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in
index eda85821b..cc56b9bd5 100644
--- a/program_info/win_install.nsi.in
+++ b/program_info/win_install.nsi.in
@@ -368,6 +368,10 @@ Section "@Launcher_DisplayName@"
WriteRegStr HKCU Software\Classes\curseforge "URL Protocol" ""
WriteRegStr HKCU Software\Classes\curseforge\shell\open\command "" '"$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" "%1"'
+; Write the URL Handler into registry for prismlauncher
+ WriteRegStr HKCU Software\Classes\prismlauncher "URL Protocol" ""
+ WriteRegStr HKCU Software\Classes\prismlauncher\shell\open\command "" '"$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" "%1"'
+
; Write the uninstall keys for Windows
${GetParameters} $R0
${GetOptions} $R0 "/NoUninstaller" $R1