mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Fixed a few consumer bugs and added an exporter
Rename exporter to export and fixt some debugging Account for files not matching the sender/title pattern Added a safety note Wrong regex on the name parser Renamed the command to something slightly less ambiguous
This commit is contained in:
24
src/paperless/db.py
Normal file
24
src/paperless/db.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import gnupg
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class GnuPG(object):
|
||||
"""
|
||||
A handy singleton to use when handling encrypted files.
|
||||
"""
|
||||
|
||||
gpg = gnupg.GPG(gnupghome=settings.GNUPG_HOME)
|
||||
|
||||
@classmethod
|
||||
def decrypted(cls, path):
|
||||
return cls.gpg.decrypt_file(path, passphrase=settings.PASSPHRASE).data
|
||||
|
||||
@classmethod
|
||||
def encrypted(cls, path):
|
||||
return cls.gpg.encrypt_file(
|
||||
path,
|
||||
recipients=None,
|
||||
passphrase=settings.PASSPHRASE,
|
||||
symmetric=True
|
||||
).data
|
@@ -148,4 +148,3 @@ CONSUMPTION_DIR = os.environ.get("PAPERLESS_CONSUME")
|
||||
# `None` and you'll be prompted for the passphrase at runtime. The default
|
||||
# looks for an environment variable.
|
||||
PASSPHRASE = os.environ.get("PAPERLESS_PASSPHRASE")
|
||||
|
||||
|
Reference in New Issue
Block a user