forked from dz0ny/chrome-transmission-remote
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Janez Troha
committed
Dec 14, 2010
1 parent
9d1c675
commit a44d0f6
Showing
39 changed files
with
3,014 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Useful if you run Transmission Bittorrent Client on a remote server (LAN or across the Internet). | ||
|
||
Features | ||
* Click a torrent link to download it using a remote Transmission client | ||
- click on most torrent links to automatically send it to Transmission | ||
- right-click any link to send to Transmission | ||
- custom download directories | ||
- browser icon notification badges: add, dup, fail | ||
- hold down ALT, CTRL, or SHIFT to download the torrent file locally | ||
|
||
* Remote Control | ||
- notifications when a torrent download completes | ||
- filter by name and status | ||
- pause and resume torrents | ||
- remove torrents (double-click) with data (CTRL + double-click) | ||
- toggle turtle mode | ||
|
||
version 0.9.8 | ||
- improved compatibility with more torrent sites | ||
|
||
version 0.9.7 | ||
- added global torrent stats to the popup | ||
- more fixes to the download location popup | ||
|
||
version 0.9.6 | ||
- fixed bug with new torrents being added to the bottom of the list | ||
|
||
version 0.9.5 | ||
- slight updates to make the download location popup more consistent | ||
- fixed the download location popup always showing on some sites | ||
- code optimizations to the popup list | ||
- code optimizations to the options page | ||
|
||
version 0.9.4 | ||
- fixed minor rare graphical issue with some installations of linux | ||
- cleaned up css for popup | ||
|
||
version 0.9.3 | ||
- notifications will no longer show up for seeding torrents | ||
- you can now edit the label and directory of custom download directories | ||
|
||
version 0.9.2 | ||
- small fix with enabling and disabling notifications | ||
|
||
version 0.9.1 | ||
- notifications now disappear after 30 seconds | ||
|
||
version 0.9.0 | ||
- added right-click menu item to send any link to transmission | ||
- added notifications when torrents finish | ||
- added a keep-alive function | ||
- setting the path in the url string to blank will now work correctly | ||
- fixed issue when having multiple torrents verifying data | ||
- verifying local data now graphically shows progress | ||
- fixed completed date glitch when verifying re-added torrents | ||
- improved compatibility with more torrent sites | ||
- a lot of changes under the hood in anticipation for future chrome api's | ||
- more changes to make the download popup look more uniform across sites | ||
- code optimizations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAKnPVENgzdtE2YQZt | ||
0RbB+gc0eVTaMmrHVEVMkgPQyj5USaX3m8/eSVhXLoNMSV/EIJzdRLoFxnZjBAv7R | ||
rf6ayt6ZXFppGua2snPfGx9jLpuWQKvXwq2HzzY9QhmsE0TyXAr1307rsdprkF+2v | ||
bMmjzXKJLzijzj/IolI0u/B7rAgMBAAECgYEAiDjYYgzgV0xOKlju2hkkqKGmCA/3 | ||
egCZThhw87m6qL4Iyar/N8N1jfUjC+XVTT03o0631mj1Tzlj0QCBdxO1QhB2HkUCN | ||
6ivu54bw2nWS5eXXZsR2zfERHmvhV/3/0diEKCiay+3ViqzmMg3vWb8zGw1V6Io1O | ||
BcGdhGUv2BdEECQQDbXN7ZkKCOv9xfynMYydtBMvXZzMxfZ51dbnF3OBstwg/OLOq | ||
b+A4tj8VmYmOwYEHIk4pLGGLkfJ6ahFlOHslbAkEAxivDPvCXRT6tl82M2RHnnZp5 | ||
+4k4ykjWKzGVqN6CJsKSA6x5Rxcxh4lfpT5galhdQC63pqUMH2mFsAzlJGZlsQJBA | ||
NdknpFk+LKSY7JPWKqrcjXX8x3UgYzgcd2PF6znk5BfsCNTaV6SuGE2fa8lxxsluR | ||
JZBP7tyBTw5M92SzZw9mcCQQCHenusl8aS7Fq5ISldbUQvFuC1+gX9JPZl6SwrmpL | ||
X9MTmBg+TbmPKCTx+N7qqeWam7klXgBZdk0J2LRqqW+bBAkB4kyCYgWccJv6gYVuy | ||
at19i+6sEQDEEmi5gj/NyqhC62UiiQBZASS3Us7rXidLU7XkglJCd7OUjjXrWXkQB | ||
FH/ | ||
-----END PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<!DOCTYPE html> | ||
<script type="text/javascript" src="js/torentAdder.js"></script> | ||
<script type="text/javascript"> | ||
// global variables | ||
var completedTorrents = '', | ||
// string of completed torrents to prevent duplicate notifications | ||
notificationTimer; // holds the timeout so that it can be cancelled and stopped | ||
// send context-menu link to inject.js | ||
|
||
function sendLink(info, tab) { | ||
chrome.tabs.sendRequest(tab.id, { | ||
url: info.linkUrl | ||
}); | ||
} | ||
|
||
// context menu for forcably sending a link to transmission | ||
chrome.contextMenus.create({ | ||
'title': 'Send link to Transmission', | ||
'contexts': ['link'], | ||
'onclick': sendLink | ||
}); | ||
|
||
// format the torrent download link into a valid torrent link | ||
|
||
function formatLink(url) { | ||
if ((/kickasstorrents\.com\/torrents/i).test(url)) { | ||
url = url.replace(/\/$/i, '.torrent'); | ||
} | ||
|
||
return url; | ||
} | ||
|
||
// send request to the remote Transmission client | ||
|
||
function rpcTransmission(args, method, tag, port) { | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('POST', localStorage.server + '/rpc', true, localStorage.user, localStorage.pass); | ||
xhr.setRequestHeader('X-Transmission-Session-Id', localStorage.sessionId); | ||
if (method === 'torrent-add' && window.navigator.appVersion.indexOf("Chrome\/9.0") > 1) { | ||
downloadTorrent(JSON.parse("{" + args + "}").filename); | ||
} else { | ||
if (typeof tag === 'undefined') { | ||
xhr.send('{ "arguments": { ' + args + ' }, "method": "' + method + '" }'); | ||
} else { | ||
xhr.send('{ "arguments": { ' + args + ' }, "method": "' + method + '", "tag": ' + tag + ' }'); | ||
} | ||
} | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState === 4) { | ||
if (xhr.getResponseHeader('X-Transmission-Session-Id')) { // re-request with the correct session id | ||
localStorage.sessionId = xhr.getResponseHeader('X-Transmission-Session-Id'); | ||
return rpcTransmission(args, method, tag, port); | ||
} | ||
|
||
var responseJSON = JSON.parse(xhr.responseText); | ||
|
||
if (tag === 10) { // create a notification when a torrent finishes | ||
var notification; | ||
|
||
for (var i = 0, torrent; torrent = responseJSON.arguments.torrents[i]; ++i) { | ||
if (torrent.status === 16 && torrent.leftUntilDone === 0 && completedTorrents.indexOf(torrent.id) < 0) { | ||
notification = webkitNotifications.createNotification('images/icon48.png', 'Torrent Download Complete', torrent.name + ' has finished downloading.'); | ||
notification.show(); | ||
|
||
// hide the notification after 30 seconds | ||
setTimeout(function() { | ||
notification.cancel(); | ||
}, '30000'); | ||
|
||
// mark the completed torrent so another notification isn't displayed for it | ||
completedTorrents += torrent.id + ','; | ||
} | ||
} | ||
} else if (typeof port !== 'undefined') { | ||
port.postMessage({ | ||
args: responseJSON.arguments, | ||
tag: responseJSON.tag | ||
}); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
// receive messages from the popup and injected scripts | ||
chrome.extension.onConnect.addListener(function(port) { | ||
switch (port.name) { | ||
case 'popup': | ||
port.onMessage.addListener(function(msg) { | ||
switch (msg.method) { | ||
case 'torrent-get': | ||
case 'session-get': | ||
rpcTransmission(msg.args, msg.method, msg.tag, port); | ||
break; | ||
default: | ||
rpcTransmission(msg.args, msg.method); | ||
} | ||
}); | ||
break; | ||
case 'inject': | ||
port.onMessage.addListener(function(msg) { | ||
var dirs = JSON.parse(localStorage.dirs); | ||
|
||
// check if custom download location is enabled | ||
if (localStorage.dLocation === 'dlcustom' && dirs.length > 0) { | ||
if (typeof msg.dir === 'undefined') { // need a download location | ||
port.postMessage({ | ||
url: msg.url, | ||
dirs: dirs, | ||
method: 'customdl' | ||
}); | ||
} else { | ||
rpcTransmission('"filename": "' + formatLink(msg.url) + '", "download-dir": "' + msg.dir + '"', msg.method); | ||
} | ||
} else { | ||
rpcTransmission('"filename": "' + formatLink(msg.url) + '"', msg.method); | ||
} | ||
}); | ||
break; | ||
case 'options': | ||
port.onMessage.addListener(function(msg) { | ||
// stop the notification timer | ||
clearTimeout(notificationTimer); | ||
|
||
// start it up again if it's enabled | ||
if (msg.notifications) notificationRefresh(); | ||
}); | ||
break; | ||
} | ||
}); | ||
|
||
// show notifications when a torrent completes (30s timer) | ||
|
||
function notificationRefresh() { | ||
rpcTransmission('"fields": [ "id", "name", "status", "leftUntilDone" ], "ids": "recently-active"', 'torrent-get', 10); | ||
|
||
notificationTimer = setTimeout(notificationRefresh, 30000); | ||
} | ||
|
||
// only display notifications and keep-alive if it's enabled | ||
if (localStorage.notifications === 'true') { | ||
notificationRefresh(); | ||
} | ||
|
||
// first time users and new upgraders | ||
if (typeof localStorage.verConfig === 'undefined' || localStorage.verConfig < 2) chrome.tabs.create({ | ||
url: 'options.html' | ||
}); | ||
|
||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!DOCTYPE html> | ||
<html><head><title>Drop torrent file here</title><link rel="stylesheet" type="text/css" href="css/basket.css"> | ||
</head><body><div id="dropbox" title="Drop torrent files here"></div> | ||
<script type="text/javascript" src="js/torentAdder.js"></script> | ||
<script type="text/javascript" src="js/basket.js"></script> | ||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html><head><title>Confirm adding torrent</title><link rel="stylesheet" type="text/css" href="css/confirm.css"> | ||
</head><body> | ||
<script type="text/javascript" src="js/ejs.js"></script> | ||
<script type="text/javascript" src="js/torentAdder.js"></script> | ||
<script type="text/javascript" src="js/confirm.js"></script> | ||
<ul id="content"></ul> | ||
<div id="footer"> | ||
<div id="cancel">Cancel</div><div id="confirm">Confirm</div> | ||
</div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#dropbox{ | ||
background: url(../images/icon128.png) no-repeat 0 0; | ||
width: 128px; | ||
height: 128px; | ||
-webkit-background-size: 100%; | ||
} | ||
#dropbox:hover{ | ||
opacity: .8; | ||
} | ||
*{ | ||
overflow: none; | ||
|
||
} | ||
HTML, BODY | ||
{ | ||
margin: 0; | ||
padding: 0; | ||
-webkit-user-select: none; | ||
background: #F8FCFE; | ||
width: 100%; | ||
height: 100%; | ||
overflow: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
HTML, BODY | ||
{ | ||
margin: 0; | ||
padding: 0; | ||
-webkit-user-select: none; | ||
background: #F8FCFE; | ||
width: 100%; | ||
height: 100%; | ||
overflow: none; | ||
} | ||
#centerv | ||
{ | ||
display: -webkit-box; | ||
-webkit-box-align: center; | ||
-webkit-box-orient: vertical; | ||
-webkit-box-flex: 1; | ||
} | ||
#centerh | ||
{ | ||
display: -webkit-box; | ||
-webkit-box-align: center; | ||
-webkit-box-orient: horizontal; | ||
-webkit-box-flex: 1; | ||
} | ||
#footer | ||
{ | ||
position: fixed; | ||
bottom: 0px; | ||
height: 40px; | ||
width: 100%; | ||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA7CAIAAAA1lncVAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAGNJREFUeNpcTbsOgDAIhEtM//+nXFzcTYxfoU6chRKrHcgB98K2HzivGyQhIjGkI3P//vnj33vQOt93RwXNIFp9lTNa+wU2Tc/UxNYpzmWXhifv7B3zXeP5oU2+TAXrMj8CDAA+VFkbUEmEBAAAAABJRU5ErkJggg==); | ||
} |
Oops, something went wrong.