mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-30 08:35:24 +00:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d48faa9416 | ||
|
|
e7ead755d3 | ||
|
|
be4c4cdbfe | ||
|
|
3e6e1e6efd | ||
|
|
1dc797e9be | ||
|
|
0cb56c49bb | ||
|
|
5cea561838 | ||
|
|
ca32553478 | ||
|
|
cfbb383514 |
No files matched your search
+4
-4
@@ -129,10 +129,10 @@ ARG RUNTIME_PACKAGES="\
|
||||
ghostscript \
|
||||
gnupg \
|
||||
icc-profiles-free \
|
||||
# PostgreSQL client library, used by psycopg
|
||||
libpq5 \
|
||||
# MariaDB client library, used by mysqlclient
|
||||
libmariadb3 \
|
||||
# PostgreSQL
|
||||
postgresql-client \
|
||||
# MySQL / MariaDB
|
||||
mariadb-client \
|
||||
# OCRmyPDF dependencies
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-eng \
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Single-shot database readiness probe used by the init-wait-for-db s6 service.
|
||||
|
||||
Exits 0 if the database server is accepting connections, 1 otherwise. The
|
||||
retry and backoff loop lives in the calling shell script.
|
||||
|
||||
This replaces pg_isready / mariadb-admin ping, so the image does not need the
|
||||
PostgreSQL or MariaDB command line clients. Like those tools, this only checks
|
||||
that the server answers. A server which responds with an error, such as bad
|
||||
credentials or an unknown database, counts as ready, so the real error is
|
||||
reported by the migrations step instead of this one timing out.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
CONNECT_TIMEOUT = 5
|
||||
|
||||
|
||||
def postgres_ready() -> bool:
|
||||
from psycopg import pq
|
||||
from psycopg.conninfo import make_conninfo
|
||||
|
||||
# This is libpq's PQping, which is what pg_isready uses. It reports OK when
|
||||
# the server answers, even if it would refuse these credentials, and REJECT
|
||||
# when the server is up but still starting or shutting down.
|
||||
conninfo = make_conninfo(
|
||||
host=os.environ.get("PAPERLESS_DBHOST", "localhost"),
|
||||
port=int(os.environ.get("PAPERLESS_DBPORT", "5432")),
|
||||
user=os.environ.get("PAPERLESS_DBUSER", "paperless"),
|
||||
connect_timeout=CONNECT_TIMEOUT,
|
||||
)
|
||||
return pq.PGconn.ping(conninfo.encode()) == pq.Ping.OK
|
||||
|
||||
|
||||
def mariadb_ready() -> bool:
|
||||
import MySQLdb
|
||||
|
||||
try:
|
||||
MySQLdb.connect(
|
||||
host=os.environ.get("PAPERLESS_DBHOST", "localhost"),
|
||||
port=int(os.environ.get("PAPERLESS_DBPORT", "3306")),
|
||||
user=os.environ.get("PAPERLESS_DBUSER", "paperless"),
|
||||
passwd=os.environ.get("PAPERLESS_DBPASS", "paperless"),
|
||||
connect_timeout=CONNECT_TIMEOUT,
|
||||
).close()
|
||||
return True
|
||||
except MySQLdb.OperationalError as e:
|
||||
# Codes below 2000 are errors sent by the server (access denied, too
|
||||
# many connections, ...). 2000+ are client side (can't connect, lost
|
||||
# connection), meaning the server was not reached.
|
||||
code = e.args[0] if e.args and isinstance(e.args[0], int) else 0
|
||||
return 0 < code < 2000
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if os.environ.get("PAPERLESS_DBENGINE") == "mariadb":
|
||||
ready = mariadb_ready()
|
||||
else:
|
||||
ready = postgres_ready()
|
||||
return 0 if ready else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -7,7 +7,6 @@ set -euo pipefail
|
||||
declare -r LOG_PREFIX="[init-db-wait]"
|
||||
|
||||
declare -ri TIMEOUT=60
|
||||
declare -r PROBE="/etc/s6-overlay/s6-rc.d/init-wait-for-db/db_ready.py"
|
||||
declare -i ATTEMPT=0
|
||||
declare -i DELAY=0
|
||||
declare -i STARTED_AT=${EPOCHSECONDS:?EPOCHSECONDS var unset}
|
||||
@@ -36,7 +35,11 @@ delay_next_attempt() {
|
||||
wait_for_postgres() {
|
||||
echo "${LOG_PREFIX} Waiting for PostgreSQL to start..."
|
||||
|
||||
while ! python3 "${PROBE}"; do
|
||||
local -r host="${PAPERLESS_DBHOST:-localhost}"
|
||||
local -r port="${PAPERLESS_DBPORT:-5432}"
|
||||
local -r user="${PAPERLESS_DBUSER:-paperless}"
|
||||
|
||||
while ! pg_isready -h "${host}" -p "${port}" --username "${user}"; do
|
||||
delay_next_attempt
|
||||
done
|
||||
echo "${LOG_PREFIX} Connected to PostgreSQL"
|
||||
@@ -45,7 +48,10 @@ wait_for_postgres() {
|
||||
wait_for_mariadb() {
|
||||
echo "${LOG_PREFIX} Waiting for MariaDB to start..."
|
||||
|
||||
while ! python3 "${PROBE}"; do
|
||||
local -r host="${PAPERLESS_DBHOST:-localhost}"
|
||||
local -r port="${PAPERLESS_DBPORT:-3306}"
|
||||
|
||||
while ! mariadb-admin --host="${host}" --port="${port}" --skip-ssl ping --silent >/dev/null 2>&1; do
|
||||
delay_next_attempt
|
||||
done
|
||||
echo "${LOG_PREFIX} Connected to MariaDB"
|
||||
|
||||
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1595
-523
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1545
-473
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1594
-522
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1654
-582
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1538
-466
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+2066
-994
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
+1537
-465
File diff suppressed because it is too large.
Load diff
@@ -74,6 +74,10 @@ _LOCK_BACKOFF_CAP: Final[float] = 10.0 # seconds
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
# Upper bound on autocomplete suggestions. tantivy sizes its collector from the
|
||||
# requested limit, so an unbounded value aborts the whole process on allocation.
|
||||
MAX_AUTOCOMPLETE_LIMIT = 1000
|
||||
|
||||
|
||||
class ViewerGrant(NamedTuple):
|
||||
"""Direct user and group view grants for a single document.
|
||||
@@ -998,7 +1002,8 @@ class TantivyBackend:
|
||||
|
||||
Args:
|
||||
term: Prefix to match against autocomplete words
|
||||
limit: Maximum number of suggestions to return
|
||||
limit: Maximum number of suggestions to return, capped at
|
||||
MAX_AUTOCOMPLETE_LIMIT
|
||||
user: User for permission filtering (None for no filtering)
|
||||
|
||||
Returns:
|
||||
@@ -1021,7 +1026,7 @@ class TantivyBackend:
|
||||
"autocomplete_word",
|
||||
normalized_term,
|
||||
permission_query,
|
||||
limit,
|
||||
min(limit, MAX_AUTOCOMPLETE_LIMIT),
|
||||
)
|
||||
|
||||
return [x[0] for x in matches]
|
||||
|
||||
@@ -112,6 +112,10 @@ if TYPE_CHECKING:
|
||||
|
||||
logger = logging.getLogger("paperless.serializers")
|
||||
|
||||
# How much of an upload is read to detect its type. libmagic examines at most
|
||||
# 7 MiB (its default bytes_max), so this is more than it will ever look at.
|
||||
_MIME_SNIFF_BYTES = 8 * 1024 * 1024
|
||||
|
||||
|
||||
# https://www.django-rest-framework.org/api-guide/serializers/#example
|
||||
class DynamicFieldsModelSerializer(serializers.ModelSerializer[Any]):
|
||||
@@ -2363,8 +2367,9 @@ class PostDocumentSerializer(serializers.Serializer[dict[str, Any]]):
|
||||
)
|
||||
|
||||
def validate_document(self, document):
|
||||
document_data = document.file.read()
|
||||
mime_type = magic.from_buffer(document_data, mime=True)
|
||||
# libmagic only examines a bounded prefix, so an upload of any size is
|
||||
# never read into memory just to detect its type
|
||||
mime_type = magic.from_buffer(document.read(_MIME_SNIFF_BYTES), mime=True)
|
||||
|
||||
if not is_mime_type_supported(mime_type):
|
||||
if (
|
||||
@@ -2380,7 +2385,7 @@ class PostDocumentSerializer(serializers.Serializer[dict[str, Any]]):
|
||||
_("File type %(type)s not supported") % {"type": mime_type},
|
||||
)
|
||||
|
||||
return document.name, document_data
|
||||
return document.name, document
|
||||
|
||||
def validate_correspondent(self, correspondent):
|
||||
if correspondent:
|
||||
|
||||
@@ -1069,6 +1069,13 @@ class TestAutocomplete:
|
||||
results = backend.autocomplete("micro", limit=10)
|
||||
assert "microsoft" in results
|
||||
|
||||
def test_huge_limit_is_clamped(self, backend: TantivyBackend) -> None:
|
||||
"""An oversized limit must be capped, not handed to tantivy as-is."""
|
||||
doc = DocumentFactory.create(title="Microsoft invoice", content="payment")
|
||||
backend.add_or_update(doc)
|
||||
|
||||
assert "microsoft" in backend.autocomplete("micro", limit=10**15)
|
||||
|
||||
def test_results_ordered_by_document_frequency(
|
||||
self,
|
||||
backend: TantivyBackend,
|
||||
|
||||
@@ -2089,6 +2089,38 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase):
|
||||
self.assertIsNone(overrides.document_type_id)
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
|
||||
def test_upload_type_is_detected_from_a_prefix(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- An upload larger than the prefix read to detect its type
|
||||
WHEN:
|
||||
- The document is posted
|
||||
THEN:
|
||||
- The type is detected from the prefix and the upload is accepted
|
||||
- The file handed to the consumer holds the whole upload
|
||||
"""
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
content = SIMPLE_DIGITAL_PDF.read_bytes()
|
||||
|
||||
with (
|
||||
mock.patch("documents.serialisers._MIME_SNIFF_BYTES", 1024),
|
||||
SimpleUploadedFile(
|
||||
"simple.pdf",
|
||||
content,
|
||||
content_type="application/pdf",
|
||||
) as f,
|
||||
):
|
||||
response = self.client.post(
|
||||
"/api/documents/post_document/",
|
||||
{"document": f},
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
input_doc, _ = self.assert_queue_consumption_task_call_args()
|
||||
self.assertEqual(input_doc.original_file.read_bytes(), content)
|
||||
|
||||
def test_upload_with_path_traversal_filename_is_reduced_to_basename(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import CommandError
|
||||
@@ -337,3 +339,41 @@ class TestDocumentListObjectFilterSchema:
|
||||
param = next(p for p in params if p["name"] == param_name)
|
||||
assert param["schema"] == {"type": "array", "items": {"type": "integer"}}
|
||||
assert param["explode"] is False
|
||||
|
||||
|
||||
class TestOauthCallbackSchema:
|
||||
@pytest.mark.parametrize("name", ["code", "state"])
|
||||
def test_empty_code_and_state_are_not_schema_valid(
|
||||
self,
|
||||
api_schema: dict[str, Any],
|
||||
name: str,
|
||||
) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- The generated schema
|
||||
WHEN:
|
||||
- The code and state parameters of the OAuth callback are read
|
||||
THEN:
|
||||
- They are required and not empty, the view answers 400 to an empty one
|
||||
"""
|
||||
params = api_schema["paths"]["/api/oauth/callback/"]["get"]["parameters"]
|
||||
param = next(p for p in params if p["name"] == name)
|
||||
|
||||
assert param["required"] is True
|
||||
assert param["schema"]["minLength"] == 1
|
||||
|
||||
|
||||
class TestOcrPageImageSchema:
|
||||
def test_page_image_is_declared_as_png(self, api_schema: dict[str, Any]) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- The generated schema
|
||||
WHEN:
|
||||
- The 200 response of the OCR template page image is read
|
||||
THEN:
|
||||
- It is a PNG, which is what the view serves
|
||||
"""
|
||||
path = "/api/ocr_templates/document-page-image/{doc_id}/{page}/"
|
||||
content = api_schema["paths"][path]["get"]["responses"]["200"]["content"]
|
||||
|
||||
assert list(content) == ["image/png"]
|
||||
@@ -996,6 +996,9 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
||||
response = self.client.get("/api/search/autocomplete/?term=test&limit=-1")
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
response = self.client.get("/api/search/autocomplete/?term=test&limit=null")
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
response = self.client.get("/api/search/autocomplete/")
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
+108
-20
@@ -942,7 +942,7 @@ class EmailDocumentDetailSchema(EmailSerializer):
|
||||
parameters=[
|
||||
OpenApiParameter(
|
||||
name="id",
|
||||
type=OpenApiTypes.STR,
|
||||
type=OpenApiTypes.INT,
|
||||
location=OpenApiParameter.PATH,
|
||||
),
|
||||
],
|
||||
@@ -2205,7 +2205,7 @@ class DocumentViewSet(
|
||||
raise Http404
|
||||
|
||||
try:
|
||||
doc_name, doc_data = serializer.validated_data.get("document")
|
||||
doc_name, doc_file = serializer.validated_data.get("document")
|
||||
version_label = serializer.validated_data.get("version_label")
|
||||
|
||||
t = int(mktime(datetime.now().timetuple()))
|
||||
@@ -2216,7 +2216,9 @@ class DocumentViewSet(
|
||||
pathvalidate.sanitize_filename(doc_name),
|
||||
)
|
||||
|
||||
temp_file_path.write_bytes(doc_data)
|
||||
with temp_file_path.open("wb") as scratch_file:
|
||||
for chunk in doc_file.chunks():
|
||||
scratch_file.write(chunk)
|
||||
|
||||
os.utime(temp_file_path, times=(t, t))
|
||||
|
||||
@@ -2884,6 +2886,13 @@ class UnifiedSearchViewSet(DocumentViewSet):
|
||||
return Response(max_asn + 1)
|
||||
|
||||
|
||||
LOG_FILES = {
|
||||
"paperless": "paperless.log",
|
||||
"mail": "mail.log",
|
||||
"celery": "celery.log",
|
||||
}
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
list=extend_schema(
|
||||
description="Logs view",
|
||||
@@ -2901,6 +2910,7 @@ class UnifiedSearchViewSet(DocumentViewSet):
|
||||
name="id",
|
||||
type=OpenApiTypes.STR,
|
||||
location=OpenApiParameter.PATH,
|
||||
enum=list(LOG_FILES),
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="limit",
|
||||
@@ -2921,18 +2931,12 @@ class UnifiedSearchViewSet(DocumentViewSet):
|
||||
class LogViewSet(ViewSet):
|
||||
permission_classes = (IsAuthenticated, PaperlessAdminPermissions)
|
||||
|
||||
ALLOWED_LOG_FILES = {
|
||||
"paperless": "paperless.log",
|
||||
"mail": "mail.log",
|
||||
"celery": "celery.log",
|
||||
}
|
||||
|
||||
def get_log_file(self, log_key: str) -> Path:
|
||||
return Path(settings.LOGGING_DIR) / self.ALLOWED_LOG_FILES[log_key]
|
||||
return Path(settings.LOGGING_DIR) / LOG_FILES[log_key]
|
||||
|
||||
def retrieve(self, request, *args, **kwargs):
|
||||
log_key = kwargs.get("pk")
|
||||
if log_key not in self.ALLOWED_LOG_FILES:
|
||||
if log_key not in LOG_FILES:
|
||||
raise Http404
|
||||
|
||||
log_file = self.get_log_file(log_key)
|
||||
@@ -2961,9 +2965,7 @@ class LogViewSet(ViewSet):
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
existing_logs = [
|
||||
log_key
|
||||
for log_key in self.ALLOWED_LOG_FILES
|
||||
if self.get_log_file(log_key).is_file()
|
||||
log_key for log_key in LOG_FILES if self.get_log_file(log_key).is_file()
|
||||
]
|
||||
return Response(existing_logs)
|
||||
|
||||
@@ -3498,7 +3500,7 @@ class PostDocumentView(GenericAPIView[Any]):
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
|
||||
doc_name, doc_data = serializer.validated_data.get("document")
|
||||
doc_name, doc_file = serializer.validated_data.get("document")
|
||||
doc_name = normalize("NFC", doc_name)
|
||||
correspondent_id = serializer.validated_data.get("correspondent")
|
||||
document_type_id = serializer.validated_data.get("document_type")
|
||||
@@ -3518,7 +3520,9 @@ class PostDocumentView(GenericAPIView[Any]):
|
||||
pathvalidate.sanitize_filename(doc_name),
|
||||
)
|
||||
|
||||
temp_file_path.write_bytes(doc_data)
|
||||
with temp_file_path.open("wb") as scratch_file:
|
||||
for chunk in doc_file.chunks():
|
||||
scratch_file.write(chunk)
|
||||
|
||||
os.utime(temp_file_path, times=(t, t))
|
||||
|
||||
@@ -3733,7 +3737,10 @@ class SearchAutoCompleteView(GenericAPIView[Any]):
|
||||
return HttpResponseBadRequest("Term required")
|
||||
|
||||
if "limit" in request.query_params:
|
||||
limit = int(request.query_params["limit"])
|
||||
try:
|
||||
limit = int(request.query_params["limit"])
|
||||
except ValueError:
|
||||
return HttpResponseBadRequest("Invalid limit")
|
||||
if limit <= 0:
|
||||
return HttpResponseBadRequest("Invalid limit")
|
||||
else:
|
||||
@@ -4009,7 +4016,36 @@ class GlobalSearchView(PassUserMixin):
|
||||
get=extend_schema(
|
||||
description="Get statistics for the current user",
|
||||
responses={
|
||||
(200, "application/json"): OpenApiTypes.OBJECT,
|
||||
(200, "application/json"): inline_serializer(
|
||||
name="Statistics",
|
||||
fields={
|
||||
"documents_total": serializers.IntegerField(),
|
||||
"documents_inbox": serializers.IntegerField(allow_null=True),
|
||||
"inbox_tag": serializers.IntegerField(
|
||||
allow_null=True,
|
||||
help_text="The first inbox tag, kept for backwards compatibility",
|
||||
),
|
||||
"inbox_tags": serializers.ListField(
|
||||
child=serializers.IntegerField(),
|
||||
allow_null=True,
|
||||
),
|
||||
"document_file_type_counts": serializers.ListField(
|
||||
child=inline_serializer(
|
||||
name="MimeTypeCount",
|
||||
fields={
|
||||
"mime_type": serializers.CharField(),
|
||||
"mime_type_count": serializers.IntegerField(),
|
||||
},
|
||||
),
|
||||
),
|
||||
"character_count": serializers.IntegerField(),
|
||||
"tag_count": serializers.IntegerField(),
|
||||
"correspondent_count": serializers.IntegerField(),
|
||||
"document_type_count": serializers.IntegerField(),
|
||||
"storage_path_count": serializers.IntegerField(),
|
||||
"current_asn": serializers.IntegerField(),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
@@ -4494,7 +4530,13 @@ def get_github_stars() -> int | None:
|
||||
get=extend_schema(
|
||||
description="Get the current version of the Paperless-NGX server",
|
||||
responses={
|
||||
(200, "application/json"): OpenApiTypes.OBJECT,
|
||||
(200, "application/json"): inline_serializer(
|
||||
name="RemoteVersion",
|
||||
fields={
|
||||
"version": serializers.CharField(),
|
||||
"update_available": serializers.BooleanField(),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
@@ -4559,7 +4601,17 @@ class RemoteVersionView(GenericAPIView[Any]):
|
||||
),
|
||||
],
|
||||
responses={
|
||||
(200, "application/json"): OpenApiTypes.OBJECT,
|
||||
(200, "application/json"): inline_serializer(
|
||||
name="ReleaseNotes",
|
||||
fields={
|
||||
"version": serializers.CharField(),
|
||||
"releases": serializers.ListField(
|
||||
child=serializers.DictField(),
|
||||
help_text="GitHub release objects",
|
||||
),
|
||||
"stars": serializers.IntegerField(allow_null=True),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
@@ -5823,6 +5875,26 @@ class SystemStatusView(PassUserMixin):
|
||||
)
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
get=extend_schema(
|
||||
description="List the documents in the trash",
|
||||
responses={(200, "application/json"): DocumentSerializer(many=True)},
|
||||
),
|
||||
post=extend_schema(
|
||||
description="Restore documents from the trash, or delete them permanently",
|
||||
responses={
|
||||
(200, "application/json"): inline_serializer(
|
||||
name="TrashActionResult",
|
||||
fields={
|
||||
"result": serializers.CharField(),
|
||||
"doc_ids": serializers.ListField(
|
||||
child=serializers.IntegerField(),
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
class TrashView(ListModelMixin, PassUserMixin):
|
||||
permission_classes = (IsAuthenticated, TrashPermissions)
|
||||
serializer_class = TrashSerializer
|
||||
@@ -5971,6 +6043,22 @@ class OcrTemplateViewSet(BulkPermissionMixin, PassUserMixin, ModelViewSet[OcrTem
|
||||
]
|
||||
return super().get_permissions()
|
||||
|
||||
@extend_schema(
|
||||
parameters=[
|
||||
OpenApiParameter(
|
||||
name="doc_id",
|
||||
type=OpenApiTypes.INT,
|
||||
location=OpenApiParameter.PATH,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="page",
|
||||
type={"type": "integer", "minimum": 1},
|
||||
location=OpenApiParameter.PATH,
|
||||
description="1-based page number",
|
||||
),
|
||||
],
|
||||
responses={(200, "image/png"): OpenApiTypes.BINARY},
|
||||
)
|
||||
@action(
|
||||
detail=False,
|
||||
methods=["get"],
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: paperless-ngx\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-11-27 02:54+0000\n"
|
||||
"POT-Creation-Date: 2026-11-30 04:05+0000\n"
|
||||
"PO-Revision-Date: 2022-02-17 04:17\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: English\n"
|
||||
@@ -1879,49 +1879,49 @@ msgstr ""
|
||||
msgid "OCR template zones"
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:491 documents/serialisers.py:815
|
||||
#: documents/serialisers.py:2913 documents/views.py:372 documents/views.py:638
|
||||
#: documents/views.py:2868 paperless_mail/serialisers.py:145
|
||||
#: documents/serialisers.py:495 documents/serialisers.py:819
|
||||
#: documents/serialisers.py:2918 documents/views.py:372 documents/views.py:638
|
||||
#: documents/views.py:2870 paperless_mail/serialisers.py:145
|
||||
msgid "Insufficient permissions."
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:647
|
||||
#: documents/serialisers.py:651
|
||||
msgid "Invalid color."
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2380
|
||||
#: documents/serialisers.py:2385
|
||||
#, python-format
|
||||
msgid "File type %(type)s not supported"
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2424
|
||||
#: documents/serialisers.py:2429
|
||||
#, python-format
|
||||
msgid "Custom field id must be an integer: %(id)s"
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2431
|
||||
#: documents/serialisers.py:2436
|
||||
#, python-format
|
||||
msgid "Custom field with id %(id)s does not exist"
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2448 documents/serialisers.py:2458
|
||||
#: documents/serialisers.py:2453 documents/serialisers.py:2463
|
||||
msgid ""
|
||||
"Custom fields must be a list of integers or an object mapping ids to values."
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2453
|
||||
#: documents/serialisers.py:2458
|
||||
msgid "Some custom fields don't exist or were specified twice."
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2600
|
||||
#: documents/serialisers.py:2605
|
||||
msgid "Invalid variable detected."
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2969
|
||||
#: documents/serialisers.py:2974
|
||||
msgid "Duplicate document identifiers are not allowed."
|
||||
msgstr ""
|
||||
|
||||
#: documents/serialisers.py:2999 documents/views.py:5001
|
||||
#: documents/serialisers.py:3004 documents/views.py:5053
|
||||
#, python-format
|
||||
msgid "Documents not found: %(ids)s"
|
||||
msgstr ""
|
||||
@@ -2192,7 +2192,7 @@ msgstr ""
|
||||
msgid "Specify only one of text, title_search, query, or more_like_id."
|
||||
msgstr ""
|
||||
|
||||
#: documents/views.py:365 documents/views.py:2865
|
||||
#: documents/views.py:365 documents/views.py:2867
|
||||
msgid "Invalid more_like_id"
|
||||
msgstr ""
|
||||
|
||||
@@ -2208,20 +2208,20 @@ msgstr ""
|
||||
msgid "AI backend rejected the request. Check logs for details."
|
||||
msgstr ""
|
||||
|
||||
#: documents/views.py:5017
|
||||
#: documents/views.py:5069
|
||||
#, python-format
|
||||
msgid "Insufficient permissions to share document %(id)s."
|
||||
msgstr ""
|
||||
|
||||
#: documents/views.py:5064
|
||||
#: documents/views.py:5116
|
||||
msgid "Bundle is already being processed."
|
||||
msgstr ""
|
||||
|
||||
#: documents/views.py:5130
|
||||
#: documents/views.py:5182
|
||||
msgid "The share link bundle is still being prepared. Please try again later."
|
||||
msgstr ""
|
||||
|
||||
#: documents/views.py:5144
|
||||
#: documents/views.py:5196
|
||||
msgid "The share link bundle is unavailable."
|
||||
msgstr ""
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user