pdfding: 1.4.1 -> 1.5.1

Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
This commit is contained in:
phanirithvij
2026-02-10 12:05:41 +05:30
parent 364039cf28
commit c2c711dd7f
5 changed files with 42 additions and 56 deletions
+2 -1
View File
@@ -85,6 +85,7 @@
-F "notes=" \
-F "tag_string=" \
-F "description=" \
-F "collection=1" \
-F "use_file_name=on" \
-F "name=test-upload" \
-F "file=@{test_pdf};type=application/pdf" \
@@ -100,7 +101,7 @@
""")
# verify pdf in user's dir
machine.succeed("test -f ${stateDir}/media/1/pdf/*.pdf")
machine.succeed("test -f ${stateDir}/media/1/default/pdf/*.pdf")
# verify one entry exists in sqlite db
machine.succeed("sqlite3 ${stateDir}/db/db.sqlite3 'SELECT COUNT(*) FROM pdf_pdf' | grep -q '^1$'")
+2 -2
View File
@@ -60,8 +60,8 @@
print(machine.succeed("consume-immediate"))
# verify pdf is in user's dir, and removed from consume dir
machine.wait_for_file("${stateDir}/media/1/pdf/dummy.pdf")
machine.fail("test -f ${stateDir}/consume/1/pdf/dummy.pdf")
machine.wait_for_file("${stateDir}/media/1/default/pdf/dummy.pdf")
machine.fail("test -f ${stateDir}/consume/1/default/pdf/dummy.pdf")
# verify pdf is also in postgres db
machine.succeed("sudo -u pdfding psql -tAc 'SELECT COUNT(*) FROM pdf_pdf' | grep -q '^1$'")
+4 -3
View File
@@ -133,6 +133,7 @@ in
-F "notes=" \
-F "tag_string=" \
-F "description=" \
-F "collection=1" \
-F "use_file_name=on" \
-F "name=test-upload" \
-F "file=@{test_pdf};type=application/pdf" \
@@ -148,7 +149,7 @@ in
""")
# verify pdf in user's dir
machine.succeed("test -f ${stateDir}/media/1/pdf/*.pdf")
machine.succeed("test -f ${stateDir}/media/1/default/pdf/*.pdf")
# verify one entry exists in sqlite db
machine.succeed("sqlite3 ${stateDir}/db/db.sqlite3 'SELECT COUNT(*) FROM pdf_pdf' | grep -q '^1$'")
@@ -163,8 +164,8 @@ in
print(machine.succeed("backup-immediate"))
# verify the backup s3 service has that pdf file
machine.wait_until_succeeds("mc stat garage/pdfding-bucket/1/pdf/dummy.pdf", timeout=10)
print(machine.succeed("mc stat garage/pdfding-bucket/1/pdf/dummy.pdf"))
machine.wait_until_succeeds("mc stat garage/pdfding-bucket/1/default/pdf/dummy.pdf", timeout=10)
print(machine.succeed("mc stat garage/pdfding-bucket/1/default/pdf/dummy.pdf"))
'';
# Debug interactively with:
+12 -18
View File
@@ -1,16 +1,17 @@
{
stdenv,
nodejs,
npmHooks,
fetchpatch2,
fetchNpmDeps,
fetchzip,
fetchFromGitHub,
npmHooks,
tailwindcss_4,
nodejs,
}:
let
pdfjsVersion = "5.4.296"; # see update script
pdfjsHash = "sha256-b4W7wETq2CIZm2rJCmXEYvPhQtCbXS76L7GDvng6wn4=";
pdfjsVersion = "5.4.394"; # see update script
pdfjsHash = "sha256-pd7xwfvR9U1bHT5eblszYU3YJQwQwhuyDDiNj+fnyaQ=";
pdfjs = fetchzip {
url = "https://github.com/mozilla/pdf.js/releases/download/v${pdfjsVersion}/pdfjs-${pdfjsVersion}-dist.zip";
hash = pdfjsHash;
@@ -27,29 +28,20 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "pdfding-frontend";
version = "1.4.1";
version = "1.5.1";
src = fetchFromGitHub {
owner = "mrmn2";
repo = "PdfDing";
tag = "v${finalAttrs.version}";
hash = "sha256-8e80gMdB6U3977dIU7bIAAEguYmi+AWQgUgYPDLCYLI=";
hash = "sha256-PXkD+2k8/LmMWzZAj8qEK4mLoOKS4mDWcqe8AgoCdBU=";
};
npmDeps = fetchNpmDeps {
inherit (finalAttrs) src;
name = "pdfding-frontend-${finalAttrs.version}-npm-deps";
hash = "sha256-v1NFqDnFcRK8sd0bV3ck+LLMYQ90Dl1R1OnBTwWUVUg=";
hash = "sha256-SgL8QhRGONGhJBu6b8HSVqZPzJ+NojhVClBEH5ajCcc=";
};
patches = [
# remove patch in 1.4.2
# package.json has missing version and name
(fetchpatch2 {
url = "https://github.com/mrmn2/PdfDing/pull/203.patch?full_index=1";
hash = "sha256-lKtpqKdyoGZdU4fTegto+YUIduIWbM82RQU9459NpC0=";
})
];
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
@@ -67,8 +59,10 @@ stdenv.mkDerivation (finalAttrs: {
tailwindcss -i $out/pdfding/static/css/input.css -o $out/pdfding/static/css/tailwind.css --minify
rm $out/pdfding/static/css/input.css
for i in build/pdf.mjs build/pdf.sandbox.mjs build/pdf.worker.mjs web/viewer.mjs; \
do node_modules/terser/bin/terser $out/pdfding/static/pdfjs/$i --compress -o $out/pdfding/static/pdfjs/$i; done
for i in build/pdf.mjs build/pdf.sandbox.mjs build/pdf.worker.mjs web/viewer.mjs;
do
node_modules/terser/bin/terser $out/pdfding/static/pdfjs/$i --compress -o $out/pdfding/static/pdfjs/$i;
done
npm run build
+22 -32
View File
@@ -1,49 +1,33 @@
{
lib,
python3,
callPackage,
fetchFromGitHub,
fetchpatch2,
makeWrapper,
nixosTests,
python3,
}:
let
python = python3;
in
python.pkgs.buildPythonPackage (finalAttrs: {
pname = "pdfding";
version = "1.4.1";
version = "1.5.1";
src = fetchFromGitHub {
owner = "mrmn2";
repo = "PdfDing";
tag = "v${finalAttrs.version}";
hash = "sha256-rrUaqxDO16NAOic74jeYgN+7Alvo+fIIacJdSOg0hFM=";
# remove in 1.5.0
postFetch = "mv $out/{license.txt,LICENSE}";
hash = "sha256-PXkD+2k8/LmMWzZAj8qEK4mLoOKS4mDWcqe8AgoCdBU=";
};
pyproject = true;
patches = [
# remove all patches in 1.5.0 (next version after 1.4.1)
# patch to add data_dir
# fixes two tests, remove patch in the next version
# https://github.com/mrmn2/PdfDing/pull/248
(fetchpatch2 {
url = "https://github.com/mrmn2/PdfDing/commit/f4945f2836ca8d972fcee2f00ef1d9cf217bada1.patch?full_index=1";
hash = "sha256-VGjyIAVi+qd2WZ8FVKKC2ijLinoflO7RmPwIW1/oGcY=";
})
# pyproject.toml still has 0.1.1 very old version
(fetchpatch2 {
url = "https://github.com/mrmn2/PdfDing/pull/203.patch?full_index=1";
hash = "sha256-lKtpqKdyoGZdU4fTegto+YUIduIWbM82RQU9459NpC0=";
})
# allows customising consume_schedule crontab
(fetchpatch2 {
url = "https://github.com/mrmn2/PdfDing/commit/96a13574718e0d27240eee8893fb799a02f24c05.patch?full_index=1";
hash = "sha256-Stq392rIbsphvaE23GgFWb91KzpD6aOQu9MGDDoaO7s=";
})
# allow specifying region for s3 backups
(fetchpatch2 {
url = "https://github.com/mrmn2/PdfDing/commit/3e412654f62d83b745111bd1d3587aca1a7739e1.patch?full_index=1";
hash = "sha256-RQS3yJjrIaViFlm6it6zyRZOn+nTQE8qr8OpY+zYSCY=";
url = "https://github.com/mrmn2/PdfDing/pull/248/commits/8f6900dddd1dbbe1a1024a484f63b792dd022f99.patch?full_index=1";
hash = "sha256-5oUC2TKL4X5IFy/41qViaafyUr4+bLBIovk9AWQmxZc=";
})
];
@@ -63,9 +47,12 @@ python.pkgs.buildPythonPackage (finalAttrs: {
django-cleanup
django-htmx
gunicorn
huey
markdown
minio
nh3
oauthlib
pillow
psycopg2-binary
pypdf
pypdfium2
@@ -74,14 +61,11 @@ python.pkgs.buildPythonPackage (finalAttrs: {
rapidfuzz
ruamel-yaml
whitenoise
huey
pillow
oauthlib
# dependecies required for django collectstatic
requests
pyjwt
cryptography
pyjwt
requests
]
++ qrcode.optional-dependencies.pil
++ django-allauth.optional-dependencies.socialaccount;
@@ -155,10 +139,9 @@ python.pkgs.buildPythonPackage (finalAttrs: {
pythonRelaxDeps = [
"django"
"django-allauth"
"huey"
"minio"
"django-htmx"
"pypdf"
"pypdfium2"
"ruamel-yaml"
];
nativeCheckInputs = with python.pkgs; [
@@ -171,6 +154,12 @@ python.pkgs.buildPythonPackage (finalAttrs: {
"--ignore=e2e"
];
disabledTests = [
# broken tests in 1.5.0
"test_adjust_file_paths_to_ws_collection"
"test_oidc_callback" # AssertionError: 200 != 401
];
/*
fix two breaking tests by providing full out path
AssertionError: Calls not found
@@ -211,6 +200,7 @@ python.pkgs.buildPythonPackage (finalAttrs: {
license = lib.licenses.agpl3Only;
mainProgram = "pdfding-manage";
maintainers = with lib.maintainers; [ phanirithvij ];
platforms = lib.platforms.unix;
teams = with lib.teams; [ ngi ];
};
})