Skip to content

Commit

Permalink
Release v1.9.6. Support scanning betazone
Browse files Browse the repository at this point in the history
  • Loading branch information
xsacha committed Oct 19, 2014
1 parent 8d933af commit b2202cf
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Sachesi.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TARGET="Sachesi"
win32: RC_ICONS += assets/sachesi-114.ico
else:mac: ICON = assets/sachesi-114.icns
else: ICON = assets/sachesi-114.png
VERSION = 1.9.5
VERSION = 1.9.6

# Global specific
CONFIG += c++11
Expand Down
56 changes: 30 additions & 26 deletions src/mainnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void MainNet::grabPotentialLinks(QString softwareRelease, QString osVersion, boo
auto appendNewHeader = [&potentialText] (QString name, QString devices) {
potentialText.append("\n" + name + ": " + devices + " (Debrick + Core OS)\n");
};
auto appendNewLink = [&potentialText, &hashval] (QString linkType, int type, bool OMAP, QString hwType, QString version) {
auto appendNewLink = [this, &potentialText, &hashval] (QString linkType, int type, bool OMAP, QString hwType, QString version) {
QString typeString;
if (type == 2) {
potentialText.append(linkType + " IFS\n");
Expand All @@ -234,7 +234,10 @@ void MainNet::grabPotentialLinks(QString softwareRelease, QString osVersion, boo
typeString = "qcfm.radio.";
}

potentialText.append("http://cdn.fs.sl.blackberry.com/fs/qnx/production/" + hashval + "/com.qnx." + typeString);
potentialText.append(QString("http://cdn.fs.sl.blackberry.com/fs/qnx/%1/%2/com.qnx.%3")
.arg(_hasPotentialLinks == 1 ? "production" : "betazone")
.arg(hashval)
.arg(typeString));

if (OMAP) // Old Playbook style
potentialText.append("factory" + hwType + "/" + version + "/winchester.factory_sfi" + hwType + "-" + version + "-nto+armle-v7+signed.bar\n");
Expand Down Expand Up @@ -536,30 +539,31 @@ void MainNet::reverseLookupReply() {
if (!swRelease.isEmpty() && swRelease.at(0).isDigit()) {
QCryptographicHash hash(QCryptographicHash::Sha1);
hash.addData(swRelease.toLocal8Bit());
QString server = "http://cdn.fs.sl.blackberry.com/fs/qnx/production/";
/*if (reply->url().host().startsWith("beta")) {
server = "http://cdn.fs.sl.blackberry.com/fs/qnx/beta/";
}*/
QString url = server + QString(hash.result().toHex());
QNetworkRequest request;
request.setRawHeader("Content-Type", "text/xml;charset=UTF-8");
request.setUrl(QUrl(url));
QNetworkReply* replyTmp = manager->head(request);
connect(replyTmp, &QNetworkReply::finished, [=]() {
// Seems to give 301 redirect if it's real
uint status = replyTmp->attribute(QNetworkRequest::HttpStatusCodeAttribute).toUInt();
// New SW release found
_softwareRelease = swRelease;
if (status == 200 || (status > 300 && status <= 308)) {
_hasPotentialLinks = true; emit hasPotentialLinksChanged();
} else if (skip) {
// Instead of using version, report 'not in system' so that it is skipped
_softwareRelease = "SR not in system";
}
emit softwareReleaseChanged();
setScanning(0);
replyTmp->deleteLater();
});
foreach(QString server, QStringList() << "production" << "betazone") {
QString url = "http://cdn.fs.sl.blackberry.com/fs/qnx/" + server + "/" + QString(hash.result().toHex());
QNetworkRequest request;
request.setRawHeader("Content-Type", "text/xml;charset=UTF-8");
request.setUrl(QUrl(url));
QNetworkReply* replyTmp = manager->head(request);
connect(replyTmp, &QNetworkReply::finished, [=]() {
if (!_softwareRelease.startsWith("10") || !_hasPotentialLinks)
{
// Seems to give 301 redirect if it's real
uint status = replyTmp->attribute(QNetworkRequest::HttpStatusCodeAttribute).toUInt();
// New SW release found
_softwareRelease = swRelease;
if (status == 200 || (status > 300 && status <= 308)) {
_hasPotentialLinks = (server == "production") ? 1 : 2; emit hasPotentialLinksChanged();
} else if (skip) {
// Instead of using version, report 'not in system' so that it is skipped
_softwareRelease = "SR not in system";
}
emit softwareReleaseChanged();
setScanning(0);
}
replyTmp->deleteLater();
});
}
} else {
_softwareRelease = swRelease; emit softwareReleaseChanged();
setScanning(0);
Expand Down
4 changes: 2 additions & 2 deletions src/mainnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MainNet : public QObject {
Q_PROPERTY(int updateCheckedNeededCount READ updateCheckedNeededCount NOTIFY updateCheckedCountChanged)
Q_PROPERTY(QString error MEMBER _error NOTIFY errorChanged)
Q_PROPERTY(QString multiscanVersion MEMBER _multiscanVersion NOTIFY updateMessageChanged)
Q_PROPERTY(bool hasPotentialLinks MEMBER _hasPotentialLinks NOTIFY hasPotentialLinksChanged)
Q_PROPERTY(int hasPotentialLinks MEMBER _hasPotentialLinks NOTIFY hasPotentialLinksChanged)
Q_PROPERTY(bool hasBootAccess READ hasBootAccess CONSTANT)
Q_PROPERTY(bool multiscan MEMBER _multiscan WRITE setMultiscan NOTIFY multiscanChanged)
Q_PROPERTY(int scanning MEMBER _scanning WRITE setScanning NOTIFY scanningChanged)
Expand Down Expand Up @@ -143,7 +143,7 @@ private slots:
QString _error;
QString _multiscanVersion;
bool _multiscan;
bool _hasPotentialLinks;
int _hasPotentialLinks;
int _scanning;
QFile _currentFile;
int _maxId, _dlBytes, _dlTotal;
Expand Down
2 changes: 1 addition & 1 deletion src/sachesi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
app.setOrganizationName("Qtness");
app.setOrganizationDomain("qtness.com");
app.setApplicationName("Sachesi");
app.setApplicationVersion("1.9.5");
app.setApplicationVersion("1.9.6");

// Install translator by locale language string
QTranslator appTranslator;
Expand Down

0 comments on commit b2202cf

Please sign in to comment.