Hello community, here is the log from the commit of package musique for openSUSE:Factory checked in at 2020-12-01 14:22:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/musique (Old) and /work/SRC/openSUSE:Factory/.musique.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "musique" Tue Dec 1 14:22:53 2020 rev:2 rq:851873 version:1.10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/musique/musique.changes 2020-10-26 16:15:24.494887141 +0100 +++ /work/SRC/openSUSE:Factory/.musique.new.5913/musique.changes 2020-12-01 14:23:07.173614929 +0100 @@ -1,0 +2,6 @@ +Mon Nov 30 14:46:54 UTC 2020 - Cor Blom <corne...@solcon.nl> + +- Update to 1.10.1 + * No upstream changelog + +------------------------------------------------------------------- Old: ---- musique-1.10.tar.xz New: ---- musique-1.10.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ musique.spec ++++++ --- /var/tmp/diff_new_pack.oiiAme/_old 2020-12-01 14:23:07.797615604 +0100 +++ /var/tmp/diff_new_pack.oiiAme/_new 2020-12-01 14:23:07.801615608 +0100 @@ -17,7 +17,7 @@ Name: musique -Version: 1.10 +Version: 1.10.1 Release: 0 Summary: A different take on the music player License: GPL-3.0-only AND LGPL-2.1-only ++++++ _service ++++++ --- /var/tmp/diff_new_pack.oiiAme/_old 2020-12-01 14:23:07.833615643 +0100 +++ /var/tmp/diff_new_pack.oiiAme/_new 2020-12-01 14:23:07.837615647 +0100 @@ -4,7 +4,7 @@ <param name="url">https://github.com/flaviotordini/musique.git</param> <param name="filename">musique</param> <param name="versionformat">@PARENT_TAG@</param> - <param name="revision">1.10</param> + <param name="revision">1.10.1</param> </service> <service mode="disabled" name="recompress"> <param name="file">*.tar</param> ++++++ musique-1.10.tar.xz -> musique-1.10.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/.github/FUNDING.yml new/musique-1.10.1/.github/FUNDING.yml --- old/musique-1.10/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/musique-1.10.1/.github/FUNDING.yml 2020-11-30 10:20:50.000000000 +0100 @@ -0,0 +1,2 @@ +github: flaviotordini +custom: https://flavio.tordini.org/donate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/http/.github/FUNDING.yml new/musique-1.10.1/lib/http/.github/FUNDING.yml --- old/musique-1.10/lib/http/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/musique-1.10.1/lib/http/.github/FUNDING.yml 2020-11-30 10:20:50.000000000 +0100 @@ -0,0 +1,2 @@ +github: flaviotordini +custom: https://flavio.tordini.org/donate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/http/README.md new/musique-1.10.1/lib/http/README.md --- old/musique-1.10/lib/http/README.md 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/http/README.md 2020-11-30 10:20:50.000000000 +0100 @@ -9,6 +9,7 @@ - Easier POST requests - Read timeouts (don't let your requests get stuck forever). (now supported by Qt >= 5.15) - Redirection support (now supported by Qt >= 5.6) +- Disk-based cache implementation similar to Qt's but not strictly a HTTP cache, i.e. it ignores HTTP headers. This is good if want to cache successful requests irrespective of what the origin server says you should do. The cache also fallbacks to stale content when the server returns an error. ## Design @@ -98,6 +99,19 @@ }); ``` +Or using two separate signals for success and failure: +``` +#include "http.h" + +auto reply = Http::instance().get("https://google.com/"); +connect(reply, &HttpReply::data, this, [](auto &bytes) { + qDebug() << "Feel the bytes!" << bytes; +}); +connect(reply, &HttpReply::error, this, [](auto &msg) { + qDebug() << "Something's wrong here" << msg; +}); +``` + This is a real-world example of building a Http object with more complex features. It throttles requests, uses a custom user agent and caches results: ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/http/src/cachedhttp.cpp new/musique-1.10.1/lib/http/src/cachedhttp.cpp --- old/musique-1.10/lib/http/src/cachedhttp.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/http/src/cachedhttp.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -97,7 +97,7 @@ qDebug() << "HIT" << key << req.url; return new CachedHttpReply(value, req.url); } - qDebug() << "MISS" << key << req.url; + // qDebug() << "MISS" << key << req.url; return new WrappedHttpReply(*this, cache, key, http.request(req)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/http/src/httpreply.h new/musique-1.10.1/lib/http/src/httpreply.h --- old/musique-1.10/lib/http/src/httpreply.h 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/http/src/httpreply.h 2020-11-30 10:20:50.000000000 +0100 @@ -16,6 +16,19 @@ virtual QByteArray header(const QByteArray &headerName) const; virtual QByteArray body() const = 0; + template <typename Functor> HttpReply &onData(Functor lambda) { + connect(this, &HttpReply::data, this, lambda); + return *this; + } + template <typename Functor> HttpReply &onError(Functor lambda) { + connect(this, &HttpReply::error, this, lambda); + return *this; + } + template <typename Functor> HttpReply &onFinished(Functor lambda) { + connect(this, &HttpReply::finished, this, lambda); + return *this; + } + signals: void data(const QByteArray &bytes); void error(const QString &message); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/js/js.cpp new/musique-1.10.1/lib/js/js.cpp --- old/musique-1.10/lib/js/js.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/js/js.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -1,14 +1,12 @@ #include "js.h" -#include "jsnamfactory.h" - #include "cachedhttp.h" namespace { Http &cachedHttp() { static Http *h = [] { CachedHttp *cachedHttp = new CachedHttp(Http::instance(), "js"); - cachedHttp->setMaxSeconds(3600 * 6); + cachedHttp->setMaxSeconds(3600); // Avoid expiring the cached js cachedHttp->setMaxSize(0); @@ -85,12 +83,18 @@ if (engine) engine->deleteLater(); engine = new QQmlEngine(this); - engine->setNetworkAccessManagerFactory(new JSNAMFactory); + engine->setNetworkAccessManagerFactory(&namFactory); engine->globalObject().setProperty("global", engine->globalObject()); QJSValue timer = engine->newQObject(new JSTimer(engine)); + engine->globalObject().setProperty("setTimeoutQt", timer.property("setTimeout")); + QJSValue setTimeoutWrapperFunction = + engine->evaluate("function setTimeout(cb, delay) {" + "const args = Array.prototype.slice.call(arguments, 2);" + "return setTimeoutQt(cb, delay, args);" + "}"); + checkError(setTimeoutWrapperFunction); engine->globalObject().setProperty("clearTimeout", timer.property("clearTimeout")); - engine->globalObject().setProperty("setTimeout", timer.property("setTimeout")); connect(cachedHttp().get(url), &HttpReply::finished, this, [this](auto &reply) { if (!reply.isSuccessful()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/js/js.h new/musique-1.10.1/lib/js/js.h --- old/musique-1.10/lib/js/js.h 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/js/js.h 2020-11-30 10:20:50.000000000 +0100 @@ -3,6 +3,7 @@ #include <QtQml> +#include "jsnamfactory.h" #include "jsresult.h" class JSTimer : public QTimer { @@ -24,14 +25,26 @@ return QJSValue(); } // This should be static but cannot bind static functions to QJSEngine - Q_INVOKABLE QJSValue setTimeout(QJSValue callback, QJSValue delayTime) { - // qDebug() << callback.toString() << delayTime.toInt(); + Q_INVOKABLE QJSValue setTimeout(QJSValue callback, QJSValue delayTime, QJSValue args) { + // qDebug() << callback.toString() << delayTime.toInt() << args.toString(); + + QJSValueList valueArgs; + if (args.isArray()) { + const int argsLength = args.property("length").toInt(); + for (int i = 0; i < argsLength; ++i) { + auto arg = args.property(i); + qDebug() << "Adding arg" << arg.toString(); + valueArgs << arg; + } + } + auto timer = new JSTimer(); timer->setInterval(delayTime.toInt()); - connect(timer, &JSTimer::timeout, this, [callback]() mutable { + + connect(timer, &JSTimer::timeout, timer, [callback, valueArgs]() mutable { qDebug() << "Calling" << callback.toString(); if (!callback.isCallable()) qDebug() << callback.toString() << "is not callable"; - auto value = callback.call(); + auto value = callback.call(valueArgs); if (value.isError()) { qWarning() << "Error" << value.toString(); qDebug() << value.property("stack").toString().splitRef('\n'); @@ -62,6 +75,8 @@ static JS &instance(); explicit JS(QObject *parent = nullptr); + JSNAMFactory &getNamFactory() { return namFactory; }; + void initialize(const QUrl &url); bool checkError(const QJSValue &value); @@ -78,6 +93,7 @@ void initialize(); QQmlEngine *engine; + JSNAMFactory namFactory; bool initializing = false; bool ready = false; QUrl url; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/js/jsnamfactory.cpp new/musique-1.10.1/lib/js/jsnamfactory.cpp --- old/musique-1.10/lib/js/jsnamfactory.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/js/jsnamfactory.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -24,16 +24,19 @@ auto headers = meta2.rawHeaders(); for (auto i = headers.begin(); i != headers.end(); ++i) { // qDebug() << i->first << i->second; - if (i->first == "Cache-Control" || i->first == "Expires") { + static const QVector<QByteArray> headersToRemove{"Cache-Control", "Expires", "Pragma"}; + if (headersToRemove.contains(i->first)) { qDebug() << "Removing" << i->first << i->second; headers.erase(i); } } + meta2.setRawHeaders(headers); return meta2; } -JSNAM::JSNAM(QObject *parent) : QNetworkAccessManager(parent) { +JSNAM::JSNAM(QObject *parent, const JSNAMFactory &factory) + : QNetworkAccessManager(parent), factory(factory) { auto cache = new JSDiskCache(this); cache->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/js"); @@ -50,13 +53,20 @@ auto req2 = request; req2.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); - // TODO maybe set user agent + auto end = factory.getRequestHeaders().cend(); + for (auto i = factory.getRequestHeaders().cbegin(); i != end; ++i) { + if (!req2.hasRawHeader(i.key())) + req2.setRawHeader(i.key(), i.value()); + else + qDebug() << "Request for" << req2.url() << "already contains header" << i.key() + << req2.rawHeader(i.key()); + } - qDebug() << req2.url(); + qDebug() << req2.url() << req2.rawHeaderList(); return QNetworkAccessManager::createRequest(op, req2, outgoingData); } QNetworkAccessManager *JSNAMFactory::create(QObject *parent) { qDebug() << "Creating NAM"; - return new JSNAM(parent); + return new JSNAM(parent, *this); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/js/jsnamfactory.h new/musique-1.10.1/lib/js/jsnamfactory.h --- old/musique-1.10/lib/js/jsnamfactory.h 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/js/jsnamfactory.h 2020-11-30 10:20:50.000000000 +0100 @@ -3,30 +3,39 @@ #include <QtQml> -class JSDiskCache : public QNetworkDiskCache { +class JSNAMFactory : public QQmlNetworkAccessManagerFactory { public: - JSDiskCache(QObject *parent); - void updateMetaData(const QNetworkCacheMetaData &meta); - QIODevice *prepare(const QNetworkCacheMetaData &meta); + QNetworkAccessManager *create(QObject *parent); + + void setRequestHeaders(QMap<QByteArray, QByteArray> value) { requestHeaders = value; }; + const QMap<QByteArray, QByteArray> &getRequestHeaders() const { return requestHeaders; } private: - QNetworkCacheMetaData fixMetadata(const QNetworkCacheMetaData &meta); + QMap<QByteArray, QByteArray> requestHeaders; }; class JSNAM : public QNetworkAccessManager { Q_OBJECT public: - JSNAM(QObject *parent); + JSNAM(QObject *parent, const JSNAMFactory &factory); protected: QNetworkReply * createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData); + +private: + const JSNAMFactory &factory; }; -class JSNAMFactory : public QQmlNetworkAccessManagerFactory { +class JSDiskCache : public QNetworkDiskCache { public: - QNetworkAccessManager *create(QObject *parent); + JSDiskCache(QObject *parent); + void updateMetaData(const QNetworkCacheMetaData &meta); + QIODevice *prepare(const QNetworkCacheMetaData &meta); + +private: + QNetworkCacheMetaData fixMetadata(const QNetworkCacheMetaData &meta); }; #endif // YTJSNAMFACTORY_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/media/.github/FUNDING.yml new/musique-1.10.1/lib/media/.github/FUNDING.yml --- old/musique-1.10/lib/media/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/musique-1.10.1/lib/media/.github/FUNDING.yml 2020-11-30 10:20:50.000000000 +0100 @@ -0,0 +1,2 @@ +github: flaviotordini +custom: https://flavio.tordini.org/donate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/media/src/mpv/mediampv.cpp new/musique-1.10.1/lib/media/src/mpv/mediampv.cpp --- old/musique-1.10/lib/media/src/mpv/mediampv.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/media/src/mpv/mediampv.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -360,8 +360,9 @@ } QString MediaMPV::file() const { - char *path; + char *path = nullptr; mpv_get_property(mpv, "path", MPV_FORMAT_STRING, &path); + if (!path) return QString(); return QString::fromUtf8(path); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/.github/FUNDING.yml new/musique-1.10.1/lib/updater/.github/FUNDING.yml --- old/musique-1.10/lib/updater/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/musique-1.10.1/lib/updater/.github/FUNDING.yml 2020-11-30 10:20:50.000000000 +0100 @@ -0,0 +1,2 @@ +github: flaviotordini +custom: https://flavio.tordini.org/donate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/README.md new/musique-1.10.1/lib/updater/README.md --- old/musique-1.10/lib/updater/README.md 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/updater/README.md 2020-11-30 10:20:50.000000000 +0100 @@ -1,6 +1,6 @@ # An updater for Qt apps -This is an extensible updater for Qt apps. It can wrap Sparkle on macOS and use its own implementation on Windows and Linux. I use it in my apps at https://flavio.tordini.org . +This is an extensible updater for Qt apps. It can wrap [Sparkle](https://sparkle-project.org/) on macOS and use its own implementation on Windows and Linux. I use it in my apps at https://flavio.tordini.org . ## Design diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/marketplace.json new/musique-1.10.1/lib/updater/marketplace.json --- old/musique-1.10/lib/updater/marketplace.json 1970-01-01 01:00:00.000000000 +0100 +++ new/musique-1.10.1/lib/updater/marketplace.json 2020-11-30 10:20:50.000000000 +0100 @@ -0,0 +1,48 @@ +{ + "$schema": "http://qt.io/schema/extension-schema-v1#", + "title": "Updater", + "extensionType": [ + "library" + ], + "version": "1", + "vendor": { + "name": "Flavio Tordini", + "url": "https://flavio.tordini.org" + }, + "contact": "Flavio Tordini <flavio.tord...@gmail.com>", + "copyright": [ + "Flavio Tordini" + ], + "author": "Flavio Tordini", + "icon": "https://flavio.tordini.org/favicon-196x196.png", + "licenses": [ + { + "licenseType": "GPLv3", + "licenseUrl": "https://opensource.org/licenses/GPL-3.0" + } + ], + "created": "2020-07-03", + "platforms": [ + "Windows", + "Linux", + "macOS" + ], + "qtVersions": [ + "5.10.0-or-later" + ], + "tags": [ + "updater,update,deploy,release,tools,utility" + ], + "price": { + "listprice": 0 + }, + "support": "flavio.tord...@gmail.com", + "bugUrl": "https://github.com/flaviotordini/updater/issues", + "sourceRepoUrl": "https://github.com/flaviotordini/updater", + "userManuals": [ + "https://github.com/flaviotordini/updater/blob/master/README.md" + ], + "dependencies": [ + "Network" + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/src/impl/defaultupdater.cpp new/musique-1.10.1/lib/updater/src/impl/defaultupdater.cpp --- old/musique-1.10/lib/updater/src/impl/defaultupdater.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/updater/src/impl/defaultupdater.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -4,8 +4,8 @@ #include "dialog.h" #include "downloader.h" #include "installer.h" +#include "openinstaller.h" #include "parser.h" -#include "runinstaller.h" namespace updater { @@ -89,7 +89,7 @@ void DefaultUpdater::update() { if (!installer) { - installer = new RunInstaller(); + installer = new OpenInstaller(); installer->setUpdater(this); } connect(installer, &Installer::error, this, [](auto message) { qWarning() << message; }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/src/impl/openinstaller.cpp new/musique-1.10.1/lib/updater/src/impl/openinstaller.cpp --- old/musique-1.10/lib/updater/src/impl/openinstaller.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/musique-1.10.1/lib/updater/src/impl/openinstaller.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -0,0 +1,13 @@ +#include "openinstaller.h" + +#include <QDesktopServices> + +namespace updater { + +OpenInstaller::OpenInstaller() {} + +void updater::OpenInstaller::start(const QString &filename) { + if (!QDesktopServices::openUrl(QUrl("file:///" + filename))) emit error("Cannot start update"); +} + +} // namespace updater diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/src/impl/openinstaller.h new/musique-1.10.1/lib/updater/src/impl/openinstaller.h --- old/musique-1.10/lib/updater/src/impl/openinstaller.h 1970-01-01 01:00:00.000000000 +0100 +++ new/musique-1.10.1/lib/updater/src/impl/openinstaller.h 2020-11-30 10:20:50.000000000 +0100 @@ -0,0 +1,20 @@ +#ifndef OPENINSTALLER_H +#define OPENINSTALLER_H + +#include <QtCore> + +#include "installer.h" + +namespace updater { + +/// Installer implementation that opens the downloaded update +class OpenInstaller : public Installer { + Q_OBJECT + +public: + OpenInstaller(); + void start(const QString &filename); +}; + +} // namespace updater +#endif // OPENINSTALLER_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/src/impl/runinstaller.cpp new/musique-1.10.1/lib/updater/src/impl/runinstaller.cpp --- old/musique-1.10/lib/updater/src/impl/runinstaller.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/updater/src/impl/runinstaller.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -2,20 +2,58 @@ #include <QDesktopServices> +#include "defaultupdater.h" + namespace updater { RunInstaller::RunInstaller() : Installer() {} void RunInstaller::start(const QString &filename) { - if (arguments.isEmpty()) { - if (!QDesktopServices::openUrl(QUrl("file:///" + filename))) - emit error("Cannot start update"); + auto processedArguments = arguments; + processedArguments << autoRestartArguments; + + if (command.isEmpty()) { + command = filename; + } else { + // replace markers + for (auto &arg : processedArguments) + arg.replace("%filename%", filename); +#ifdef Q_OS_LINUX + if (runAsAdmin) { + processedArguments.prepend(command); + command = "pkexec"; + } +#endif + } + + QProcess *process = new QProcess(); + QObject::connect(process, &QProcess::errorOccurred, this, [this](auto error) { + this->emit error("Update error: " + QVariant::fromValue(error).toString()); + }); + + if (autoRestart && updater->getRelaunchAfterInstall()) { + auto thread = new QThread; + process->moveToThread(thread); + connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, + [this](int exitCode, QProcess::ExitStatus exitStatus) { + qDebug() << "finished" << exitCode << exitStatus; + if (exitCode == 0 && exitStatus == QProcess::NormalExit) { + qDebug() << "Restarting" << qApp->applicationFilePath(); + QProcess *restartProcess = new QProcess(this); + restartProcess->startDetached(qApp->applicationFilePath(), {}); + } + }); + qDebug() << "Executing" << command << processedArguments; + process->start(command, processedArguments); + process->waitForFinished(60000); } else { - QProcess *process = new QProcess(this); - QObject::connect(process, &QProcess::errorOccurred, this, [this](auto error) { - this->emit error("Update error: " + QVariant::fromValue(error).toString()); - }); - process->startDetached(filename, arguments); + qDebug() << "Forking" << command << processedArguments; + if (!process->startDetached(command, processedArguments)) { + qWarning() << "Cannot execute" << command << processedArguments + << process->errorString(); + // Fallback to opening the downloaded payload + QDesktopServices::openUrl(QUrl("file:///" + filename)); + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/src/impl/runinstaller.h new/musique-1.10.1/lib/updater/src/impl/runinstaller.h --- old/musique-1.10/lib/updater/src/impl/runinstaller.h 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/updater/src/impl/runinstaller.h 2020-11-30 10:20:50.000000000 +0100 @@ -1,25 +1,42 @@ #ifndef UPDATER_IMPL_RUNINSTALLER_H #define UPDATER_IMPL_RUNINSTALLER_H -#include <QObject> +#include <QtCore> #include "installer.h" namespace updater { /** - * Installer implementation that simply runs the downloaded update + * Installer implementation that executes a command with arguments */ class RunInstaller : public Installer { Q_OBJECT public: RunInstaller(); + void setCommand(const QString &value) { command = value; } void setArguments(const QStringList &value) { arguments = value; }; + /** + * Currently supported on Linux only using PackageKit (pkexec) + */ + void setRunAsAdmin(bool value) { runAsAdmin = value; } + /** + * This will cause the update process to run while the app is still running. Then the app will + * self-restart. + */ + void setAutoRestart(bool value) { autoRestart = value; } + + void setRelaunchArguments(const QStringList &value) { autoRestartArguments = value; } + void start(const QString &filename); private: + QString command; QStringList arguments; + bool runAsAdmin = false; + bool autoRestart = false; + QStringList autoRestartArguments; }; } // namespace updater diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/src/updater.cpp new/musique-1.10.1/lib/updater/src/updater.cpp --- old/musique-1.10/lib/updater/src/updater.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/updater/src/updater.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -124,6 +124,8 @@ void Updater::onUserAction() { if (status == Updater::Status::UpdateDownloaded) { + // tell Installer we want the app to be restarted + setRelaunchAfterInstall(true); // update will be installed on quit qApp->quit(); return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/src/updater.h new/musique-1.10.1/lib/updater/src/updater.h --- old/musique-1.10/lib/updater/src/updater.h 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/updater/src/updater.h 2020-11-30 10:20:50.000000000 +0100 @@ -40,9 +40,15 @@ // This should be protected void setDisplayVersion(const QString &value) { displayVersion = value; } + /// true if the app can be stopped and relaunched without user interaction virtual bool getImmediateInstallAndRelaunch() const { return immediateInstallAndRelaunch; } virtual void setImmediateInstallAndRelaunch(bool value) { immediateInstallAndRelaunch = value; } + /// true if the app has to be relaunched after the update has completed + virtual bool getRelaunchAfterInstall() const { return relaunchAfterInstall; } + virtual void setRelaunchAfterInstall(bool value) { relaunchAfterInstall = value; } + + /// when true an available update will be downloaded without user interaction virtual bool getAutomaticDownload() const { return automaticDownload; } virtual void setAutomaticDownload(bool value) { automaticDownload = value; } @@ -65,6 +71,7 @@ bool automaticDownload = true; bool immediateInstallAndRelaunch = false; + bool relaunchAfterInstall = false; Status status = Status::UpToDate; QString version; QString displayVersion; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/lib/updater/updater.pri new/musique-1.10.1/lib/updater/updater.pri --- old/musique-1.10/lib/updater/updater.pri 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/lib/updater/updater.pri 2020-11-30 10:20:50.000000000 +0100 @@ -16,7 +16,7 @@ OBJECTIVE_SOURCES += $$PWD/src/sparkle/sparkleupdater.mm } else { DEFINES += UPDATER_DEFAULT - QT *= network + QT *= network widgets INCLUDEPATH += $$PWD/src/impl DEPENDPATH += $$PWD/src/impl @@ -29,7 +29,8 @@ $$PWD/src/impl/parser.h \ $$PWD/src/impl/runinstaller.h \ $$PWD/src/impl/simplexmlparser.h \ - $$PWD/src/impl/appcastparser.h + $$PWD/src/impl/appcastparser.h \ + $$PWD/src/impl/openinstaller.h SOURCES += \ $$PWD/src/impl/checker.cpp \ @@ -38,5 +39,6 @@ $$PWD/src/impl/downloader.cpp \ $$PWD/src/impl/runinstaller.cpp \ $$PWD/src/impl/simplexmlparser.cpp \ - $$PWD/src/impl/appcastparser.cpp + $$PWD/src/impl/appcastparser.cpp \ + $$PWD/src/impl/openinstaller.cpp } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/locale/ms_MY.ts new/musique-1.10.1/locale/ms_MY.ts --- old/musique-1.10/locale/ms_MY.ts 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/locale/ms_MY.ts 2020-11-30 10:20:50.000000000 +0100 @@ -210,7 +210,7 @@ </message> <message> <source>Use %1 library</source> - <translation type="unfinished"/> + <translation>Guna pustaka %1</translation> </message> </context> <context> @@ -664,15 +664,15 @@ </message> <message> <source>Thanks for updating %1 to version %2!</source> - <translation type="unfinished"/> + <translation>Terima kasih kerana mengemas kini %1 ke versi %2!</translation> </message> <message> <source>If you enjoy %1, perhaps having installed it months or even years ago, please consider becoming one of the people willing to support something you enjoy.</source> - <translation type="unfinished"/> + <translation>Jika anda menyukai %1, mungkin telah memasangnya beberapa bulan atau tahun yang lalu, dialu-alukan menyokong hasil kerja yang anda nikmati ini.</translation> </message> <message> <source>Donate</source> - <translation type="unfinished"/> + <translation>Beri Sumbangan</translation> </message> </context> <context> @@ -767,31 +767,31 @@ <name>Updater</name> <message> <source>Check for Updates...</source> - <translation type="unfinished"/> + <translation>Periksa Kemas Kini...</translation> </message> <message> <source>Version %1 is available...</source> - <translation type="unfinished"/> + <translation>Versi %1 sudah tersedia...</translation> </message> <message> <source>Downloading version %1...</source> - <translation type="unfinished"/> + <translation>Memuat turun versi %1...</translation> </message> <message> <source>Restart to Update</source> - <translation type="unfinished"/> + <translation>Mula Semula untuk Kemas Kini</translation> </message> <message> <source>Version %1 download failed</source> - <translation type="unfinished"/> + <translation>Gagal memuat turun versi %1</translation> </message> <message> <source>Check for Updates</source> - <translation type="unfinished"/> + <translation>Periksa Kemas Kini</translation> </message> <message> <source>Download Update</source> - <translation type="unfinished"/> + <translation>Muat Turun Kemas Kini</translation> </message> <message> <source>Downloading update...</source> @@ -799,37 +799,37 @@ </message> <message> <source>Retry Update Download</source> - <translation type="unfinished"/> + <translation>Cuba Lagi Muat Turun Kemas Kini</translation> </message> <message> <source>You have the latest version.</source> - <translation type="unfinished"/> + <translation>Anda sudah memiliki versi terkini.</translation> </message> <message> <source>Version %1 is available.</source> - <translation type="unfinished"/> + <translation>Versi %1 sudah tersedia.</translation> </message> <message> <source>An update has been downloaded and is ready to be installed.</source> - <translation type="unfinished"/> + <translation>Satu kemas kini telah dimuat turun dan sedia dipasang.</translation> </message> </context> <context> <name>updater::DefaultUpdater</name> <message> <source>There are currently no updates available.</source> - <translation type="unfinished"/> + <translation>Tiada kemas kini buat masa ini.</translation> </message> </context> <context> <name>updater::Dialog</name> <message> <source>You already have the latest version</source> - <translation type="unfinished"/> + <translation>Anda sudah memiliki versi terkini</translation> </message> <message> <source>Downloading %1 %2...</source> - <translation type="unfinished"/> + <translation>Memuat turun %1 %2...</translation> </message> <message> <source>A new version of %1 is available!</source> @@ -849,7 +849,7 @@ </message> <message> <source>Download Update</source> - <translation type="unfinished"/> + <translation>Muat Turun Kemas Kini</translation> </message> </context> </TS> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/locale/pt_BR.ts new/musique-1.10.1/locale/pt_BR.ts --- old/musique-1.10/locale/pt_BR.ts 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/locale/pt_BR.ts 2020-11-30 10:20:50.000000000 +0100 @@ -767,15 +767,15 @@ <name>Updater</name> <message> <source>Check for Updates...</source> - <translation type="unfinished"/> + <translation>Verificar se há atualizações...</translation> </message> <message> <source>Version %1 is available...</source> - <translation type="unfinished"/> + <translation>A Versão %1 está disponível...</translation> </message> <message> <source>Downloading version %1...</source> - <translation type="unfinished"/> + <translation>Baixando a versão %1...</translation> </message> <message> <source>Restart to Update</source> @@ -791,7 +791,7 @@ </message> <message> <source>Download Update</source> - <translation type="unfinished"/> + <translation>Baixar Atualização</translation> </message> <message> <source>Downloading update...</source> @@ -807,7 +807,7 @@ </message> <message> <source>Version %1 is available.</source> - <translation type="unfinished"/> + <translation>A Versão %1 já está disponível.</translation> </message> <message> <source>An update has been downloaded and is ready to be installed.</source> @@ -829,7 +829,7 @@ </message> <message> <source>Downloading %1 %2...</source> - <translation type="unfinished"/> + <translation>Baixando %1 %2...</translation> </message> <message> <source>A new version of %1 is available!</source> @@ -849,7 +849,7 @@ </message> <message> <source>Download Update</source> - <translation type="unfinished"/> + <translation>Baixar Atualização</translation> </message> </context> </TS> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/musique.pro new/musique-1.10.1/musique.pro --- old/musique-1.10/musique.pro 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/musique.pro 2020-11-30 10:20:50.000000000 +0100 @@ -1,7 +1,7 @@ CONFIG += c++17 exceptions_off rtti_off optimize_full object_parallel_to_source TEMPLATE = app -VERSION = 1.10 +VERSION = 1.10.1 DEFINES += APP_VERSION="$$VERSION" APP_NAME = Musique @@ -254,10 +254,6 @@ } mac|win32|contains(DEFINES, APP_UBUNTU):include(local/local.pri) -!contains(DEFINES, APP_MAC_STORE) { - include(lib/updater/updater.pri) -} - message(QT: $$QT) message(CONFIG: $$CONFIG) message(DEFINES: $$DEFINES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/src/httputils.cpp new/musique-1.10.1/src/httputils.cpp --- old/musique-1.10/src/httputils.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/src/httputils.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -72,3 +72,10 @@ }(); return ua; } + +const QByteArray &HttpUtils::stealthUserAgent() { + static const QByteArray ua = + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like " + "Gecko) Chrome/84.0.4147.105 Safari/537.36"; + return ua; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/src/httputils.h new/musique-1.10.1/src/httputils.h --- old/musique-1.10/src/httputils.h 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/src/httputils.h 2020-11-30 10:20:50.000000000 +0100 @@ -12,6 +12,7 @@ static Http &cached(); static Http ¬Cached(); static const QByteArray &userAgent(); + static const QByteArray &stealthUserAgent(); private: HttpUtils() {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/musique-1.10/src/mainwindow.cpp new/musique-1.10.1/src/mainwindow.cpp --- old/musique-1.10/src/mainwindow.cpp 2020-10-07 11:09:32.000000000 +0200 +++ new/musique-1.10.1/src/mainwindow.cpp 2020-11-30 10:20:50.000000000 +0100 @@ -131,7 +131,9 @@ } void MainWindow::lazyInit() { - JS::instance().initialize(QUrl(QLatin1String(Constants::WEBSITE) + "-ws/bundle.js")); + JS::instance().getNamFactory().setRequestHeaders( + {{"User-Agent", HttpUtils::stealthUserAgent()}}); + JS::instance().initialize(QUrl(QLatin1String(Constants::WEBSITE) + "-ws/bundle2.js")); GlobalShortcuts &shortcuts = GlobalShortcuts::instance(); #ifdef APP_MAC _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org