Merge remote-tracking branch 'origin/dev'

This commit is contained in:
Trenton Holmes 2023-11-30 07:10:29 -08:00
commit c2bede40c7
10 changed files with 89 additions and 16 deletions

View File

@ -704,6 +704,20 @@ but could result in missing text content.
this value if you are certain your documents are not malicious and
you need the text which was not OCRed
#### [`PAPERLESS_OCR_COLOR_CONVERSION_STRATEGY=<RGB>`](#PAPERLESS_OCR_COLOR_CONVERSION_STRATEGY) {#PAPERLESS_OCR_COLOR_CONVERSION_STRATEGY}
: Controls the Ghostscript color conversion strategy when creating the archive file. This setting
will only be utilized if the output is a version of PDF/A.
Valid options are CMYK, Gray, LeaveColorUnchanged, RGB or UseDeviceIndependentColor.
You can find more on the settings [here](https://ghostscript.readthedocs.io/en/latest/VectorDevices.html#color-conversion-and-management) in the Ghostscript documentation.
!!! warning
Utilizing some of the options may result in errors when creating archive
files from PDFs.
#### [`PAPERLESS_OCR_USER_ARGS=<json>`](#PAPERLESS_OCR_USER_ARGS) {#PAPERLESS_OCR_USER_ARGS}
: OCRmyPDF offers many more options. Use this parameter to specify any

View File

@ -192,4 +192,24 @@ describe('ShareLinksDropdownComponent', () => {
component.share(link)
// expect(navigatorSpy).toHaveBeenCalledWith({ url: component.getShareUrl(link) })
})
it('should correctly generate share URLs', () => {
environment.apiBaseUrl = 'http://example.com/api/'
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
'http://example.com/share/123abc123'
)
environment.apiBaseUrl = 'http://example.domainwithapiinit.com/api/'
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
'http://example.domainwithapiinit.com/share/123abc123'
)
environment.apiBaseUrl = 'http://example.domainwithapiinit.com:1234/api/'
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
'http://example.domainwithapiinit.com:1234/share/123abc123'
)
environment.apiBaseUrl =
'http://example.domainwithapiinit.com:1234/subpath/api/'
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
'http://example.domainwithapiinit.com:1234/subpath/share/123abc123'
)
})
})

View File

@ -80,7 +80,10 @@ export class ShareLinksDropdownComponent implements OnInit {
}
getShareUrl(link: PaperlessShareLink): string {
return `${environment.apiBaseUrl.replace('api', 'share')}${link.slug}`
const apiURL = new URL(environment.apiBaseUrl)
return `${apiURL.origin}${apiURL.pathname.replace(/\/api\/$/, '/share/')}${
link.slug
}`
}
getDaysRemaining(link: PaperlessShareLink): string {

View File

@ -5,7 +5,7 @@ export const environment = {
apiBaseUrl: document.baseURI + 'api/',
apiVersion: '3',
appTitle: 'Paperless-ngx',
version: '2.0.0',
version: '2.0.0-dev',
webSocketHost: window.location.host,
webSocketProtocol: window.location.protocol == 'https:' ? 'wss:' : 'ws:',
webSocketBaseUrl: base_url.pathname + 'ws/',

View File

@ -3019,7 +3019,7 @@
<context context-type="sourcefile">src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts</context>
<context context-type="linenumber">39</context>
</context-group>
<target state="translated">Neues benutzerdefinidertes Feld erstellen</target>
<target state="translated">Neues benutzerdefiniertes Feld erstellen</target>
</trans-unit>
<trans-unit id="8751213029607178010" datatype="html">
<source>Edit custom field</source>

View File

@ -0,0 +1,22 @@
# Generated by Django 4.2.7 on 2023-11-30 14:29
import multiselectfield.db.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("documents", "1040_customfield_customfieldinstance_and_more"),
]
operations = [
migrations.AlterField(
model_name="consumptiontemplate",
name="sources",
field=multiselectfield.db.fields.MultiSelectField(
choices=[(1, "Consume Folder"), (2, "Api Upload"), (3, "Mail Fetch")],
default="1,2,3",
max_length=5,
),
),
]

View File

@ -754,7 +754,7 @@ class ConsumptionTemplate(models.Model):
order = models.IntegerField(_("order"), default=0)
sources = MultiSelectField(
max_length=3,
max_length=5,
choices=DocumentSourceChoices.choices,
default=f"{DocumentSource.ConsumeFolder},{DocumentSource.ApiUpload},{DocumentSource.MailFetch}",
)

View File

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: paperless-ngx\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-10 09:02-0800\n"
"PO-Revision-Date: 2023-11-13 01:31\n"
"PO-Revision-Date: 2023-11-29 08:50\n"
"Last-Translator: \n"
"Language-Team: Russian\n"
"Language: ru_RU\n"
@ -409,7 +409,7 @@ msgstr ""
#: documents/models.py:454
msgid "owner is"
msgstr ""
msgstr "владелец"
#: documents/models.py:455
msgid "has owner in"
@ -417,7 +417,7 @@ msgstr ""
#: documents/models.py:456
msgid "does not have owner"
msgstr ""
msgstr "не имеет владельца"
#: documents/models.py:457
msgid "does not have owner in"
@ -521,7 +521,7 @@ msgstr "пользователь"
#: documents/models.py:679
msgid "note"
msgstr ""
msgstr "заметка"
#: documents/models.py:680
msgid "notes"
@ -529,15 +529,15 @@ msgstr "заметки"
#: documents/models.py:688
msgid "Archive"
msgstr ""
msgstr "Архив"
#: documents/models.py:689
msgid "Original"
msgstr ""
msgstr "Оригинал"
#: documents/models.py:700
msgid "expiration"
msgstr ""
msgstr "Срок действия"
#: documents/models.py:707
msgid "slug"
@ -645,7 +645,7 @@ msgstr ""
#: documents/models.py:887
msgid "URL"
msgstr ""
msgstr "Ссылка"
#: documents/models.py:888
msgid "Date"
@ -661,7 +661,7 @@ msgstr ""
#: documents/models.py:891
msgid "Float"
msgstr ""
msgstr "С плавающей точкой"
#: documents/models.py:892
msgid "Monetary"
@ -669,15 +669,15 @@ msgstr ""
#: documents/models.py:904
msgid "data type"
msgstr ""
msgstr "Тип данных"
#: documents/models.py:912
msgid "custom field"
msgstr ""
msgstr "Пользовательское поле"
#: documents/models.py:913
msgid "custom fields"
msgstr ""
msgstr "Пользовательские поля"
#: documents/models.py:973
msgid "custom field instance"

View File

@ -864,6 +864,11 @@ OCR_MAX_IMAGE_PIXELS: Optional[int] = None
if os.environ.get("PAPERLESS_OCR_MAX_IMAGE_PIXELS") is not None:
OCR_MAX_IMAGE_PIXELS: int = int(os.environ.get("PAPERLESS_OCR_MAX_IMAGE_PIXELS"))
OCR_COLOR_CONVERSION_STRATEGY = os.getenv(
"PAPERLESS_OCR_COLOR_CONVERSION_STRATEGY",
"RGB",
)
OCR_USER_ARGS = os.getenv("PAPERLESS_OCR_USER_ARGS", "{}")
# GNUPG needs a home directory for some reason

View File

@ -186,6 +186,11 @@ class RasterisedDocumentParser(DocumentParser):
"progress_bar": False,
}
if "pdfa" in ocrmypdf_args["output_type"]:
ocrmypdf_args[
"color_conversion_strategy"
] = settings.OCR_COLOR_CONVERSION_STRATEGY
if settings.OCR_MODE == "force" or safe_fallback:
ocrmypdf_args["force_ocr"] = True
elif settings.OCR_MODE in ["skip", "skip_noarchive"]:
@ -244,6 +249,10 @@ class RasterisedDocumentParser(DocumentParser):
f"no DPI information is present in this image and "
f"OCR_IMAGE_DPI is not set.",
)
if ocrmypdf_args["image_dpi"] < 70: # pragma: no cover
self.log.warning(
f"Image DPI of {ocrmypdf_args['image_dpi']} is low, OCR may fail",
)
if settings.OCR_USER_ARGS and not safe_fallback:
try: