Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
setvisible committed Dec 4, 2019
2 parents 0d806d8 + 8539c5e commit 3fb447c
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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\*
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.1
32 changes: 32 additions & 0 deletions web-extension/extension/substitute.py
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions web-extension/extension/synchronize_versions.bat
Original file line number Diff line number Diff line change
@@ -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 <root>/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.
1 change: 0 additions & 1 deletion web-extension/extension/version

This file was deleted.

2 changes: 1 addition & 1 deletion web-extension/launcher/launcher-manifest-chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/" ]
}
12 changes: 12 additions & 0 deletions web-extension/launcher/launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3fb447c

Please sign in to comment.