Add alternative URL for program update checking

The alternative URL is hosted on GitHub and users are able to access it:
https://github.com/qbittorrent/qBittorrent/issues/23000#issuecomment-3092538814
https://github.com/qbittorrent/qBittorrent/issues/23009#issuecomment-3093201180

Also, disguise the user agent as a normal browser to avoid standing out from the crowd and
avoid whatever issues from CDN. This only applies to non-fosshub URLs.

Closes #23000.
Closes #23009.
PR #23014.
This commit is contained in:
Chocobo1
2025-07-22 14:56:42 +08:00
committed by Vladimir Golovnev (Glassez)
parent 3fa812ced6
commit 18fb9936f0
3 changed files with 79 additions and 34 deletions

View File

@@ -45,10 +45,11 @@ class ProgramUpdater final : public QObject
Q_DISABLE_COPY_MOVE(ProgramUpdater)
public:
using QObject::QObject;
using Version = Utils::Version<4, 3>;
void checkForUpdates() const;
using QObject::QObject;
void checkForUpdates();
Version getNewVersion() const;
bool updateProgram() const;
@@ -57,14 +58,22 @@ signals:
private slots:
void rssDownloadFinished(const Net::DownloadResult &result);
void fallbackDownloadFinished(const Net::DownloadResult &result);
void fallbackDownloadFinished(const Net::DownloadResult &result, Version &version);
private:
void handleFinishedRequest();
bool shouldUseFallback() const;
enum class RemoteSource
{
Fosshub,
QbtMain,
QbtBackup
};
mutable bool m_hasCompletedOneReq = false;
Version m_remoteVersion;
Version m_fallbackRemoteVersion;
void handleFinishedRequest();
RemoteSource getLatestRemoteSource() const;
int m_pendingRequestCount = 0;
Version m_fosshubVersion;
Version m_qbtMainVersion;
Version m_qbtBackupVersion;
QUrl m_updateURL;
};