~sircmpwn/sr.ht-dev

1

[GIT PULL meta.sr.ht] api: add endpoint to download invoices

Details
Message ID
<20221122095012.41020-1-ch@bitfehler.net>
DKIM signature
missing
Download raw message
The following changes since commit b08894942c8dc236bf2f9ed65e2cade76618ce47:

  Use internal anon auth for sending notifications (2022-11-10 11:21:46 +0100)

are available in the Git repository at:

  https://git.sr.ht/~bitfehler/meta.sr.ht master

for you to fetch changes up to 8c9ca5d76a29ca661fefee77a6d71b97de0c6f62:

  api: add endpoint to download invoices (2022-11-22 10:22:18 +0100)

----------------------------------------------------------------
Sending this as PR because it includes two TTF files. For your convenience, I
am reproducing the commit message here, which provides the reasoning:

This commit adds an endpoint - though not a GraphQL one - to the API to
generate PDF invoices for download. The endpoint is compatible with the
current one (requires a POST with the same parameters), but the frontend
is not yet using it, so that it can receive more widespread testing
before going "live".

The PDF generator takes the same parameters as the Python implementation
and it's output is reasonably close. An example can be found at [1]. It
includes the smallest, sanely-licensed monospace font that a quick
search on my system turned up. PDF comes with default fonts, but they
don't support UTF-8, and IMO messing with encodings/code pages by far
outweighs the inconveniences of embedding a font or messing with
font-config to find one on the system (e.g. on my system, the standard
"monospace" font maps to an OTF font, which is not supported).

[1]: https://bitfehler.net/invoice_test.pdf

Related: https://todo.sr.ht/~sircmpwn/meta.sr.ht/183

Conrad Hoffmann (1):
      api: add endpoint to download invoices

 api/go.mod                               |   4 +-
 api/go.sum                               |   8 +-
 api/invoice/fonts/LICENSE                | 202 +++++++++++++++++++++++++++++++
 api/invoice/fonts/README                 |   1 +
 api/invoice/fonts/RobotoMono-Bold.ttf    | Bin 0 -> 126520 bytes
 api/invoice/fonts/RobotoMono-Regular.ttf | Bin 0 -> 125588 bytes
 api/invoice/invoice.go                   | 135 +++++++++++++++++++++
 api/server.go                            |  88 +++++++++++++-
 8 files changed, 433 insertions(+), 5 deletions(-)
 create mode 100644 api/invoice/fonts/LICENSE
 create mode 100644 api/invoice/fonts/README
 create mode 100644 api/invoice/fonts/RobotoMono-Bold.ttf
 create mode 100644 api/invoice/fonts/RobotoMono-Regular.ttf
 create mode 100644 api/invoice/invoice.go
Details
Message ID
<CP5SAFI8ALJG.25A0R3CCFO22K@taiga>
In-Reply-To
<20221122095012.41020-1-ch@bitfehler.net> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/meta.sr.ht
   8202a9d..bf90e13  master -> master
Reply to thread Export thread (mbox)