paperless: add automated hostingde invoice fetching

feat/authelia
Benjamin Yule Bädorf 2024-03-12 12:17:01 +01:00
parent 7466d926b3
commit e135ac3e4d
Signed by: b12f
GPG Key ID: 729956E1124F8F26
15 changed files with 350 additions and 21 deletions

View File

@ -81,6 +81,27 @@
"type": "github"
}
},
"deno2nix": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1694341738,
"narHash": "sha256-zEosA90LiNd3/EFpZNKs7XPdY7PIsat19I6uJb/MuYU=",
"owner": "SnO2WMaN",
"repo": "deno2nix",
"rev": "38dcc186763ab930acd1d751b4bfe3c0bd606ef3",
"type": "github"
},
"original": {
"owner": "SnO2WMaN",
"repo": "deno2nix",
"type": "github"
}
},
"deploy-rs": {
"inputs": {
"flake-compat": [
@ -105,7 +126,48 @@
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": [
"deno2nix",
"flake-utils"
],
"nixpkgs": [
"deno2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1667210711,
"narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=",
"owner": "numtide",
"repo": "devshell",
"rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1673956053,
@ -154,6 +216,21 @@
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -208,7 +285,7 @@
},
"musnix": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1690426816,
@ -256,15 +333,15 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1690272529,
"narHash": "sha256-MakzcKXEdv/I4qJUtq/k/eG+rVmyOZLnYNC2w1mB59Y=",
"owner": "NixOS",
"lastModified": 1670332253,
"narHash": "sha256-O5SmhlIUt1s+vK4NXeGYqwcBIMwbBPAEZ3GHE3XT28c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ef99fa5c5ed624460217c31ac4271cfb5cb2502c",
"rev": "1c9ffcf70786f0966982ce0fc76ec05df2e1dec2",
"type": "github"
},
"original": {
"owner": "NixOS",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@ -321,6 +398,22 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1690272529,
"narHash": "sha256-MakzcKXEdv/I4qJUtq/k/eG+rVmyOZLnYNC2w1mB59Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ef99fa5c5ed624460217c31ac4271cfb5cb2502c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1708831307,
"narHash": "sha256-0iL/DuGjiUeck1zEaL+aIe2WvA3/cVhp/SlmTcOZXH4=",
@ -361,8 +454,9 @@
"inputs": {
"adblock-unbound": "adblock-unbound",
"agenix": "agenix",
"deno2nix": "deno2nix",
"deploy-rs": "deploy-rs",
"flake-compat": "flake-compat",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"impermanence": "impermanence",
@ -370,7 +464,7 @@
"musnix": "musnix",
"nixos-flake": "nixos-flake",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"nixpkgs-master": "nixpkgs-master",
"nixpkgs-unstable": "nixpkgs-unstable",
"openstreetmap": "openstreetmap"

View File

@ -37,6 +37,8 @@
openstreetmap.url = "github:b12f/nixos-openstreetmap/flake-nixosmodule";
openstreetmap.inputs.nixpkgs.follows = "nixpkgs";
deno2nix.url = "github:SnO2WMaN/deno2nix";
};
outputs = inputs@{ self, ... }:
@ -60,7 +62,9 @@
inherit inputs;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.agenix.overlays.default ];
overlays = with inputs; [
agenix.overlays.default
];
};
};
@ -83,8 +87,10 @@
deploy-rs
# terraform
# terraform-backend-git
opentofu
terraform-backend-git
deno
];
shellHook = ''

View File

@ -13,6 +13,7 @@ in {
boot.loader.grub.efiInstallAsRemovable = true;
boot.loader.grub.device = "nodev";
boot.loader.timeout = 5;
boot.loader.grub.configurationLimit = 24;
boot.loader.efi.canTouchEfiVariables = false;
boot.loader.systemd-boot.enable = false;

View File

@ -8,7 +8,7 @@
./backup.nix
./unbound.nix
./dhcpd.nix
./wake-droppie.nix
# ./wake-droppie.nix
./paperless.nix
./firefly.nix
./invoiceplane.nix

View File

@ -41,6 +41,22 @@ with lib; let
echo "PDF written to $pdf"
'';
in {
#################################
# Paperless service and proxy
#################################
security.acme.certs = {
"paperless.b12f.io" = {};
};
services.nginx.virtualHosts = {
"paperless.b12f.io" = {
forceSSL = true;
useACMEHost = "paperless.b12f.io";
locations."/".proxyPass = "http://127.0.0.1:${builtins.toString config.services.paperless.port}";
};
};
services.paperless = {
enable = true;
user = psCfg.user.name;
@ -55,6 +71,10 @@ in {
};
};
#################################
# Scanning
#################################
hardware.sane = {
enable = true;
extraBackends = [pkgs.hplipWithPlugin];
@ -74,18 +94,26 @@ in {
};
};
security.acme.certs = {
"paperless.b12f.io" = {};
#################################
# hosting.de invoice fetch
#################################
age.secrets."hosting-de-invoice-sync-api-key" = {
file = "${flake.self}/secrets/hosting-de-invoice-sync-api-key.age";
mode = "400";
};
services.nginx.virtualHosts = {
"paperless.b12f.io" = {
forceSSL = true;
useACMEHost = "paperless.b12f.io";
locations."/".proxyPass = "http://127.0.0.1:${builtins.toString config.services.paperless.port}";
};
services.cron = {
enable = true;
systemCronJobs = [
"30 1 * * * root ${pkgs.fetch-hostingde-invoices}/bin/fetch-hostingde-invoices '${config.age.secrets."hosting-de-invoice-sync-api-key".path}' '${consumptionDir}'"
];
};
#################################
# Backups
#################################
systemd.tmpfiles.rules = [
"d '${backupDir}' 0700 ${psCfg.user.name} users - -"
];

View File

@ -1,7 +1,7 @@
{ pkgs, ... }:
{
services.cron = {
enable = false;
enable = true;
systemCronJobs = [
"30 1 * * * root ${pkgs.wakeonlan}/bin/wakeonlan 08:f1:ea:97:0f:0c"
];

View File

@ -7,6 +7,8 @@
nixosModules = rec {
overlays = ({ ... }: {
nixpkgs.overlays = [
inputs.deno2nix.overlays.default
(final: prev: let
unstable = import inputs.nixpkgs-unstable { system = prev.system; };
master = import inputs.nixpkgs-master { system = prev.system; };

View File

@ -5,6 +5,7 @@ with prev; {
# then, call packages with `final.callPackage`
# caddy = callPackage (import ./caddy) {};
concourse = import ./concourse.nix final;
fetch-hostingde-invoices = import ./fetch-hostingde-invoices final;
import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final);
lgcl = writeShellScriptBin "lgcl" (import ./lgcl.nix final);
mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final);

View File

@ -0,0 +1,17 @@
self: self.deno2nix.mkExecutable {
pname = "fetch-hostingde-invoices";
version = "0.1.0";
src = ./.;
bin = "simple";
entrypoint = "./main.ts";
lockfile = "./deno.lock";
config = "./deno.json";
allow = {
write = true;
env = "HOSTINGDE_API_KEY";
net = true;
};
}

View File

@ -0,0 +1,6 @@
{
"tasks": {
"dev": "deno run --watch main.ts"
},
"importMap": "./import_map.json"
}

View File

@ -0,0 +1,85 @@
{
"version": "3",
"remote": {
"https://deno.land/std@0.218.2/assert/assert.ts": "bec068b2fccdd434c138a555b19a2c2393b71dfaada02b7d568a01541e67cdc5",
"https://deno.land/std@0.218.2/assert/assertion_error.ts": "9f689a101ee586c4ce92f52fa7ddd362e86434ffdf1f848e45987dc7689976b8",
"https://deno.land/std@0.218.2/cli/parse_args.ts": "df284f03f8ef4c581c17ca12db41cc17bcf0fa2ab6a8e09dbb72fa05916d4427",
"https://deno.land/std@0.218.2/path/_common/assert_path.ts": "dbdd757a465b690b2cc72fc5fb7698c51507dec6bfafce4ca500c46b76ff7bd8",
"https://deno.land/std@0.218.2/path/_common/basename.ts": "569744855bc8445f3a56087fd2aed56bdad39da971a8d92b138c9913aecc5fa2",
"https://deno.land/std@0.218.2/path/_common/common.ts": "6157c7ec1f4db2b4a9a187efd6ce76dcaf1e61cfd49f87e40d4ea102818df031",
"https://deno.land/std@0.218.2/path/_common/constants.ts": "dc5f8057159f4b48cd304eb3027e42f1148cf4df1fb4240774d3492b5d12ac0c",
"https://deno.land/std@0.218.2/path/_common/dirname.ts": "684df4aa71a04bbcc346c692c8485594fc8a90b9408dfbc26ff32cf3e0c98cc8",
"https://deno.land/std@0.218.2/path/_common/format.ts": "92500e91ea5de21c97f5fe91e178bae62af524b72d5fcd246d6d60ae4bcada8b",
"https://deno.land/std@0.218.2/path/_common/from_file_url.ts": "d672bdeebc11bf80e99bf266f886c70963107bdd31134c4e249eef51133ceccf",
"https://deno.land/std@0.218.2/path/_common/glob_to_reg_exp.ts": "6cac16d5c2dc23af7d66348a7ce430e5de4e70b0eede074bdbcf4903f4374d8d",
"https://deno.land/std@0.218.2/path/_common/normalize.ts": "684df4aa71a04bbcc346c692c8485594fc8a90b9408dfbc26ff32cf3e0c98cc8",
"https://deno.land/std@0.218.2/path/_common/normalize_string.ts": "dfdf657a1b1a7db7999f7c575ee7e6b0551d9c20f19486c6c3f5ff428384c965",
"https://deno.land/std@0.218.2/path/_common/relative.ts": "faa2753d9b32320ed4ada0733261e3357c186e5705678d9dd08b97527deae607",
"https://deno.land/std@0.218.2/path/_common/strip_trailing_separators.ts": "7024a93447efcdcfeaa9339a98fa63ef9d53de363f1fbe9858970f1bba02655a",
"https://deno.land/std@0.218.2/path/_common/to_file_url.ts": "7f76adbc83ece1bba173e6e98a27c647712cab773d3f8cbe0398b74afc817883",
"https://deno.land/std@0.218.2/path/_interface.ts": "a1419fcf45c0ceb8acdccc94394e3e94f99e18cfd32d509aab514c8841799600",
"https://deno.land/std@0.218.2/path/_os.ts": "8fb9b90fb6b753bd8c77cfd8a33c2ff6c5f5bc185f50de8ca4ac6a05710b2c15",
"https://deno.land/std@0.218.2/path/basename.ts": "5d341aadb7ada266e2280561692c165771d071c98746fcb66da928870cd47668",
"https://deno.land/std@0.218.2/path/common.ts": "03e52e22882402c986fe97ca3b5bb4263c2aa811c515ce84584b23bac4cc2643",
"https://deno.land/std@0.218.2/path/constants.ts": "0c206169ca104938ede9da48ac952de288f23343304a1c3cb6ec7625e7325f36",
"https://deno.land/std@0.218.2/path/dirname.ts": "85bd955bf31d62c9aafdd7ff561c4b5fb587d11a9a5a45e2b01aedffa4238a7c",
"https://deno.land/std@0.218.2/path/extname.ts": "593303db8ae8c865cbd9ceec6e55d4b9ac5410c1e276bfd3131916591b954441",
"https://deno.land/std@0.218.2/path/format.ts": "42a2f3201343df77061207e6aaf78c95bafce7f711dcb7fe1e5840311c505778",
"https://deno.land/std@0.218.2/path/from_file_url.ts": "911833ae4fd10a1c84f6271f36151ab785955849117dc48c6e43b929504ee069",
"https://deno.land/std@0.218.2/path/glob_to_regexp.ts": "7f30f0a21439cadfdae1be1bf370880b415e676097fda584a63ce319053b5972",
"https://deno.land/std@0.218.2/path/is_absolute.ts": "4791afc8bfd0c87f0526eaa616b0d16e7b3ab6a65b62942e50eac68de4ef67d7",
"https://deno.land/std@0.218.2/path/is_glob.ts": "a65f6195d3058c3050ab905705891b412ff942a292bcbaa1a807a74439a14141",
"https://deno.land/std@0.218.2/path/join.ts": "ae2ec5ca44c7e84a235fd532e4a0116bfb1f2368b394db1c4fb75e3c0f26a33a",
"https://deno.land/std@0.218.2/path/join_globs.ts": "5b3bf248b93247194f94fa6947b612ab9d3abd571ca8386cf7789038545e54a0",
"https://deno.land/std@0.218.2/path/mod.ts": "2821a1bb3a4148a0ffe79c92aa41aa9319fef73c6d6f5178f52b2c720d3eb02d",
"https://deno.land/std@0.218.2/path/normalize.ts": "4155743ccceeed319b350c1e62e931600272fad8ad00c417b91df093867a8352",
"https://deno.land/std@0.218.2/path/normalize_glob.ts": "cc89a77a7d3b1d01053b9dcd59462b75482b11e9068ae6c754b5cf5d794b374f",
"https://deno.land/std@0.218.2/path/parse.ts": "65e8e285f1a63b714e19ef24b68f56e76934c3df0b6e65fd440d3991f4f8aefb",
"https://deno.land/std@0.218.2/path/posix/_util.ts": "1e3937da30f080bfc99fe45d7ed23c47dd8585c5e473b2d771380d3a6937cf9d",
"https://deno.land/std@0.218.2/path/posix/basename.ts": "39ee27a29f1f35935d3603ccf01d53f3d6e0c5d4d0f84421e65bd1afeff42843",
"https://deno.land/std@0.218.2/path/posix/common.ts": "26f60ccc8b2cac3e1613000c23ac5a7d392715d479e5be413473a37903a2b5d4",
"https://deno.land/std@0.218.2/path/posix/constants.ts": "93481efb98cdffa4c719c22a0182b994e5a6aed3047e1962f6c2c75b7592bef1",
"https://deno.land/std@0.218.2/path/posix/dirname.ts": "6535d2bdd566118963537b9dda8867ba9e2a361015540dc91f5afbb65c0cce8b",
"https://deno.land/std@0.218.2/path/posix/extname.ts": "8d36ae0082063c5e1191639699e6f77d3acf501600a3d87b74943f0ae5327427",
"https://deno.land/std@0.218.2/path/posix/format.ts": "185e9ee2091a42dd39e2a3b8e4925370ee8407572cee1ae52838aed96310c5c1",
"https://deno.land/std@0.218.2/path/posix/from_file_url.ts": "951aee3a2c46fd0ed488899d024c6352b59154c70552e90885ed0c2ab699bc40",
"https://deno.land/std@0.218.2/path/posix/glob_to_regexp.ts": "76f012fcdb22c04b633f536c0b9644d100861bea36e9da56a94b9c589a742e8f",
"https://deno.land/std@0.218.2/path/posix/is_absolute.ts": "cebe561ad0ae294f0ce0365a1879dcfca8abd872821519b4fcc8d8967f888ede",
"https://deno.land/std@0.218.2/path/posix/is_glob.ts": "8a8b08c08bf731acf2c1232218f1f45a11131bc01de81e5f803450a5914434b9",
"https://deno.land/std@0.218.2/path/posix/join.ts": "744fadcbee7047688696455c7cbb368a9625ffde67fc3058a61c98948fcd04de",
"https://deno.land/std@0.218.2/path/posix/join_globs.ts": "a9475b44645feddceb484ee0498e456f4add112e181cb94042cdc6d47d1cdd25",
"https://deno.land/std@0.218.2/path/posix/mod.ts": "2301fc1c54a28b349e20656f68a85f75befa0ee9b6cd75bfac3da5aca9c3f604",
"https://deno.land/std@0.218.2/path/posix/normalize.ts": "baeb49816a8299f90a0237d214cef46f00ba3e95c0d2ceb74205a6a584b58a91",
"https://deno.land/std@0.218.2/path/posix/normalize_glob.ts": "9c87a829b6c0f445d03b3ecadc14492e2864c3ebb966f4cea41e98326e4435c6",
"https://deno.land/std@0.218.2/path/posix/parse.ts": "0b1fc4cb890dbb699ec1d2c232d274843b4a7142e1ad976b69fe51c954eb6080",
"https://deno.land/std@0.218.2/path/posix/relative.ts": "3907d6eda41f0ff723d336125a1ad4349112cd4d48f693859980314d5b9da31c",
"https://deno.land/std@0.218.2/path/posix/resolve.ts": "08b699cfeee10cb6857ccab38fa4b2ec703b0ea33e8e69964f29d02a2d5257cf",
"https://deno.land/std@0.218.2/path/posix/to_file_url.ts": "7aa752ba66a35049e0e4a4be5a0a31ac6b645257d2e031142abb1854de250aaf",
"https://deno.land/std@0.218.2/path/posix/to_namespaced_path.ts": "28b216b3c76f892a4dca9734ff1cc0045d135532bfd9c435ae4858bfa5a2ebf0",
"https://deno.land/std@0.218.2/path/relative.ts": "ab739d727180ed8727e34ed71d976912461d98e2b76de3d3de834c1066667add",
"https://deno.land/std@0.218.2/path/resolve.ts": "a6f977bdb4272e79d8d0ed4333e3d71367cc3926acf15ac271f1d059c8494d8d",
"https://deno.land/std@0.218.2/path/to_file_url.ts": "88f049b769bce411e2d2db5bd9e6fd9a185a5fbd6b9f5ad8f52bef517c4ece1b",
"https://deno.land/std@0.218.2/path/to_namespaced_path.ts": "b706a4103b104cfadc09600a5f838c2ba94dbcdb642344557122dda444526e40",
"https://deno.land/std@0.218.2/path/windows/_util.ts": "d5f47363e5293fced22c984550d5e70e98e266cc3f31769e1710511803d04808",
"https://deno.land/std@0.218.2/path/windows/basename.ts": "e2dbf31d1d6385bfab1ce38c333aa290b6d7ae9e0ecb8234a654e583cf22f8fe",
"https://deno.land/std@0.218.2/path/windows/common.ts": "26f60ccc8b2cac3e1613000c23ac5a7d392715d479e5be413473a37903a2b5d4",
"https://deno.land/std@0.218.2/path/windows/constants.ts": "5afaac0a1f67b68b0a380a4ef391bf59feb55856aa8c60dfc01bd3b6abb813f5",
"https://deno.land/std@0.218.2/path/windows/dirname.ts": "33e421be5a5558a1346a48e74c330b8e560be7424ed7684ea03c12c21b627bc9",
"https://deno.land/std@0.218.2/path/windows/extname.ts": "165a61b00d781257fda1e9606a48c78b06815385e7d703232548dbfc95346bef",
"https://deno.land/std@0.218.2/path/windows/format.ts": "bbb5ecf379305b472b1082cd2fdc010e44a0020030414974d6029be9ad52aeb6",
"https://deno.land/std@0.218.2/path/windows/from_file_url.ts": "ced2d587b6dff18f963f269d745c4a599cf82b0c4007356bd957cb4cb52efc01",
"https://deno.land/std@0.218.2/path/windows/glob_to_regexp.ts": "e45f1f89bf3fc36f94ab7b3b9d0026729829fabc486c77f414caebef3b7304f8",
"https://deno.land/std@0.218.2/path/windows/is_absolute.ts": "4a8f6853f8598cf91a835f41abed42112cebab09478b072e4beb00ec81f8ca8a",
"https://deno.land/std@0.218.2/path/windows/is_glob.ts": "8a8b08c08bf731acf2c1232218f1f45a11131bc01de81e5f803450a5914434b9",
"https://deno.land/std@0.218.2/path/windows/join.ts": "8d03530ab89195185103b7da9dfc6327af13eabdcd44c7c63e42e27808f50ecf",
"https://deno.land/std@0.218.2/path/windows/join_globs.ts": "a9475b44645feddceb484ee0498e456f4add112e181cb94042cdc6d47d1cdd25",
"https://deno.land/std@0.218.2/path/windows/mod.ts": "2301fc1c54a28b349e20656f68a85f75befa0ee9b6cd75bfac3da5aca9c3f604",
"https://deno.land/std@0.218.2/path/windows/normalize.ts": "78126170ab917f0ca355a9af9e65ad6bfa5be14d574c5fb09bb1920f52577780",
"https://deno.land/std@0.218.2/path/windows/normalize_glob.ts": "9c87a829b6c0f445d03b3ecadc14492e2864c3ebb966f4cea41e98326e4435c6",
"https://deno.land/std@0.218.2/path/windows/parse.ts": "dbdfe2bc6db482d755b5f63f7207cd019240fcac02ad2efa582adf67ff10553a",
"https://deno.land/std@0.218.2/path/windows/relative.ts": "3e1abc7977ee6cc0db2730d1f9cb38be87b0ce4806759d271a70e4997fc638d7",
"https://deno.land/std@0.218.2/path/windows/resolve.ts": "8dae1dadfed9d46ff46cc337c9525c0c7d959fb400a6308f34595c45bdca1972",
"https://deno.land/std@0.218.2/path/windows/to_file_url.ts": "40e560ee4854fe5a3d4d12976cef2f4e8914125c81b11f1108e127934ced502e",
"https://deno.land/std@0.218.2/path/windows/to_namespaced_path.ts": "4ffa4fb6fae321448d5fe810b3ca741d84df4d7897e61ee29be961a6aac89a4c"
}
}

View File

@ -0,0 +1,5 @@
{
"imports": {
"std/": "https://deno.land/std@0.218.2/"
}
}

View File

@ -0,0 +1,59 @@
import { normalize, join } from "std/path/mod.ts";
const secretFile = normalize(Deno.args[0]);
const outDir = normalize(Deno.args[1]);
const decoder = new TextDecoder("utf-8");
const authToken = decoder.decode(await Deno.readFile(secretFile)).trim();
const getFromAPI = (url: string, body: Record<string, any>) => fetch(
url,
{
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
'Accept': 'application/json',
}),
body: JSON.stringify({ authToken, ...body }),
}
);
const response = await getFromAPI(
"https://secure.hosting.de/api/billing/v1/json/documentsFind",
{ limit: 50, sort: { field: 'documentDate', order: 'DESC' }},
);
const body = await response.json();
if (body.status !== "success") {
console.error(body.errors);
throw new Error();
}
interface InvoiceDocument {
documentId: string;
}
const documents = body.response.data as InvoiceDocument[];
await Promise.all(documents.map(async (doc) => {
const pdfResponse = await getFromAPI(
"https://secure.hosting.de/api/billing/v1/json/accountingDocumentPdfGet",
{ id: doc.documentId },
);
const fileBody = await pdfResponse.json();
if (body.status !== "success") {
console.error(body.errors);
throw new Error();
}
const url = fileBody.response;
const fileResponse = await fetch(url);
console.log(fileResponse);
const fileContents = await fileResponse.blob();
const fileNameHeader = fileResponse.headers.get('content-disposition') || '';
const fileName = fileNameHeader.split('=')[1];
await Deno.writeFile(join(outDir, fileName), fileContents.stream());
}));

View File

@ -0,0 +1,24 @@
age-encryption.org/v1
-> ssh-ed25519 8bHz7g zFQGBUd6WAdzaEzBavUWqm4U4ndIvzP00ntU1mhjSnw
xJjfZz0wwqY3k1oqDwH9VxsM6/N61H/YV43JJZokfUY
-> ssh-rsa kFDS0A
anu8DuRW7aev+nKgxZOchK5SVJO1/azxBITmEyy6IGHi78/DhaNEX1FdZoWTI4Sx
dnND3DsCLdDiLgAUXWaQrbm+ZiTW4pip1pLFlEWDjddVtek2hLHYwUDd1g11bSm1
a4Uk9Up54eZZF0j1y1/g4pwa2H/eQuQObE3uGR9RvFaIGmEftiH4aJN4jplPnXoW
YuNNYRkdG2B9fHVnmHmKZetfqx4wcXMGM2BQCw93sCUYIiMl+ggzq6WiP5lNXrvl
zVd3myPsMEWMWNX72OGmpaCtz2A2jWvO3MJlY+QjhaDzzvxN6/p6wxjGmsoymWIm
r1ZdzDjZHU8e/WLrfoHXosKr0FYtRTFU69OjmShfkpK8eHFc433g9IsV2CNWLsMR
oL9zkAvIH+cmkfzchKN2rgv8RgurDRXAOaX1tx5w/gZIrxfweXNHbUpeGej34e4A
RDPxDgccfl0i6o2xKd6FnTV6RzEgnjhsQViq5B1/yRlHeHuFlXV4XRqEplduhepb
DYY9+rxZM8uMxNTW5a9IcybWZJkocbmCUbkzOoTHpj0wtwlyKrqhtv3g+oAruPlO
yKkq5RERT+i8TRDSJubiueBp8LdG0ffd1vUaXvLh2IXVyceHIul0K+dLxwZnqiIp
+7jBIFjTRgQOiQdCCBkTvWrv3VrWRncElmAdvCKUAkY
-> piv-p256 zqq/iw AvONKaUIttkKS3u09BV7Pzhu4D8l2eD4Jeh+ebH07/BG
97r1usenqTgi1QFQQ0DK1hhaTRgXXdSh9yPY6k3vg9A
-> piv-p256 vRzPNw A9jD43mHz8IhAx2T/LbUX5aDD0mD7qXyIsq+4qnJAYHp
WHB14YVrqK9kULLkLaixTW5CuXV/F2PB+L6BlyLrBy4
-> E/-grease OT
t5kB0LrtZWT1Wo75cYHgJhQHRgcZ1JOzahc6un1gP1/hmetCoOsCYKKtVszKr278
dHFM1jMjn7EQH4kMUNXUOhcLrEy94A
--- MA00Lr6/JrZT09+RKzchJ57pvr8rg2y7wbQ6ZJu39Yg
Iû¬Ž`åƒÕM´,¯gÙ-çaü:&ÎÑàÊ<C3A0>H|ûZø'U<>&¶MiÜq±Šä¢¼)Z²ãx7yt=¸NŒh>_‰“b€P„wȬÓ[ÐZÃ-

View File

@ -48,6 +48,7 @@ let
in {
"dyndns.key.age".publicKeys = pieKeys ++ baseKeys;
"hosting-de-acme-secrets.age".publicKeys = droppieKeys ++ pieKeys ++ frikandelKeys ++ baseKeys;
"hosting-de-invoice-sync-api-key.age".publicKeys = pieKeys ++ baseKeys;
"droppie-ssh-root.key.age".publicKeys = droppieKeys ++ baseKeys;