Commit graph

9 commits

Author SHA1 Message Date
sterni
80e168b22d feat(sterni/mblog): implement environment based config mechanism
Change-Id: I091c0d5decc0a1eb3d24e81b713434ab391c677d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8347
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2023-03-24 18:32:50 +00:00
sterni
11738fc232 chore(sterni/mblog): relicense to GPL-3.0-only
This is possible since all the commits have been made by me. The code
taken from  SCLF (which is licensed LGPL-2.1-or-later) can also be
included since the LGPL 2.1 is [compatible] with the GPL 3.0.

compatible: https://www.gnu.org/licenses/license-list.en.html#LGPLv2.1
Change-Id: I2d274c29378679c489dc667a53b234642c3da817
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5928
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-07-09 17:10:46 +00:00
sterni
5bc73de59d feat: move mblog header handling into mime4cl
Accessing the headers of a MIME message feels like something mime4cl
should handle. We implemented this ad hoc in mblog before in order to
not need to worry about doing it in a sensible way. Now we introduce a
decent-ish interface for getting a header from a MIME message,
mime-message-header-values:

* It returns a list because MIME message headers may appear multiple
  times.

* It decodes RFC2047 only upon request, as you may want to be stricter
  about parsing certain fields.

* It checks header name equality case insensitively.

The code for decoding the RFC2047 string is retained and still uses
babel for doing the actual decoding.

Change-Id: I58bbbe4b46dbded04160b481a28a40d14775673d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5150
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-02-02 20:47:45 +00:00
sterni
81c47da91c refactor(sterni/mblog/note): don't escape streams char by char
Depending on the stream backing this, read-sequence should be more
efficient.

Change-Id: I5d0461f76f4b132ac6e6c3a2e503f0173d5f4114
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5194
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-02-02 20:47:45 +00:00
sterni
6cd1f6f183 refactor(sterni/mblog/note): only get escape-char-minimal from WHO
This is the only thing we need from that package and it avoids having
to solve the annoying conflict between closure-html and who.

Change-Id: Iacfb8d4948d1987e767ffc456b8e141b468ef6d9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5111
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-02-02 20:47:45 +00:00
sterni
5789814dec fix(users/sterni/mblog): handle RFC2047 in subjects
Non ASCII Subjects will use RFC2047 to encode their content. Using
mime4cl's parse-RFC2047-text we obtain a list of ASCII strings and byte
vectors tagged with their encoding. Using babel we can then decode the
byte sequence, assuming the encoding is named the same in babel and
RFC2047 (which it is for UTF-8 at least…).

Change-Id: I2840672409452bd194fb1635721e338364d9b484
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5078
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-02-02 20:47:45 +00:00
sterni
56ec3b1803 refactor(sterni/mblog): add (sub)class for apple note messages
* Upon creation of an apple-note object we can check if certain fields
  we are interested in are present and of the right type etc.

  These currently are:

  - UUID (for links later)
  - Subject (title)
  - Time
  - Text part with supported MIME type

  These are then put into their own shortcut fields in the apple-note
  subclass which allows for easier access and forces us to make sure
  they are present.

* Split out everything note related into its own package. Using the new
  type, we can expose an interface which sort of makes sense.

Change-Id: Ic9d67518354e61a3cc8388bb0e566fce661e90d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5072
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-02-02 20:47:45 +00:00
sterni
f7d7da6ace fix(users/sterni/mblog): use string-equal where casing is irrelevant
Change-Id: Ic1303a04de005977a552eba38aa13d512d2c20e2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5071
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-01-30 09:39:13 +00:00
sterni
8e156e6b86 feat(sterni/mblog): convert apple note mime msgs to html
For now mblog only contains the mnote-html executable which takes a mime
message from a maildir and prints the equivalent HTML fragment to
stdout. It is intended to work with the mblaze(7) utilities,
i. e. mnote-html resolves all `object` tags to proper `img` inclusions
with the correct filename, so mshow(1)'s -x version can supply the
needed image files. A note created using Apple's Notes app (tested with
the iOS version) can be converted in a viewable HTML file like this:

    $ mnote-html path/to/msg > fragment.html
    $ mshow -x path/to/msg
    $ cat <(echo "<!DOCTYPE html>") fragment.html > document.html
    $ xdg-open document.html

Note that only the limited feature set of Apple Notes when using the
IMAP backend is supported. The iCloud-based one has more (quite neat)
features, but its notes can only accessed via an internal API as far as
I know.

This CLI is a bit impractical due to the big startup overhead of loading
the lisp image. mblog should be become a fully fletched static site
generator in the future, but this is a good starting point and providing
the mnote-html tool is certainly useful.

Change-Id: Iee6d1558e939b932da1e70ca2d2ae75638d855df
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3271
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-09-12 21:39:49 +00:00