mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-01-22 22:34:20 -06:00
More cleanups
This commit is contained in:
@@ -60,7 +60,6 @@ class DocumentAdmin(GuardedModelAdmin):
|
|||||||
"added",
|
"added",
|
||||||
"modified",
|
"modified",
|
||||||
"mime_type",
|
"mime_type",
|
||||||
"storage_type",
|
|
||||||
"filename",
|
"filename",
|
||||||
"checksum",
|
"checksum",
|
||||||
"archive_filename",
|
"archive_filename",
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ def thumbnail_last_modified(request, pk: int) -> datetime | None:
|
|||||||
Cache should be (slightly?) faster than filesystem
|
Cache should be (slightly?) faster than filesystem
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
doc = Document.objects.only("storage_type").get(pk=pk)
|
doc = Document.objects.only("pk").get(pk=pk)
|
||||||
if not doc.thumbnail_path.exists():
|
if not doc.thumbnail_path.exists():
|
||||||
return None
|
return None
|
||||||
doc_key = get_thumbnail_modified_key(pk)
|
doc_key = get_thumbnail_modified_key(pk)
|
||||||
|
|||||||
@@ -497,7 +497,6 @@ class ConsumerPlugin(
|
|||||||
create_source_path_directory(document.source_path)
|
create_source_path_directory(document.source_path)
|
||||||
|
|
||||||
self._write(
|
self._write(
|
||||||
document.storage_type,
|
|
||||||
self.unmodified_original
|
self.unmodified_original
|
||||||
if self.unmodified_original is not None
|
if self.unmodified_original is not None
|
||||||
else self.working_copy,
|
else self.working_copy,
|
||||||
@@ -505,7 +504,6 @@ class ConsumerPlugin(
|
|||||||
)
|
)
|
||||||
|
|
||||||
self._write(
|
self._write(
|
||||||
document.storage_type,
|
|
||||||
thumbnail,
|
thumbnail,
|
||||||
document.thumbnail_path,
|
document.thumbnail_path,
|
||||||
)
|
)
|
||||||
@@ -517,7 +515,6 @@ class ConsumerPlugin(
|
|||||||
)
|
)
|
||||||
create_source_path_directory(document.archive_path)
|
create_source_path_directory(document.archive_path)
|
||||||
self._write(
|
self._write(
|
||||||
document.storage_type,
|
|
||||||
archive_path,
|
archive_path,
|
||||||
document.archive_path,
|
document.archive_path,
|
||||||
)
|
)
|
||||||
@@ -733,7 +730,7 @@ class ConsumerPlugin(
|
|||||||
}
|
}
|
||||||
CustomFieldInstance.objects.create(**args) # adds to document
|
CustomFieldInstance.objects.create(**args) # adds to document
|
||||||
|
|
||||||
def _write(self, storage_type, source, target):
|
def _write(self, source, target):
|
||||||
with (
|
with (
|
||||||
Path(source).open("rb") as read_file,
|
Path(source).open("rb") as read_file,
|
||||||
Path(target).open("wb") as write_file,
|
Path(target).open("wb") as write_file,
|
||||||
|
|||||||
@@ -418,7 +418,6 @@ class Command(CryptMixin, BaseCommand):
|
|||||||
base_name = generate_filename(
|
base_name = generate_filename(
|
||||||
document,
|
document,
|
||||||
counter=filename_counter,
|
counter=filename_counter,
|
||||||
append_gpg=False,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
base_name = document.get_public_filename(counter=filename_counter)
|
base_name = document.get_public_filename(counter=filename_counter)
|
||||||
|
|||||||
BIN
src/documents/tests/samples/documents/thumbnails/0000004.webp
Normal file
BIN
src/documents/tests/samples/documents/thumbnails/0000004.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
@@ -1203,19 +1203,6 @@ EMAIL_PARSE_DEFAULT_LAYOUT = __get_int(
|
|||||||
1, # MailRule.PdfLayout.TEXT_HTML but that can't be imported here
|
1, # MailRule.PdfLayout.TEXT_HTML but that can't be imported here
|
||||||
)
|
)
|
||||||
|
|
||||||
# Pre-2.x versions of Paperless stored your documents locally with GPG
|
|
||||||
# encryption, but that is no longer the default. This behaviour is still
|
|
||||||
# available, but it must be explicitly enabled by setting
|
|
||||||
# `PAPERLESS_PASSPHRASE` in your environment or config file. The default is to
|
|
||||||
# store these files unencrypted.
|
|
||||||
#
|
|
||||||
# Translation:
|
|
||||||
# * If you're a new user, you can safely ignore this setting.
|
|
||||||
# * If you're upgrading from 1.x, this must be set, OR you can run
|
|
||||||
# `./manage.py change_storage_type gpg unencrypted` to decrypt your files,
|
|
||||||
# after which you can unset this value.
|
|
||||||
PASSPHRASE = os.getenv("PAPERLESS_PASSPHRASE")
|
|
||||||
|
|
||||||
# Trigger a script after every successful document consumption?
|
# Trigger a script after every successful document consumption?
|
||||||
PRE_CONSUME_SCRIPT = os.getenv("PAPERLESS_PRE_CONSUME_SCRIPT")
|
PRE_CONSUME_SCRIPT = os.getenv("PAPERLESS_PRE_CONSUME_SCRIPT")
|
||||||
POST_CONSUME_SCRIPT = os.getenv("PAPERLESS_POST_CONSUME_SCRIPT")
|
POST_CONSUME_SCRIPT = os.getenv("PAPERLESS_POST_CONSUME_SCRIPT")
|
||||||
|
|||||||
Reference in New Issue
Block a user