11#include " ApplyLibraryOverrides.h"
2- #include < launch/LaunchTask.h>
2+ #include " Application.h"
3+ #include " BuildConfig.h"
4+ #include " launch/LaunchTask.h"
35#include " minecraft/PackProfile.h"
46#include " net/Download.h"
57#include " net/NetJob.h"
68
7- #include " Application.h"
8-
99ApplyLibraryOverrides::ApplyLibraryOverrides (LaunchTask* parent, AuthSessionPtr session)
1010 : LaunchStep(parent), m_session(session), m_instance(m_parent->instance ())
1111{}
@@ -17,13 +17,13 @@ void ApplyLibraryOverrides::executeTask()
1717
1818void ApplyLibraryOverrides::downloadLibraryOverrideList ()
1919{
20- const auto libraryOverrideListUrl =
21- QUrl (" https://raw.githubusercontent.com/FreesmTeam/FreesmLauncher/refs/heads/develop/epl_metadata.json" );
20+ const auto libraryOverrideListUrl = QUrl (m_isFirstDownloadTry ? BuildConfig.EPL_META_URL : BuildConfig.EPL_META_FALLBACK_URL );
2221 m_response = std::make_shared<QByteArray>();
2322 m_request = Net::Download::makeByteArray (libraryOverrideListUrl, m_response);
2423
2524 m_task.reset (new NetJob (" Fetch EPL metadata" , APPLICATION->network ()));
2625 m_task->addNetAction (m_request);
26+ m_task->setAskRetry (false );
2727
2828 connect (m_task.get (), &NetJob::finished, this , &ApplyLibraryOverrides::onLibraryOverrideDownloadFinished);
2929 connect (m_task.get (), &NetJob::aborted, this , [this ] { emitFailed (tr (" Aborted" )); });
@@ -34,6 +34,10 @@ void ApplyLibraryOverrides::downloadLibraryOverrideList()
3434void ApplyLibraryOverrides::onLibraryOverrideDownloadFinished ()
3535{
3636 if (m_request->error () != QNetworkReply::NoError) {
37+ if (m_isFirstDownloadTry) {
38+ m_isFirstDownloadTry = false ;
39+ return downloadLibraryOverrideList ();
40+ }
3741 emitFailed (" Failed to download EPL metadata." );
3842 return ;
3943 }
0 commit comments