Giter VIP home page Giter VIP logo

nas-download-manager's Introduction

NAS Download Manager

An open source browser extension for adding/managing download tasks to your Synology DiskStation.

Donate

๐Ÿ”ง Maintenance Mode ๐Ÿ”ง

NAS Download Manager is in maintenance mode. See the announcement for details.

Having an Issue?

If you're here because of an issue with the extension, please check the FAQ first. If you can't find an answer there, feel free to open an issue!

About

NAS Download Manager allows you to add and manage your download tasks on your Synology DiskStation right from your browser. It requires a Synology NAS with DSM version 4 or higher.

Please note that NAS Download Manager is not an official Synology offering.

Features

  • Right-click and download many types of media (<video> and <audio> tags) and files (e.g. .torrent files).
  • Clear all completed tasks with one click.
  • Choose destination folder for new download tasks.
  • View, filter and sort all the current download tasks in the extension popup.
  • Add/pause/resume/remove download tasks in the extension popup.
  • System notifications for completed download tasks.
  • Open some types of links (e.g. magnet:) in the extension rather than a desktop application.

Officially Supported Browsers

Browsers Reported to Work

These browsers are not officially supported and the extension is untested with them, but there are ways to install it.

Unsupported Browsers

There are currently no plans to support the following browsers.

  • Safari

Privacy

NAS Download Manager needs your login credentials to communicate with your NAS. It doesn't collect, store or transmit any other information. Read more.

Development

Please note that development is not actively supported on Windows. Some of the below commands may fail and require manually invoking an analogous Windows command instead.

Prerequisites

Dependencies are managed with Yarn. Install it if you don't already have it.

Actively Developing the Extension

These instructions describe how to build and automatically re-build the assets for the extension for quick iteration during active development. For building, optimizing and packaging the extension for distribution, see the next section.

Please note that while the build tasks will auto-recompile, the browser may not pick up changes automatically. In particular, changes to code running in the extension's background generally requires you to explicitly refresh the extension (for which there is usually a button in the debugging interface). Changes to language support may require you to remove the development extension entirely and re-add it.

  1. Install dependencies.

    yarn
    
  2. Start a build to watch files and auto-recompile code on change.

    yarn watch
    
  3. In your browser, navigate to the extension debugging page and open manifest.json.

    Firefox: about:debugging > This Firefox > Load Temporary Add-on...

    Chrome: about:extensions > Enable "Developer mode" > Load unpacked

Packing the Extension for Distribution

  1. Install dependencies.

    yarn
    
  2. Build and optimize all assets.

    yarn build
    
  3. Zip all assets into a file suitable for distribution.

    yarn zip
    
  4. (Optional) Zip all source code into a file suitable for distribution.

    yarn zip-sources
    

Translating the Extension

I need help localizing NAS Download Manager! Read in detail about how to localize WebExtensions, or skip to the sections below for short summaries.

Adding a New Language

In order to add the new language, base your translation file off the English messages file.

  1. Copy _locales/en/messages.json into a new file at _locales/<your language code>/messages.json.
  2. Edit the message field in each item with your translation.
  3. In src/common/moment.ts, add a new import line like import "moment/locale/<your language code>";.
  4. Load (or reload) the extension to test it out. You may need to remove the extension entirely and then re-add it for changes to be reflected.
  5. Open a pull request!

There are automated checks to ensure that you're only defining translated strings that the extension actually uses.

Editing an Existing Language

If you're adding more strings for an incomplete translation, you can use ./scripts/diff-messages <your language code> to get a list of all the entries you need to add to the messages.json in a format that is easily copy-pasted:

$ ./scripts/diff-messages ru
"Badge_shows": {
  "message": "Badge shows",
  "description": "Prefix text for badge-display-type dropdown."
},

nas-download-manager's People

Contributors

bizoo avatar boin avatar damienmathe avatar dependabot[bot] avatar jiashiunl avatar kachelkaiser avatar seansfkelley avatar vanja-san avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nas-download-manager's Issues

audit all API calls for "no permissions" guard

If you leave the extension logged in but the NAS goes to sleep, it seems to "invalidate" the session in a sense by throwing back "no permissions" errors for many/all requests. Some API calls are wrapped to help prevent this by re-logging-in, but not all.

PathSelector makes API calls that are unguarded by the "no permissions" check.

I'm thinking either:

  • Re-wrap API client in a no-permissions-retry interface (could also bake this right into synology-typescript-api).
  • Push all API calls to apiActions where they can be controlled.
  • Both.

Log in with different cookie than normal browser user?

If you followed the link here from the extension settings page

Summary

If you were sent here by a message in the connection test area of the settings page, it means you're using an older version of DSM. These versions (4.x and possibly also 5.x) had a bug in the login code where they might override your existing browser session logged into DSM, if any, and replace it with the session logged in from the extension.

Steps to Check if You're Affected

You can see if you're affected by this issue using the follow steps:

  1. In your browser settings, allow third-party cookies if you don't already (and be sure to reset this when you're done with these steps!).
  2. Open a new tab, and log into DSM using some user account A and check "remember me".
  3. Open the Synology Download Manager preferences and enter your credentials and the same URL for some user account B.
  4. Click "test connection".
  5. Return to your browser tab from step (2) and refresh it: if you're logged out or your logged-in account has changed to B, you are affected by the issue.

Workarounds

You can work around this issue by doing any of the following:

  • Disallowing third-party cookies in your browser preferences.
  • Using a different URL for the extension and browser sessions (e.g. one of those *.synology.me domains Synology hands out).
  • Using the same account for normal browser sessions as for the extension.
  • Upgrading to DSM 6.

Technical Details

The issue is a bug in DSM where early versions of the login API would always return a Set-Cookie header, even if you didn't ask for it (Synology Download Manager asks for a token that is passed around in Javascript instead, never using cookies, so that you can maintain a separate session in the extension). If third-party cookies are accepted, Firefox will respect the header and override the login cookie on the domain*, thereby replacing your browser session with the one from the extension.

This is a known issue on Synology's end, and their technical support's recommended fix was "use a newer version". Early versions of DSM do not have a version of the login API without this bug, which is why you had a message direct you here. Synology Download Manager will automatically use a newer, fixed version of the login API if it exists.

* Allowing cookies to leak out of extensions without user consent is arguably a bug, though I don't see anything on bugzilla.

Original bug report follows

If the extension is logging into a different user than normally used for your browser DSM sessions, the extension always highjacks the cookie so have to log out of the extension user and back into the normal browser user.

Example:

  • normally log into DSM with user "my-user" and check "remember me" to save the login in a cookie.
  • set extension to log in with user "synology-download-manager"
  • go to DSM, user will be "synology-download-manager", have to log out, and log in to "my-user"

Connection test wording tweaks

If the NAS is asleep when the connection test starts, it will have to wait until it wakes from sleep. Maybe if the test takes more than N seconds the message should update to say as much?

consider making all settings live

This will also mean we don't have to lock all the settings behind a credentials test.

Things to be aware of:

  • The creds should still update as a unit. I'm thinking a pair of buttons, Test Connection and Save Connection Settings next to it. But that's a little clunky and doesn't actually reduce the overhead much from now.
  • We need to notify when changes are auto-saved with a nearby visual indicator.

Support 2-factor (2-step) authentication (2FA)

In version 0.9.x and before, two-factor authentication accidentally worked in some extension/browser/DSM combinations due to the way cookies behave. I was forced to close out that accidental feature when DSM 6.2.4/7.0 made an unannounced breaking change causing the extension to start logging people out of their non-extension login sessions.

As a workaround, since the extension doesn't interact with any DSM session you might have outside the extension (i.e. in a browser tab), you can create a separate user with very few permissions but no second factor for use only with this extension. Alternately, you can downgrade to 0.9.3.


This may interact really poorly with the existing auto-relogin behavior, because sessions sometimes expire at weird times, but we can't store the second factor (by design) to log back in.

As a stop-gap for all the people asking for this, maybe I could introduce a "share login with browser" checkbox which disables the login behavior in the extension and asks people to login with a browser tab, thereby getting 2FA via a side channel again.

Add right click > download advanced...

This would pop up a UI similar to that of the current add button in the popup, but in the current tab (since, AFAICT, you can't programmatically open the popup itself).

popup doesn't open in private browsing mode

The issue is that getBackgroundPage returns null in private browsing mode, so the whole popup just dies.

Fixes include:

  1. Catching this specific case and rendering an error state.
  2. Rewrite the popup to only use sendMessage to talk to the background page (ugh).

Kind of weird that the popup gets caught out by this, since there should only really be one popup per browser instance, private or no...

Bug report

The extension never displayed anything, except for the download count in the icon. However, now it shows this error:
afbeelding

p.s. after submiting this bug report, I saw the interface as intended for the first time :)
That probably means the bug is solved, but I'm still reporting just in case...

Versions

Extension version: 0.4.0

Browser and version: Firefox Developer edition 58.0b4

DSM version: 5.2

Download Station version: 3.5-2985

Steps to Reproduce the Issue

  1. installed extension on relatively fresh Firefox browser
TypeError: 'n.toFixed is not a function'
Error stack trace: renderString@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:32820:23
formatMetric1024@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:32825:20
renderStatus@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:32893:20
render@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:32868:65
finishClassComponent@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:14329:22
updateClassComponent@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:14306:12
beginWork@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:14685:16
performUnitOfWork@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:16653:16
workLoop@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:16762:28
callCallback@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:5379:9
invokeGuardedCallbackDev@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:5418:7
invokeGuardedCallback@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:5275:5
performWork@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:16880:7
scheduleUpdateImpl@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:17265:19
scheduleUpdate@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:17204:12
scheduleTopLevelUpdate@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:17475:5
updateContainer@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:17505:7
renderSubtreeIntoContainer/<@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:21185:7
unbatchedUpdates@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:17336:14
renderSubtreeIntoContainer@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:21184:5
render@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:21209:12
@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:33285:13
fetchStateAndNotify/</<@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:31619:32
fetchStateAndNotify/<@moz-extension://35eac94a-192b-fe44-bac3-3b247322dea5/dist/js/popup.js:31619:9

React stack trace:
    in Task$1 (created by Popup)
    in ul (created by Popup)
    in div (created by Popup)
    in div (created by Popup)
    in div (created by Popup)
    in Popup
    in FatalErrorWrapper

can't log in with DSM 4.2

Versions

Extension version: 0.30 or 0.31, last updated 2017-11-15
Browser and version: Firefox 56.0 (64 bit)
DSM version: 4.2-3256
Download Station version: 3.3-2386

Steps to Reproduce the Issue

It just stop working some days ago,
today i open the settings page and click the "Test Connection" button,
then it shows "The requested version does not support this functionality."

Please bring back support for old DSM in future versions, thank you.

Toolbar Menu not showing

Versions

OS: Xubuntu 16.04

Browser and version: FF57 (was also in 56)

DSM version: DSM 5.2-5967 Update 6 (was also with Update 5)

Download Station version: 3.5-2985

Steps to Reproduce the Issue

  1. I click on the toolbar icon
  2. Instead of the menu, only this shows:

synoextension

It seems to be a very general issue, but since no one reported it so far, I guess I'm doing something wrong...

Error: Broken link with torrent URL's

Hi,

Does anyone have the issue that the plugin doesn't download torrents files?
It gives the error "Broken link", while the " Synology Download Station" plugin in Chrome works fine with the same torrent file?

Thank you.

does not build on Windows 10

while executing npm run build , it fails with the following log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 silly lifecycle [email protected]~prebuild: no script for prebuild, continuing
7 info lifecycle [email protected]~build: [email protected]
8 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build: PATH: {....}
11 silly lifecycle [email protected]~build: Args: [ '/d /s /c',
11 silly lifecycle   '(rm -r lib dist || true) && npm run build:transpile && npm run build:bundle && npm run build:styles' ]
12 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
13 info lifecycle [email protected]~build: Failed to exec build script
14 verbose stack Error: [email protected] build: `(rm -r lib dist || true) && npm run build:transpile && npm run build:bundle && npm run build:styles`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd E:\synology-download-manager
17 error Windows_NT 10.0.16237
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
19 error node v6.10.2
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] build: `(rm -r lib dist || true) && npm run build:transpile && npm run build:bundle && npm run build:styles`
22 error Exit status 1
23 error Failed at the [email protected] build script '(rm -r lib dist || true) && npm run build:transpile && npm run build:bundle && npm run build:styles'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the synology-download-manager package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     (rm -r lib dist || true) && npm run build:transpile && npm run build:bundle && npm run build:styles
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs synology-download-manager
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls synology-download-manager
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Too-short timeout for settings page can be misleading.

If the NAS is asleep, the default 10 second timeout can be too short to allow it to wake and respond to requests. The symptom of this is a "connection failure" caused by a timeout even when the protocol, hostname and port are correct (and trying again works as expected).

Connection test successful, but then error loading tasks

Hi

Edit: I'm having this issue on Firefox Nightly only! Works perfectly in Firefox and Chrome.

Thanks for this new addon which hopefully manages to seal the gap between Firefox and DSM Download Station once and for all ๐Ÿ˜‡

After installing and setting the connection details, the connection test works successfully.

But, when I then click the toolbar button to show the list, I see "Error loading tasks".
Checking in the debug console, I see this:

(poll-1) polling for tasks...  popup.js:64258:5
(poll-1) poll completed with response Object { type: "probable-wrong-url-or-no-connection", error: Error }  popup.js:64269:9

Here the object in the debug console:
error

Does the CSRF token header have something to do with it?

I don't understand why the connection test is successful but then fails to make a request for the entries.

missing zip on windows 10

see log below

E:\synology-download-manager> npm run zip

> [email protected] zip E:\synology-download-manager
> rimraf addon.zip && zip -r addon.zip . -i 'dist/*' -i 'html/*' -i 'icons/*' -i 'vendor/*' -i 'manifest.json' -x '**/*.map' -x '**/.DS_Store'

'zip' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.16237
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "zip"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] zip: `rimraf addon.zip && zip -r addon.zip . -i 'dist/*' -i 'html/*' -i 'icons/*' -i 'vendor/*' -i 'manifest.json' -x '**/*.map' -x '**/.DS_Store'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] zip script 'rimraf addon.zip && zip -r addon.zip . -i 'dist/*' -i 'html/*' -i 'icons/*' -i 'vendor/*' -i 'manifest.json' -x '**/*.map' -x '**/.DS_Store''.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the synology-download-manager package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     rimraf addon.zip && zip -r addon.zip . -i 'dist/*' -i 'html/*' -i 'icons/*' -i 'vendor/*' -i 'manifest.json' -x '**/*.map' -x '**/.DS_Store'
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs synology-download-manager
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls synology-download-manager
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\synology-download-manager\npm-debug.log

Consider global pause/resume buttons

Could change the "filter" button to be generic "controls" button and then add a "Task Control" section to it that includes these buttons along with the clear button. Alternately, could also remove the always-visible text from the updating status and make it on-hover only to clear up space in the header bar.

Automatically open magnet links

The feature that when you click on a magnet link, Firefox automatically opens it with the extension "Synology Download Manager".

I have been using this feature in SynoLoader for a time. You set "extensions.SynoLoader.use_magnet; true" in about: config and after that, each magnet you click on opens automatically by the extension, awesome.

I think this code has something to do with that:
https://github.com/Lemutar/Synoloader/blob/master/src/modules/MagnetHandler.js

popup should work in private browsing mode

Right now it just says "sorry, doesn't work". The way to fix this is to rewrite the communication layer between the popup and the background page to use sendMessage instead of sharing references to JS objects, but that's a bunch of work.

"open with Synology Download Manager" should be an option in the browser's "what do you want to open this file/link with" popup

Hi!

Great extension, the update to FF57 brought me here. Your Extension has many more cool features than the others I have used but I miss one thing, which i cannot find here as a feature request.

When there is a download with no Download Link which is accessible with right click, such as a download started through a script the browser opens a dialouge-Box what to do with the file. Here would be great to have the option "Download with synology download Manager".

Thanks in advance.

Destination-select improvements

  • Allow creating (deleting?) folders.
  • Allow clearing the selected folder back to the default.
  • Tweak visuals -- a lot of it is crowded/undifferentiated and looks like an afterthought.

set up i18n contributions

crowdin.com? The build tasks should probably also be streamlined, notably by including aliases and merging the typescript compilation into the rollup task, if possible.

Support QuickConnect IDs

The quickconnect protocol is not officially documented and would require some reverse-engineering, so this feature is unlikely to get implemented any time soon.

The workaround for now is to use the regular "external access" configuration (e.g., the synology.me domain).

"The logged in session does not have permission"

Having trouble reproducing this, but what I do know is:

  • Happened when the NAS was asleep and had to be woken by the extension.
  • I had just changed the login credentials, though both accounts have permission to use DownloadStation.

allow changing sort type

Logical things to support (asc/desc for all types):

  • name
  • date completed
  • date added
  • percentage completed

This is probably something that should be readily accessible, so we'll want to include it in the header and probably redesign the header to fit it. We'll probably also want to put the filter checkboxes there too...?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.