update @ Tue 29 Aug 10:47:52 EEST 2023

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2023-08-29 10:47:52 +03:00
parent 8828313adc
commit 42fcd971e0
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A50D5B4B599AF8A2
2 changed files with 18 additions and 1 deletions

View file

@ -123,6 +123,7 @@
"recent-title-trunc": 32, "recent-title-trunc": 32,
"server-host": "127.0.0.1", "server-host": "127.0.0.1",
"server-port": 8080, "server-port": 8080,
"post-preview-size": 196,
"posts": { "posts": {
"blogging-system-rewrite-again-3": { "blogging-system-rewrite-again-3": {
"title": "blogging system rewrite ( again ) :3", "title": "blogging system rewrite ( again ) :3",

View file

@ -137,6 +137,7 @@ DEFAULT_CONFIG: typing.Dict[str, typing.Any] = {
"recent-title-trunc": 32, "recent-title-trunc": 32,
"server-host": "127.0.0.1", "server-host": "127.0.0.1",
"server-port": 8080, "server-port": 8080,
"post-preview-size": 196,
"posts": {}, "posts": {},
} }
@ -1108,7 +1109,22 @@ def apis(config: typing.Dict[str, typing.Any]) -> int:
"""generate and hash apis""" """generate and hash apis"""
with open("recents.json", "w") as recents: with open("recents.json", "w") as recents:
json.dump(dict(tuple(config["posts"].items())[: config["recents"]]), recents) json.dump(
dict(
map(
lambda kv: (
kv[0],
{
"title": kv[1]["title"],
"content": trunc(kv[1]["content"], config["post-preview-size"]),
"created": kv[1]["created"],
},
),
tuple(config["posts"].items())[: config["recents"]],
)
),
recents,
)
lnew(f"generated {recents.name!r}") lnew(f"generated {recents.name!r}")
for api in recents.name, CONFIG_FILE: for api in recents.name, CONFIG_FILE: