Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit 123692e

Browse files
authored
Merge pull request #14 from slgobinath/uget-chrome-wrapper-2
Uget chrome wrapper 2
2 parents f0b2922 + 72799c5 commit 123692e

15 files changed

+142
-76
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Please test uget-chrome-wrapper on your system and report any issues [here](http
3131
Please test uget-chrome-wrapper and create installers for your operating system
3232

3333
## History
34+
Version 2.0.0 (Under developer testing):
35+
* Migrate to Python 3
36+
* Show uget-chrome-wrapper status in the extension
37+
* Submitted native Opera addon
38+
3439
Version 1.3.3:
3540
* Ctrl + Shift + U to disable uGet Integration extension temporarily
3641
* Option to exclude URLs

build/windows/uget-chrome-wrapper.nsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; uget-chrome-wrapper is a tool to integrate uGet Download manager
2-
; with Google Chrome in Linux systems.
2+
; with Google Chrome, Chromium, Vivaldi and Opera in Linux and Windows.
33

44
; Copyright (C) 2016 Gobinath
55

@@ -148,7 +148,7 @@ Section "uget-chrome-wrapper (required)"
148148

149149
; Update the json file
150150
FileOpen $9 $INSTDIR\com.javahelps.ugetchromewrapper.json w ;Opens a Empty File an fills it
151-
FileWrite $9 '{"name":"com.javahelps.ugetchromewrapper","description":"Integrate uGet with Google Chrome","path":"$0\\uget-chrome-wrapper.py","type":"stdio","allowed_origins":["chrome-extension://efjgjleilhflffpbnkaofpmdnajdpepi/"]}$\r$\n'
151+
FileWrite $9 '{"name":"com.javahelps.ugetchromewrapper","description":"Integrate uGet with Google Chrome","path":"$0\\uget-chrome-wrapper.py","type":"stdio","allowed_origins":["chrome-extension://efjgjleilhflffpbnkaofpmdnajdpepi/","chrome-extension://akcbnhoidebjpiefdkmaaicfgdpbnoac/"]}$\r$\n'
152152
FileClose $9 ;Closes the filled file
153153

154154

chrome-extension/background.js renamed to extension/background.js

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
/*
2-
* uget-chrome-wrapper is an extension to integrate uGet Download manager
3-
* with Google Chrome, Chromium and Vivaldi in Linux and Windows.
4-
*
5-
* Copyright (C) 2016 Gobinath
6-
*
7-
* This program is free software: you can redistribute it and/or modify
8-
* it under the terms of the GNU General Public License as published by
9-
* the Free Software Foundation, either version 3 of the License, or
10-
* (at your option) any later version.
11-
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
16-
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19-
*/
2+
* uget-chrome-wrapper is an extension to integrate uGet Download manager
3+
* with Google Chrome, Chromium, Vivaldi and Opera in Linux and Windows.
4+
*
5+
* Copyright (C) 2016 Gobinath
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
2020

2121
var interruptDownloads = true;
2222
var ugetWrapperNotFound = true;
2323
var interruptDownload = false;
2424
var disposition = '';
2525
var hostName = 'com.javahelps.ugetchromewrapper';
26+
var ugetChromeWrapperVersion;
27+
var ugetVersion;
2628
var chromeVersion;
2729
var filter = [];
2830
var keywords = [];
@@ -46,12 +48,14 @@ try {
4648
chromeVersion = 33;
4749
}
4850
chromeVersion = parseInt(chromeVersion);
49-
sendMessageToHost({ version: "1.1.6" });
51+
sendMessageToHost({
52+
version: "2.0.0"
53+
});
5054

5155
if (localStorage["uget-keywords"]) {
5256
keywords = localStorage["uget-keywords"].split(/[\s,]+/);
5357
} else {
54-
localStorage["uget-keywords"] = '';
58+
localStorage["uget-keywords"] = '';
5559
}
5660

5761

@@ -61,7 +65,6 @@ if (!localStorage["uget-interrupt"]) {
6165
var interrupt = (localStorage["uget-interrupt"] == "true");
6266
setInterruptDownload(interrupt);
6367
}
64-
console.log(localStorage["uget-interrupt"]);
6568
// Message format to send the download information to the uget-chrome-wrapper
6669
var message = {
6770
url: '',
@@ -76,10 +79,10 @@ var message = {
7679
// Listen to the key press
7780
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
7881
var msg = request.message;
79-
if(msg === 'enable') {
82+
if (msg === 'enable') {
8083
// Temporarily enable
8184
setInterruptDownload(true);
82-
} else if(msg == 'disable') {
85+
} else if (msg == 'disable') {
8386
// Temporarily disable
8487
setInterruptDownload(false);
8588
} else {
@@ -92,9 +95,23 @@ chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
9295
function sendMessageToHost(message) {
9396
chrome.runtime.sendNativeMessage(hostName, message, function(response) {
9497
ugetWrapperNotFound = (response == null);
98+
if (!ugetWrapperNotFound && !ugetChromeWrapperVersion) {
99+
ugetChromeWrapperVersion = response.version;
100+
ugetVersion = response.uget;
101+
}
95102
});
96103
}
97104

105+
function getInfo() {
106+
if (ugetWrapperNotFound || !ugetChromeWrapperVersion) {
107+
return "<font color='red'>Error: Unable to connect to the uget-chrome-wrapper</font>";
108+
} else if (!ugetChromeWrapperVersion.startsWith("2.")) {
109+
return "<font color='orange'>Warning: Please update the uget-chrome-wrapper to the latest version</font>";
110+
} else {
111+
return "<font color='green'>Info: Found uGet: " + ugetVersion + " and uget-chrome-wrapper: " + ugetChromeWrapperVersion + "</font>";
112+
}
113+
}
114+
98115
function clearMessage() {
99116
message.url = '';
100117
message.cookies = '';
@@ -159,7 +176,9 @@ chrome.downloads.onCreated.addListener(function(downloadItem) {
159176
}
160177

161178
chrome.downloads.cancel(downloadItem.id); // Cancel the download
162-
chrome.downloads.erase({ id: downloadItem.id }); // Erase the download from list
179+
chrome.downloads.erase({
180+
id: downloadItem.id
181+
}); // Erase the download from list
163182

164183
clearMessage();
165184
message.url = url;
@@ -297,7 +316,9 @@ chrome.webRequest.onHeadersReceived.addListener(function(details) {
297316
message.postdata = '';
298317
var scheme = /^https/.test(details.url) ? 'https' : 'http';
299318
if (chromeVersion >= 35) {
300-
return { redirectUrl: "javascript:" };
319+
return {
320+
redirectUrl: "javascript:"
321+
};
301322
} else if (details.frameId === 0) {
302323
chrome.tabs.update(details.tabId, {
303324
url: "javascript:"
@@ -360,11 +381,15 @@ function isBlackListed(url) {
360381
function setInterruptDownload(interrupt, writeToStorage) {
361382
interruptDownloads = interrupt;
362383
if (interrupt) {
363-
chrome.browserAction.setIcon({ path: "./icon_32.png" });
384+
chrome.browserAction.setIcon({
385+
path: "./icon_32.png"
386+
});
364387
} else {
365-
chrome.browserAction.setIcon({ path: "./icon_disabled_32.png" });
388+
chrome.browserAction.setIcon({
389+
path: "./icon_disabled_32.png"
390+
});
366391
}
367-
if(writeToStorage) {
392+
if (writeToStorage) {
368393
localStorage["uget-interrupt"] = interrupt.toString();
369394
}
370395
}

chrome-extension/content.js renamed to extension/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* uget-chrome-wrapper is an extension to integrate uGet Download manager
3-
* with Google Chrome, Chromium and Vivaldi in Linux and Windows.
3+
* with Google Chrome, Chromium, Vivaldi and Opera in Linux and Windows.
44
*
55
* Copyright (C) 2016 Gobinath
66
*
File renamed without changes.
File renamed without changes.
File renamed without changes.

extension/icon_64.png

4.1 KB
Loading

chrome-extension/manifest.json renamed to extension/manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
"run_at": "document_start"
2222
}
2323
],
24-
"description": "uGet Browser Integration extension replaces default download manager of Google Chrome by uGet Download Manager.",
24+
"description": "uGet Browser Integration extension replaces default download manager by uGet Download Manager.",
2525
"homepage_url": "https://slgobinath.github.io/uget-chrome-wrapper",
2626
"icons": {
2727
"32": "icon_32.png",
2828
"48": "icon_48.png",
29+
"64": "icon_64.png",
2930
"128": "icon_128.png"
3031
},
3132
"manifest_version": 2,
@@ -42,5 +43,5 @@
4243
"downloads",
4344
"storage"
4445
],
45-
"version": "1.1.6"
46+
"version": "2.0.0"
4647
}

0 commit comments

Comments
 (0)