-
Notifications
You must be signed in to change notification settings - Fork 6
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
Rémi Rigal
committed
Jun 18, 2020
0 parents
commit ed3211d
Showing
16 changed files
with
455 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,3 @@ | ||
.idea/ | ||
|
||
*.zip |
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,21 @@ | ||
# PyLoad Assistant - Chrome Extension | ||
|
||
This is a Chrome extension to monitor and easily add downloads to a [PyLoad](https://github.com/pyload/pyload) server. | ||
|
||
|
||
## Usage | ||
|
||
First makes sure that the IP address and the port of the `PyLoad` server are correctly set in the option page, as well as the user credentials. | ||
These data will only be stored locally using the Chrome storage feature. | ||
|
||
The current downloads are available from anywhere. | ||
If the current active tab has a downloadable file, an extra panel will be displayed with a button to start the download. | ||
|
||
|
||
## Screenshots | ||
|
||
![Screenshot1](images/screenshot-1.png) | ||
|
||
![Screenshot2](images/screenshot-2.png) | ||
|
||
![Screenshot3](images/screenshot-3.png) |
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 @@ | ||
chrome.runtime.onInstalled.addListener(function() { | ||
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { | ||
chrome.declarativeContent.onPageChanged.addRules([{ | ||
conditions: [new chrome.declarativeContent.PageStateMatcher({ | ||
pageUrl: {schemes: ['http', 'https']}, | ||
})], | ||
actions: [new chrome.declarativeContent.ShowPageAction()] | ||
}]); | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
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,17 @@ | ||
html { | ||
min-width: 500px; | ||
min-height: 160px; | ||
} | ||
|
||
body { | ||
min-width: 500px; | ||
min-height: 160px; | ||
max-width: 500px; | ||
padding: 12px 16px; | ||
} | ||
|
||
.ellipsis { | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,28 @@ | ||
{ | ||
"name": "PyLoad Assistant", | ||
"version": "0.0.1", | ||
"description": "Extension for PyLoad to easily monitor and add downloads", | ||
"permissions": ["activeTab", "declarativeContent", "storage"], | ||
"optional_permissions": ["http://*/", "https://*/"], | ||
"background": { | ||
"scripts": ["background.js"], | ||
"persistent": false | ||
}, | ||
"page_action": { | ||
"default_popup": "popup.html", | ||
"default_icon": { | ||
"16": "images/icon.png", | ||
"32": "images/icon.png", | ||
"48": "images/icon.png", | ||
"128": "images/icon.png" | ||
} | ||
}, | ||
"icons": { | ||
"16": "images/icon.png", | ||
"32": "images/icon.png", | ||
"48": "images/icon.png", | ||
"128": "images/icon.png" | ||
}, | ||
"options_page": "options.html", | ||
"manifest_version": 2 | ||
} |
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,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> | ||
</head> | ||
<body> | ||
<div class="text-center h1 m-4"> | ||
PyLoad Assistant Options | ||
</div> | ||
<div class="d-flex justify-content-center m-5"> | ||
<form> | ||
<div class="form-group"> | ||
<label for="serverIp">PyLoad server's IP address</label> | ||
<input type="text" class="form-control" id="serverIp"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="serverPort">PyLoad server's port</label> | ||
<input type="number" class="form-control" id="serverPort"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="username">Username</label> | ||
<input type="text" class="form-control" id="username"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="password">Password</label> | ||
<input type="password" class="form-control" id="password"> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="d-flex justify-content-center"> | ||
<div class="m-2"> | ||
<button id="save" class="btn btn-primary">Save</button> | ||
</div> | ||
</div> | ||
<div class="d-flex justify-content-center"> | ||
<div id="saved" class="alert alert-success m-2" hidden>Saved</div> | ||
</div> | ||
</body> | ||
|
||
<script type="text/javascript" src="js/jquery-3.5.1.min.js"></script> | ||
<script type="text/javascript" src="js/bootstrap.min.js"></script> | ||
<script src="options.js"></script> | ||
</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,52 @@ | ||
let usernameInput = document.getElementById('username'); | ||
let passwordInput = document.getElementById('password'); | ||
let serverIpInput = document.getElementById('serverIp'); | ||
let serverPortInput = document.getElementById('serverPort'); | ||
|
||
let saveButton = document.getElementById('save'); | ||
let savedLabel = document.getElementById('saved'); | ||
|
||
|
||
function setSaved() { | ||
savedLabel.hidden = false; | ||
setTimeout(function() { | ||
savedLabel.hidden = true; | ||
}, 3000); | ||
} | ||
|
||
|
||
saveButton.onclick = function(ev) { | ||
chrome.storage.sync.set({ | ||
username: usernameInput.value, | ||
password: passwordInput.value, | ||
serverIp: serverIpInput.value, | ||
serverPort: serverPortInput.value | ||
}, function () { | ||
chrome.permissions.contains({ | ||
origins: [`http://${serverIpInput.value}:${serverPortInput.value}/`] | ||
}, function(result) { | ||
console.log(result); | ||
if (result) { | ||
setSaved(); | ||
} else { | ||
chrome.permissions.request({ | ||
origins: [`http://${serverIpInput.value}:${serverPortInput.value}/`] | ||
}, function(granted) { | ||
console.log(result); | ||
if (granted) { | ||
setSaved(); | ||
} else { | ||
alert('Not granting this permission will make the extension unusable.') | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
chrome.storage.sync.get(['username', 'password', 'serverIp', 'serverPort'], function(data) { | ||
usernameInput.value = data.username || ''; | ||
passwordInput.value = data.password || ''; | ||
serverIpInput.value = data.serverIp || '172.0.0.1'; | ||
serverPortInput.value = data.serverPort || 8001; | ||
}); |
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,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> | ||
<link rel="stylesheet" type="text/css" href="css/styles.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
</head> | ||
|
||
<body> | ||
<div class="d-flex align-items-center" style="margin-bottom: 8px"> | ||
<div class="font-weight-bold">Current Downloads</div> | ||
<div class="ml-auto"> | ||
<button id="optionsButton" class="btn"> | ||
<i class="fa fa-gear small"></i> | ||
</button> | ||
</div> | ||
</div> | ||
<div id="status"> | ||
<div class="d-flex justify-content-center"> | ||
<div class="spinner-border text-primary m-3"></div> | ||
</div> | ||
</div> | ||
|
||
<div id="pageDownloadDiv" hidden> | ||
<div class="dropdown-divider" style="margin: 20px 0 12px;"></div> | ||
|
||
<label class="font-weight-bold">Page Download</label> | ||
<div id="downloadDiv" class="text-center m-2" hidden> | ||
<div id="downloadLabel"></div> | ||
<button type="button" class="btn btn-primary" id="download" style="margin-top: 12px">Start Download</button> | ||
</div> | ||
</div> | ||
|
||
<div class="text-center m-3"> | ||
<div class="alert alert-danger" id="error" hidden></div> | ||
<div class="alert alert-success" id="success" hidden></div> | ||
</div> | ||
|
||
</body> | ||
|
||
<script type="text/javascript" src="js/jquery-3.5.1.min.js"></script> | ||
<script type="text/javascript" src="js/bootstrap.min.js"></script> | ||
<script src="popup.js"></script> | ||
</html> |
Oops, something went wrong.