Enabling HTTP updater

This commit is contained in:
Eric Kotato 2019-09-28 17:19:45 +03:00
parent 83e499d96c
commit 9b529798cf
2 changed files with 20 additions and 22 deletions

View file

@ -1072,7 +1072,7 @@ private:
rpl::event_stream<Progress> _progress; rpl::event_stream<Progress> _progress;
rpl::event_stream<> _failed; rpl::event_stream<> _failed;
rpl::event_stream<> _ready; rpl::event_stream<> _ready;
//Implementation _httpImplementation; Implementation _httpImplementation;
Implementation _mtpImplementation; Implementation _mtpImplementation;
std::shared_ptr<Loader> _activeLoader; std::shared_ptr<Loader> _activeLoader;
bool _usingMtprotoLoader = (cAlphaVersion() != 0); bool _usingMtprotoLoader = (cAlphaVersion() != 0);
@ -1183,7 +1183,7 @@ int Updater::already() const {
} }
void Updater::stop() { void Updater::stop() {
//_httpImplementation = Implementation(); _httpImplementation = Implementation();
_mtpImplementation = Implementation(); _mtpImplementation = Implementation();
_activeLoader = nullptr; _activeLoader = nullptr;
_action = Action::Waiting; _action = Action::Waiting;
@ -1219,9 +1219,9 @@ void Updater::start(bool forceWait) {
} }
if (sendRequest) { if (sendRequest) {
// startImplementation( startImplementation(
// &_httpImplementation, &_httpImplementation,
// std::make_unique<HttpChecker>(_testing)); std::make_unique<HttpChecker>(_testing));
startImplementation( startImplementation(
&_mtpImplementation, &_mtpImplementation,
std::make_unique<MtpChecker>(_mtproto, _testing)); std::make_unique<MtpChecker>(_mtproto, _testing));
@ -1298,7 +1298,7 @@ void Updater::handleTimeout() {
which.failed = true; which.failed = true;
} }
}; };
//reset(_httpImplementation); reset(_httpImplementation);
reset(_mtpImplementation); reset(_mtpImplementation);
if (!tryLoaders()) { if (!tryLoaders()) {
cSetLastUpdateCheck(0); cSetLastUpdateCheck(0);
@ -1310,8 +1310,7 @@ void Updater::handleTimeout() {
} }
bool Updater::tryLoaders() { bool Updater::tryLoaders() {
//if (_httpImplementation.checker || _mtpImplementation.checker) { if (_httpImplementation.checker || _mtpImplementation.checker) {
if (_mtpImplementation.checker) {
// Some checkers didn't finish yet. // Some checkers didn't finish yet.
return true; return true;
} }
@ -1340,19 +1339,18 @@ bool Updater::tryLoaders() {
_isLatest.fire({}); _isLatest.fire({});
} }
}; };
//if (_mtpImplementation.failed && _httpImplementation.failed) { if (_mtpImplementation.failed && _httpImplementation.failed) {
if (_mtpImplementation.failed) {
_failed.fire({}); _failed.fire({});
return false; return false;
// } else if (!_mtpImplementation.loader) { } else if (!_mtpImplementation.loader) {
// tryOne(_httpImplementation); tryOne(_httpImplementation);
// } else if (!_httpImplementation.loader) { } else if (!_httpImplementation.loader) {
// tryOne(_mtpImplementation); tryOne(_mtpImplementation);
// } else { } else {
// tryOne(_usingMtprotoLoader tryOne(_usingMtprotoLoader
// ? _mtpImplementation ? _mtpImplementation
// : _httpImplementation); : _httpImplementation);
// _usingMtprotoLoader = !_usingMtprotoLoader; _usingMtprotoLoader = !_usingMtprotoLoader;
} }
return true; return true;
} }
@ -1569,7 +1567,7 @@ void UpdateApplication() {
#elif defined OS_MAC_STORE // OS_WIN_STORE #elif defined OS_MAC_STORE // OS_WIN_STORE
return "https://itunes.apple.com/ae/app/telegram-desktop/id946399090"; return "https://itunes.apple.com/ae/app/telegram-desktop/id946399090";
#else // OS_WIN_STORE || OS_MAC_STORE #else // OS_WIN_STORE || OS_MAC_STORE
return "https://desktop.telegram.org"; return "https://github.com/kotatogram/kotatogram-desktop";
#endif // OS_WIN_STORE || OS_MAC_STORE #endif // OS_WIN_STORE || OS_MAC_STORE
}(); }();
UrlClickHandler::Open(url); UrlClickHandler::Open(url);

View file

@ -2735,7 +2735,7 @@ const QString &AutoupdatePrefix(const QString &replaceWith = {}) {
QString autoupdatePrefixFile() { QString autoupdatePrefixFile() {
Expects(!Core::UpdaterDisabled()); Expects(!Core::UpdaterDisabled());
return cWorkingDir() + "tdata/prefix"; return cWorkingDir() + "tdata/kotatoprefix";
} }
const QString &readAutoupdatePrefixRaw() { const QString &readAutoupdatePrefixRaw() {
@ -2752,7 +2752,7 @@ const QString &readAutoupdatePrefixRaw() {
return AutoupdatePrefix(value); return AutoupdatePrefix(value);
} }
} }
return AutoupdatePrefix("https://updates.tdesktop.com"); return AutoupdatePrefix("https://kotatogram.github.io");
} }
void writeAutoupdatePrefix(const QString &prefix) { void writeAutoupdatePrefix(const QString &prefix) {