mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-12-03 17:58:41 +00:00
Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e0a4e5bdb | ||
|
|
8464a91b4c | ||
|
|
2d28fc216c | ||
|
|
e399937109 | ||
|
|
9c8fd02bf8 | ||
|
|
ec82da6d9a | ||
|
|
00a73a24d2 | ||
|
|
9d8903b32d | ||
|
|
637d190332 | ||
|
|
8b34780d3e | ||
|
|
bb3604624b | ||
|
|
8591e71a4e | ||
|
|
5f6617ff29 | ||
|
|
56a77ed914 | ||
|
|
970aab73ea | ||
|
|
d1251aaef6 | ||
|
|
fca95bc821 | ||
|
|
f684baaea8 | ||
|
|
e7ead755d3 | ||
|
|
be4c4cdbfe | ||
|
|
3e6e1e6efd | ||
|
|
1dc797e9be | ||
|
|
0cb56c49bb | ||
|
|
5cea561838 | ||
|
|
ca32553478 | ||
|
|
cfbb383514 |
No files matched your search
@@ -1,8 +1,6 @@
|
|||||||
# Please see the documentation for all configuration options:
|
# Please see the documentation for all configuration options:
|
||||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
version: 2
|
version: 2
|
||||||
# Required for uv support for now
|
|
||||||
enable-beta-ecosystems: true
|
|
||||||
updates:
|
updates:
|
||||||
# Enable version updates for pnpm
|
# Enable version updates for pnpm
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ jobs:
|
|||||||
runs-on: ubuntu-26.04
|
runs-on: ubuntu-26.04
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
container: mcr.microsoft.com/playwright:v1.64.1-resolute
|
container: mcr.microsoft.com/playwright:v1.65.1-resolute
|
||||||
env:
|
env:
|
||||||
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
|
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
|
||||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||||
|
|||||||
+35
-35
@@ -5,14 +5,14 @@
|
|||||||
<trans-unit id="ngb.alert.close" datatype="html">
|
<trans-unit id="ngb.alert.close" datatype="html">
|
||||||
<source>Close</source>
|
<source>Close</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/alert/alert.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/alert/alert.ts</context>
|
||||||
<context context-type="linenumber">38,39</context>
|
<context context-type="linenumber">38,39</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.carousel.slide-number" datatype="html">
|
<trans-unit id="ngb.carousel.slide-number" datatype="html">
|
||||||
<source> Slide <x id="INTERPOLATION" equiv-text="source?: NgbSli"/> of <x id="INTERPOLATION_1" equiv-text="s._cycleToSelec"/> </source>
|
<source> Slide <x id="INTERPOLATION" equiv-text="source?: NgbSli"/> of <x id="INTERPOLATION_1" equiv-text="s._cycleToSelec"/> </source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/carousel/carousel.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/carousel/carousel.ts</context>
|
||||||
<context context-type="linenumber">386,393</context>
|
<context context-type="linenumber">386,393</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<note priority="1" from="description">Currently selected slide number read by screen reader</note>
|
<note priority="1" from="description">Currently selected slide number read by screen reader</note>
|
||||||
@@ -20,219 +20,219 @@
|
|||||||
<trans-unit id="ngb.carousel.previous" datatype="html">
|
<trans-unit id="ngb.carousel.previous" datatype="html">
|
||||||
<source>Previous</source>
|
<source>Previous</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/carousel/carousel.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/carousel/carousel.ts</context>
|
||||||
<context context-type="linenumber">425,426</context>
|
<context context-type="linenumber">425,426</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.carousel.next" datatype="html">
|
<trans-unit id="ngb.carousel.next" datatype="html">
|
||||||
<source>Next</source>
|
<source>Next</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/carousel/carousel.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/carousel/carousel.ts</context>
|
||||||
<context context-type="linenumber">452,453</context>
|
<context context-type="linenumber">452,453</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.datepicker.select-month" datatype="html">
|
<trans-unit id="ngb.datepicker.select-month" datatype="html">
|
||||||
<source>Select month</source>
|
<source>Select month</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
||||||
<context context-type="linenumber">52</context>
|
<context context-type="linenumber">52</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
||||||
<context context-type="linenumber">52</context>
|
<context context-type="linenumber">52</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.datepicker.select-year" datatype="html">
|
<trans-unit id="ngb.datepicker.select-year" datatype="html">
|
||||||
<source>Select year</source>
|
<source>Select year</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
||||||
<context context-type="linenumber">52</context>
|
<context context-type="linenumber">52</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation-select.ts</context>
|
||||||
<context context-type="linenumber">52</context>
|
<context context-type="linenumber">52</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.datepicker.previous-month" datatype="html">
|
<trans-unit id="ngb.datepicker.previous-month" datatype="html">
|
||||||
<source>Previous month</source>
|
<source>Previous month</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
||||||
<context context-type="linenumber">73,76</context>
|
<context context-type="linenumber">73,76</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
||||||
<context context-type="linenumber">73,76</context>
|
<context context-type="linenumber">73,76</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.datepicker.next-month" datatype="html">
|
<trans-unit id="ngb.datepicker.next-month" datatype="html">
|
||||||
<source>Next month</source>
|
<source>Next month</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
||||||
<context context-type="linenumber">73,74</context>
|
<context context-type="linenumber">73,74</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/datepicker/datepicker-navigation.ts</context>
|
||||||
<context context-type="linenumber">73,74</context>
|
<context context-type="linenumber">73,74</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.first" datatype="html">
|
<trans-unit id="ngb.pagination.first" datatype="html">
|
||||||
<source>««</source>
|
<source>««</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277,278</context>
|
<context context-type="linenumber">277,278</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.previous" datatype="html">
|
<trans-unit id="ngb.pagination.previous" datatype="html">
|
||||||
<source>«</source>
|
<source>«</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277,278</context>
|
<context context-type="linenumber">277,278</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.next" datatype="html">
|
<trans-unit id="ngb.pagination.next" datatype="html">
|
||||||
<source>»</source>
|
<source>»</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277</context>
|
<context context-type="linenumber">277</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.last" datatype="html">
|
<trans-unit id="ngb.pagination.last" datatype="html">
|
||||||
<source>»»</source>
|
<source>»»</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277</context>
|
<context context-type="linenumber">277</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.first-aria" datatype="html">
|
<trans-unit id="ngb.pagination.first-aria" datatype="html">
|
||||||
<source>First</source>
|
<source>First</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277,278</context>
|
<context context-type="linenumber">277,278</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.previous-aria" datatype="html">
|
<trans-unit id="ngb.pagination.previous-aria" datatype="html">
|
||||||
<source>Previous</source>
|
<source>Previous</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277,278</context>
|
<context context-type="linenumber">277,278</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.next-aria" datatype="html">
|
<trans-unit id="ngb.pagination.next-aria" datatype="html">
|
||||||
<source>Next</source>
|
<source>Next</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277,278</context>
|
<context context-type="linenumber">277,278</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.pagination.last-aria" datatype="html">
|
<trans-unit id="ngb.pagination.last-aria" datatype="html">
|
||||||
<source>Last</source>
|
<source>Last</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/pagination/pagination.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/pagination/pagination.ts</context>
|
||||||
<context context-type="linenumber">277,278</context>
|
<context context-type="linenumber">277,278</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.progressbar.value" datatype="html">
|
<trans-unit id="ngb.progressbar.value" datatype="html">
|
||||||
<source><x id="INTERPOLATION"/></source>
|
<source><x id="INTERPOLATION"/></source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/progressbar/progressbar.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/progressbar/progressbar.ts</context>
|
||||||
<context context-type="linenumber">39,40</context>
|
<context context-type="linenumber">39,40</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.HH" datatype="html">
|
<trans-unit id="ngb.timepicker.HH" datatype="html">
|
||||||
<source>HH</source>
|
<source>HH</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.hours" datatype="html">
|
<trans-unit id="ngb.timepicker.hours" datatype="html">
|
||||||
<source>Hours</source>
|
<source>Hours</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.MM" datatype="html">
|
<trans-unit id="ngb.timepicker.MM" datatype="html">
|
||||||
<source>MM</source>
|
<source>MM</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.minutes" datatype="html">
|
<trans-unit id="ngb.timepicker.minutes" datatype="html">
|
||||||
<source>Minutes</source>
|
<source>Minutes</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.increment-hours" datatype="html">
|
<trans-unit id="ngb.timepicker.increment-hours" datatype="html">
|
||||||
<source>Increment hours</source>
|
<source>Increment hours</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.decrement-hours" datatype="html">
|
<trans-unit id="ngb.timepicker.decrement-hours" datatype="html">
|
||||||
<source>Decrement hours</source>
|
<source>Decrement hours</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.increment-minutes" datatype="html">
|
<trans-unit id="ngb.timepicker.increment-minutes" datatype="html">
|
||||||
<source>Increment minutes</source>
|
<source>Increment minutes</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.decrement-minutes" datatype="html">
|
<trans-unit id="ngb.timepicker.decrement-minutes" datatype="html">
|
||||||
<source>Decrement minutes</source>
|
<source>Decrement minutes</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.SS" datatype="html">
|
<trans-unit id="ngb.timepicker.SS" datatype="html">
|
||||||
<source>SS</source>
|
<source>SS</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.seconds" datatype="html">
|
<trans-unit id="ngb.timepicker.seconds" datatype="html">
|
||||||
<source>Seconds</source>
|
<source>Seconds</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.increment-seconds" datatype="html">
|
<trans-unit id="ngb.timepicker.increment-seconds" datatype="html">
|
||||||
<source>Increment seconds</source>
|
<source>Increment seconds</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.decrement-seconds" datatype="html">
|
<trans-unit id="ngb.timepicker.decrement-seconds" datatype="html">
|
||||||
<source>Decrement seconds</source>
|
<source>Decrement seconds</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.timepicker.PM" datatype="html">
|
<trans-unit id="ngb.timepicker.PM" datatype="html">
|
||||||
<source><x id="INTERPOLATION"/></source>
|
<source><x id="INTERPOLATION"/></source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/timepicker/timepicker.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/timepicker/timepicker.ts</context>
|
||||||
<context context-type="linenumber">442</context>
|
<context context-type="linenumber">442</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="ngb.toast.close-aria" datatype="html">
|
<trans-unit id="ngb.toast.close-aria" datatype="html">
|
||||||
<source>Close</source>
|
<source>Close</source>
|
||||||
<context-group purpose="location">
|
<context-group purpose="location">
|
||||||
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.2.3_@angular+core@22.2.3_@angular+_2a970977f09c8afdd1f9933e219c8db5/node_modules/src/toast/toast.ts</context>
|
<context context-type="sourcefile">node_modules/.pnpm/@ng-bootstrap+ng-bootstrap@21.0.0_@angular+common@22.3.0_@angular+core@22.3.0_@angular+_a7f2e22ebef7f277c3d304e2c62cd610/node_modules/src/toast/toast.ts</context>
|
||||||
<context context-type="linenumber">80</context>
|
<context context-type="linenumber">80</context>
|
||||||
</context-group>
|
</context-group>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
|||||||
+30
-30
@@ -15,60 +15,60 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/cdk": "^22.2.4",
|
"@angular/cdk": "^22.3.0",
|
||||||
"@angular/common": "~22.2.3",
|
"@angular/common": "~22.3.0",
|
||||||
"@angular/compiler": "~22.2.3",
|
"@angular/compiler": "~22.3.0",
|
||||||
"@angular/core": "~22.2.3",
|
"@angular/core": "~22.3.0",
|
||||||
"@angular/forms": "~22.2.3",
|
"@angular/forms": "~22.3.0",
|
||||||
"@angular/localize": "~22.2.3",
|
"@angular/localize": "~22.3.0",
|
||||||
"@angular/platform-browser": "~22.2.3",
|
"@angular/platform-browser": "~22.3.0",
|
||||||
"@angular/router": "~22.2.3",
|
"@angular/router": "~22.3.0",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^21.0.0",
|
"@ng-bootstrap/ng-bootstrap": "^21.0.0",
|
||||||
"@ng-select/ng-select": "~24.2.1",
|
"@ng-select/ng-select": "~24.2.1",
|
||||||
"@ngneat/dirty-check-forms": "^3.0.3",
|
"@ngneat/dirty-check-forms": "^3.0.3",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"bootstrap": "^5.3.8",
|
"bootstrap": "^5.3.9",
|
||||||
"bootstrap-icons": "^1.13.2",
|
"bootstrap-icons": "^1.13.2",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"lodash-es": "^4.18.1",
|
"lodash-es": "^4.18.1",
|
||||||
"marked": "~18.1.1",
|
"marked": "~18.2.1",
|
||||||
"mime-names": "^1.0.0",
|
"mime-names": "^1.0.0",
|
||||||
"ngx-color": "^10.1.0",
|
"ngx-color": "^10.1.0",
|
||||||
"ngx-cookie-service": "^22.0.0",
|
"ngx-cookie-service": "^22.2.0",
|
||||||
"ngx-device-detector": "^12.0.0",
|
"ngx-device-detector": "^12.0.0",
|
||||||
"ngx-ui-tour-ng-bootstrap": "^19.0.0",
|
"ngx-ui-tour-ng-bootstrap": "^19.0.0",
|
||||||
"normalize-diacritics": "^5.0.0",
|
"normalize-diacritics": "^5.0.0",
|
||||||
"pdfjs-dist": "^6.4.299",
|
"pdfjs-dist": "^6.5.438",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.9.1",
|
||||||
"utif": "^3.1.0",
|
"utif": "^3.1.0",
|
||||||
"uuid": "^14.0.3"
|
"uuid": "^14.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-builders/jest": "^22.0.1",
|
"@angular-builders/jest": "^22.0.1",
|
||||||
"@angular-devkit/core": "^22.2.4",
|
"@angular-devkit/core": "^22.3.0",
|
||||||
"@angular-devkit/schematics": "^22.2.4",
|
"@angular-devkit/schematics": "^22.3.0",
|
||||||
"@angular-eslint/builder": "22.6.0",
|
"@angular-eslint/builder": "22.8.0",
|
||||||
"@angular-eslint/eslint-plugin": "22.6.0",
|
"@angular-eslint/eslint-plugin": "22.8.0",
|
||||||
"@angular-eslint/eslint-plugin-template": "22.6.0",
|
"@angular-eslint/eslint-plugin-template": "22.8.0",
|
||||||
"@angular-eslint/schematics": "22.6.0",
|
"@angular-eslint/schematics": "22.8.0",
|
||||||
"@angular-eslint/template-parser": "22.6.0",
|
"@angular-eslint/template-parser": "22.8.0",
|
||||||
"@angular/build": "22.2.4",
|
"@angular/build": "22.3.0",
|
||||||
"@angular/cli": "22.2.4",
|
"@angular/cli": "22.3.0",
|
||||||
"@angular/compiler-cli": "~22.2.3",
|
"@angular/compiler-cli": "~22.3.0",
|
||||||
"@playwright/test": "^1.64.1",
|
"@playwright/test": "^1.65.1",
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^26.6.5",
|
"@types/node": "^26.6.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.72.0",
|
"@typescript-eslint/eslint-plugin": "^8.74.0",
|
||||||
"@typescript-eslint/parser": "^8.72.0",
|
"@typescript-eslint/parser": "^8.74.0",
|
||||||
"@typescript-eslint/utils": "^8.72.0",
|
"@typescript-eslint/utils": "^8.74.0",
|
||||||
"eslint": "^10.13.0",
|
"eslint": "^10.15.0",
|
||||||
"jest": "30.5.2",
|
"jest": "30.5.2",
|
||||||
"jest-environment-jsdom": "^30.5.2",
|
"jest-environment-jsdom": "^30.5.2",
|
||||||
"jest-junit": "^17.0.0",
|
"jest-junit": "^17.0.0",
|
||||||
"jest-preset-angular": "^17.0.3",
|
"jest-preset-angular": "^17.0.3",
|
||||||
"jest-websocket-mock": "^2.5.0",
|
"jest-websocket-mock": "^2.5.0",
|
||||||
"prettier": "^3.9.10",
|
"prettier": "^3.10.1",
|
||||||
"prettier-plugin-organize-imports": "^4.3.0",
|
"prettier-plugin-organize-imports": "^4.3.0",
|
||||||
"ts-node": "~10.9.2",
|
"ts-node": "~10.9.2",
|
||||||
"typescript": "^6.0.3"
|
"typescript": "^6.0.3"
|
||||||
|
|||||||
Generated
+1670
-1235
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")
|
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):
|
class ViewerGrant(NamedTuple):
|
||||||
"""Direct user and group view grants for a single document.
|
"""Direct user and group view grants for a single document.
|
||||||
@@ -998,7 +1002,8 @@ class TantivyBackend:
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
term: Prefix to match against autocomplete words
|
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)
|
user: User for permission filtering (None for no filtering)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -1021,7 +1026,7 @@ class TantivyBackend:
|
|||||||
"autocomplete_word",
|
"autocomplete_word",
|
||||||
normalized_term,
|
normalized_term,
|
||||||
permission_query,
|
permission_query,
|
||||||
limit,
|
min(limit, MAX_AUTOCOMPLETE_LIMIT),
|
||||||
)
|
)
|
||||||
|
|
||||||
return [x[0] for x in matches]
|
return [x[0] for x in matches]
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
logger = logging.getLogger("paperless.serializers")
|
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
|
# https://www.django-rest-framework.org/api-guide/serializers/#example
|
||||||
class DynamicFieldsModelSerializer(serializers.ModelSerializer[Any]):
|
class DynamicFieldsModelSerializer(serializers.ModelSerializer[Any]):
|
||||||
@@ -1326,6 +1330,11 @@ class SavedViewFilterRuleSerializer(serializers.ModelSerializer[SavedViewFilterR
|
|||||||
|
|
||||||
class SavedViewSerializer(OwnedObjectSerializer):
|
class SavedViewSerializer(OwnedObjectSerializer):
|
||||||
filter_rules = SavedViewFilterRuleSerializer(many=True)
|
filter_rules = SavedViewFilterRuleSerializer(many=True)
|
||||||
|
display_fields = serializers.ListField(
|
||||||
|
child=serializers.CharField(),
|
||||||
|
required=False,
|
||||||
|
allow_null=True,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SavedView
|
model = SavedView
|
||||||
@@ -1467,11 +1476,13 @@ class SavedViewSerializer(OwnedObjectSerializer):
|
|||||||
attrs = super().validate(attrs)
|
attrs = super().validate(attrs)
|
||||||
if "display_fields" in attrs and attrs["display_fields"] is not None:
|
if "display_fields" in attrs and attrs["display_fields"] is not None:
|
||||||
for field in attrs["display_fields"]:
|
for field in attrs["display_fields"]:
|
||||||
if (
|
# i.e. 'custom_field_' followed by the id of a custom field
|
||||||
SavedView.DisplayFields.CUSTOM_FIELD[:-2] in field
|
custom_field = re.fullmatch(
|
||||||
): # i.e. check for 'custom_field_' prefix
|
rf"{re.escape(SavedView.DisplayFields.CUSTOM_FIELD[:-2])}(\d+)",
|
||||||
field_id = int(re.search(r"\d+", field)[0])
|
field,
|
||||||
if not CustomField.objects.filter(id=field_id).exists():
|
)
|
||||||
|
if custom_field:
|
||||||
|
if not CustomField.objects.filter(id=custom_field[1]).exists():
|
||||||
raise serializers.ValidationError(
|
raise serializers.ValidationError(
|
||||||
f"Invalid field: {field}",
|
f"Invalid field: {field}",
|
||||||
)
|
)
|
||||||
@@ -2363,8 +2374,9 @@ class PostDocumentSerializer(serializers.Serializer[dict[str, Any]]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def validate_document(self, document):
|
def validate_document(self, document):
|
||||||
document_data = document.file.read()
|
# libmagic only examines a bounded prefix, so an upload of any size is
|
||||||
mime_type = magic.from_buffer(document_data, mime=True)
|
# 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 not is_mime_type_supported(mime_type):
|
||||||
if (
|
if (
|
||||||
@@ -2380,7 +2392,7 @@ class PostDocumentSerializer(serializers.Serializer[dict[str, Any]]):
|
|||||||
_("File type %(type)s not supported") % {"type": mime_type},
|
_("File type %(type)s not supported") % {"type": mime_type},
|
||||||
)
|
)
|
||||||
|
|
||||||
return document.name, document_data
|
return document.name, document
|
||||||
|
|
||||||
def validate_correspondent(self, correspondent):
|
def validate_correspondent(self, correspondent):
|
||||||
if correspondent:
|
if correspondent:
|
||||||
|
|||||||
@@ -786,15 +786,15 @@ def cleanup_user_deletion(sender, instance: User | Group, **kwargs) -> None:
|
|||||||
if instance.pk in permissions.get("default_view_users", []):
|
if instance.pk in permissions.get("default_view_users", []):
|
||||||
permissions["default_view_users"].remove(instance.pk)
|
permissions["default_view_users"].remove(instance.pk)
|
||||||
updated = True
|
updated = True
|
||||||
if instance.pk in permissions.get("default_change_users", []):
|
if instance.pk in permissions.get("default_edit_users", []):
|
||||||
permissions["default_change_users"].remove(instance.pk)
|
permissions["default_edit_users"].remove(instance.pk)
|
||||||
updated = True
|
updated = True
|
||||||
elif isinstance(instance, Group):
|
elif isinstance(instance, Group):
|
||||||
if instance.pk in permissions.get("default_view_groups", []):
|
if instance.pk in permissions.get("default_view_groups", []):
|
||||||
permissions["default_view_groups"].remove(instance.pk)
|
permissions["default_view_groups"].remove(instance.pk)
|
||||||
updated = True
|
updated = True
|
||||||
if instance.pk in permissions.get("default_change_groups", []):
|
if instance.pk in permissions.get("default_edit_groups", []):
|
||||||
permissions["default_change_groups"].remove(instance.pk)
|
permissions["default_edit_groups"].remove(instance.pk)
|
||||||
updated = True
|
updated = True
|
||||||
if updated:
|
if updated:
|
||||||
ui_settings.settings["permissions"] = permissions
|
ui_settings.settings["permissions"] = permissions
|
||||||
|
|||||||
@@ -1069,6 +1069,13 @@ class TestAutocomplete:
|
|||||||
results = backend.autocomplete("micro", limit=10)
|
results = backend.autocomplete("micro", limit=10)
|
||||||
assert "microsoft" in results
|
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(
|
def test_results_ordered_by_document_frequency(
|
||||||
self,
|
self,
|
||||||
backend: TantivyBackend,
|
backend: TantivyBackend,
|
||||||
|
|||||||
@@ -2089,6 +2089,38 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase):
|
|||||||
self.assertIsNone(overrides.document_type_id)
|
self.assertIsNone(overrides.document_type_id)
|
||||||
self.assertIsNone(overrides.tag_ids)
|
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:
|
def test_upload_with_path_traversal_filename_is_reduced_to_basename(self) -> None:
|
||||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||||
id=str(uuid.uuid4()),
|
id=str(uuid.uuid4()),
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import pytest
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from rest_framework import status
|
||||||
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
|
from documents.models import CustomField
|
||||||
|
from documents.models import SavedView
|
||||||
|
|
||||||
|
|
||||||
|
class TestSavedViewDisplayFields:
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"value",
|
||||||
|
[
|
||||||
|
pytest.param(["custom_field_abc"], id="no-id"),
|
||||||
|
pytest.param(["custom_field_"], id="empty-id"),
|
||||||
|
pytest.param(["xcustom_field_{id}"], id="prefixed"),
|
||||||
|
pytest.param(["custom_field_{id}x"], id="suffixed"),
|
||||||
|
pytest.param([1], id="not-a-string"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_malformed_display_fields_are_a_400(
|
||||||
|
self,
|
||||||
|
admin_client: APIClient,
|
||||||
|
admin_user: User,
|
||||||
|
value: object,
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- A saved view and a custom field
|
||||||
|
WHEN:
|
||||||
|
- Its display fields are patched to something that names no field
|
||||||
|
THEN:
|
||||||
|
- The response is a 400 and the stored display fields are unchanged
|
||||||
|
"""
|
||||||
|
custom_field = CustomField.objects.create(
|
||||||
|
name="cf",
|
||||||
|
data_type=CustomField.FieldDataType.STRING,
|
||||||
|
)
|
||||||
|
view = SavedView.objects.create(
|
||||||
|
name="view",
|
||||||
|
owner=admin_user,
|
||||||
|
sort_field="created",
|
||||||
|
display_fields=["title"],
|
||||||
|
)
|
||||||
|
if isinstance(value, list):
|
||||||
|
value = [
|
||||||
|
item.format(id=custom_field.pk) if isinstance(item, str) else item
|
||||||
|
for item in value
|
||||||
|
]
|
||||||
|
|
||||||
|
response = admin_client.patch(
|
||||||
|
f"/api/saved_views/{view.pk}/",
|
||||||
|
{"display_fields": value},
|
||||||
|
format="json",
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||||
|
view.refresh_from_db()
|
||||||
|
assert view.display_fields == ["title"]
|
||||||
|
|
||||||
|
def test_a_custom_field_display_name_is_accepted(
|
||||||
|
self,
|
||||||
|
admin_client: APIClient,
|
||||||
|
admin_user: User,
|
||||||
|
) -> None:
|
||||||
|
custom_field = CustomField.objects.create(
|
||||||
|
name="cf",
|
||||||
|
data_type=CustomField.FieldDataType.STRING,
|
||||||
|
)
|
||||||
|
view = SavedView.objects.create(
|
||||||
|
name="view",
|
||||||
|
owner=admin_user,
|
||||||
|
sort_field="created",
|
||||||
|
)
|
||||||
|
|
||||||
|
response = admin_client.patch(
|
||||||
|
f"/api/saved_views/{view.pk}/",
|
||||||
|
{"display_fields": ["title", f"custom_field_{custom_field.pk}"]},
|
||||||
|
format="json",
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_200_OK
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.core.management.base import CommandError
|
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)
|
param = next(p for p in params if p["name"] == param_name)
|
||||||
assert param["schema"] == {"type": "array", "items": {"type": "integer"}}
|
assert param["schema"] == {"type": "array", "items": {"type": "integer"}}
|
||||||
assert param["explode"] is False
|
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"]
|
||||||
@@ -671,8 +671,8 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
|||||||
content="things i paid for in august",
|
content="things i paid for in august",
|
||||||
pk=2,
|
pk=2,
|
||||||
checksum="B",
|
checksum="B",
|
||||||
# 1 month, 1 day ago
|
# More than 1 month ago, in the search timezone
|
||||||
added=timezone.now() - relativedelta(months=1, days=1),
|
added=timezone.localtime() - relativedelta(months=1, days=7),
|
||||||
)
|
)
|
||||||
d3 = Document.objects.create(
|
d3 = Document.objects.create(
|
||||||
title="bank statement 3",
|
title="bank statement 3",
|
||||||
@@ -706,6 +706,10 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
|||||||
@override_settings(
|
@override_settings(
|
||||||
TIME_ZONE="America/Denver",
|
TIME_ZONE="America/Denver",
|
||||||
)
|
)
|
||||||
|
@time_machine.travel(
|
||||||
|
datetime.datetime(2026, 12, 1, 0, 1, tzinfo=datetime.UTC),
|
||||||
|
tick=False,
|
||||||
|
)
|
||||||
def test_search_added_in_last_month_timezone_behind(self) -> None:
|
def test_search_added_in_last_month_timezone_behind(self) -> None:
|
||||||
"""
|
"""
|
||||||
GIVEN:
|
GIVEN:
|
||||||
@@ -729,8 +733,8 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
|||||||
content="things i paid for in august",
|
content="things i paid for in august",
|
||||||
pk=2,
|
pk=2,
|
||||||
checksum="B",
|
checksum="B",
|
||||||
# 1 month, 1 day ago
|
# More than 1 month ago, in the search timezone
|
||||||
added=timezone.now() - relativedelta(months=1, days=1),
|
added=timezone.localtime() - relativedelta(months=1, days=7),
|
||||||
)
|
)
|
||||||
d3 = Document.objects.create(
|
d3 = Document.objects.create(
|
||||||
title="bank statement 3",
|
title="bank statement 3",
|
||||||
@@ -996,6 +1000,9 @@ class TestDocumentSearchApi(DirectoriesMixin, APITestCase):
|
|||||||
response = self.client.get("/api/search/autocomplete/?term=test&limit=-1")
|
response = self.client.get("/api/search/autocomplete/?term=test&limit=-1")
|
||||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
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/")
|
response = self.client.get("/api/search/autocomplete/")
|
||||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
|||||||
+116
-20
@@ -942,7 +942,7 @@ class EmailDocumentDetailSchema(EmailSerializer):
|
|||||||
parameters=[
|
parameters=[
|
||||||
OpenApiParameter(
|
OpenApiParameter(
|
||||||
name="id",
|
name="id",
|
||||||
type=OpenApiTypes.STR,
|
type=OpenApiTypes.INT,
|
||||||
location=OpenApiParameter.PATH,
|
location=OpenApiParameter.PATH,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -1036,6 +1036,14 @@ class DocumentViewSet(
|
|||||||
# Bound the IN clauses used for search results and through-table lookups.
|
# Bound the IN clauses used for search results and through-table lookups.
|
||||||
selection_data_batch_size = 10_000
|
selection_data_batch_size = 10_000
|
||||||
|
|
||||||
|
def initial(self, request, *args, **kwargs):
|
||||||
|
super().initial(request, *args, **kwargs)
|
||||||
|
# Only ASCII digits can be a document id, reject anything else here, before
|
||||||
|
# any action calls int() on it
|
||||||
|
pk = kwargs.get("pk")
|
||||||
|
if pk is not None and not (pk.isascii() and pk.isdigit()):
|
||||||
|
raise Http404
|
||||||
|
|
||||||
def _get_selection_data_for_queryset(
|
def _get_selection_data_for_queryset(
|
||||||
self,
|
self,
|
||||||
queryset: QuerySet[Document],
|
queryset: QuerySet[Document],
|
||||||
@@ -2205,7 +2213,7 @@ class DocumentViewSet(
|
|||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
try:
|
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")
|
version_label = serializer.validated_data.get("version_label")
|
||||||
|
|
||||||
t = int(mktime(datetime.now().timetuple()))
|
t = int(mktime(datetime.now().timetuple()))
|
||||||
@@ -2216,7 +2224,9 @@ class DocumentViewSet(
|
|||||||
pathvalidate.sanitize_filename(doc_name),
|
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))
|
os.utime(temp_file_path, times=(t, t))
|
||||||
|
|
||||||
@@ -2884,6 +2894,13 @@ class UnifiedSearchViewSet(DocumentViewSet):
|
|||||||
return Response(max_asn + 1)
|
return Response(max_asn + 1)
|
||||||
|
|
||||||
|
|
||||||
|
LOG_FILES = {
|
||||||
|
"paperless": "paperless.log",
|
||||||
|
"mail": "mail.log",
|
||||||
|
"celery": "celery.log",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@extend_schema_view(
|
@extend_schema_view(
|
||||||
list=extend_schema(
|
list=extend_schema(
|
||||||
description="Logs view",
|
description="Logs view",
|
||||||
@@ -2901,6 +2918,7 @@ class UnifiedSearchViewSet(DocumentViewSet):
|
|||||||
name="id",
|
name="id",
|
||||||
type=OpenApiTypes.STR,
|
type=OpenApiTypes.STR,
|
||||||
location=OpenApiParameter.PATH,
|
location=OpenApiParameter.PATH,
|
||||||
|
enum=list(LOG_FILES),
|
||||||
),
|
),
|
||||||
OpenApiParameter(
|
OpenApiParameter(
|
||||||
name="limit",
|
name="limit",
|
||||||
@@ -2921,18 +2939,12 @@ class UnifiedSearchViewSet(DocumentViewSet):
|
|||||||
class LogViewSet(ViewSet):
|
class LogViewSet(ViewSet):
|
||||||
permission_classes = (IsAuthenticated, PaperlessAdminPermissions)
|
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:
|
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):
|
def retrieve(self, request, *args, **kwargs):
|
||||||
log_key = kwargs.get("pk")
|
log_key = kwargs.get("pk")
|
||||||
if log_key not in self.ALLOWED_LOG_FILES:
|
if log_key not in LOG_FILES:
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
log_file = self.get_log_file(log_key)
|
log_file = self.get_log_file(log_key)
|
||||||
@@ -2961,9 +2973,7 @@ class LogViewSet(ViewSet):
|
|||||||
|
|
||||||
def list(self, request, *args, **kwargs):
|
def list(self, request, *args, **kwargs):
|
||||||
existing_logs = [
|
existing_logs = [
|
||||||
log_key
|
log_key for log_key in LOG_FILES if self.get_log_file(log_key).is_file()
|
||||||
for log_key in self.ALLOWED_LOG_FILES
|
|
||||||
if self.get_log_file(log_key).is_file()
|
|
||||||
]
|
]
|
||||||
return Response(existing_logs)
|
return Response(existing_logs)
|
||||||
|
|
||||||
@@ -3498,7 +3508,7 @@ class PostDocumentView(GenericAPIView[Any]):
|
|||||||
serializer = self.get_serializer(data=request.data)
|
serializer = self.get_serializer(data=request.data)
|
||||||
serializer.is_valid(raise_exception=True)
|
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)
|
doc_name = normalize("NFC", doc_name)
|
||||||
correspondent_id = serializer.validated_data.get("correspondent")
|
correspondent_id = serializer.validated_data.get("correspondent")
|
||||||
document_type_id = serializer.validated_data.get("document_type")
|
document_type_id = serializer.validated_data.get("document_type")
|
||||||
@@ -3518,7 +3528,9 @@ class PostDocumentView(GenericAPIView[Any]):
|
|||||||
pathvalidate.sanitize_filename(doc_name),
|
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))
|
os.utime(temp_file_path, times=(t, t))
|
||||||
|
|
||||||
@@ -3733,7 +3745,10 @@ class SearchAutoCompleteView(GenericAPIView[Any]):
|
|||||||
return HttpResponseBadRequest("Term required")
|
return HttpResponseBadRequest("Term required")
|
||||||
|
|
||||||
if "limit" in request.query_params:
|
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:
|
if limit <= 0:
|
||||||
return HttpResponseBadRequest("Invalid limit")
|
return HttpResponseBadRequest("Invalid limit")
|
||||||
else:
|
else:
|
||||||
@@ -4009,7 +4024,36 @@ class GlobalSearchView(PassUserMixin):
|
|||||||
get=extend_schema(
|
get=extend_schema(
|
||||||
description="Get statistics for the current user",
|
description="Get statistics for the current user",
|
||||||
responses={
|
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 +4538,13 @@ def get_github_stars() -> int | None:
|
|||||||
get=extend_schema(
|
get=extend_schema(
|
||||||
description="Get the current version of the Paperless-NGX server",
|
description="Get the current version of the Paperless-NGX server",
|
||||||
responses={
|
responses={
|
||||||
(200, "application/json"): OpenApiTypes.OBJECT,
|
(200, "application/json"): inline_serializer(
|
||||||
|
name="RemoteVersion",
|
||||||
|
fields={
|
||||||
|
"version": serializers.CharField(),
|
||||||
|
"update_available": serializers.BooleanField(),
|
||||||
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -4559,7 +4609,17 @@ class RemoteVersionView(GenericAPIView[Any]):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
responses={
|
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 +5883,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):
|
class TrashView(ListModelMixin, PassUserMixin):
|
||||||
permission_classes = (IsAuthenticated, TrashPermissions)
|
permission_classes = (IsAuthenticated, TrashPermissions)
|
||||||
serializer_class = TrashSerializer
|
serializer_class = TrashSerializer
|
||||||
@@ -5971,6 +6051,22 @@ class OcrTemplateViewSet(BulkPermissionMixin, PassUserMixin, ModelViewSet[OcrTem
|
|||||||
]
|
]
|
||||||
return super().get_permissions()
|
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(
|
@action(
|
||||||
detail=False,
|
detail=False,
|
||||||
methods=["get"],
|
methods=["get"],
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: paperless-ngx\n"
|
"Project-Id-Version: paperless-ngx\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2026-11-27 02:54+0000\n"
|
"POT-Creation-Date: 2026-11-30 18:39+0000\n"
|
||||||
"PO-Revision-Date: 2022-02-17 04:17\n"
|
"PO-Revision-Date: 2022-02-17 04:17\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: English\n"
|
"Language-Team: English\n"
|
||||||
@@ -1879,49 +1879,49 @@ msgstr ""
|
|||||||
msgid "OCR template zones"
|
msgid "OCR template zones"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:491 documents/serialisers.py:815
|
#: documents/serialisers.py:495 documents/serialisers.py:819
|
||||||
#: documents/serialisers.py:2913 documents/views.py:372 documents/views.py:638
|
#: documents/serialisers.py:2918 documents/views.py:372 documents/views.py:638
|
||||||
#: documents/views.py:2868 paperless_mail/serialisers.py:145
|
#: documents/views.py:2878 paperless_mail/serialisers.py:145
|
||||||
msgid "Insufficient permissions."
|
msgid "Insufficient permissions."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:647
|
#: documents/serialisers.py:651
|
||||||
msgid "Invalid color."
|
msgid "Invalid color."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2380
|
#: documents/serialisers.py:2385
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "File type %(type)s not supported"
|
msgid "File type %(type)s not supported"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2424
|
#: documents/serialisers.py:2429
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Custom field id must be an integer: %(id)s"
|
msgid "Custom field id must be an integer: %(id)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2431
|
#: documents/serialisers.py:2436
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Custom field with id %(id)s does not exist"
|
msgid "Custom field with id %(id)s does not exist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2448 documents/serialisers.py:2458
|
#: documents/serialisers.py:2453 documents/serialisers.py:2463
|
||||||
msgid ""
|
msgid ""
|
||||||
"Custom fields must be a list of integers or an object mapping ids to values."
|
"Custom fields must be a list of integers or an object mapping ids to values."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2453
|
#: documents/serialisers.py:2458
|
||||||
msgid "Some custom fields don't exist or were specified twice."
|
msgid "Some custom fields don't exist or were specified twice."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2600
|
#: documents/serialisers.py:2605
|
||||||
msgid "Invalid variable detected."
|
msgid "Invalid variable detected."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2969
|
#: documents/serialisers.py:2974
|
||||||
msgid "Duplicate document identifiers are not allowed."
|
msgid "Duplicate document identifiers are not allowed."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/serialisers.py:2999 documents/views.py:5001
|
#: documents/serialisers.py:3004 documents/views.py:5061
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Documents not found: %(ids)s"
|
msgid "Documents not found: %(ids)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -2192,36 +2192,36 @@ msgstr ""
|
|||||||
msgid "Specify only one of text, title_search, query, or more_like_id."
|
msgid "Specify only one of text, title_search, query, or more_like_id."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:365 documents/views.py:2865
|
#: documents/views.py:365 documents/views.py:2875
|
||||||
msgid "Invalid more_like_id"
|
msgid "Invalid more_like_id"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:1697
|
#: documents/views.py:1705
|
||||||
msgid "Invalid AI configuration."
|
msgid "Invalid AI configuration."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:1708
|
#: documents/views.py:1716
|
||||||
msgid "AI backend request timed out."
|
msgid "AI backend request timed out."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:1720
|
#: documents/views.py:1728
|
||||||
msgid "AI backend rejected the request. Check logs for details."
|
msgid "AI backend rejected the request. Check logs for details."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:5017
|
#: documents/views.py:5077
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Insufficient permissions to share document %(id)s."
|
msgid "Insufficient permissions to share document %(id)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:5064
|
#: documents/views.py:5124
|
||||||
msgid "Bundle is already being processed."
|
msgid "Bundle is already being processed."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:5130
|
#: documents/views.py:5190
|
||||||
msgid "The share link bundle is still being prepared. Please try again later."
|
msgid "The share link bundle is still being prepared. Please try again later."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: documents/views.py:5144
|
#: documents/views.py:5204
|
||||||
msgid "The share link bundle is unavailable."
|
msgid "The share link bundle is unavailable."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -2661,7 +2661,7 @@ msgstr ""
|
|||||||
msgid "Chinese Traditional"
|
msgid "Chinese Traditional"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: paperless/urls.py:452
|
#: paperless/urls.py:455
|
||||||
msgid "Paperless-ngx administration"
|
msgid "Paperless-ngx administration"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
@@ -374,15 +374,19 @@ class TikaDocumentParser:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
parsed = self._tika_client.metadata.from_file(document_path, mime_type)
|
parsed = self._tika_client.metadata.from_file(document_path, mime_type)
|
||||||
return [
|
metadata: list[MetadataEntry] = []
|
||||||
{
|
for key, value in parsed.data.items():
|
||||||
"namespace": "",
|
if isinstance(value, list):
|
||||||
"prefix": "",
|
value = " ".join(str(item) for item in value)
|
||||||
"key": key,
|
metadata.append(
|
||||||
"value": parsed.data[key],
|
{
|
||||||
}
|
"namespace": "",
|
||||||
for key in parsed.data
|
"prefix": "",
|
||||||
]
|
"key": key,
|
||||||
|
"value": str(value),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return metadata
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Error while fetching document metadata for %s: %s",
|
"Error while fetching document metadata for %s: %s",
|
||||||
|
|||||||
@@ -365,3 +365,8 @@ class ApplicationConfigurationSerializer(
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = ApplicationConfiguration
|
model = ApplicationConfiguration
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
|
class TOTPActivationSerializer(serializers.Serializer[dict[str, str]]):
|
||||||
|
secret = serializers.CharField()
|
||||||
|
code = serializers.CharField()
|
||||||
@@ -131,8 +131,10 @@ class TestTikaParser:
|
|||||||
httpx_mock.add_response(
|
httpx_mock.add_response(
|
||||||
json={
|
json={
|
||||||
"Content-Type": "application/vnd.oasis.opendocument.text",
|
"Content-Type": "application/vnd.oasis.opendocument.text",
|
||||||
"X-TIKA:Parsed-By": [],
|
"X-TIKA:Parsed-By": ["ParserA", "ParserB"],
|
||||||
|
"X-TIKA:Parsed-By-Full-Set": [],
|
||||||
"Some-key": "value",
|
"Some-key": "value",
|
||||||
|
"meta:page-count": 2,
|
||||||
"dcterms:created": "2020-11-21T00:00:00",
|
"dcterms:created": "2020-11-21T00:00:00",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -144,6 +146,11 @@ class TestTikaParser:
|
|||||||
|
|
||||||
assert "dcterms:created" in [m["key"] for m in metadata]
|
assert "dcterms:created" in [m["key"] for m in metadata]
|
||||||
assert "Some-key" in [m["key"] for m in metadata]
|
assert "Some-key" in [m["key"] for m in metadata]
|
||||||
|
values = {entry["key"]: entry["value"] for entry in metadata}
|
||||||
|
assert values["X-TIKA:Parsed-By"] == "ParserA ParserB"
|
||||||
|
assert values["X-TIKA:Parsed-By-Full-Set"] == ""
|
||||||
|
assert values["meta:page-count"] == "2"
|
||||||
|
assert all(isinstance(value, str) for value in values.values())
|
||||||
|
|
||||||
def test_convert_failure(
|
def test_convert_failure(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
import pytest
|
||||||
|
from django.test import Client
|
||||||
|
from rest_framework import status
|
||||||
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
|
|
||||||
|
class TestUnmatchedApiPaths:
|
||||||
|
@pytest.mark.parametrize("method", ["get", "post", "put", "patch", "delete"])
|
||||||
|
def test_unmatched_api_path_is_a_json_404(
|
||||||
|
self,
|
||||||
|
rest_api_client: APIClient,
|
||||||
|
method: str,
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- An unauthenticated client
|
||||||
|
WHEN:
|
||||||
|
- Any method is sent to an /api/ URL that no route matches
|
||||||
|
THEN:
|
||||||
|
- The response is a JSON 404, not a redirect to the login page
|
||||||
|
"""
|
||||||
|
response = getattr(rest_api_client, method)("/api/this_does_not_exist/")
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_404_NOT_FOUND
|
||||||
|
assert response["Content-Type"].startswith("application/json")
|
||||||
|
|
||||||
|
def test_unmatched_api_path_is_a_json_404_when_authenticated(
|
||||||
|
self,
|
||||||
|
admin_client: APIClient,
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- An authenticated client
|
||||||
|
WHEN:
|
||||||
|
- An /api/ URL that no route matches is requested
|
||||||
|
THEN:
|
||||||
|
- The response is a JSON 404, not the frontend page
|
||||||
|
"""
|
||||||
|
response = admin_client.get("/api/this/is/nested/and/missing/")
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_404_NOT_FOUND
|
||||||
|
assert response["Content-Type"].startswith("application/json")
|
||||||
|
|
||||||
|
def test_other_paths_still_reach_the_frontend_catch_all(
|
||||||
|
self,
|
||||||
|
client: Client,
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- An anonymous browser request
|
||||||
|
WHEN:
|
||||||
|
- A non-API path is requested
|
||||||
|
THEN:
|
||||||
|
- The frontend catch-all still applies, which sends the user to log in
|
||||||
|
"""
|
||||||
|
response = client.get("/documents/")
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_302_FOUND
|
||||||
|
assert "login" in response["Location"]
|
||||||
|
|
||||||
|
|
||||||
|
class TestDocumentRouteIds:
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"action",
|
||||||
|
[
|
||||||
|
"download",
|
||||||
|
"history",
|
||||||
|
"metadata",
|
||||||
|
"notes",
|
||||||
|
"preview",
|
||||||
|
"root",
|
||||||
|
"share_links",
|
||||||
|
"suggestions",
|
||||||
|
"thumb",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrize("pk", ["null", "true", "abc", "0.5", "%20"])
|
||||||
|
def test_non_numeric_document_id_is_a_json_404(
|
||||||
|
self,
|
||||||
|
admin_client: APIClient,
|
||||||
|
action: str,
|
||||||
|
pk: str,
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- An authenticated client
|
||||||
|
WHEN:
|
||||||
|
- A document sub-route is requested with an id that is not a number
|
||||||
|
THEN:
|
||||||
|
- The response is a JSON 404, not a server error
|
||||||
|
"""
|
||||||
|
response = admin_client.get(f"/api/documents/{pk}/{action}/")
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_404_NOT_FOUND
|
||||||
|
assert response["Content-Type"].startswith("application/json")
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import pytest
|
||||||
|
from rest_framework import status
|
||||||
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
|
|
||||||
|
class TestTotpView:
|
||||||
|
def test_options_does_not_fail(self, admin_client: APIClient) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- An authenticated client
|
||||||
|
WHEN:
|
||||||
|
- OPTIONS is sent to the TOTP endpoint
|
||||||
|
THEN:
|
||||||
|
- The request succeeds, DRF's metadata needs a serializer on the view
|
||||||
|
"""
|
||||||
|
response = admin_client.options("/api/profile/totp/")
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_200_OK
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"body",
|
||||||
|
[{}, {"secret": "abc"}, {"code": "123456"}, {"secret": None, "code": None}],
|
||||||
|
)
|
||||||
|
def test_activation_with_missing_fields_is_a_400(
|
||||||
|
self,
|
||||||
|
admin_client: APIClient,
|
||||||
|
body: dict[str, str | None],
|
||||||
|
) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- An authenticated client
|
||||||
|
WHEN:
|
||||||
|
- TOTP is activated without both the secret and the code
|
||||||
|
THEN:
|
||||||
|
- The response is a 400, not a server error
|
||||||
|
"""
|
||||||
|
response = admin_client.post("/api/profile/totp/", body, format="json")
|
||||||
|
|
||||||
|
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||||
@@ -658,9 +658,9 @@ class TestUserGroupDeletionCleanup(TestCase):
|
|||||||
"permissions": {
|
"permissions": {
|
||||||
"default_owner": user2.id,
|
"default_owner": user2.id,
|
||||||
"default_view_users": [user2.id],
|
"default_view_users": [user2.id],
|
||||||
"default_change_users": [user2.id],
|
"default_edit_users": [user2.id],
|
||||||
"default_view_groups": [group.id],
|
"default_view_groups": [group.id],
|
||||||
"default_change_groups": [group.id],
|
"default_edit_groups": [group.id],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -670,13 +670,13 @@ class TestUserGroupDeletionCleanup(TestCase):
|
|||||||
permissions = ui_settings.settings.get("permissions", {})
|
permissions = ui_settings.settings.get("permissions", {})
|
||||||
self.assertIsNone(permissions.get("default_owner"))
|
self.assertIsNone(permissions.get("default_owner"))
|
||||||
self.assertEqual(permissions.get("default_view_users"), [])
|
self.assertEqual(permissions.get("default_view_users"), [])
|
||||||
self.assertEqual(permissions.get("default_change_users"), [])
|
self.assertEqual(permissions.get("default_edit_users"), [])
|
||||||
|
|
||||||
group.delete()
|
group.delete()
|
||||||
ui_settings.refresh_from_db()
|
ui_settings.refresh_from_db()
|
||||||
permissions = ui_settings.settings.get("permissions", {})
|
permissions = ui_settings.settings.get("permissions", {})
|
||||||
self.assertEqual(permissions.get("default_view_groups"), [])
|
self.assertEqual(permissions.get("default_view_groups"), [])
|
||||||
self.assertEqual(permissions.get("default_change_groups"), [])
|
self.assertEqual(permissions.get("default_edit_groups"), [])
|
||||||
|
|
||||||
def test_user_group_deletion_error_handling(self) -> None:
|
def test_user_group_deletion_error_handling(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ from documents.views import WorkflowTriggerViewSet
|
|||||||
from documents.views import WorkflowViewSet
|
from documents.views import WorkflowViewSet
|
||||||
from documents.views import serve_logo
|
from documents.views import serve_logo
|
||||||
from paperless.consumers import StatusConsumer
|
from paperless.consumers import StatusConsumer
|
||||||
|
from paperless.views import ApiNotFoundView
|
||||||
from paperless.views import ApplicationConfigurationViewSet
|
from paperless.views import ApplicationConfigurationViewSet
|
||||||
from paperless.views import DisconnectSocialAccountView
|
from paperless.views import DisconnectSocialAccountView
|
||||||
from paperless.views import FaviconView
|
from paperless.views import FaviconView
|
||||||
@@ -309,6 +310,8 @@ urlpatterns = [
|
|||||||
RedirectView.as_view(url="schema/view/"),
|
RedirectView.as_view(url="schema/view/"),
|
||||||
),
|
),
|
||||||
*api_router.urls,
|
*api_router.urls,
|
||||||
|
# Must stay last, anything unmatched under /api/ is a JSON 404
|
||||||
|
re_path(r"^.*$", ApiNotFoundView.as_view(), name="api_not_found"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
+55
-6
@@ -24,9 +24,12 @@ from django_filters.rest_framework import DjangoFilterBackend
|
|||||||
from drf_spectacular.types import OpenApiTypes
|
from drf_spectacular.types import OpenApiTypes
|
||||||
from drf_spectacular.utils import extend_schema
|
from drf_spectacular.utils import extend_schema
|
||||||
from drf_spectacular.utils import extend_schema_view
|
from drf_spectacular.utils import extend_schema_view
|
||||||
|
from drf_spectacular.utils import inline_serializer
|
||||||
|
from rest_framework import serializers
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
from rest_framework.authtoken.views import ObtainAuthToken
|
from rest_framework.authtoken.views import ObtainAuthToken
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
|
from rest_framework.exceptions import NotFound
|
||||||
from rest_framework.exceptions import ValidationError
|
from rest_framework.exceptions import ValidationError
|
||||||
from rest_framework.fields import BooleanField
|
from rest_framework.fields import BooleanField
|
||||||
from rest_framework.filters import OrderingFilter
|
from rest_framework.filters import OrderingFilter
|
||||||
@@ -35,6 +38,7 @@ from rest_framework.pagination import PageNumberPagination
|
|||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.throttling import ScopedRateThrottle
|
from rest_framework.throttling import ScopedRateThrottle
|
||||||
|
from rest_framework.views import APIView
|
||||||
from rest_framework.viewsets import ModelViewSet
|
from rest_framework.viewsets import ModelViewSet
|
||||||
|
|
||||||
from documents.models import PaperlessTask
|
from documents.models import PaperlessTask
|
||||||
@@ -49,6 +53,7 @@ from paperless.serialisers import ApplicationConfigurationSerializer
|
|||||||
from paperless.serialisers import GroupSerializer
|
from paperless.serialisers import GroupSerializer
|
||||||
from paperless.serialisers import PaperlessAuthTokenSerializer
|
from paperless.serialisers import PaperlessAuthTokenSerializer
|
||||||
from paperless.serialisers import ProfileSerializer
|
from paperless.serialisers import ProfileSerializer
|
||||||
|
from paperless.serialisers import TOTPActivationSerializer
|
||||||
from paperless.serialisers import UserSerializer
|
from paperless.serialisers import UserSerializer
|
||||||
|
|
||||||
|
|
||||||
@@ -274,8 +279,16 @@ class ProfileView(GenericAPIView[Any]):
|
|||||||
|
|
||||||
@extend_schema_view(
|
@extend_schema_view(
|
||||||
get=extend_schema(
|
get=extend_schema(
|
||||||
|
description="Generate a new TOTP secret, its otpauth URL and a QR code",
|
||||||
responses={
|
responses={
|
||||||
(200, "application/json"): OpenApiTypes.OBJECT,
|
(200, "application/json"): inline_serializer(
|
||||||
|
name="TotpSetup",
|
||||||
|
fields={
|
||||||
|
"url": serializers.CharField(),
|
||||||
|
"qr_svg": serializers.CharField(help_text="QR code as an SVG"),
|
||||||
|
"secret": serializers.CharField(),
|
||||||
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
post=extend_schema(
|
post=extend_schema(
|
||||||
@@ -290,7 +303,17 @@ class ProfileView(GenericAPIView[Any]):
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
responses={
|
responses={
|
||||||
(200, "application/json"): OpenApiTypes.OBJECT,
|
(200, "application/json"): inline_serializer(
|
||||||
|
name="TotpActivation",
|
||||||
|
fields={
|
||||||
|
"success": serializers.BooleanField(),
|
||||||
|
"recovery_codes": serializers.ListField(
|
||||||
|
child=serializers.CharField(),
|
||||||
|
allow_null=True,
|
||||||
|
help_text="Only returned when the code was valid",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
delete=extend_schema(
|
delete=extend_schema(
|
||||||
@@ -306,6 +329,7 @@ class TOTPView(GenericAPIView[Any]):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
permission_classes = [IsAuthenticated]
|
permission_classes = [IsAuthenticated]
|
||||||
|
serializer_class = TOTPActivationSerializer
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
@@ -328,15 +352,18 @@ class TOTPView(GenericAPIView[Any]):
|
|||||||
"""
|
"""
|
||||||
Validates a TOTP code and activates the TOTP authenticator
|
Validates a TOTP code and activates the TOTP authenticator
|
||||||
"""
|
"""
|
||||||
|
serializer = self.get_serializer(data=request.data)
|
||||||
|
serializer.is_valid(raise_exception=True)
|
||||||
|
secret = serializer.validated_data["secret"]
|
||||||
valid = totp_auth.validate_totp_code(
|
valid = totp_auth.validate_totp_code(
|
||||||
request.data["secret"],
|
secret,
|
||||||
request.data["code"],
|
serializer.validated_data["code"],
|
||||||
)
|
)
|
||||||
recovery_codes = None
|
recovery_codes = None
|
||||||
if valid:
|
if valid:
|
||||||
auth = totp_auth.TOTP.activate(
|
auth = totp_auth.TOTP.activate(
|
||||||
request.user,
|
request.user,
|
||||||
request.data["secret"],
|
secret,
|
||||||
).instance
|
).instance
|
||||||
signals.authenticator_added.send(
|
signals.authenticator_added.send(
|
||||||
sender=Authenticator,
|
sender=Authenticator,
|
||||||
@@ -523,7 +550,14 @@ class DisconnectSocialAccountView(GenericAPIView[Any]):
|
|||||||
@extend_schema_view(
|
@extend_schema_view(
|
||||||
get=extend_schema(
|
get=extend_schema(
|
||||||
responses={
|
responses={
|
||||||
(200, "application/json"): OpenApiTypes.OBJECT,
|
(200, "application/json"): inline_serializer(
|
||||||
|
name="SocialAccountProvider",
|
||||||
|
fields={
|
||||||
|
"name": serializers.CharField(),
|
||||||
|
"login_url": serializers.CharField(),
|
||||||
|
},
|
||||||
|
many=True,
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -557,3 +591,18 @@ class SocialAccountProvidersView(GenericAPIView[Any]):
|
|||||||
]
|
]
|
||||||
|
|
||||||
return Response(sorted(resp, key=lambda p: p["name"]))
|
return Response(sorted(resp, key=lambda p: p["name"]))
|
||||||
|
|
||||||
|
|
||||||
|
@extend_schema(exclude=True)
|
||||||
|
class ApiNotFoundView(APIView):
|
||||||
|
"""
|
||||||
|
A JSON 404 for any /api/ URL that no other route matches. Without this, those
|
||||||
|
URLs fall through to the frontend catch-all, which answers a redirect to the
|
||||||
|
login page or the single page app, never an error an API client can read.
|
||||||
|
"""
|
||||||
|
|
||||||
|
authentication_classes = ()
|
||||||
|
permission_classes = ()
|
||||||
|
|
||||||
|
def initial(self, request, *args, **kwargs):
|
||||||
|
raise NotFound
|
||||||
+40
-48
@@ -2,6 +2,7 @@ import datetime
|
|||||||
import imaplib
|
import imaplib
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -893,8 +894,6 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
def _handle_message(self, message, rule: MailRule) -> int:
|
def _handle_message(self, message, rule: MailRule) -> int:
|
||||||
message = self._preprocess_message(message)
|
message = self._preprocess_message(message)
|
||||||
|
|
||||||
processed_elements = 0
|
|
||||||
|
|
||||||
# Skip Message handling when only attachments are to be processed but
|
# Skip Message handling when only attachments are to be processed but
|
||||||
# message doesn't have any.
|
# message doesn't have any.
|
||||||
if (
|
if (
|
||||||
@@ -902,7 +901,7 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
and rule.consumption_scope == MailRule.ConsumptionScope.ATTACHMENTS_ONLY
|
and rule.consumption_scope == MailRule.ConsumptionScope.ATTACHMENTS_ONLY
|
||||||
):
|
):
|
||||||
self._record_processed_without_consumption(message, rule)
|
self._record_processed_without_consumption(message, rule)
|
||||||
return processed_elements
|
return 0
|
||||||
|
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
f"Rule {rule}: "
|
f"Rule {rule}: "
|
||||||
@@ -913,29 +912,47 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
tag_ids: list[int] = [tag.id for tag in rule.assign_tags.all()]
|
tag_ids: list[int] = [tag.id for tag in rule.assign_tags.all()]
|
||||||
doc_type = rule.assign_document_type
|
doc_type = rule.assign_document_type
|
||||||
|
|
||||||
|
consume_tasks: list[Signature] = []
|
||||||
|
|
||||||
if (
|
if (
|
||||||
rule.consumption_scope == MailRule.ConsumptionScope.EML_ONLY
|
rule.consumption_scope == MailRule.ConsumptionScope.EML_ONLY
|
||||||
or rule.consumption_scope == MailRule.ConsumptionScope.EVERYTHING
|
or rule.consumption_scope == MailRule.ConsumptionScope.EVERYTHING
|
||||||
):
|
):
|
||||||
processed_elements += self._process_eml(
|
consume_tasks.append(
|
||||||
message,
|
self._build_eml_task(
|
||||||
rule,
|
message,
|
||||||
tag_ids,
|
rule,
|
||||||
doc_type,
|
tag_ids,
|
||||||
|
doc_type,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
rule.consumption_scope == MailRule.ConsumptionScope.ATTACHMENTS_ONLY
|
rule.consumption_scope == MailRule.ConsumptionScope.ATTACHMENTS_ONLY
|
||||||
or rule.consumption_scope == MailRule.ConsumptionScope.EVERYTHING
|
or rule.consumption_scope == MailRule.ConsumptionScope.EVERYTHING
|
||||||
):
|
):
|
||||||
processed_elements += self._process_attachments(
|
consume_tasks.extend(
|
||||||
message,
|
self._build_attachment_tasks(
|
||||||
rule,
|
message,
|
||||||
tag_ids,
|
rule,
|
||||||
doc_type,
|
tag_ids,
|
||||||
|
doc_type,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
return processed_elements
|
# One chord per message, so the mail action and the ProcessedMail row
|
||||||
|
# are written once, after every part of the message has been consumed
|
||||||
|
if consume_tasks:
|
||||||
|
queue_consumption_tasks(
|
||||||
|
consume_tasks=consume_tasks,
|
||||||
|
rule=rule,
|
||||||
|
message=message,
|
||||||
|
uid_validity=self._current_uid_validity,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self._record_processed_without_consumption(message, rule)
|
||||||
|
|
||||||
|
return len(consume_tasks)
|
||||||
|
|
||||||
def _record_processed_without_consumption(
|
def _record_processed_without_consumption(
|
||||||
self,
|
self,
|
||||||
@@ -994,16 +1011,14 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _process_attachments(
|
def _build_attachment_tasks(
|
||||||
self,
|
self,
|
||||||
message: MailMessage,
|
message: MailMessage,
|
||||||
rule: MailRule,
|
rule: MailRule,
|
||||||
tag_ids,
|
tag_ids,
|
||||||
doc_type,
|
doc_type,
|
||||||
):
|
) -> list[Signature]:
|
||||||
processed_attachments = 0
|
consume_tasks: list[Signature] = []
|
||||||
|
|
||||||
consume_tasks = []
|
|
||||||
|
|
||||||
for att in message.attachments:
|
for att in message.attachments:
|
||||||
if (
|
if (
|
||||||
@@ -1104,8 +1119,6 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
consume_tasks.append(consume_task)
|
consume_tasks.append(consume_task)
|
||||||
|
|
||||||
processed_attachments += 1
|
|
||||||
else:
|
else:
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
f"Rule {rule}: "
|
f"Rule {rule}: "
|
||||||
@@ -1114,33 +1127,22 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
f"by paperless",
|
f"by paperless",
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(consume_tasks) > 0:
|
return consume_tasks
|
||||||
queue_consumption_tasks(
|
|
||||||
consume_tasks=consume_tasks,
|
|
||||||
rule=rule,
|
|
||||||
message=message,
|
|
||||||
uid_validity=self._current_uid_validity,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
# No files to consume, just mark as processed if it wasn't by .eml processing
|
|
||||||
self._record_processed_without_consumption(message, rule)
|
|
||||||
|
|
||||||
return processed_attachments
|
def _build_eml_task(
|
||||||
|
|
||||||
def _process_eml(
|
|
||||||
self,
|
self,
|
||||||
message: MailMessage,
|
message: MailMessage,
|
||||||
rule: MailRule,
|
rule: MailRule,
|
||||||
tag_ids,
|
tag_ids,
|
||||||
doc_type,
|
doc_type,
|
||||||
):
|
) -> Signature:
|
||||||
settings.SCRATCH_DIR.mkdir(parents=True, exist_ok=True)
|
settings.SCRATCH_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
_, temp_filename = tempfile.mkstemp(
|
fd, temp_filename = tempfile.mkstemp(
|
||||||
prefix="paperless-mail-",
|
prefix="paperless-mail-",
|
||||||
dir=settings.SCRATCH_DIR,
|
dir=settings.SCRATCH_DIR,
|
||||||
suffix=".eml",
|
suffix=".eml",
|
||||||
)
|
)
|
||||||
with Path(temp_filename).open("wb") as f:
|
with os.fdopen(fd, "wb") as f:
|
||||||
# Move "From"-header to beginning of file
|
# Move "From"-header to beginning of file
|
||||||
# TODO: This ugly workaround is needed because the parser is
|
# TODO: This ugly workaround is needed because the parser is
|
||||||
# chosen only by the mime_type detected via magic
|
# chosen only by the mime_type detected via magic
|
||||||
@@ -1191,17 +1193,7 @@ class MailAccountHandler(LoggingMixin):
|
|||||||
owner_id=rule.owner.id if rule.owner else None,
|
owner_id=rule.owner.id if rule.owner else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
consume_task = consume_file.s(
|
return consume_file.s(
|
||||||
input_doc=input_doc,
|
input_doc=input_doc,
|
||||||
overrides=doc_overrides,
|
overrides=doc_overrides,
|
||||||
).set(headers={"trigger_source": PaperlessTask.TriggerSource.EMAIL_CONSUME})
|
).set(headers={"trigger_source": PaperlessTask.TriggerSource.EMAIL_CONSUME})
|
||||||
|
|
||||||
queue_consumption_tasks(
|
|
||||||
consume_tasks=[consume_task],
|
|
||||||
rule=rule,
|
|
||||||
message=message,
|
|
||||||
uid_validity=self._current_uid_validity,
|
|
||||||
)
|
|
||||||
|
|
||||||
processed_elements = 1
|
|
||||||
return processed_elements
|
|
||||||
@@ -416,6 +416,44 @@ class TestMail(
|
|||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_handle_message_everything_scope_single_row(self) -> None:
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- A rule consuming the eml and attachments, and a mail with or
|
||||||
|
without attachments
|
||||||
|
WHEN:
|
||||||
|
- The mail is handled and its queued mail action is applied
|
||||||
|
THEN:
|
||||||
|
- The eml and attachments are queued together in one call
|
||||||
|
- Exactly one ProcessedMail row exists and it is not
|
||||||
|
PROCESSED_WO_CONSUMPTION
|
||||||
|
"""
|
||||||
|
rule = MailRule.objects.create(
|
||||||
|
account=MailAccount.objects.create(
|
||||||
|
name="test",
|
||||||
|
imap_server="",
|
||||||
|
username="admin",
|
||||||
|
password="secret",
|
||||||
|
),
|
||||||
|
consumption_scope=MailRule.ConsumptionScope.EVERYTHING,
|
||||||
|
)
|
||||||
|
|
||||||
|
for attachments in (0, 2):
|
||||||
|
with self.subTest(attachments=attachments):
|
||||||
|
self.mailMocker._queue_consumption_tasks_mock.reset_mock()
|
||||||
|
message = self.mailMocker.messageBuilder.create_message(
|
||||||
|
subject=f"{attachments} attachments",
|
||||||
|
attachments=attachments,
|
||||||
|
)
|
||||||
|
|
||||||
|
result = self.mail_account_handler._handle_message(message, rule)
|
||||||
|
self.mailMocker.apply_mail_actions()
|
||||||
|
|
||||||
|
self.assertEqual(result, 1 + attachments)
|
||||||
|
self.mailMocker._queue_consumption_tasks_mock.assert_called_once()
|
||||||
|
processed = ProcessedMail.objects.get(rule=rule, uid=message.uid)
|
||||||
|
self.assertEqual(processed.status, "SUCCESS")
|
||||||
|
|
||||||
def test_handle_empty_message_long_subject(self) -> None:
|
def test_handle_empty_message_long_subject(self) -> None:
|
||||||
"""
|
"""
|
||||||
GIVEN:
|
GIVEN:
|
||||||
|
|||||||
@@ -272,8 +272,6 @@ class TestMailMessageGpgDecryptor(TestMail):
|
|||||||
"override_title": message.subject,
|
"override_title": message.subject,
|
||||||
"override_filename": f"{message.subject}.eml",
|
"override_filename": f"{message.subject}.eml",
|
||||||
},
|
},
|
||||||
],
|
|
||||||
[
|
|
||||||
{"override_title": "file_0", "override_filename": "file_0.pdf"},
|
{"override_title": "file_0", "override_filename": "file_0.pdf"},
|
||||||
{"override_title": "file_1", "override_filename": "file_1.pdf"},
|
{"override_title": "file_1", "override_filename": "file_1.pdf"},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from django.http import HttpResponseRedirect
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
from drf_spectacular.types import OpenApiTypes
|
from drf_spectacular.types import OpenApiTypes
|
||||||
|
from drf_spectacular.utils import OpenApiParameter
|
||||||
from drf_spectacular.utils import extend_schema
|
from drf_spectacular.utils import extend_schema
|
||||||
from drf_spectacular.utils import extend_schema_view
|
from drf_spectacular.utils import extend_schema_view
|
||||||
from drf_spectacular.utils import inline_serializer
|
from drf_spectacular.utils import inline_serializer
|
||||||
@@ -254,8 +255,39 @@ class MailRuleViewSet(PassUserMixin, ModelViewSet[MailRule]):
|
|||||||
|
|
||||||
@extend_schema_view(
|
@extend_schema_view(
|
||||||
get=extend_schema(
|
get=extend_schema(
|
||||||
description="Callback view for OAuth2 authentication",
|
description=(
|
||||||
responses={200: None},
|
"Callback view for OAuth2 authentication. Redirects back to the "
|
||||||
|
"frontend, with the outcome in the query string"
|
||||||
|
),
|
||||||
|
parameters=[
|
||||||
|
OpenApiParameter(
|
||||||
|
name="code",
|
||||||
|
# An empty value is rejected
|
||||||
|
type={"type": "string", "minLength": 1},
|
||||||
|
location=OpenApiParameter.QUERY,
|
||||||
|
required=True,
|
||||||
|
description="Authorization code returned by the OAuth provider",
|
||||||
|
),
|
||||||
|
OpenApiParameter(
|
||||||
|
name="state",
|
||||||
|
# An empty value is rejected
|
||||||
|
type={"type": "string", "minLength": 1},
|
||||||
|
location=OpenApiParameter.QUERY,
|
||||||
|
required=True,
|
||||||
|
description="State value, must match the one stored in the session",
|
||||||
|
),
|
||||||
|
OpenApiParameter(
|
||||||
|
name="scope",
|
||||||
|
type=OpenApiTypes.STR,
|
||||||
|
location=OpenApiParameter.QUERY,
|
||||||
|
required=False,
|
||||||
|
description="Granted scopes, sent by Gmail but not by Outlook",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
responses={
|
||||||
|
302: None,
|
||||||
|
(400, "text/html"): OpenApiTypes.STR,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
class OauthCallbackView(GenericAPIView[Any]):
|
class OauthCallbackView(GenericAPIView[Any]):
|
||||||
|
|||||||
Reference in new issue
Block a user