Skip to content

Commit e514599

Browse files
committed
synched with upstream
2 parents 294dd21 + 815f880 commit e514599

File tree

8 files changed

+181
-104
lines changed

8 files changed

+181
-104
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,57 @@ jobs:
99
steps:
1010
- name: Checkout
1111
uses: actions/checkout@v2
12+
1213
- name: Package
1314
run: python3 make_release.py
15+
1416
- name: Upload
1517
uses: actions/upload-artifact@v2
1618
with:
1719
name: plugin
1820
path: |
1921
DeDRM_tools_*.zip
2022
DeDRM_tools.zip
23+
24+
# - name: Delete old release
25+
# uses: cb80/delrel@latest
26+
# with:
27+
# tag: autorelease
28+
# token: ${{ github.token }}
29+
#
30+
# - name: Delete old tag
31+
# uses: dev-drprasad/delete-tag-and-release@v1.0
32+
# with:
33+
# tag_name: autorelease
34+
# github_token: ${{ github.token }}
35+
# delete_release: true
36+
#
37+
# - name: Prepare release
38+
# run: cp DeDRM_tools.zip DeDRM_alpha_${{ github.sha }}.zip
39+
#
40+
# - name: Auto-release
41+
# id: autorelease
42+
# uses: softprops/action-gh-release@v1
43+
# with:
44+
# tag_name: autorelease
45+
# token: ${{ github.token }}
46+
# name: Automatic alpha release with latest changes
47+
# body: |
48+
# This release is automatically generated by Github for each commit.
49+
#
50+
# This means, every time a change is made to this repo, this release will be updated to contain an untested copy of the plugin at that stage. This will contain the most up-to-date code, but it's not tested at all and may be broken.
51+
#
52+
# Last update based on Git commit ${{ github.sha }}.
53+
# prerelease: true
54+
# draft: true
55+
# files: DeDRM_alpha_${{ github.sha }}.zip
56+
#
57+
# - name: Make release public
58+
# uses: irongut/EditRelease@v1.2.0
59+
# with:
60+
# token: ${{ github.token }}
61+
# id: ${{ steps.autorelease.outputs.id }}
62+
# draft: false
63+
# prerelease: true
64+
#
65+
#

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,6 @@ List of changes since the fork of Apprentice Harper's repository:
8989
- PDF: Ignore invalid PDF objids unless the script is running in strict mode. Fixes some PDFs, apparently. Fixes #233.
9090
- Bugfix: EPUBs with remaining content in the encryption.xml after decryption weren't written correctly.
9191
- Support for Adobe's 'aes128-cbc-uncompressed' encryption method (fixes #242).
92+
- Two bugfixes for Amazon DeDRM from Satuoni ( https://github.com/noDRM/DeDRM_tools/issues/315#issuecomment-1508305428 ) and andrewc12 ( https://github.com/andrewc12/DeDRM_tools/commit/d9233d61f00d4484235863969919059f4d0b2057 ) that might make the plugin work with newer versions.
93+
- Fix font decryption not working with some books (fixes #347), thanks for the patch @bydioeds.
94+
- Fix a couple unicode errors for Python2 in Kindle and Nook code.

DeDRM_plugin/epubfontdecrypt.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
# -*- coding: utf-8 -*-
33

44
# epubfontdecrypt.py
5-
# Copyright © 2021 by noDRM
5+
# Copyright © 2021-2023 by noDRM
66

77
# Released under the terms of the GNU General Public Licence, version 3
88
# <http://www.gnu.org/licenses/>
99

1010

1111
# Revision history:
1212
# 1 - Initial release
13+
# 2 - Bugfix for multiple book IDs, reported at #347
1314

1415
"""
1516
Decrypts / deobfuscates font files in EPUB files
@@ -18,7 +19,7 @@
1819
from __future__ import print_function
1920

2021
__license__ = 'GPL v3'
21-
__version__ = "1"
22+
__version__ = "2"
2223

2324
import os
2425
import traceback
@@ -193,9 +194,10 @@ def decryptFontsBook(inpath, outpath):
193194
pass
194195

195196
try:
196-
identify_element = container.find(packageNS("metadata")).find(metadataDCNS("identifier"))
197-
if (secret_key_name is None or secret_key_name == identify_element.get("id")):
198-
font_master_key = identify_element.text
197+
identify_elements = container.find(packageNS("metadata")).findall(metadataDCNS("identifier"))
198+
for element in identify_elements:
199+
if (secret_key_name is None or secret_key_name == element.get("id")):
200+
font_master_key = element.text
199201
except:
200202
pass
201203

DeDRM_plugin/ignoblekeyNookStudy.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,26 @@ def getNookLogFiles():
5454
paths = set()
5555
if 'LOCALAPPDATA' in os.environ.keys():
5656
# Python 2.x does not return unicode env. Use Python 3.x
57-
path = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
57+
if sys.version_info[0] == 2:
58+
path = winreg.ExpandEnvironmentStrings(u"%LOCALAPPDATA%")
59+
else:
60+
path = winreg.ExpandEnvironmentStrings("%LOCALAPPDATA%")
5861
if os.path.isdir(path):
5962
paths.add(path)
6063
if 'USERPROFILE' in os.environ.keys():
6164
# Python 2.x does not return unicode env. Use Python 3.x
62-
path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Local"
65+
if sys.version_info[0] == 2:
66+
path = winreg.ExpandEnvironmentStrings(u"%USERPROFILE%")+u"\\AppData\\Local"
67+
else:
68+
path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Local"
69+
6370
if os.path.isdir(path):
6471
paths.add(path)
65-
path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Roaming"
72+
73+
if sys.version_info[0] == 2:
74+
path = winreg.ExpandEnvironmentStrings(u"%USERPROFILE%")+u"\\AppData\\Roaming"
75+
else:
76+
path = winreg.ExpandEnvironmentStrings("%USERPROFILE%")+"\\AppData\\Roaming"
6677
if os.path.isdir(path):
6778
paths.add(path)
6879
# User Shell Folders show take precedent over Shell Folders if present

0 commit comments

Comments
 (0)