From f5f2d33f930674e03f8c81c1eaa3d35ddabc2886 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Sat, 11 Feb 2023 17:35:08 -0500 Subject: [PATCH 01/40] parse nil metadata Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- launcher/InstancePageProvider.h | 2 +- .../minecraft/mod/tasks/LocalModParseTask.cpp | 72 +++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/launcher/InstancePageProvider.h b/launcher/InstancePageProvider.h index 5d8beca9..286298cc 100644 --- a/launcher/InstancePageProvider.h +++ b/launcher/InstancePageProvider.h @@ -36,7 +36,7 @@ public: values.append(new VersionPage(onesix.get())); values.append(ManagedPackPage::createPage(onesix.get())); auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList()); - modsPage->setFilter("%1 (*.zip *.jar *.litemod)"); + modsPage->setFilter("%1 (*.zip *.jar *.litemod *.nilmod)"); values.append(modsPage); values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList())); values.append(new ResourcePackPage(onesix.get(), onesix->resourcePackList())); diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index 91cb747f..03b599ea 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -285,6 +285,48 @@ ModDetails ReadLiteModInfo(QByteArray contents) return details; } +// https://git.sleeping.town/unascribed/NilLoader/src/commit/d7fc87b255fc31019ff90f80d45894927fac6efc/src/main/java/nilloader/api/NilMetadata.java#L64 +ModDetails ReadNilModInfo(QByteArray contents, QString fname) +{ + ModDetails details; + + // this is a css file (why) but we only care about a couple key/value pairs from it + // hence this instead of a css parser lib + // could be made a lot better but it works(tm) + // (does css require properties to be on their own lines? if so, the code can get less horrible looking) + QString contentStr = QString(contents).trimmed(); + int firstidx = contentStr.indexOf("@nilmod"); + firstidx = contentStr.indexOf("{", firstidx); + int lastidx = contentStr.indexOf("}", firstidx); + int nameidx = contentStr.indexOf("name:", firstidx); + int descidx = contentStr.indexOf("description:", firstidx); + int authorsidx = contentStr.indexOf("authors:", firstidx); + int versionidx = contentStr.indexOf("version:", firstidx); + + if (nameidx != -1 && nameidx < lastidx) { + nameidx = contentStr.indexOf('"', nameidx); + details.name = contentStr.mid(nameidx + 1, contentStr.indexOf('"', nameidx + 1) - nameidx - 1); + } + if (descidx != -1 && descidx < lastidx) { + descidx = contentStr.indexOf('"', descidx); + details.description = contentStr.mid(descidx + 1, contentStr.indexOf('"', descidx + 1) - descidx - 1); + } + if (authorsidx != -1 && authorsidx < lastidx) { + authorsidx = contentStr.indexOf('"', authorsidx); + details.authors.append(contentStr.mid(authorsidx + 1, contentStr.indexOf('"', authorsidx + 1) - authorsidx - 1)); + } + if (versionidx != -1 && versionidx < lastidx) { + versionidx = contentStr.indexOf('"', versionidx); + details.version = contentStr.mid(versionidx + 1, contentStr.indexOf('"', versionidx + 1) - versionidx - 1); + } else { + details.version = "?"; + } + + details.mod_id = fname.remove(".nilmod.css"); + + return details; +} + bool process(Mod& mod, ProcessingLevel level) { switch (mod.type()) { @@ -401,6 +443,36 @@ bool processZIP(Mod& mod, ProcessingLevel level) mod.setDetails(details); return true; + } else if (zip.setCurrentFile("META-INF/nil/mappings.json")) { + // nilloader uses the filename of the metadata file for the modid, so we can't know the exact filename + // thankfully, there is a good file to use as a canary so we don't look for nil meta all the time + + QStringList foundNilMetas; + for (auto& fname : zip.getFileNameList()) { + if (fname.endsWith(".nilmod.css")) { + foundNilMetas.append(fname); + } + } + + if (foundNilMetas.size() > 1 && foundNilMetas.at(0) == "nilloader.nilmod.css") { + // nilmods can shade nilloader to be able to run as a standalone agent - which includes nilloader's own meta file + // so if there is more than one meta file, ignore nilloader's meta, since it's not the actual mod + foundNilMetas.removeFirst(); + } + + if (zip.setCurrentFile(foundNilMetas.at(0))) { + if (!file.open(QIODevice::ReadOnly)) { + zip.close(); + return false; + } + + details = ReadNilModInfo(file.readAll(), foundNilMetas.at(0)); + file.close(); + zip.close(); + + mod.setDetails(details); + return true; + } } zip.close(); From 7896dd19c12c0276551ba188adc6184dcf0a3184 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Sat, 11 Feb 2023 17:36:06 -0500 Subject: [PATCH 02/40] nilmods instance page mostly copied from the coremod page impl Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- launcher/InstancePageProvider.h | 1 + launcher/minecraft/MinecraftInstance.cpp | 17 +++++++++++++++++ launcher/minecraft/MinecraftInstance.h | 3 +++ launcher/minecraft/launch/ScanModFolders.cpp | 14 +++++++++++++- launcher/minecraft/launch/ScanModFolders.h | 2 ++ launcher/ui/pages/instance/ModFolderPage.cpp | 9 +++++++++ launcher/ui/pages/instance/ModFolderPage.h | 13 +++++++++++++ 7 files changed, 58 insertions(+), 1 deletion(-) diff --git a/launcher/InstancePageProvider.h b/launcher/InstancePageProvider.h index 286298cc..b4b6e739 100644 --- a/launcher/InstancePageProvider.h +++ b/launcher/InstancePageProvider.h @@ -39,6 +39,7 @@ public: modsPage->setFilter("%1 (*.zip *.jar *.litemod *.nilmod)"); values.append(modsPage); values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList())); + values.append(new NilModFolderPage(onesix.get(), onesix->nilModList())); values.append(new ResourcePackPage(onesix.get(), onesix->resourcePackList())); values.append(new TexturePackPage(onesix.get(), onesix->texturePackList())); values.append(new ShaderPackPage(onesix.get(), onesix->shaderPackList())); diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index 4fe234c4..0737a648 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -290,6 +290,11 @@ QString MinecraftInstance::coreModsDir() const return FS::PathCombine(gameRoot(), "coremods"); } +QString MinecraftInstance::nilModsDir() const +{ + return FS::PathCombine(gameRoot(), "nilmods"); +} + QString MinecraftInstance::resourcePacksDir() const { return FS::PathCombine(gameRoot(), "resourcepacks"); @@ -1125,6 +1130,18 @@ std::shared_ptr MinecraftInstance::coreModList() const return m_core_mod_list; } +std::shared_ptr MinecraftInstance::nilModList() const +{ + if (!m_nil_mod_list) + { + bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool(); + m_nil_mod_list.reset(new ModFolderModel(nilModsDir(), is_indexed)); + m_nil_mod_list->disableInteraction(isRunning()); + connect(this, &BaseInstance::runningStatusChanged, m_nil_mod_list.get(), &ModFolderModel::disableInteraction); + } + return m_nil_mod_list; +} + std::shared_ptr MinecraftInstance::resourcePackList() const { if (!m_resource_pack_list) diff --git a/launcher/minecraft/MinecraftInstance.h b/launcher/minecraft/MinecraftInstance.h index 1bbd7b83..a75fa481 100644 --- a/launcher/minecraft/MinecraftInstance.h +++ b/launcher/minecraft/MinecraftInstance.h @@ -84,6 +84,7 @@ public: QString shaderPacksDir() const; QString modsRoot() const override; QString coreModsDir() const; + QString nilModsDir() const; QString modsCacheLocation() const; QString libDir() const; QString worldDir() const; @@ -116,6 +117,7 @@ public: ////// Mod Lists ////// std::shared_ptr loaderModList() const; std::shared_ptr coreModList() const; + std::shared_ptr nilModList() const; std::shared_ptr resourcePackList() const; std::shared_ptr texturePackList() const; std::shared_ptr shaderPackList() const; @@ -170,6 +172,7 @@ protected: // data std::shared_ptr m_components; mutable std::shared_ptr m_loader_mod_list; mutable std::shared_ptr m_core_mod_list; + mutable std::shared_ptr m_nil_mod_list; mutable std::shared_ptr m_resource_pack_list; mutable std::shared_ptr m_shader_pack_list; mutable std::shared_ptr m_texture_pack_list; diff --git a/launcher/minecraft/launch/ScanModFolders.cpp b/launcher/minecraft/launch/ScanModFolders.cpp index bdffeadd..71e7638c 100644 --- a/launcher/minecraft/launch/ScanModFolders.cpp +++ b/launcher/minecraft/launch/ScanModFolders.cpp @@ -55,6 +55,12 @@ void ScanModFolders::executeTask() if(!cores->update()) { m_coreModsDone = true; } + + auto nils = m_inst->nilModList(); + connect(nils.get(), &ModFolderModel::updateFinished, this, &ScanModFolders::nilModsDone); + if(!nils->update()) { + m_nilModsDone = true; + } checkDone(); } @@ -70,9 +76,15 @@ void ScanModFolders::coreModsDone() checkDone(); } +void ScanModFolders::nilModsDone() +{ + m_nilModsDone = true; + checkDone(); +} + void ScanModFolders::checkDone() { - if(m_modsDone && m_coreModsDone) { + if(m_modsDone && m_coreModsDone && m_nilModsDone) { emitSucceeded(); } } diff --git a/launcher/minecraft/launch/ScanModFolders.h b/launcher/minecraft/launch/ScanModFolders.h index d5989170..111a5850 100644 --- a/launcher/minecraft/launch/ScanModFolders.h +++ b/launcher/minecraft/launch/ScanModFolders.h @@ -33,10 +33,12 @@ public: private slots: void coreModsDone(); void modsDone(); + void nilModsDone(); private: void checkDone(); private: // DATA bool m_modsDone = false; + bool m_nilModsDone = false; bool m_coreModsDone = false; }; diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp index d9069915..8c87a8a0 100644 --- a/launcher/ui/pages/instance/ModFolderPage.cpp +++ b/launcher/ui/pages/instance/ModFolderPage.cpp @@ -273,3 +273,12 @@ bool CoreModFolderPage::shouldDisplay() const } return false; } + +NilModFolderPage::NilModFolderPage(BaseInstance* inst, std::shared_ptr mods, QWidget* parent) + : ModFolderPage(inst, mods, parent) +{} + +bool NilModFolderPage::shouldDisplay() const +{ + return !m_model->dir().isEmpty(); +} diff --git a/launcher/ui/pages/instance/ModFolderPage.h b/launcher/ui/pages/instance/ModFolderPage.h index ff58b38a..cad240bd 100644 --- a/launcher/ui/pages/instance/ModFolderPage.h +++ b/launcher/ui/pages/instance/ModFolderPage.h @@ -81,3 +81,16 @@ class CoreModFolderPage : public ModFolderPage { virtual bool shouldDisplay() const override; }; + +class NilModFolderPage : public ModFolderPage { + public: + explicit NilModFolderPage(BaseInstance* inst, std::shared_ptr mods, QWidget* parent = 0); + virtual ~NilModFolderPage() = default; + + virtual QString displayName() const override { return tr("Nilmods"); } + virtual QIcon icon() const override { return APPLICATION->getThemedIcon("coremods"); } + virtual QString id() const override { return "nilmods"; } + virtual QString helpPage() const override { return "Nil-mods"; } + + virtual bool shouldDisplay() const override; +}; From c07fff750354e23149470d493a7c96624fe2ab26 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Sun, 12 Feb 2023 17:23:15 -0500 Subject: [PATCH 03/40] switch to qdcss for parsing make it not horrible to look at Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- CMakeLists.txt | 1 + launcher/CMakeLists.txt | 1 + .../minecraft/mod/tasks/LocalModParseTask.cpp | 39 +++++---------- libraries/README.md | 8 +++ libraries/qdcss/CMakeLists.txt | 18 +++++++ libraries/qdcss/include/qdcss.h | 21 ++++++++ libraries/qdcss/src/qdcss.cpp | 49 +++++++++++++++++++ 7 files changed, 110 insertions(+), 27 deletions(-) create mode 100644 libraries/qdcss/CMakeLists.txt create mode 100644 libraries/qdcss/include/qdcss.h create mode 100644 libraries/qdcss/src/qdcss.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 37bb49ba..6ce8143c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -448,6 +448,7 @@ if (NOT ghc_filesystem_FOUND) else() message(STATUS "Using system ghc_filesystem") endif() +add_subdirectory(libraries/qdcss) # css parser ############################### Built Artifacts ############################### diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 1bfe9cbc..c6b9e380 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1025,6 +1025,7 @@ target_link_libraries(Launcher_logic nbt++ ${ZLIB_LIBRARIES} tomlplusplus::tomlplusplus + qdcss BuildConfig Katabasis Qt${QT_VERSION_MAJOR}::Widgets diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index 03b599ea..2263f8ec 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -290,37 +291,21 @@ ModDetails ReadNilModInfo(QByteArray contents, QString fname) { ModDetails details; - // this is a css file (why) but we only care about a couple key/value pairs from it - // hence this instead of a css parser lib - // could be made a lot better but it works(tm) - // (does css require properties to be on their own lines? if so, the code can get less horrible looking) - QString contentStr = QString(contents).trimmed(); - int firstidx = contentStr.indexOf("@nilmod"); - firstidx = contentStr.indexOf("{", firstidx); - int lastidx = contentStr.indexOf("}", firstidx); - int nameidx = contentStr.indexOf("name:", firstidx); - int descidx = contentStr.indexOf("description:", firstidx); - int authorsidx = contentStr.indexOf("authors:", firstidx); - int versionidx = contentStr.indexOf("version:", firstidx); + QDCSS cssData = QDCSS(contents); + auto name = cssData.get("@nilmod.name"); + auto desc = cssData.get("@nilmod.description"); + auto authors = cssData.get("@nilmod.authors"); - if (nameidx != -1 && nameidx < lastidx) { - nameidx = contentStr.indexOf('"', nameidx); - details.name = contentStr.mid(nameidx + 1, contentStr.indexOf('"', nameidx + 1) - nameidx - 1); + if (name->has_value()) { + details.name = name->value(); } - if (descidx != -1 && descidx < lastidx) { - descidx = contentStr.indexOf('"', descidx); - details.description = contentStr.mid(descidx + 1, contentStr.indexOf('"', descidx + 1) - descidx - 1); + if (desc->has_value()) { + details.description = desc->value(); } - if (authorsidx != -1 && authorsidx < lastidx) { - authorsidx = contentStr.indexOf('"', authorsidx); - details.authors.append(contentStr.mid(authorsidx + 1, contentStr.indexOf('"', authorsidx + 1) - authorsidx - 1)); - } - if (versionidx != -1 && versionidx < lastidx) { - versionidx = contentStr.indexOf('"', versionidx); - details.version = contentStr.mid(versionidx + 1, contentStr.indexOf('"', versionidx + 1) - versionidx - 1); - } else { - details.version = "?"; + if (authors->has_value()) { + details.authors.append(authors->value()); } + details.version = cssData.get("@nilmod.version")->value_or("?"); details.mod_id = fname.remove(".nilmod.css"); diff --git a/libraries/README.md b/libraries/README.md index 95be8740..4da11314 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -140,3 +140,11 @@ A TOML language parser. Used by Forge 1.14+ to store mod metadata. See [github repo](https://github.com/marzer/tomlplusplus). Licenced under the MIT licence. + +## qdcss + +A quick and dirty css parser, used by NilLoader to store mod metadata. + +Translated (and heavily trimmed down) from [the original Java code](https://github.com/unascribed/NilLoader/blob/trunk/src/main/java/nilloader/api/lib/qdcss/QDCSS.java) from NilLoader + +Licensed under LGPL version 3. diff --git a/libraries/qdcss/CMakeLists.txt b/libraries/qdcss/CMakeLists.txt new file mode 100644 index 00000000..0afdef32 --- /dev/null +++ b/libraries/qdcss/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.9.4) +project(qdcss) + +if(QT_VERSION_MAJOR EQUAL 5) + find_package(Qt5 COMPONENTS Core REQUIRED) +elseif(Launcher_QT_VERSION_MAJOR EQUAL 6) + find_package(Qt6 COMPONENTS Core Core5Compat REQUIRED) + list(APPEND qdcss_LIBS Qt${QT_VERSION_MAJOR}::Core5Compat) +endif() + +set(QDCSS_SOURCES + include/qdcss.h + src/qdcss.cpp +) + +add_library(qdcss STATIC ${QDCSS_SOURCES}) +target_include_directories(qdcss PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_link_libraries(qdcss Qt${QT_VERSION_MAJOR}::Core ${qdcss_LIBS}) diff --git a/libraries/qdcss/include/qdcss.h b/libraries/qdcss/include/qdcss.h new file mode 100644 index 00000000..2bcac36f --- /dev/null +++ b/libraries/qdcss/include/qdcss.h @@ -0,0 +1,21 @@ +#ifndef QDCSS_H +#define QDCSS_H + +#include +#include +#include +#include + +class QDCSS { + // these are all we need to parse a couple string values out of a css string + // lots more in the original code, yet to be ported + // https://github.com/unascribed/NilLoader/blob/trunk/src/main/java/nilloader/api/lib/qdcss/QDCSS.java + public: + QDCSS(QString); + std::optional* get(QString); + + private: + QMap m_data; +}; + +#endif // QDCSS_H diff --git a/libraries/qdcss/src/qdcss.cpp b/libraries/qdcss/src/qdcss.cpp new file mode 100644 index 00000000..4426dcae --- /dev/null +++ b/libraries/qdcss/src/qdcss.cpp @@ -0,0 +1,49 @@ +#include "qdcss.h" + +#include +#include +#include + +QRegularExpression ruleset_re = QRegularExpression(R"([#.]?(@?\w+?)\s*\{(.*?)\})", QRegularExpression::DotMatchesEverythingOption); +QRegularExpression rule_re = QRegularExpression(R"((\S+?)\s*:\s*(?:\"(.*?)(?append(value); + } + } +} + +std::optional* QDCSS::get(QString key) +{ + auto found = m_data.find(key); + + if (found == m_data.end() || found->empty()) { + return new std::optional; + } + + return new std::optional(found->back()); +} From d93cb751b074447709ad323f8ca5b379498ab470 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sun, 12 Feb 2023 16:23:33 -0700 Subject: [PATCH 04/40] fix: oversight caused prism to be `.zip` windows default Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- program_info/win_install.nsi.in | 103 +++++++++++++++++++------------- 1 file changed, 62 insertions(+), 41 deletions(-) diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in index 42a9e762..5ad6078e 100644 --- a/program_info/win_install.nsi.in +++ b/program_info/win_install.nsi.in @@ -114,7 +114,8 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@ ;-------------------------------- ; Shell Associate Macros -!macro APP_SETUP DESCRIPTION ICON APP_ID APP_NAME APP_EXE COMMANDTEXT COMMAND ; VERB APP_COMPANY +!macro APP_SETUP_Def DESCRIPTION ICON APP_ID APP_NAME APP_EXE COMMANDTEXT COMMAND + ; setup APP_ID WriteRegStr ShCtx "Software\Classes\${APP_ID}" "" `${DESCRIPTION}` WriteRegStr ShCtx "Software\Classes\${APP_ID}\DefaultIcon" "" `${ICON}` @@ -123,24 +124,28 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@ WriteRegStr ShCtx "Software\Classes\${APP_ID}\shell\open" "" `${COMMANDTEXT}` WriteRegStr ShCtx "Software\Classes\${APP_ID}\shell\open\command" "" `${COMMAND}` - ; if you want the app to use it's own implementation of a verb - ;WriteRegStr ShCtx "Software\Classes\${APP_ID}\shell\${VERB}" "" "${DESCRIPTION}" - ;WriteRegStr ShCtx "Software\Classes\${APP_ID}\shell\${VERB}\command" "" `${COMMAND}` - WriteRegStr ShCtx "Software\Classes\Applications\${APP_EXE}\shell\open\command" "" `${COMMAND}` WriteRegStr ShCtx "Software\Classes\Applications\${APP_EXE}" "FriendlyAppName" `${APP_NAME}` ; [Optional] - ;WriteRegStr ShCtx "Software\Classes\Applications\${APP_EXE}" "ApplicationCompany" `${APP_COMPANY}` ; [Optional] - ;WriteRegNone ShCtx "Software\Classes\Applications\${APP_EXE}\SupportedTypes" ".${EXT}" ; [Optional] Only allow "Open With" with specific extension(s) on WinXP+ - - # Register "Default Programs" [Optional] - !ifdef REGISTER_DEFAULTPROGRAMS - WriteRegStr ShCtx "Software\Classes\Applications\${APP_EXE}\Capabilities" "ApplicationDescription" `${DESCRIPTION}` - WriteRegStr ShCtx "Software\RegisteredApplications" `${APP_NAME}` "Software\Classes\Applications\${APP_EXE}\Capabilities" - !endif !macroend -!macro APP_ASSOCIATE EXT APP_ID APP_EXE OVERWIRTE +!macro APP_SETUP DESCRIPTION ICON APP_ID APP_NAME APP_EXE COMMANDTEXT COMMAND + + !insertmacro APP_SETUP_Def `${DESCRIPTION}` `${ICON}` `${APP_ID}` `${APP_NAME}` `${APP_EXE}` `${COMMANDTEXT}` `${COMMAND}` + +!macroend + +!macro APP_SETUP_DEFAULT DESCRIPTION ICON APP_ID APP_NAME APP_EXE COMMANDTEXT COMMAND + + !insertmacro APP_SETUP_Def `${DESCRIPTION}` `${ICON}` `${APP_ID}` `${APP_NAME}` `${APP_EXE}` `${COMMANDTEXT}` `${COMMAND}` + + # Register "Default Programs" + WriteRegStr ShCtx "Software\Classes\Applications\${APP_EXE}\Capabilities" "ApplicationDescription" `${DESCRIPTION}` + WriteRegStr ShCtx "Software\RegisteredApplications" `${APP_NAME}` "Software\Classes\Applications\${APP_EXE}\Capabilities" + +!macroend + +!macro APP_ASSOCIATE_Def EXT APP_ID APP_EXE OVERWIRTE ; Backup the previously associated file class ${If} ${OVERWIRTE} == true ReadRegStr $R0 ShCtx "Software\Classes\${EXT}" "" @@ -151,10 +156,20 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@ WriteRegNone ShCtx "Software\Classes\${EXT}\OpenWithList" "${APP_EXE}" ; Win2000+ WriteRegNone ShCtx "Software\Classes\${EXT}\OpenWithProgids" "${APP_ID}" ; WinXP+ - # Register "Default Programs" [Optional] - !ifdef REGISTER_DEFAULTPROGRAMS +!macroend + +!macro APP_ASSOCIATE EXT APP_ID APP_EXE OVERWIRTE + + !insertmacro APP_ASSOCIATE_Def `${EXT}` `${APP_ID}` `${APP_EXE}` `${OVERWIRTE}` + +!macroend + +!macro APP_ASSOCIATE_DEFAULT EXT APP_ID APP_EXE OVERWIRTE + + !insertmacro APP_ASSOCIATE_Def `${EXT}` `${APP_ID}` `${APP_EXE}` `${OVERWIRTE}` + + # Register "Default Programs" WriteRegStr ShCtx "Software\Classes\Applications\${APP_EXE}\Capabilities\FileAssociations" "${EXT}" "${APP_ID}" - !endif !macroend @@ -191,12 +206,10 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@ DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${EXT}\OpenWithProgids" DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${EXT}\OpenWithList" DeleteRegKey /IfEmpty HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${EXT}" - ;DeleteRegKey HKCU "Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.${EXT}" - ;DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.${EXT}" !macroend -!macro APP_TEARDOWN APP_ID APP_NAME APP_EXE +!macro APP_TEARDOWN_Def APP_ID APP_NAME APP_EXE # Unregister file type ClearErrors @@ -208,13 +221,6 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@ # Unregister "Open With" DeleteRegKey ShCtx "Software\Classes\Applications\${APP_EXE}" - # Unregister "Default Programs" - !ifdef REGISTER_DEFAULTPROGRAMS - DeleteRegValue ShCtx "Software\RegisteredApplications" `${APP_NAME}` - DeleteRegKey ShCtx "Software\Classes\Applications\${APP_EXE}\Capabilities" - DeleteRegKey /IfEmpty ShCtx "Software\Classes\Applications\${APP_EXE}" - !endif - DeleteRegKey ShCtx `Software\Classes\${APP_ID}` DeleteRegKey ShCtx "Software\Classes\Applications\${APP_EXE}" @@ -227,6 +233,23 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@ !macroend +!macro APP_TEARDOWN APP_ID APP_NAME APP_EXE + + !insertmacro APP_TEARDOWN_Def `${APP_ID}` `${APP_NAME}` `${APP_EXE}` + +!macroend + +!macro APP_TEARDOWN_DEFAULT APP_ID APP_NAME APP_EXE + + !insertmacro APP_TEARDOWN_Def `${APP_ID}` `${APP_NAME}` `${APP_EXE}` + + # Unregister "Default Programs" + DeleteRegValue ShCtx "Software\RegisteredApplications" `${APP_NAME}` + DeleteRegKey ShCtx "Software\Classes\Applications\${APP_EXE}\Capabilities" + DeleteRegKey /IfEmpty ShCtx "Software\Classes\Applications\${APP_EXE}" + +!macroend + ; !defines for use with SHChangeNotify !ifdef SHCNE_ASSOCCHANGED !undef SHCNE_ASSOCCHANGED @@ -308,21 +331,19 @@ Section /o "Desktop Shortcut" DESKTOP_SHORTCUTS SectionEnd -!define APP_ID "@Launcher_CommonName@.App" -!define APP_EXE "@Launcher_APP_BINARY_NAME@.exe" -!define APP_ICON "$INSTDIR\${APP_EXE},0" -!define APP_DESCRIPTION "@Launcher_DisplayName@" -!define APP_NAME "@Launcher_DisplayName@" -!define APP_CMD_TEXT "Minecraft Modpack" - -!define REGISTER_DEFAULTPROGRAMS ; value doesn't matter +!define APPID "@Launcher_CommonName@.App" +!define APPEXE "@Launcher_APP_BINARY_NAME@.exe" +!define APPICON "$INSTDIR\${APPEXE},0" +!define APPDESCRIPTION "@Launcher_DisplayName@" +!define APPNAME "@Launcher_DisplayName@" +!define APPCMDTEXT "Minecraft Modpack" Section -ShellAssoc - !insertmacro APP_SETUP `${APP_DESCRIPTION}` `${APP_ICON}` `${APP_ID}` `${APP_CMD_TEXT}` `${APP_EXE}` `${APP_CMD_TEXT}` '$INSTDIR\${APP_EXE} -I "%1"' + !insertmacro APP_SETUP `${APPDESCRIPTION}` `${APPICON}` `${APPID}` `${APPCMDTEXT}` `${APPEXE}` `${APPCMDTEXT}` '$INSTDIR\${APPEXE} -I "%1"' - !insertmacro APP_ASSOCIATE ".zip" `${APP_ID}` `${APP_EXE}` false - !insertmacro APP_ASSOCIATE ".mrpack" `${APP_ID}` `${APP_EXE}` true + !insertmacro APP_ASSOCIATE_DEFAULT ".mrpack" `${APPID}` `${APPEXE}` true + !insertmacro APP_ASSOCIATE ".zip" `${APPID}` `${APPEXE}` false !insertmacro NotifyShell_AssocChanged SectionEnd @@ -361,10 +382,10 @@ SectionEnd Section -un.ShellAssoc - !insertmacro APP_TEARDOWN `${APP_ID}` `${APP_NAME}` `${APP_EXE}` + !insertmacro APP_TEARDOWN_DEFAULT `${APPID}` `${APPNAME}` `${APPEXE}` - !insertmacro APP_UNASSOCIATE ".zip" `${APP_ID}` - !insertmacro APP_UNASSOCIATE ".mrpack" `${APP_ID}` + !insertmacro APP_UNASSOCIATE ".zip" `${APPID}` + !insertmacro APP_UNASSOCIATE ".mrpack" `${APPID}` !insertmacro NotifyShell_AssocChanged SectionEnd From 7d02e1f8660193e88086c0e80b6749e4d34af0a7 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sun, 12 Feb 2023 17:34:37 -0700 Subject: [PATCH 05/40] feat: make shell association an optional section Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- program_info/win_install.nsi.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in index 5ad6078e..49e22500 100644 --- a/program_info/win_install.nsi.in +++ b/program_info/win_install.nsi.in @@ -336,9 +336,9 @@ SectionEnd !define APPICON "$INSTDIR\${APPEXE},0" !define APPDESCRIPTION "@Launcher_DisplayName@" !define APPNAME "@Launcher_DisplayName@" -!define APPCMDTEXT "Minecraft Modpack" +!define APPCMDTEXT "@Launcher_DisplayName@" -Section -ShellAssoc +Section /o "Shell Association (Open-With dialog)" SHELL_ASSOC !insertmacro APP_SETUP `${APPDESCRIPTION}` `${APPICON}` `${APPID}` `${APPCMDTEXT}` `${APPEXE}` `${APPCMDTEXT}` '$INSTDIR\${APPEXE} -I "%1"' From 9c2a3231c5ee1b15b09bae9b064827ad3dcb86e0 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Mon, 13 Feb 2023 01:45:23 -0500 Subject: [PATCH 06/40] do not create nilmods folder "it cant be that easy" - me, clueless Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- launcher/minecraft/MinecraftInstance.cpp | 2 +- launcher/minecraft/mod/ModFolderModel.cpp | 2 +- launcher/minecraft/mod/ModFolderModel.h | 2 +- launcher/minecraft/mod/ResourceFolderModel.cpp | 6 ++++-- launcher/minecraft/mod/ResourceFolderModel.h | 3 ++- launcher/ui/pages/instance/ModFolderPage.cpp | 2 +- launcher/ui/pages/instance/ModFolderPage.h | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index 0737a648..af4da5d0 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -1135,7 +1135,7 @@ std::shared_ptr MinecraftInstance::nilModList() const if (!m_nil_mod_list) { bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool(); - m_nil_mod_list.reset(new ModFolderModel(nilModsDir(), is_indexed)); + m_nil_mod_list.reset(new ModFolderModel(nilModsDir(), is_indexed, false)); m_nil_mod_list->disableInteraction(isRunning()); connect(this, &BaseInstance::runningStatusChanged, m_nil_mod_list.get(), &ModFolderModel::disableInteraction); } diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp index f258ad69..2d777656 100644 --- a/launcher/minecraft/mod/ModFolderModel.cpp +++ b/launcher/minecraft/mod/ModFolderModel.cpp @@ -50,7 +50,7 @@ #include "minecraft/mod/tasks/ModFolderLoadTask.h" #include "modplatform/ModIndex.h" -ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed) : ResourceFolderModel(QDir(dir)), m_is_indexed(is_indexed) +ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed, bool create_dir) : ResourceFolderModel(QDir(dir), create_dir), m_is_indexed(is_indexed) { m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER }; } diff --git a/launcher/minecraft/mod/ModFolderModel.h b/launcher/minecraft/mod/ModFolderModel.h index 6898f6eb..84e70db9 100644 --- a/launcher/minecraft/mod/ModFolderModel.h +++ b/launcher/minecraft/mod/ModFolderModel.h @@ -75,7 +75,7 @@ public: Enable, Toggle }; - ModFolderModel(const QString &dir, bool is_indexed = false); + ModFolderModel(const QString &dir, bool is_indexed = false, bool create_dir = true); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; diff --git a/launcher/minecraft/mod/ResourceFolderModel.cpp b/launcher/minecraft/mod/ResourceFolderModel.cpp index fdfb434b..b8353133 100644 --- a/launcher/minecraft/mod/ResourceFolderModel.cpp +++ b/launcher/minecraft/mod/ResourceFolderModel.cpp @@ -12,9 +12,11 @@ #include "tasks/Task.h" -ResourceFolderModel::ResourceFolderModel(QDir dir, QObject* parent) : QAbstractListModel(parent), m_dir(dir), m_watcher(this) +ResourceFolderModel::ResourceFolderModel(QDir dir, bool create_dir, QObject* parent) : QAbstractListModel(parent), m_dir(dir), m_watcher(this) { - FS::ensureFolderPathExists(m_dir.absolutePath()); + if (create_dir) { + FS::ensureFolderPathExists(m_dir.absolutePath()); + } m_dir.setFilter(QDir::Readable | QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs); m_dir.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware); diff --git a/launcher/minecraft/mod/ResourceFolderModel.h b/launcher/minecraft/mod/ResourceFolderModel.h index f1bc2dd7..e4227a33 100644 --- a/launcher/minecraft/mod/ResourceFolderModel.h +++ b/launcher/minecraft/mod/ResourceFolderModel.h @@ -24,7 +24,8 @@ class QSortFilterProxyModel; class ResourceFolderModel : public QAbstractListModel { Q_OBJECT public: - ResourceFolderModel(QDir, QObject* parent = nullptr); + ResourceFolderModel(QDir, bool, QObject* parent = nullptr); + ResourceFolderModel(QDir dir, QObject* parent = nullptr) : ResourceFolderModel(dir, true, parent) {}; ~ResourceFolderModel() override; /** Starts watching the paths for changes. diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp index 8c87a8a0..4548af59 100644 --- a/launcher/ui/pages/instance/ModFolderPage.cpp +++ b/launcher/ui/pages/instance/ModFolderPage.cpp @@ -280,5 +280,5 @@ NilModFolderPage::NilModFolderPage(BaseInstance* inst, std::shared_ptrdir().isEmpty(); + return m_model->dir().exists(); } diff --git a/launcher/ui/pages/instance/ModFolderPage.h b/launcher/ui/pages/instance/ModFolderPage.h index cad240bd..2fc7b574 100644 --- a/launcher/ui/pages/instance/ModFolderPage.h +++ b/launcher/ui/pages/instance/ModFolderPage.h @@ -90,7 +90,7 @@ class NilModFolderPage : public ModFolderPage { virtual QString displayName() const override { return tr("Nilmods"); } virtual QIcon icon() const override { return APPLICATION->getThemedIcon("coremods"); } virtual QString id() const override { return "nilmods"; } - virtual QString helpPage() const override { return "Nil-mods"; } + virtual QString helpPage() const override { return "Nilmods"; } virtual bool shouldDisplay() const override; }; From 256fc322a8decfd113ea73bf61ec15ce31a6f474 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:57:35 -0500 Subject: [PATCH 07/40] minor cleanup Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- launcher/minecraft/mod/tasks/LocalModParseTask.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index 2263f8ec..945ccda7 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -434,17 +434,12 @@ bool processZIP(Mod& mod, ProcessingLevel level) QStringList foundNilMetas; for (auto& fname : zip.getFileNameList()) { - if (fname.endsWith(".nilmod.css")) { + // nilmods can shade nilloader to be able to run as a standalone agent - which includes nilloader's own meta file + if (fname.endsWith(".nilmod.css") && fname != "nilloader.nilmod.css") { foundNilMetas.append(fname); } } - if (foundNilMetas.size() > 1 && foundNilMetas.at(0) == "nilloader.nilmod.css") { - // nilmods can shade nilloader to be able to run as a standalone agent - which includes nilloader's own meta file - // so if there is more than one meta file, ignore nilloader's meta, since it's not the actual mod - foundNilMetas.removeFirst(); - } - if (zip.setCurrentFile(foundNilMetas.at(0))) { if (!file.open(QIODevice::ReadOnly)) { zip.close(); From 7973b01e81af29f0de7c6873ef119f15a2fb0791 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Sun, 19 Feb 2023 17:21:53 -0500 Subject: [PATCH 08/40] fix metadata for mods with `.nilmod` extension Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- launcher/minecraft/mod/Resource.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/launcher/minecraft/mod/Resource.cpp b/launcher/minecraft/mod/Resource.cpp index 7c572d92..0d35d755 100644 --- a/launcher/minecraft/mod/Resource.cpp +++ b/launcher/minecraft/mod/Resource.cpp @@ -37,6 +37,9 @@ void Resource::parseFile() if (file_name.endsWith(".zip") || file_name.endsWith(".jar")) { m_type = ResourceType::ZIPFILE; file_name.chop(4); + } else if (file_name.endsWith(".nilmod")) { + m_type = ResourceType::ZIPFILE; + file_name.chop(7); } else if (file_name.endsWith(".litemod")) { m_type = ResourceType::LITEMOD; file_name.chop(8); From dc8109658c3c178e91acfc316467d1bdffe0bf40 Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Wed, 22 Feb 2023 13:20:13 -0500 Subject: [PATCH 09/40] review fixes Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- launcher/minecraft/mod/ModFolderModel.cpp | 2 +- launcher/minecraft/mod/ResourceFolderModel.cpp | 2 +- launcher/minecraft/mod/ResourceFolderModel.h | 3 +-- launcher/minecraft/mod/tasks/LocalModParseTask.cpp | 9 +++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp index 2d777656..3f31b93c 100644 --- a/launcher/minecraft/mod/ModFolderModel.cpp +++ b/launcher/minecraft/mod/ModFolderModel.cpp @@ -50,7 +50,7 @@ #include "minecraft/mod/tasks/ModFolderLoadTask.h" #include "modplatform/ModIndex.h" -ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed, bool create_dir) : ResourceFolderModel(QDir(dir), create_dir), m_is_indexed(is_indexed) +ModFolderModel::ModFolderModel(const QString &dir, bool is_indexed, bool create_dir) : ResourceFolderModel(QDir(dir), nullptr, create_dir), m_is_indexed(is_indexed) { m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER }; } diff --git a/launcher/minecraft/mod/ResourceFolderModel.cpp b/launcher/minecraft/mod/ResourceFolderModel.cpp index b8353133..f2a77c12 100644 --- a/launcher/minecraft/mod/ResourceFolderModel.cpp +++ b/launcher/minecraft/mod/ResourceFolderModel.cpp @@ -12,7 +12,7 @@ #include "tasks/Task.h" -ResourceFolderModel::ResourceFolderModel(QDir dir, bool create_dir, QObject* parent) : QAbstractListModel(parent), m_dir(dir), m_watcher(this) +ResourceFolderModel::ResourceFolderModel(QDir dir, QObject* parent, bool create_dir) : QAbstractListModel(parent), m_dir(dir), m_watcher(this) { if (create_dir) { FS::ensureFolderPathExists(m_dir.absolutePath()); diff --git a/launcher/minecraft/mod/ResourceFolderModel.h b/launcher/minecraft/mod/ResourceFolderModel.h index e4227a33..3bd78870 100644 --- a/launcher/minecraft/mod/ResourceFolderModel.h +++ b/launcher/minecraft/mod/ResourceFolderModel.h @@ -24,8 +24,7 @@ class QSortFilterProxyModel; class ResourceFolderModel : public QAbstractListModel { Q_OBJECT public: - ResourceFolderModel(QDir, bool, QObject* parent = nullptr); - ResourceFolderModel(QDir dir, QObject* parent = nullptr) : ResourceFolderModel(dir, true, parent) {}; + ResourceFolderModel(QDir, QObject* parent = nullptr, bool create_dir = true); ~ResourceFolderModel() override; /** Starts watching the paths for changes. diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index 945ccda7..da27a505 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -432,21 +432,22 @@ bool processZIP(Mod& mod, ProcessingLevel level) // nilloader uses the filename of the metadata file for the modid, so we can't know the exact filename // thankfully, there is a good file to use as a canary so we don't look for nil meta all the time - QStringList foundNilMetas; + QString foundNilMeta; for (auto& fname : zip.getFileNameList()) { // nilmods can shade nilloader to be able to run as a standalone agent - which includes nilloader's own meta file if (fname.endsWith(".nilmod.css") && fname != "nilloader.nilmod.css") { - foundNilMetas.append(fname); + foundNilMeta = fname; + break; } } - if (zip.setCurrentFile(foundNilMetas.at(0))) { + if (zip.setCurrentFile(foundNilMeta)) { if (!file.open(QIODevice::ReadOnly)) { zip.close(); return false; } - details = ReadNilModInfo(file.readAll(), foundNilMetas.at(0)); + details = ReadNilModInfo(file.readAll(), foundNilMeta); file.close(); zip.close(); From 01c4ed232e67c1b980a0c091c4c277722811d3dc Mon Sep 17 00:00:00 2001 From: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> Date: Fri, 24 Feb 2023 15:01:59 -0500 Subject: [PATCH 10/40] license stuff Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> --- libraries/qdcss/LICENSE | 72 +++++++++++++++++++++++++++++++++ libraries/qdcss/include/qdcss.h | 4 ++ libraries/qdcss/src/qdcss.cpp | 4 ++ 3 files changed, 80 insertions(+) create mode 100644 libraries/qdcss/LICENSE diff --git a/libraries/qdcss/LICENSE b/libraries/qdcss/LICENSE new file mode 100644 index 00000000..0e547029 --- /dev/null +++ b/libraries/qdcss/LICENSE @@ -0,0 +1,72 @@ +GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. + +0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. + +"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". + +The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. + +1. Exception to Section 3 of the GNU GPL. +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. + +2. Conveying Modified Versions. +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: + + a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. + +3. Object Code Incorporating Material from Library Header Files. +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license document. + +4. Combined Works. +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: + + a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license document. + + c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. + + e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) + +5. Combined Libraries. +You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + +6. Revised Versions of the GNU Lesser General Public License. +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. + diff --git a/libraries/qdcss/include/qdcss.h b/libraries/qdcss/include/qdcss.h index 2bcac36f..a7fac34e 100644 --- a/libraries/qdcss/include/qdcss.h +++ b/libraries/qdcss/include/qdcss.h @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2023 kumquat-ir 66188216+kumquat-ir@users.noreply.github.com +// +// SPDX-License-Identifier: LGPL-3.0-only + #ifndef QDCSS_H #define QDCSS_H diff --git a/libraries/qdcss/src/qdcss.cpp b/libraries/qdcss/src/qdcss.cpp index 4426dcae..c531fb63 100644 --- a/libraries/qdcss/src/qdcss.cpp +++ b/libraries/qdcss/src/qdcss.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2023 kumquat-ir 66188216+kumquat-ir@users.noreply.github.com +// +// SPDX-License-Identifier: LGPL-3.0-only + #include "qdcss.h" #include From 1feb63052020db941a3c1a10d14c9a4791169c1a Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 1 Mar 2023 09:54:49 +0000 Subject: [PATCH 11/40] Allow custom Modrinth API token Signed-off-by: TheKodeToad --- launcher/Application.cpp | 15 ++++++++-- launcher/Application.h | 2 ++ launcher/net/Download.cpp | 7 ++++- launcher/net/Upload.cpp | 6 ++++ launcher/ui/pages/global/APIPage.cpp | 5 ++++ launcher/ui/pages/global/APIPage.ui | 45 ++++++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 3 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index caaa74c8..d6de6236 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -7,6 +7,7 @@ * Copyright (C) 2022 Sefa Eyeoglu * Copyright (C) 2022 Lenny McLennington * Copyright (C) 2022 Tayou + * Copyright (C) 2023 TheKodeToad * * 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 @@ -225,7 +226,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_serverToJoin = parser.value("server"); m_profileToUse = parser.value("profile"); m_liveCheck = parser.isSet("alive"); - + m_instanceIdToShowWindowOf = parser.value("show"); for (auto zip_path : parser.values("import")){ @@ -346,7 +347,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) import.command = "import"; import.args.insert("path", zip_url.toString()); m_peerInstance->sendMessage(import.serialize(), timeout); - } + } } } else @@ -657,6 +658,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_settings->set("FlameKeyOverride", flameKey); m_settings->reset("CFKeyOverride"); } + m_settings->registerSetting("ModrinthToken", ""); m_settings->registerSetting("UserAgentOverride", ""); // Init page provider @@ -1545,6 +1547,15 @@ QString Application::getFlameAPIKey() return BuildConfig.FLAME_API_KEY; } +QString Application::getModrinthAPIToken() +{ + QString tokenOverride = m_settings->get("ModrinthToken").toString(); + if (!tokenOverride.isEmpty()) + return tokenOverride; + + return QString(); +} + QString Application::getUserAgent() { QString uaOverride = m_settings->get("UserAgentOverride").toString(); diff --git a/launcher/Application.h b/launcher/Application.h index 1b3dc499..91c5fc63 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -3,6 +3,7 @@ * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu * Copyright (C) 2022 Tayou + * Copyright (C) 2023 TheKodeToad * * 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 @@ -177,6 +178,7 @@ public: QString getMSAClientID(); QString getFlameAPIKey(); + QString getModrinthAPIToken(); QString getUserAgent(); QString getUserAgentUncached(); diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index 5982c8c9..0816e926 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -3,6 +3,7 @@ * PolyMC - Minecraft Launcher * Copyright (c) 2022 flowln * Copyright (C) 2022 Sefa Eyeoglu + * Copyright (C) 2023 TheKodeToad * * 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 @@ -116,7 +117,11 @@ void Download::executeTask() if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host().contains("api.curseforge.com")) { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - }; + } else if (request.url().host().contains("api.modrinth.com")) { + QString token = APPLICATION->getModrinthAPIToken(); + if (!token.isNull()) + request.setRawHeader("Authorization", token.toUtf8()); + } QNetworkReply* rep = m_network->get(request); diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp index 79b6af8d..36d50c1e 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -3,6 +3,7 @@ * PolyMC - Minecraft Launcher * Copyright (c) 2022 flowln * Copyright (C) 2022 Sefa Eyeoglu + * Copyright (C) 2023 TheKodeToad * * 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 @@ -219,7 +220,12 @@ namespace Net { if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host().contains("api.curseforge.com")) { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); + } else if (request.url().host().contains("api.modrinth.com")) { + QString token = APPLICATION->getModrinthAPIToken(); + if (!token.isNull()) + request.setRawHeader("Authorization", token.toUtf8()); } + //TODO other types of post requests ? request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); QNetworkReply* rep = m_network->post(request, m_post_data); diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index e3d30475..ac74b3a1 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2022 Sefa Eyeoglu * Copyright (c) 2022 Jamie Mansfield * Copyright (c) 2022 Lenny McLennington + * Copyright (C) 2023 TheKodeToad * * 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 @@ -147,6 +148,8 @@ void APIPage::loadSettings() ui->metaURL->setText(metaURL); QString flameKey = s->get("FlameKeyOverride").toString(); ui->flameKey->setText(flameKey); + QString modrinthToken = s->get("ModrinthToken").toString(); + ui->modrinthToken->setText(modrinthToken); QString customUserAgent = s->get("UserAgentOverride").toString(); ui->userAgentLineEdit->setText(customUserAgent); } @@ -177,6 +180,8 @@ void APIPage::applySettings() s->set("MetaURLOverride", metaURL); QString flameKey = ui->flameKey->text(); s->set("FlameKeyOverride", flameKey); + QString modrinthToken = ui->modrinthToken->text(); + s->set("ModrinthToken", modrinthToken); s->set("UserAgentOverride", ui->userAgentLineEdit->text()); } diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index d56a9ef6..b09a86ee 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -240,6 +240,51 @@ + + + + true + + + &Modrinth API + + + + + + Note: you only need to set this to access private data. + + + + + + + Enter a custom API token for Modrinth here. + + + Qt::RichText + + + true + + + true + + + + + + + true + + + (None) + + + + + + From a7b80922967744efa6c9ffba457ac6850d4f660a Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 1 Mar 2023 14:41:13 +0000 Subject: [PATCH 12/40] Add link Signed-off-by: TheKodeToad --- launcher/ui/pages/global/APIPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index b09a86ee..431fd8c6 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -252,7 +252,7 @@ - Note: you only need to set this to access private data. + <html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/api-spec/#section/Authentication"><span style=" text-decoration: underline; color:#0000ff;">documentation</span></a> for more information.</p></body></html> From 1f3d18ec12bb7a971962101570cbad8e18788614 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 2 Mar 2023 09:26:00 +0000 Subject: [PATCH 13/40] Replace with exact match and add TODO to improve Signed-off-by: TheKodeToad --- launcher/net/Download.cpp | 5 +++-- launcher/net/Upload.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index 0816e926..adb3d6fa 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -114,10 +114,11 @@ void Download::executeTask() } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); + // TODO remove duplication and use constant if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host().contains("api.curseforge.com")) { + && request.url().host() == "api.curseforge.com") { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host().contains("api.modrinth.com")) { + } else if (request.url().host() == "api.modrinth.com") { QString token = APPLICATION->getModrinthAPIToken(); if (!token.isNull()) request.setRawHeader("Authorization", token.toUtf8()); diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp index 36d50c1e..cd0de945 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -217,10 +217,11 @@ namespace Net { } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); + // TODO remove duplication and use constant if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host().contains("api.curseforge.com")) { + && request.url().host() == "api.curseforge.com") { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host().contains("api.modrinth.com")) { + } else if (request.url().host() == "api.modrinth.com") { QString token = APPLICATION->getModrinthAPIToken(); if (!token.isNull()) request.setRawHeader("Authorization", token.toUtf8()); From cbe6eff2fa917401b913a96c551429caad852b3b Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 2 Mar 2023 09:28:14 +0000 Subject: [PATCH 14/40] Move Modrinth before CurseForge for consistency Signed-off-by: TheKodeToad --- launcher/ui/pages/global/APIPage.ui | 90 ++++++++++++++--------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index 431fd8c6..8c515f3a 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -195,51 +195,6 @@ - - - - true - - - &CurseForge Core API - - - - - - Note: you probably don't need to set this if CurseForge already works. - - - - - - - Enter a custom API Key for CurseForge here. - - - Qt::RichText - - - true - - - true - - - - - - - true - - - (Default) - - - - - - @@ -285,6 +240,51 @@ + + + + true + + + &CurseForge Core API + + + + + + Note: you probably don't need to set this if CurseForge already works. + + + + + + + Enter a custom API Key for CurseForge here. + + + Qt::RichText + + + true + + + true + + + + + + + true + + + (Default) + + + + + + From 4efbf22089bc1fc49409cb31bfffe26cdb9b6b36 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 2 Mar 2023 10:19:26 +0000 Subject: [PATCH 15/40] Prism-ify more license headers Signed-off-by: TheKodeToad --- launcher/net/Download.cpp | 2 +- launcher/net/Upload.cpp | 2 +- launcher/ui/pages/global/APIPage.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index adb3d6fa..f199c0b2 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher + * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln * Copyright (C) 2022 Sefa Eyeoglu * Copyright (C) 2023 TheKodeToad diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp index cd0de945..b90c71ba 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher + * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln * Copyright (C) 2022 Sefa Eyeoglu * Copyright (C) 2023 TheKodeToad diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index ac74b3a1..f662ee1c 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher + * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu * Copyright (c) 2022 Jamie Mansfield * Copyright (c) 2022 Lenny McLennington From 06de728aa7fc5db842f03a53fb8a0f8d2b131924 Mon Sep 17 00:00:00 2001 From: flow Date: Sun, 5 Mar 2023 08:24:56 -0300 Subject: [PATCH 16/40] fix: use `toLocalFile()` instead of `path()` QUrl::path() adds a '/' at the beginning of the path on Windows, causing the world to explode every once in a while. Signed-off-by: flow --- launcher/MMCZip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/MMCZip.cpp b/launcher/MMCZip.cpp index c6d56543..1eda43fe 100644 --- a/launcher/MMCZip.cpp +++ b/launcher/MMCZip.cpp @@ -320,7 +320,7 @@ std::optional MMCZip::extractSubDir(QuaZip *zip, const QString & su if (relative_file_name.isEmpty()) { target_file_path = target + '/'; } else { - target_file_path = FS::PathCombine(target_top_dir.path(), sub_path, relative_file_name); + target_file_path = FS::PathCombine(target_top_dir.toLocalFile(), sub_path, relative_file_name); if (relative_file_name.endsWith('/') && !target_file_path.endsWith('/')) target_file_path += '/'; } From b9dfcf6d2f03eb859959287c552fcbf22e928565 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 5 Mar 2023 14:21:07 +0100 Subject: [PATCH 17/40] chore: bump ghc-filesystem Signed-off-by: Sefa Eyeoglu --- libraries/filesystem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/filesystem b/libraries/filesystem index cd6805e9..8a2edd6d 160000 --- a/libraries/filesystem +++ b/libraries/filesystem @@ -1 +1 @@ -Subproject commit cd6805e94dd5d6346be1b75a54cdc27787319dd2 +Subproject commit 8a2edd6d92ed820521d42c94d179462bf06b5ed3 From 07702d3be7755ecf536561e7ef1848d7085ca771 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 5 Mar 2023 14:23:40 +0100 Subject: [PATCH 18/40] fix: drop unneeded GHC_FILESYSTEM_WITH_INSTALL Signed-off-by: Sefa Eyeoglu --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ce8143c..23269559 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -442,7 +442,6 @@ add_subdirectory(libraries/gamemode) add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API if (NOT ghc_filesystem_FOUND) message(STATUS "Using bundled ghc_filesystem") - set(GHC_FILESYSTEM_WITH_INSTALL OFF) # Workaround ghc::filesystem bug add_subdirectory(libraries/filesystem) # Implementation of std::filesystem for old C++, for usage in old macOS add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem) else() From dd96e1819d3fb72e01c268a1e4707f88b0df97c7 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 5 Mar 2023 14:24:40 +0100 Subject: [PATCH 19/40] fix: remove unneeded alias for ghc_filesystem Signed-off-by: Sefa Eyeoglu --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23269559..40936e44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -443,7 +443,6 @@ add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API if (NOT ghc_filesystem_FOUND) message(STATUS "Using bundled ghc_filesystem") add_subdirectory(libraries/filesystem) # Implementation of std::filesystem for old C++, for usage in old macOS - add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem) else() message(STATUS "Using system ghc_filesystem") endif() From 76f66148db09b6110d2d916da5c9f9f4dae139b8 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 5 Mar 2023 18:21:24 +0000 Subject: [PATCH 20/40] Apply flowln's suggestion Signed-off-by: TheKodeToad --- launcher/net/Download.cpp | 8 ++++---- launcher/net/Upload.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index f199c0b2..e8a1d0b0 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -114,11 +114,11 @@ void Download::executeTask() } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); - // TODO remove duplication and use constant - if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host() == "api.curseforge.com") { + // TODO remove duplication + if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host() == QUrl(BuildConfig.FLAME_BASE_URL).host()) { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host() == "api.modrinth.com") { + } else if (request.url().host() == QUrl(BuildConfig.MODRINTH_PROD_URL).host() || + request.url().host() == QUrl(BuildConfig.MODRINTH_STAGING_URL).host()) { QString token = APPLICATION->getModrinthAPIToken(); if (!token.isNull()) request.setRawHeader("Authorization", token.toUtf8()); diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp index b90c71ba..ccf43c2d 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -217,11 +217,11 @@ namespace Net { } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); - // TODO remove duplication and use constant - if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host() == "api.curseforge.com") { + // TODO remove duplication + if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host() == QUrl(BuildConfig.FLAME_BASE_URL).host()) { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host() == "api.modrinth.com") { + } else if (request.url().host() == QUrl(BuildConfig.MODRINTH_PROD_URL).host() || + request.url().host() == QUrl(BuildConfig.MODRINTH_STAGING_URL).host()) { QString token = APPLICATION->getModrinthAPIToken(); if (!token.isNull()) request.setRawHeader("Authorization", token.toUtf8()); From 088be050b245dc60e799e677369cb4d9d941c0fe Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 7 Mar 2023 20:46:27 +0000 Subject: [PATCH 21/40] Apply flowln's suggestion :) Co-authored-by: flow Signed-off-by: TheKodeToad --- launcher/ui/pages/global/APIPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index 8c515f3a..91f867e0 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -207,7 +207,7 @@ - <html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/api-spec/#section/Authentication"><span style=" text-decoration: underline; color:#0000ff;">documentation</span></a> for more information.</p></body></html> + <html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/api-spec/#section/Authentication">documentation</a> for more information.</p></body></html> From 59cf8f678f6e3448dae1af99a59eb4d0157408c9 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 7 Mar 2023 20:50:19 +0000 Subject: [PATCH 22/40] (hopefully) Fix duplicates names Signed-off-by: TheKodeToad --- launcher/ui/pages/global/APIPage.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index 91f867e0..d866d7f9 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -250,14 +250,14 @@ - + Note: you probably don't need to set this if CurseForge already works. - + Enter a custom API Key for CurseForge here. From 59b15c5f08e00e2da0f77b9544881e93158320ed Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 7 Mar 2023 21:03:09 +0000 Subject: [PATCH 23/40] Fix another duplicate name :facepalm: Signed-off-by: TheKodeToad --- launcher/ui/pages/global/APIPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index d866d7f9..40b89d91 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -248,7 +248,7 @@ &CurseForge Core API - + From a8ffdeca2b1592bc13f11ab4203b94bf6d8ae1d2 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Wed, 8 Mar 2023 11:03:50 +0100 Subject: [PATCH 24/40] chore!: switch to Qt 6 by default Signed-off-by: Sefa Eyeoglu --- CMakeLists.txt | 2 +- flatpak/org.prismlauncher.PrismLauncher.yml | 1 + nix/default.nix | 2 +- snap/snapcraft.yaml | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40936e44..05c69c89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,7 +174,7 @@ set(Launcher_SUBREDDIT_URL "https://www.reddit.com/r/PrismLauncher/" CACHE STRIN # Builds set(Launcher_FORCE_BUNDLED_LIBS OFF CACHE BOOL "Prevent using system libraries, if they are available as submodules") -set(Launcher_QT_VERSION_MAJOR "5" CACHE STRING "Major Qt version to build against") +set(Launcher_QT_VERSION_MAJOR "6" CACHE STRING "Major Qt version to build against") # API Keys # NOTE: These API keys are here for convenience. If you rebrand this software or intend to break the terms of service diff --git a/flatpak/org.prismlauncher.PrismLauncher.yml b/flatpak/org.prismlauncher.PrismLauncher.yml index 071772c6..0524946f 100644 --- a/flatpak/org.prismlauncher.PrismLauncher.yml +++ b/flatpak/org.prismlauncher.PrismLauncher.yml @@ -32,6 +32,7 @@ modules: config-opts: - -DLauncher_BUILD_PLATFORM=flatpak - -DCMAKE_BUILD_TYPE=Debug + - -DLauncher_QT_VERSION_MAJOR=5 build-options: env: JAVA_HOME: /usr/lib/sdk/openjdk17/jvm/openjdk-17 diff --git a/nix/default.nix b/nix/default.nix index f6ab1332..99bb2231 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { ] ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland; cmakeFlags = lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] - ++ lib.optionals (lib.versionAtLeast qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=6" ]; + ++ lib.optionals (lib.versionOlder qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=5" ]; dontWrapQtApps = true; postUnpack = '' diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8e647eea..d4eb646c 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -39,6 +39,7 @@ parts: - "-DCMAKE_BUILD_TYPE=RelWithDebInfo" - "-DENABLE_LTO=ON" - "-DLauncher_BUILD_PLATFORM=snap" + - "-DLauncher_QT_VERSION_MAJOR=5" apps: prismlauncher: From c638fd9056f7a9b86e899d32a8e85eae23e321e4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 9 Mar 2023 14:41:24 +0000 Subject: [PATCH 25/40] chore(deps): update actions/cache action to v3.3.0 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41eb5eb7..8a71d1c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -158,7 +158,7 @@ jobs: - name: Retrieve ccache cache (Windows MinGW-w64) if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug' - uses: actions/cache@v3.2.6 + uses: actions/cache@v3.3.0 with: path: '${{ github.workspace }}\.ccache' key: ${{ matrix.os }}-mingw-w64-ccache-${{ github.run_id }} From 5ac3e5c95890c60765fa4ee4e40e7a2ac2dc4768 Mon Sep 17 00:00:00 2001 From: Kenneth Chew Date: Sun, 12 Mar 2023 18:31:38 -0400 Subject: [PATCH 26/40] Update `tomlplusplus` library Fix build on MinGW g++ 10 Signed-off-by: Kenneth Chew --- libraries/tomlplusplus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/tomlplusplus b/libraries/tomlplusplus index 0a90913a..7eb2ffcc 160000 --- a/libraries/tomlplusplus +++ b/libraries/tomlplusplus @@ -1 +1 @@ -Subproject commit 0a90913abf9390b9e08ab6d3b40ac11634553f38 +Subproject commit 7eb2ffcc09f8e9890dc0b77ff8ab00fc53b1f2b8 From 430369feb8712b314b0c31deef43435fe94a4f45 Mon Sep 17 00:00:00 2001 From: Kenneth Chew Date: Sun, 12 Mar 2023 18:32:42 -0400 Subject: [PATCH 27/40] fix: explicit conversion to C string to fix MinGW g++ 10 build Signed-off-by: Kenneth Chew --- launcher/modplatform/helpers/HashUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/modplatform/helpers/HashUtils.cpp b/launcher/modplatform/helpers/HashUtils.cpp index 2177ddad..81c94e1b 100644 --- a/launcher/modplatform/helpers/HashUtils.cpp +++ b/launcher/modplatform/helpers/HashUtils.cpp @@ -79,7 +79,7 @@ void FlameHasher::executeTask() // CF-specific auto should_filter_out = [](char c) { return (c == 9 || c == 10 || c == 13 || c == 32); }; - std::ifstream file_stream(StringUtils::toStdString(m_path), std::ifstream::binary); + std::ifstream file_stream(StringUtils::toStdString(m_path).c_str(), std::ifstream::binary); // TODO: This is very heavy work, but apparently QtConcurrent can't use move semantics, so we can't boop this to another thread. // How do we make this non-blocking then? m_hash = QString::number(MurmurHash2(std::move(file_stream), 4 * MiB, should_filter_out)); From 20525bec295042bb93a6aa256a3f4394eeda3613 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 Mar 2023 10:50:27 +0000 Subject: [PATCH 28/40] chore(deps): update actions/cache action to v3.3.1 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a71d1c9..1c27a8c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -158,7 +158,7 @@ jobs: - name: Retrieve ccache cache (Windows MinGW-w64) if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug' - uses: actions/cache@v3.3.0 + uses: actions/cache@v3.3.1 with: path: '${{ github.workspace }}\.ccache' key: ${{ matrix.os }}-mingw-w64-ccache-${{ github.run_id }} From 4b36d1e3ead7af49fa176419249b65616853413c Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 13 Mar 2023 15:33:23 +0100 Subject: [PATCH 29/40] chore: drop Snap packaging We do not have a lot of expertise dealing with Snap and as it is currently breaking our CI, it might be good to drop support for it. This does not mean that it won't come back in the future, but as it stands, it was effectively unmaintained and was only used for nightly builds anyway. Signed-off-by: Sefa Eyeoglu --- .github/workflows/build.yml | 25 ----------------- snap/snapcraft.yaml | 56 ------------------------------------- 2 files changed, 81 deletions(-) delete mode 100644 snap/snapcraft.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a71d1c9..ac522e2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -550,31 +550,6 @@ jobs: run: | ccache -s - snap: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - if: inputs.build_type == 'Debug' - uses: actions/checkout@v3 - with: - submodules: 'true' - - name: Set short version - shell: bash - if: inputs.build_type == 'Debug' - run: | - ver_short=`git rev-parse --short HEAD` - echo "VERSION=$ver_short" >> $GITHUB_ENV - - name: Package Snap (Linux) - id: snapcraft - if: inputs.build_type == 'Debug' - uses: snapcore/action-build@v1 - - name: Upload Snap (Linux) - if: inputs.build_type == 'Debug' - uses: actions/upload-artifact@v3 - with: - name: prismlauncher_${{ env.VERSION }}_amd64.snap - path: ${{ steps.snapcraft.outputs.snap }} - flatpak: runs-on: ubuntu-latest container: diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml deleted file mode 100644 index d4eb646c..00000000 --- a/snap/snapcraft.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: prismlauncher -license: GPL-3.0-only -base: core20 -website: https://prismlauncher.org/ -source-code: https://github.com/PrismLauncher/PrismLauncher -issues: https://github.com/PrismLauncher/PrismLauncher/issues -donation: https://opencollective.com/prismlauncher -contact: https://discord.gg/prismlauncher -summary: A custom Minecraft launcher with modpack support -adopt-info: prismlauncher - -grade: devel -confinement: strict - -architectures: - - build-on: amd64 - - build-on: arm64 - -parts: - prismlauncher: - parse-info: - - usr/share/metainfo/org.prismlauncher.PrismLauncher.metainfo.xml - plugin: cmake - build-packages: - - default-jdk-headless - stage-packages: - - openjdk-17-jre - - openjdk-8-jre - source: . - override-pull: | - snapcraftctl pull - # Fix the icon reference in the desktop file - sed -i.bak -e 's|Icon=org.prismlauncher.PrismLauncher|Icon=/usr/share/icons/hicolor/scalable/apps/org.prismlauncher.PrismLauncher.svg|g' program_info/org.prismlauncher.PrismLauncher.desktop.in - # Remove the build directory so that local development doesn't interfere with Snap compilation - rm -rf build - cmake-generator: Ninja - cmake-parameters: - - "-DCMAKE_INSTALL_PREFIX=/usr" - - "-DCMAKE_BUILD_TYPE=RelWithDebInfo" - - "-DENABLE_LTO=ON" - - "-DLauncher_BUILD_PLATFORM=snap" - - "-DLauncher_QT_VERSION_MAJOR=5" - -apps: - prismlauncher: - common-id: org.prismlauncher.PrismLauncher - desktop: usr/share/applications/org.prismlauncher.PrismLauncher.desktop - command: usr/bin/prismlauncher - extensions: - - kde-neon - plugs: - - home - - opengl - - network - - network-bind - - audio-playback From c17f6e37e5e32138f778cedf66c80e20f1eacd2e Mon Sep 17 00:00:00 2001 From: Janrupf Date: Mon, 13 Mar 2023 16:37:45 +0100 Subject: [PATCH 30/40] feat: Add setting for downloads directory Closes #641 Signed-off-by: Janrupf --- launcher/Application.cpp | 1 + launcher/ui/dialogs/BlockedModsDialog.cpp | 2 +- launcher/ui/pages/global/LauncherPage.cpp | 18 +++++- launcher/ui/pages/global/LauncherPage.h | 1 + launcher/ui/pages/global/LauncherPage.ui | 71 ++++++++++++++--------- 5 files changed, 63 insertions(+), 30 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 321f944b..879af535 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -516,6 +516,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) m_settings->registerSetting("InstanceDir", "instances"); m_settings->registerSetting({"CentralModsDir", "ModsDir"}, "mods"); m_settings->registerSetting("IconsDir", "icons"); + m_settings->registerSetting("DownloadsDir", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)); // Editors m_settings->registerSetting("JsonEditor", QString()); diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp index eb427953..ff885f10 100644 --- a/launcher/ui/dialogs/BlockedModsDialog.cpp +++ b/launcher/ui/dialogs/BlockedModsDialog.cpp @@ -184,7 +184,7 @@ void BlockedModsDialog::directoryChanged(QString path) /// @brief add the user downloads folder and the global mods folder to the filesystem watcher void BlockedModsDialog::setupWatch() { - const QString downloadsFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); + const QString downloadsFolder = APPLICATION->settings()->get("DownloadsDir").toString(); const QString modsFolder = APPLICATION->settings()->get("CentralModsDir").toString(); m_watcher.addPath(downloadsFolder); m_watcher.addPath(modsFolder); diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index a9f44c0b..324eb461 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -140,8 +140,8 @@ void LauncherPage::on_instDirBrowseBtn_clicked() if (result == QMessageBox::Ok) { ui->instDirTextBox->setText(cooked_dir); - } - } + } + } else { ui->instDirTextBox->setText(cooked_dir); @@ -160,6 +160,7 @@ void LauncherPage::on_iconsDirBrowseBtn_clicked() ui->iconsDirTextBox->setText(cooked_dir); } } + void LauncherPage::on_modsDirBrowseBtn_clicked() { QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"), ui->modsDirTextBox->text()); @@ -172,6 +173,17 @@ void LauncherPage::on_modsDirBrowseBtn_clicked() } } +void LauncherPage::on_downloadsDirBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Downloads Folder"), ui->downloadsDirTextBox->text()); + + if (!raw_dir.isEmpty() && QDir(raw_dir).exists()) + { + QString cooked_dir = FS::NormalizePath(raw_dir); + ui->downloadsDirTextBox->setText(cooked_dir); + } +} + void LauncherPage::on_metadataDisableBtn_clicked() { ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked()); @@ -204,6 +216,7 @@ void LauncherPage::applySettings() s->set("InstanceDir", ui->instDirTextBox->text()); s->set("CentralModsDir", ui->modsDirTextBox->text()); s->set("IconsDir", ui->iconsDirTextBox->text()); + s->set("DownloadsDir", ui->downloadsDirTextBox->text()); auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId(); switch (sortMode) @@ -260,6 +273,7 @@ void LauncherPage::loadSettings() ui->instDirTextBox->setText(s->get("InstanceDir").toString()); ui->modsDirTextBox->setText(s->get("CentralModsDir").toString()); ui->iconsDirTextBox->setText(s->get("IconsDir").toString()); + ui->downloadsDirTextBox->setText(s->get("DownloadsDir").toString()); QString sortMode = s->get("InstSortMode").toString(); diff --git a/launcher/ui/pages/global/LauncherPage.h b/launcher/ui/pages/global/LauncherPage.h index c60156c2..33f66f1b 100644 --- a/launcher/ui/pages/global/LauncherPage.h +++ b/launcher/ui/pages/global/LauncherPage.h @@ -88,6 +88,7 @@ slots: void on_instDirBrowseBtn_clicked(); void on_modsDirBrowseBtn_clicked(); void on_iconsDirBrowseBtn_clicked(); + void on_downloadsDirBrowseBtn_clicked(); void on_metadataDisableBtn_clicked(); /*! diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index f084d970..1fe55678 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -38,7 +38,7 @@ QTabWidget::Rounded - 1 + 0 @@ -67,13 +67,6 @@ Folders - - - - ... - - - @@ -81,29 +74,12 @@ - - - - ... - - + + - - - - &Icons: - - - iconsDirTextBox - - - - - - @@ -117,6 +93,20 @@ + + + + ... + + + + + + + ... + + + @@ -127,6 +117,33 @@ + + + + &Icons: + + + iconsDirTextBox + + + + + + + Downloads: + + + + + + + + + + ... + + + From 9dff1bac838b5a827b1e323bdc983b0f7d1e61bd Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 10:48:19 +0100 Subject: [PATCH 31/40] chore(nix): format code using alejandra Signed-off-by: Sefa Eyeoglu --- flake.nix | 59 ++++++++++++-------- nix/default.nix | 129 +++++++++++++++++++++---------------------- nix/flake-compat.nix | 2 +- 3 files changed, 100 insertions(+), 90 deletions(-) diff --git a/flake.nix b/flake.nix index 5615a758..f173511c 100644 --- a/flake.nix +++ b/flake.nix @@ -3,35 +3,46 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; - libnbtplusplus = { url = "github:PrismLauncher/libnbtplusplus"; flake = false; }; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + libnbtplusplus = { + url = "github:PrismLauncher/libnbtplusplus"; + flake = false; + }; }; - outputs = { self, nixpkgs, libnbtplusplus, ... }: - let - # User-friendly version number. - version = builtins.substring 0 8 self.lastModifiedDate; + outputs = { + self, + nixpkgs, + libnbtplusplus, + ... + }: let + # User-friendly version number. + version = builtins.substring 0 8 self.lastModifiedDate; - # Supported systems (qtbase is currently broken for "aarch64-darwin") - supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]; + # Supported systems (qtbase is currently broken for "aarch64-darwin") + supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux"]; - # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - # Nixpkgs instantiated for supported systems. - pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + # Nixpkgs instantiated for supported systems. + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); - packagesFn = pkgs: rec { - prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus; }; - prismlauncher = pkgs.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus; }; - }; - in - { - packages = forAllSystems (system: - let packages = packagesFn pkgs.${system}; in - packages // { default = packages.prismlauncher; } - ); - - overlay = final: packagesFn; + packagesFn = pkgs: rec { + prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix {inherit version self libnbtplusplus;}; + prismlauncher = pkgs.qt6Packages.callPackage ./nix {inherit version self libnbtplusplus;}; }; + in { + packages = forAllSystems ( + system: let + packages = packagesFn pkgs.${system}; + in + packages // {default = packages.prismlauncher;} + ); + + overlay = final: packagesFn; + }; } diff --git a/nix/default.nix b/nix/default.nix index 99bb2231..6d4f3f24 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,52 +1,54 @@ -{ lib -, stdenv -, cmake -, jdk8 -, jdk17 -, zlib -, file -, wrapQtAppsHook -, xorg -, libpulseaudio -, qtbase -, qtsvg -, qtwayland -, libGL -, quazip -, glfw -, openal -, extra-cmake-modules -, tomlplusplus -, ghc_filesystem -, cmark -, msaClientID ? "" -, jdks ? [ jdk17 jdk8 ] - +{ + lib, + stdenv, + cmake, + jdk8, + jdk17, + zlib, + file, + wrapQtAppsHook, + xorg, + libpulseaudio, + qtbase, + qtsvg, + qtwayland, + libGL, + quazip, + glfw, + openal, + extra-cmake-modules, + tomlplusplus, + ghc_filesystem, + cmark, + msaClientID ? "", + jdks ? [jdk17 jdk8], # flake -, self -, version -, libnbtplusplus + self, + version, + libnbtplusplus, }: - stdenv.mkDerivation rec { pname = "prismlauncher"; inherit version; src = lib.cleanSource self; - nativeBuildInputs = [ extra-cmake-modules cmake file jdk17 wrapQtAppsHook ]; - buildInputs = [ - qtbase - qtsvg - zlib - quazip - ghc_filesystem - tomlplusplus - cmark - ] ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland; + nativeBuildInputs = [extra-cmake-modules cmake file jdk17 wrapQtAppsHook]; + buildInputs = + [ + qtbase + qtsvg + zlib + quazip + ghc_filesystem + tomlplusplus + cmark + ] + ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland; - cmakeFlags = lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] - ++ lib.optionals (lib.versionOlder qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=5" ]; + cmakeFlags = + lib.optionals (msaClientID != "") ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"] + ++ lib.optionals (lib.versionOlder qtbase.version "6") ["-DLauncher_QT_VERSION_MAJOR=5"]; dontWrapQtApps = true; postUnpack = '' @@ -57,30 +59,27 @@ stdenv.mkDerivation rec { chown -R $USER: source/libraries/libnbtplusplus ''; - postInstall = - let - libpath = with xorg; - lib.makeLibraryPath [ - libX11 - libXext - libXcursor - libXrandr - libXxf86vm - libpulseaudio - libGL - glfw - openal - stdenv.cc.cc.lib - ]; - in - '' - # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 - wrapQtApp $out/bin/prismlauncher \ - --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \ - --prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks} \ - --prefix PATH : ${lib.makeBinPath [xorg.xrandr]} - ''; - + postInstall = let + libpath = with xorg; + lib.makeLibraryPath [ + libX11 + libXext + libXcursor + libXrandr + libXxf86vm + libpulseaudio + libGL + glfw + openal + stdenv.cc.cc.lib + ]; + in '' + # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 + wrapQtApp $out/bin/prismlauncher \ + --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \ + --prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks} \ + --prefix PATH : ${lib.makeBinPath [xorg.xrandr]} + ''; meta = with lib; { homepage = "https://prismlauncher.org/"; @@ -93,6 +92,6 @@ stdenv.mkDerivation rec { platforms = platforms.linux; changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${version}"; license = licenses.gpl3Only; - maintainers = with maintainers; [ minion3665 Scrumplex ]; + maintainers = with maintainers; [minion3665 Scrumplex]; }; } diff --git a/nix/flake-compat.nix b/nix/flake-compat.nix index 8b6cb99c..7162a6cf 100644 --- a/nix/flake-compat.nix +++ b/nix/flake-compat.nix @@ -6,4 +6,4 @@ let sha256 = narHash; }; in -import flake-compat { src = ../.; } + import flake-compat {src = ../.;} From 950f921c09930076a19621bea9730cc866c3c482 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 10:50:07 +0100 Subject: [PATCH 32/40] refactor(nix): use flake-utils Signed-off-by: Sefa Eyeoglu --- flake.lock | 16 ++++++++++++++++ flake.nix | 39 ++++++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/flake.lock b/flake.lock index 051e1664..a0f503cd 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,21 @@ "type": "github" } }, + "flake-utils": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "libnbtplusplus": { "flake": false, "locked": { @@ -51,6 +66,7 @@ "root": { "inputs": { "flake-compat": "flake-compat", + "flake-utils": "flake-utils", "libnbtplusplus": "libnbtplusplus", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index f173511c..f476fdf9 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; @@ -16,6 +17,7 @@ outputs = { self, nixpkgs, + flake-utils, libnbtplusplus, ... }: let @@ -23,26 +25,29 @@ version = builtins.substring 0 8 self.lastModifiedDate; # Supported systems (qtbase is currently broken for "aarch64-darwin") - supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux"]; - - # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - - # Nixpkgs instantiated for supported systems. - pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + supportedSystems = with flake-utils.lib.system; [ + x86_64-linux + x86_64-darwin + aarch64-linux + ]; packagesFn = pkgs: rec { - prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix {inherit version self libnbtplusplus;}; - prismlauncher = pkgs.qt6Packages.callPackage ./nix {inherit version self libnbtplusplus;}; + prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix { + inherit version self libnbtplusplus; + }; + prismlauncher = pkgs.qt6Packages.callPackage ./nix { + inherit version self libnbtplusplus; + }; }; - in { - packages = forAllSystems ( - system: let - packages = packagesFn pkgs.${system}; + in + flake-utils.lib.eachSystem supportedSystems (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages = let + packages = packagesFn pkgs; in - packages // {default = packages.prismlauncher;} - ); + packages // {default = packages.prismlauncher;}; - overlay = final: packagesFn; - }; + overlay = final: packagesFn; + }); } From b324778be7d5713947d70dbf1f095f541a20345b Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 10:51:47 +0100 Subject: [PATCH 33/40] feat(nix): add devShell Signed-off-by: Sefa Eyeoglu --- .envrc | 1 + .gitignore | 3 +++ flake.nix | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 010bc323..778024e3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,9 @@ Debug build /build-* +# direnv / Nix +.direnv/ + # Install dirs install /install-* diff --git a/flake.nix b/flake.nix index f476fdf9..3294c799 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,11 @@ in packages // {default = packages.prismlauncher;}; + devShells.default = pkgs.mkShell { + inputsFrom = [self.packages.${system}.default]; + buildInputs = with pkgs; [ccache ninja]; + }; + overlay = final: packagesFn; }); } From 95a0bd61a9788751e78a5cad9f8ee810f174b81e Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 10:53:51 +0100 Subject: [PATCH 34/40] feat(nix): add pre-commit-hooks.nix Signed-off-by: Sefa Eyeoglu --- .gitignore | 1 + flake.lock | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 29 +++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 778024e3..635d1c53 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ build # direnv / Nix .direnv/ +.pre-commit-config.yaml # Install dirs install diff --git a/flake.lock b/flake.lock index a0f503cd..5820e098 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1676283394, @@ -31,6 +47,27 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "libnbtplusplus": { "flake": false, "locked": { @@ -63,12 +100,55 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": [ + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1678376203, + "narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "1a20b9708962096ec2481eeb2ddca29ed747770a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", "libnbtplusplus": "libnbtplusplus", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" } } }, diff --git a/flake.nix b/flake.nix index 3294c799..6173670a 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,11 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; @@ -18,6 +23,7 @@ self, nixpkgs, flake-utils, + pre-commit-hooks, libnbtplusplus, ... }: let @@ -43,12 +49,35 @@ flake-utils.lib.eachSystem supportedSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in { + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + markdownlint.enable = true; + alejandra.enable = true; + + clang-format = { + enable = + false; # As most of the codebase is **not** formatted, we don't want clang-format yet + types_or = ["c" "c++"]; + }; + }; + }; + }; + packages = let packages = packagesFn pkgs; in packages // {default = packages.prismlauncher;}; devShells.default = pkgs.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + packages = with pkgs; [ + nodePackages.markdownlint-cli + alejandra + clang-tools + ]; + inputsFrom = [self.packages.${system}.default]; buildInputs = with pkgs; [ccache ninja]; }; From a1130dace0315f3a1894af7d066a333aef6b9205 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 10:54:50 +0100 Subject: [PATCH 35/40] chore: format markdown files Signed-off-by: Sefa Eyeoglu --- BUILD.md | 52 +------------------------ libraries/katabasis/acknowledgements.md | 12 +++--- 2 files changed, 7 insertions(+), 57 deletions(-) diff --git a/BUILD.md b/BUILD.md index 2443ac56..a139039d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,53 +1,3 @@ # Build Instructions -Full build instructions will be available on [the website](https://prismlauncher.org/wiki/development/build-instructions/). - -If you would like to contribute or fix an issue with the Build instructions you will be able to do so [here](https://github.com/PrismLauncher/website/blob/master/src/wiki/development/build-instructions.md). - -## Getting the source - -Clone the source code using git, and grab all the submodules. This is generic for all platforms you want to build on. -``` -git clone --recursive https://github.com/PrismLauncher/PrismLauncher -cd PrismLauncher -``` - -## Linux - -This guide will mostly mention dependant packages by their Debian naming and commands are done by a user in the sudoers file. -### Dependencies - -- A C++ compiler capable of building C++17 code (can be found in the package `build-essential`). -- Qt Development tools 5.12 or newer (on Debian 11 or Debian-based distributions, `qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5`). -- `cmake` 3.15 or newer. -- `extra-cmake-modules`. -- zlib (`zlib1g-dev` on Debian 11 or Debian-based distributions). -- Java Development Kit (Java JDK) (`openjdk-17-jdk` on Debian 11 or Debian-based distributions). -- Mesa GL headers (`libgl1-mesa-dev` on Debian 11 or Debian-based distributions). -- (Optional) `scdoc` to generate man pages. - -In conclusion, to check if all you need is installed (including optional): - -``` -sudo apt install build-essential qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5 cmake extra-cmake-modules zlib1g-dev openjdk-17-jdk libgl1-mesa-dev scdoc -``` - -### Compiling -#### Building and installing on the system -This is usually the suggested way to build the client. - -``` -cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr" -DENABLE_LTO=ON -cmake --build build -j$(nproc) -sudo cmake --install build -``` - -#### Building a portable binary - -``` -cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -cmake --build build -j$(nproc) -cmake --install build -cmake --install build --component portable -``` - +Full build instructions are available on [the website](https://prismlauncher.org/wiki/development/build-instructions/). diff --git a/libraries/katabasis/acknowledgements.md b/libraries/katabasis/acknowledgements.md index ccc7c263..a6989d15 100644 --- a/libraries/katabasis/acknowledgements.md +++ b/libraries/katabasis/acknowledgements.md @@ -8,10 +8,10 @@ > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > -> * Redistributions of source code must retain the above copyright notice, this +> * Redistributions of source code must retain the above copyright notice, this > list of conditions and the following disclaimer. > -> * Redistributions in binary form must reproduce the above copyright notice, +> * Redistributions in binary form must reproduce the above copyright notice, > this list of conditions and the following disclaimer in the documentation > and/or other materials provided with the distribution. > @@ -36,12 +36,12 @@ Cryptographic methods for Qt. > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > -> * Redistributions of source code must retain the above copyright +> * Redistributions of source code must retain the above copyright > notice, this list of conditions and the following disclaimer. -> * Redistributions in binary form must reproduce the above copyright +> * Redistributions in binary form must reproduce the above copyright > notice, this list of conditions and the following disclaimer in the > documentation and/or other materials provided with the distribution. -> * Neither the name of the Rathenau Instituut, Andre Somers nor the +> * Neither the name of the Rathenau Instituut, Andre Somers nor the > names of its contributors may be used to endorse or promote products > derived from this software without specific prior written permission. > @@ -62,7 +62,7 @@ Configurable settings storage, Twitter XAuth specialization, new demos, cleanups > "Hi Akos, > -> I'm writing this mail to confirm that my contributions to the O2 library, available here https://github.com/pipacs/o2, can be freely distributed according to the project's license (as shown in the LICENSE file). +> I'm writing this mail to confirm that my contributions to the O2 library, available here , can be freely distributed according to the project's license (as shown in the LICENSE file). > > Regards, > -mandeep" From cfca82ceb3aafd1e24ff4eeb943d97e0c69e6f3d Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 10:58:41 +0100 Subject: [PATCH 36/40] chore(nix)!: use overlays.default Signed-off-by: Sefa Eyeoglu --- flake.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 6173670a..0f736308 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,7 @@ aarch64-linux ]; - packagesFn = pkgs: rec { + packagesFn = pkgs: { prismlauncher-qt5 = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus; }; @@ -81,7 +81,8 @@ inputsFrom = [self.packages.${system}.default]; buildInputs = with pkgs; [ccache ninja]; }; - - overlay = final: packagesFn; - }); + }) + // { + overlays.default = final: _: (packagesFn final); + }; } From 5db4fabcad8def43a1185be125443b7d067f0fe9 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 10:59:43 +0100 Subject: [PATCH 37/40] chore(nix): add deadnix Signed-off-by: Sefa Eyeoglu --- flake.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flake.nix b/flake.nix index 0f736308..f656703c 100644 --- a/flake.nix +++ b/flake.nix @@ -54,7 +54,9 @@ src = ./.; hooks = { markdownlint.enable = true; + alejandra.enable = true; + deadnix.enable = true; clang-format = { enable = @@ -75,6 +77,7 @@ packages = with pkgs; [ nodePackages.markdownlint-cli alejandra + deadnix clang-tools ]; From 7707af08e3b6eca9cfd3678c10ef449f8523e640 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 11:19:23 +0100 Subject: [PATCH 38/40] chore(nix): update sources Signed-off-by: Sefa Eyeoglu --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 5820e098..ad9196a9 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -86,11 +86,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1671417167, - "narHash": "sha256-JkHam6WQOwZN1t2C2sbp1TqMv3TVRjzrdoejqfefwrM=", + "lastModified": 1678693419, + "narHash": "sha256-bbSv5yqZAW6dz+3f3f3pOUZbxpPN+3OgCljgn7P+nnQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bb31220cca6d044baa6dc2715b07497a2a7c4bc7", + "rev": "8e3fad82be64c06fbfb9fd43993aec9ef4623936", "type": "github" }, "original": { From af949f5cdd74e0f86ba2bcea510765f883ae2aee Mon Sep 17 00:00:00 2001 From: Nikhil B <59918974+heftymouse@users.noreply.github.com> Date: Tue, 14 Mar 2023 16:52:06 +0530 Subject: [PATCH 39/40] Add visual studio files to gitignore Signed-off-by: Nikhil B <59918974+heftymouse@users.noreply.github.com> --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 010bc323..c72f7a1d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,10 +11,12 @@ html/ *.pro.user CMakeLists.txt.user CMakeLists.txt.user.* +CMakeSettings.json /.project /.settings /.idea /.vscode +/.vs cmake-build-*/ Debug From 05b6969ee507fce515d4f961814487239a946055 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 14 Mar 2023 13:35:16 +0100 Subject: [PATCH 40/40] fix: add mnemonic to downloads directory setting Signed-off-by: Sefa Eyeoglu --- launcher/ui/pages/global/LauncherPage.ui | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 1fe55678..923b7f95 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -130,7 +130,10 @@ - Downloads: + &Downloads: + + + downloadsDirTextBox