增加了自动openpgp签名选项,修改了打印版本的样式

This commit is contained in:
:NoBody: committed 2026-05-08 22:47:21 +08:00
1 parent 59a5400fe1
commit 7a3f8b0e81
51 files changed
+1176 -419

No files matched your search

+21 -1
View File
@@ -1,4 +1,8 @@
import { DocuBuilder, IndexBuilder } from "../pdf_builder/builder.ts";
import {
DocuBuilder,
IndexBuilder,
OpenPGPSigner,
} from "../pdf_builder/builder.ts";
export async function generate_pdf() {
const cfg = JSON.parse(await Deno.readTextFile("config.json"));
@@ -111,3 +115,19 @@ export async function use_qpdf() {
}
}
}
export async function sign_pdf() {
const config = JSON.parse(await Deno.readTextFile("config.json"));
for (const cfg of config.settings) {
if (cfg.pdf.signing?.enabled) {
console.log(`Signing PDF ${cfg.playwright.path}...`);
const signer = new OpenPGPSigner(
cfg.playwright.path,
cfg.pdf.signing.key_path,
cfg.pdf.signing.output_path,
);
await signer.sign();
console.log(`Successfully signed PDF: ${cfg.pdf.signing.output_path}`);
}
}
}
+8
View File
@@ -1,7 +1,9 @@
import { OpenPGPSigner } from "../pdf_builder/builder.ts";
import {
add_index_to_pdf,
generate_md,
generate_pdf,
sign_pdf,
use_qpdf,
} from "./handlers.ts";
@@ -34,6 +36,12 @@ export async function match_sub_command_to_function(
if (options.use_qpdf) {
await use_qpdf();
}
if (options.sign_pdf) {
console.log("Signing PDF...");
await sign_pdf();
}
break;
case "md":