mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-10 01:01:17 -06:00
Compare commits
1 Commits
feature/ne
...
fab2f47599
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fab2f47599 |
50
.github/dependabot.yml
vendored
50
.github/dependabot.yml
vendored
@@ -41,56 +41,30 @@ updates:
|
|||||||
- "backend"
|
- "backend"
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
groups:
|
groups:
|
||||||
# Development & CI/CD Tooling
|
|
||||||
development:
|
development:
|
||||||
patterns:
|
patterns:
|
||||||
- "*pytest*"
|
- "*pytest*"
|
||||||
- "ruff"
|
- "ruff"
|
||||||
- "mkdocs-material"
|
- "mkdocs-material"
|
||||||
- "pre-commit*"
|
- "pre-commit*"
|
||||||
# Django & DRF Ecosystem
|
django:
|
||||||
django-ecosystem:
|
|
||||||
patterns:
|
patterns:
|
||||||
- "*django*"
|
- "*django*"
|
||||||
- "drf-*"
|
- "drf-*"
|
||||||
- "djangorestframework"
|
major-versions:
|
||||||
- "whitenoise"
|
|
||||||
- "bleach"
|
|
||||||
- "jinja2"
|
|
||||||
# Async, Task Queuing & Caching
|
|
||||||
async-tasks:
|
|
||||||
patterns:
|
|
||||||
- "celery*"
|
|
||||||
- "channels*"
|
|
||||||
- "flower"
|
|
||||||
- "redis"
|
|
||||||
# Document, PDF, and OCR Processing
|
|
||||||
document-processing:
|
|
||||||
patterns:
|
|
||||||
- "ocrmypdf"
|
|
||||||
- "pdf2image"
|
|
||||||
- "pyzbar"
|
|
||||||
- "zxing-cpp"
|
|
||||||
- "tika-client"
|
|
||||||
- "gotenberg-client"
|
|
||||||
- "python-magic"
|
|
||||||
- "python-gnupg"
|
|
||||||
# Data, NLP, and Search
|
|
||||||
data-nlp-search:
|
|
||||||
patterns:
|
|
||||||
- "nltk"
|
|
||||||
- "scikit-learn"
|
|
||||||
- "langdetect"
|
|
||||||
- "rapidfuzz"
|
|
||||||
- "whoosh-reloaded"
|
|
||||||
# Utilities (Patch Updates)
|
|
||||||
utilities-patch:
|
|
||||||
update-types:
|
update-types:
|
||||||
- "patch"
|
- "major"
|
||||||
# Utilities (Minor Updates)
|
small-changes:
|
||||||
utilities-minor:
|
|
||||||
update-types:
|
update-types:
|
||||||
- "minor"
|
- "minor"
|
||||||
|
- "patch"
|
||||||
|
exclude-patterns:
|
||||||
|
- "*django*"
|
||||||
|
- "drf-*"
|
||||||
|
pre-built:
|
||||||
|
patterns:
|
||||||
|
- psycopg*
|
||||||
|
- zxing-cpp
|
||||||
# Enable updates for GitHub Actions
|
# Enable updates for GitHub Actions
|
||||||
- package-ecosystem: "github-actions"
|
- package-ecosystem: "github-actions"
|
||||||
target-branch: "dev"
|
target-branch: "dev"
|
||||||
|
|||||||
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Install python
|
- name: Install python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
@@ -81,7 +81,7 @@ jobs:
|
|||||||
- pre-commit
|
- pre-commit
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
@@ -131,7 +131,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Start containers
|
- name: Start containers
|
||||||
run: |
|
run: |
|
||||||
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml pull --quiet
|
docker compose --file ${{ github.workspace }}/docker/compose/docker-compose.ci-test.yml pull --quiet
|
||||||
@@ -202,7 +202,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- pre-commit
|
- pre-commit
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
@@ -235,7 +235,7 @@ jobs:
|
|||||||
shard-index: [1, 2, 3, 4]
|
shard-index: [1, 2, 3, 4]
|
||||||
shard-count: [4]
|
shard-count: [4]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
@@ -284,7 +284,7 @@ jobs:
|
|||||||
shard-index: [1, 2]
|
shard-index: [1, 2]
|
||||||
shard-count: [2]
|
shard-count: [2]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
@@ -327,7 +327,7 @@ jobs:
|
|||||||
- tests-frontend
|
- tests-frontend
|
||||||
- tests-frontend-e2e
|
- tests-frontend-e2e
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
@@ -424,7 +424,7 @@ jobs:
|
|||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
# If https://github.com/docker/buildx/issues/1044 is resolved,
|
# If https://github.com/docker/buildx/issues/1044 is resolved,
|
||||||
# the append input with a native arm64 arch could be used to
|
# the append input with a native arm64 arch could be used to
|
||||||
# significantly speed up building
|
# significantly speed up building
|
||||||
@@ -497,7 +497,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
@@ -643,7 +643,7 @@ jobs:
|
|||||||
if: needs.publish-release.outputs.prerelease == 'false'
|
if: needs.publish-release.outputs.prerelease == 'false'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
|
|||||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
|||||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v4
|
uses: github/codeql-action/init@v4
|
||||||
|
|||||||
2
.github/workflows/crowdin.yml
vendored
2
.github/workflows/crowdin.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.PNGX_BOT_PAT }}
|
token: ${{ secrets.PNGX_BOT_PAT }}
|
||||||
- name: crowdin action
|
- name: crowdin action
|
||||||
|
|||||||
2
.github/workflows/translate-strings.yml
vendored
2
.github/workflows/translate-strings.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.PNGX_BOT_PAT }}
|
token: ${{ secrets.PNGX_BOT_PAT }}
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from django.core.validators import MaxLengthValidator
|
|||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.core.validators import integer_validator
|
from django.core.validators import integer_validator
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from django.db.models.functions import Lower
|
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.dateparse import parse_datetime
|
from django.utils.dateparse import parse_datetime
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
@@ -39,7 +38,6 @@ from guardian.utils import get_user_obj_perms_model
|
|||||||
from rest_framework import fields
|
from rest_framework import fields
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.fields import SerializerMethodField
|
from rest_framework.fields import SerializerMethodField
|
||||||
from rest_framework.filters import OrderingFilter
|
|
||||||
|
|
||||||
if settings.AUDIT_LOG_ENABLED:
|
if settings.AUDIT_LOG_ENABLED:
|
||||||
from auditlog.context import set_actor
|
from auditlog.context import set_actor
|
||||||
@@ -577,28 +575,18 @@ class TagSerializer(MatchingModelSerializer, OwnedObjectSerializer):
|
|||||||
)
|
)
|
||||||
def get_children(self, obj):
|
def get_children(self, obj):
|
||||||
filter_q = self.context.get("document_count_filter")
|
filter_q = self.context.get("document_count_filter")
|
||||||
request = self.context.get("request")
|
|
||||||
if filter_q is None:
|
if filter_q is None:
|
||||||
|
request = self.context.get("request")
|
||||||
user = getattr(request, "user", None) if request else None
|
user = getattr(request, "user", None) if request else None
|
||||||
filter_q = get_document_count_filter_for_user(user)
|
filter_q = get_document_count_filter_for_user(user)
|
||||||
self.context["document_count_filter"] = filter_q
|
self.context["document_count_filter"] = filter_q
|
||||||
|
serializer = TagSerializer(
|
||||||
children_queryset = (
|
|
||||||
obj.get_children_queryset()
|
obj.get_children_queryset()
|
||||||
.select_related("owner")
|
.select_related("owner")
|
||||||
.annotate(document_count=Count("documents", filter=filter_q))
|
.annotate(document_count=Count("documents", filter=filter_q)),
|
||||||
|
many=True,
|
||||||
|
context=self.context,
|
||||||
)
|
)
|
||||||
|
|
||||||
view = self.context.get("view")
|
|
||||||
ordering = (
|
|
||||||
OrderingFilter().get_ordering(request, children_queryset, view)
|
|
||||||
if request and view
|
|
||||||
else None
|
|
||||||
)
|
|
||||||
ordering = ordering or (Lower("name"),)
|
|
||||||
children_queryset = children_queryset.order_by(*ordering)
|
|
||||||
|
|
||||||
serializer = TagSerializer(children_queryset, many=True, context=self.context)
|
|
||||||
return serializer.data
|
return serializer.data
|
||||||
|
|
||||||
# children as nested Tag objects
|
# children as nested Tag objects
|
||||||
|
|||||||
@@ -137,25 +137,3 @@ class CustomSocialAccountAdapter(DefaultSocialAccountAdapter):
|
|||||||
user.save()
|
user.save()
|
||||||
handle_social_account_updated(None, request, sociallogin)
|
handle_social_account_updated(None, request, sociallogin)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
def on_authentication_error(
|
|
||||||
self,
|
|
||||||
request,
|
|
||||||
provider,
|
|
||||||
error=None,
|
|
||||||
exception=None,
|
|
||||||
extra_context=None,
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Just log errors and pass them along.
|
|
||||||
"""
|
|
||||||
logger.warning(
|
|
||||||
f"Social authentication error for provider `{provider!s}`: {error!s} ({exception!s})",
|
|
||||||
)
|
|
||||||
return super().on_authentication_error(
|
|
||||||
request,
|
|
||||||
provider,
|
|
||||||
error,
|
|
||||||
exception,
|
|
||||||
extra_context,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -167,17 +167,3 @@ class TestCustomSocialAccountAdapter(TestCase):
|
|||||||
self.assertEqual(user.groups.count(), 1)
|
self.assertEqual(user.groups.count(), 1)
|
||||||
self.assertTrue(user.groups.filter(name="group1").exists())
|
self.assertTrue(user.groups.filter(name="group1").exists())
|
||||||
self.assertFalse(user.groups.filter(name="group2").exists())
|
self.assertFalse(user.groups.filter(name="group2").exists())
|
||||||
|
|
||||||
def test_error_logged_on_authentication_error(self):
|
|
||||||
adapter = get_social_adapter()
|
|
||||||
request = HttpRequest()
|
|
||||||
with self.assertLogs("paperless.auth", level="INFO") as log_cm:
|
|
||||||
adapter.on_authentication_error(
|
|
||||||
request,
|
|
||||||
provider="test-provider",
|
|
||||||
error="Error",
|
|
||||||
exception="Test authentication error",
|
|
||||||
)
|
|
||||||
self.assertTrue(
|
|
||||||
any("Test authentication error" in message for message in log_cm.output),
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user