Comments (6)
Hm, interesting, thanks for the links.
It looks like it only supports the magnet
protocol (due to limitations in registerProtocolHandler
and protocol_handlers
), not .torrent
files served over HTTP(S). It does it by rewriting magnet links to use the nonce transmitter.web-extension
host and then registering an onBeforeRequest
handler scoped down to just that nonce host. onBeforeRequest
is also capable of intercepting every request, but the clever protocol_handlers
trick prevents it from needing to do so.
More details on this workaround available at StackOverflow. The complete list of legal protocol_handlers
might also be useful. The tracking bug on Bugzilla has a lot of detail, but seems to be focused on improving the existing implementation rather than adding support for extensions to directly intercept certain requests or register themselves with the download window.
from nas-download-manager.
Hey there, glad you like the extension! The new restrictions placed on extensions in Firefox 57+ have dropped a number of features, and based on my searching the documentation, this one appears to be included. I agree, it's quite inconvenient -- the only advice I can give you when sites do this is to accept the download, then open the Downloads view in Firefox, right-click the download and Copy Download Link, at which point you can paste it into the extension (after clicking the +
button).
This is a feature I would like to have, so I'm going to leave this issue open indefinitely in case Mozilla introduces a way for me to implement it.
from nas-download-manager.
Hello seansfkelley!
I am really glad I found your addon as you seem to be the only active developer for a Synology addon.
During my research on this topic I stumbled upon an approach to integrate an external download manager (https://addons.mozilla.org/en-US/firefox/addon/ugetintegration/) by passing the download URL to a program.
Would it be possible to adapt this in conjunction with something like SynoGet, which passes a download URL to the Synology DLM? You can get SynoGet and the source here: http://www.synology-forum.de/showthread.html?3616-SynoGet-Download-via-Kommandozeile-hinzuf%C3%BCgen/page4 (post by BjoernWeber at 16.05.2010 08:39)
Personally I would use this to redirect certain file types to the NAS. But being able to redirect just every download to the NAS with an on/off switch would be really great already.
Thanks!
from nas-download-manager.
Hm, interesting, it looks like uGet Integration uses a pair of rather invasive APIs to get the job done, but between them most use-cases are probably covered:
downloads.onCreated
(used here) which appears to fire when the user okays the download dialog and the download begins (which is too late for good UX, I think).webRequest.onHeadersReceived
(used here) which intercepts every (!) request and checks if it's suitable for downloading, then fires off a request to do so and cancels the original. This would probably work for Synology Download Manager, but it's pretty invasive, has the potential to slow everything down and it'd be a good chunk of work to implement. It would prevent the download dialog from ever appearing though, so it ought to be more transparent and should work for magnet links as well. (EDIT: The docs say thatcancel
cannot be set in this handler -- so will this even provide nice UX or will we end up with doubled downloads?)
from nas-download-manager.
The following extension does this without being invasive to all requests:
https://addons.mozilla.org/en-US/firefox/addon/transmitter-for-transmission/
codebase:
more specifically:
from nas-download-manager.
I'm working on a similar extension but for aria2c.
For the download API I use the following code to get the *.torrent file when it was downloaded and send its content to the aria2c rpc service.
function handleChanged(delta) {
const { endTime, state, id } = delta;
if (!endTime || !state) {
return;
}
if (state.current === 'complete') {
console.log(`Download ${delta.id} has completed.`);
// workaround: search by id not works well in incognito
chrome.downloads.search({ orderBy: ['-startTime'] }, (items) => {
const [target] = items.filter((itm) => itm.endTime === endTime.current && itm.id === id);
const {
filename,
mime,
} = target;
if (!mime.includes('application/x-bittorrent')
&& !filename.endsWith('.torrent')) {
// not torrent file
return;
}
const url = `file://${filename}`;
const xhr = new XMLHttpRequest();
// Load the data directly as a Blob.
xhr.responseType = 'blob';
xhr.onload = () => {
const reader = new FileReader();
reader.readAsDataURL(xhr.response);
reader.onloadend = () => {
const base64data = reader.result;
jrpc.call('aria2.addTorrent', [
ARIA2_TOKEN,
base64data.replace(/.*:.*;base64,(.*)/, (p1, p2) => p2),
]).then((res) => {
// success, remove the torrent file
chrome.downloads.removeFile(id);
}).catch((err) => {
console.log(err);
});
};
};
xhr.open('GET', url);
xhr.send();
});
}
}
chrome.downloads.onChanged.addListener(handleChanged);
from nas-download-manager.
Related Issues (20)
- getURL is deprecated
- Cannot connect using Firefox.
- URL link, right click advanced context menu, save to folder option HOT 1
- miscellaneous maintenance list
- Not support 2 factor authentication. HOT 1
- ability to create a new folder in NAS directory prior to initiating download HOT 1
- add link to login error message directing users to the FAQ if certs are the likely culprit
- Die angeforderte API existiert nicht.
- It can't login to NAS anymore HOT 2
- Support http authentication
- Loggin issue on DSM 7 HOT 2
- "URL(s) to download" auto-focus
- Announcement: Maintenance Mode 🔧
- cannoct login using quickconnect, only local IP address HOT 1
- Connection failed for an unknown reason DSM7 HOT 2
- Decryption of DLC files
- IPv6 HOT 3
- DevTools console failed to load source map: Could not load content for chrome-extension://iaijio... System error: net::ERR_BLOCKED_BY_CLIENT HOT 2
- error when restarting browser HOT 3
- Magnet association with NAS Download Manager HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nas-download-manager.