From 25a395f128bc17b567429f991b7e46b0696b25d6 Mon Sep 17 00:00:00 2001 From: Nydragon Date: Wed, 12 Jun 2024 19:29:42 +0900 Subject: [PATCH] feat: make libcrypto and libssl paths overrideable It is necessary to properly use this plugin on NixOS and also allows overriding for testing & other purposes. --- calibre-plugin/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py index fa35047..0568995 100644 --- a/calibre-plugin/__init__.py +++ b/calibre-plugin/__init__.py @@ -285,6 +285,20 @@ class ACSMInput(FileTypePlugin): # Okay, now all the modules are available, import the Adobe modules. + # Crucial to import first, as libadobe imports oscrypto as well + + libcrypto_path = os.environ["ACSM_LIBCRYPTO"] + libssl_path = os.environ["ACSM_LIBSSL"] + + if os.path.exists(libcrypto_path) and os.path.exists(libssl_path): + import oscrypto + + oscrypto.use_openssl( + libcrypto_path = libcrypto_path, + libssl_path = libssl_path, + ) + + from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest from libadobeAccount import createDeviceFile, createUser, signIn, activateDevice from libadobeFulfill import buildRights, fulfill