diff --git a/.appveyor.yml b/.appveyor.yml index 8e96c6d4..d0acb2c3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -401,6 +401,12 @@ after_test: - 7z a %ZIP_FILE% .\..\..\install-DownZemAll-cmake\* # zip the browser addons + +# update manifest.json versions + - cd C:\projects\DownZemAll\web-extension\extension + - .\synchronize_versions.bat + - cd C:\projects\DownZemAll\bin + # DownRightNow_webextension_firefox_v1.2.0.xpi - set ZIP_FIREFOX_WEB_EXTENSION="DownRightNow_firefox_v%AppVersion%.xpi" - 7z a %ZIP_FIREFOX_WEB_EXTENSION% .\..\web-extension\extension\firefox\* diff --git a/version b/version index 88c5fb89..347f5833 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.4.0 +1.4.1 diff --git a/web-extension/extension/substitute.py b/web-extension/extension/substitute.py new file mode 100644 index 00000000..5b418518 --- /dev/null +++ b/web-extension/extension/substitute.py @@ -0,0 +1,32 @@ +#substitute.py +# +# Copyright 2019 Sebastien Vavassori. All rights reserved. +# Use of this source code is governed by a LGPL license that can be +# found in the LICENSE file. +# +import sys +import os + +# print(sys.argv) + +oldvalue = sys.argv[1] +newvaluefile = sys.argv[2] +inputfile = sys.argv[3] +outputfile = sys.argv[3] + "_temp" + +with open(newvaluefile) as f: + first_line = f.readline() + +newvalue = first_line.split('\n') + +fin = open(inputfile, "rt") +fout = open(outputfile, "wt") + +for line in fin: + fout.write(line.replace(oldvalue, newvalue[0])) + +fin.close() +fout.close() + +os.remove(inputfile) +os.rename(outputfile, inputfile) diff --git a/web-extension/extension/synchronize_versions.bat b/web-extension/extension/synchronize_versions.bat new file mode 100644 index 00000000..13874fe8 --- /dev/null +++ b/web-extension/extension/synchronize_versions.bat @@ -0,0 +1,16 @@ +@echo off +:: Copyright 2019 Sébastien Vavassori. All rights reserved. +:: Use of this source code is governed by a LGPL license that can be +:: found in the LICENSE file. + +:: +:: This batch script rewrites the Firefox/Chrome manifest.json files +:: with the current value present in /version +:: + +echo.Updating version... + +python substitute.py "1.4.0" .\..\..\version .\chromium\manifest.json +python substitute.py "1.4.0" .\..\..\version .\firefox\manifest.json + +echo.Version updated. diff --git a/web-extension/extension/version b/web-extension/extension/version deleted file mode 100644 index 88c5fb89..00000000 --- a/web-extension/extension/version +++ /dev/null @@ -1 +0,0 @@ -1.4.0 diff --git a/web-extension/launcher/launcher-manifest-chrome.json b/web-extension/launcher/launcher-manifest-chrome.json index 425769d5..4b9820df 100644 --- a/web-extension/launcher/launcher-manifest-chrome.json +++ b/web-extension/launcher/launcher-manifest-chrome.json @@ -3,5 +3,5 @@ "description": "DownRightNow Launcher Host for Native Messaging", "path": "launcher.exe", "type": "stdio", - "allowed_origins": [ "chrome-extension://afodkgpjbniehgobgnpjpgdopfaonidl/" ] + "allowed_origins": [ "chrome-extension://modofbhnhlagjmejdbalnijgncppjeio/" ] } diff --git a/web-extension/launcher/launcher.cpp b/web-extension/launcher/launcher.cpp index abcab66a..0dfee035 100644 --- a/web-extension/launcher/launcher.cpp +++ b/web-extension/launcher/launcher.cpp @@ -78,7 +78,11 @@ void mSleep(int ms) static void sendDataToExtension(const std::string &message) { +#if defined(Q_OS_WIN) _setmode(_fileno(stdout), O_BINARY); +#else + freopen("file_out.txt", "wb", stdout); /* w = write, b = binary */ +#endif try { std::string json = "{\"text\": \"" + message + "\"}"; std::string::size_type length = json.length(); @@ -125,7 +129,11 @@ static std::string cleanChromeMessage(const std::string &message) static std::string openStandardStreamIn() { std::cout.setf(std::ios_base::unitbuf); +#if defined(Q_OS_WIN) _setmode(_fileno(stdin), _O_BINARY); /* Keep \n instead of \r\n */ +#else + freopen("file_in.txt", "rb", stdin); /* r = read, b = binary */ +#endif int size = 0; for (int i = 0; i <= 3; i++) { @@ -162,7 +170,11 @@ static bool startInteractiveMode(const QString &program) #endif // Start the Application, detached from the Launcher +#if QT_VERSION_MAJOR >= 5 && QT_VERSION_MINOR >= 10 // QT_VERSION >= 0x051000 return process.startDetached(); +#else + return process.startDetached(program, QStringList() << "-i"); +#endif } static bool sendCommandToProcess(const QString &program, const QString &arguments)