Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jdownloader2: init at 2.0 #136998

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9128,6 +9128,12 @@
githubId = 801525;
name = "rembo10";
};
remgodow = {
email = "[email protected]";
github = "remgodow";
githubId = 10079854;
name = "remgodow";
};
renatoGarcia = {
email = "[email protected]";
github = "renatoGarcia";
Expand Down
68 changes: 68 additions & 0 deletions pkgs/applications/networking/jdownloader2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{ stdenv, lib, fetchurl, writeScript, makeDesktopItem, copyDesktopItems, jre, imagemagick, coreutils }:

let

icon = fetchurl {
url = "https://jdownloader.org/_media/vote/trazo.png";
sha256 = "3ebab992e7dd04ffcb6c30fee1a7e2b43f3537cb2b22124b30325d25bffdac29";
};

wrapper = writeScript "jdownloader" ''
#! ${stdenv.shell}
PATH=${lib.makeBinPath [ jre coreutils ]}
JDJAR=''${XDG_DATA_HOME:-$HOME/.local/share}/jdownloader/JDownloader.jar
Copy link
Contributor

@milahu milahu Oct 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally, i am NOT happy with auto-updates. should be "default off, enable on demand"

also, should be built from source. there is a mirror at https://github.com/mirror/jdownloader
the official repo is password-protected

that "source" contains 250 MByte build artifacts (*.jar files) and 50 MByte sources (*.java files in src/)
ideally, we would download only the src/ folder, like github-downloader (via stackoverflow)
wontfix

Copy link
Contributor Author

@remgodow remgodow Oct 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to begin with, JDownloader supports many websites via its plugin system, and those are always autoupdated. Main app does not update automatically, only checks for updates, here is more info
https://support.jdownloader.org/Knowledgebase/Article/View/updates-update-behavior

I did not try to build from source, and I'm not sure if it is possible without access to the main repo, for example they use proprietary libraries, and I believe there are closed source parts as well (kinda like VSCode). That would require some tinkering, as for ex. AUR packages are using the bootstrapper as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an issue from the mirror about missing dependencies from password-protected official repo. mirror/jdownloader#47

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an issue from the mirror about missing dependencies

the svn repos listed in https://jdownloader.org/knowledge/wiki/development/get-started are public, the issue is only a request to mirror these repos

they use proprietary libraries, and I believe there are closed source parts as well

im afraid yes ... im trying to build from source with headless eclipse, but at the end of the day, there will still be some binary blobs (*.jar files with closed source), so jdownloader has license unfree

→ use containers for better security?

pyload is missing : /

$ nix-shell -p pyload 
error: pyload has been removed from nixpkgs, as it was unmaintained.

Copy link
Contributor

@milahu milahu Oct 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

→ use containers for better security?

https://github.com/mviereck/x11docker (via)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x11docker

https://github.com/jlesage/docker-jdownloader-2 has invented this wheel already : )

Copy link
Contributor

@milahu milahu Oct 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the end of the day, there will still be some binary blobs (*.jar files with closed source), so jdownloader has license unfree

yepp

Compiling 4610 source files to /build/jdownloader/bin
/build/jdownloader/src/jd/plugins/AccountInfo.java:267: error: cannot find symbol
        final long serverTime = br.getCurrentServerTime(-1);
                                  ^
  symbol:   method getCurrentServerTime(int)
  location: variable br of type Browser

jdownloader requires closed sources:

JDClosed
JDownloaderServerOptions
UpdateClientV2
JDownloaderUpdater

per jdownloader/build/newBuild/build.xml

i want to patch the myjdownloaderclient ...
in headless mode, jdownloader requires a valid account for myjdownloader

jd ignores json config

i have not-yet found a way to use a self-hosted api server, or to disable this completely ...
so much for "untrusted" software

relevant configkey is serverhost (default api.jdownloader.org) in cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json
but jd always says

|---------------------------Headless Information-------------------------------
|       MyJDownloader
|       Your 'My JDownloader' logins are not correct. 
|       Please check username/email and password!
|       Enter y -> Enter Logins
|       Enter n -> Exit JDownloader

so im back to binary patching ... or pyLoad

binary patching - its simple, its fun

let jd update, to download jar files
get Core.jar from approot
open recaf
open Core.jar
classes > org > jd > api > myjd > myjdcontroller
Ctrl+F for: boolean isAlwaysConnectRequired

edit the assembler code

 DEFINE PUBLIC FINAL isAlwaysConnectRequired()Z
 A:
 LINE A 105
-INVOKESTATIC org/appwork/utils/Application.isHeadless()Z
-IRETURN
+EXPR return false;
 B:

Ctrl+S, file > export > export to Core.patched.jar

in jd approot, replace Core.jar with Core.patched.jar

now, jd starts in headless mode, without requiring myjd login

dir=`dirname "$0"`
if [ ! -f ''${JDJAR} ]; then
install -Dm755 $dir/JDownloader.jar ''${JDJAR}
fi
${jre}/bin/java -jar ''${JDJAR} "''${@}"
'';

in stdenv.mkDerivation rec {
pname = "jdownloader2";
version = "2.0";

#there is no https endpoint for this domain
src = fetchurl {
url = "https://archive.org/download/jdownloader_202109/JDownloader.jar";
sha256 = "9951b786e24fc3777a0df0a7b516ba53d0c8e778d6a69ebc29dcff86ee6b5829";
};

dontUnpack = true;

nativeBuildInputs = [ imagemagick copyDesktopItems ];

desktopItems = [
(makeDesktopItem {
name = "JDownloader 2";
exec = wrapper;
icon = "jdownloader";
comment = "Free, open-source download management tool.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho, "FOSS" is not relevant here. i would just say "Download manager"
(you can download all kinds of files with jd, also youtube videos ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took that from the official website, the FOSS refers to JDownloader not the stuff you can download, I think. Sure thing, I can change that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the package name, I can change that as well. For quite some time there were jdownloader and jdownloader2, the jdownloader is obsolete by now, but few people still use the jdownloader2 name as you can see on the repology https://repology.org/projects/?search=jdownloader

desktopName = "JDownloader 2";
genericName = "JDownloader 2";
categories = "Network;";
})
];

installPhase = ''
mkdir -pv $out/bin $out/share/applications
cp ${src} $out/bin/JDownloader.jar

# create icons
for size in 16 32 48 64 72 96 128 192 512 1024; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -resize "$size"x"$size" \
${icon} \
$out/share/icons/hicolor/"$size"x"$size"/apps/jdownloader.png
done
'';

# Some easy metadata, in case I forget.
meta = with lib; {
homepage = "https://jdownloader.org/";
description = "Free, open-source download management tool";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ remgodow ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25652,6 +25652,8 @@ with pkgs;

dupd = callPackage ../tools/misc/dupd { };

jdownloader2 = callPackage ../applications/networking/jdownloader2 { };

jdupes = callPackage ../tools/misc/jdupes { };

jed = callPackage ../applications/editors/jed { };
Expand Down