update @ Fri 23 Sep 01:29:49 EEST 2022

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-09-23 01:29:49 +03:00
parent b317c6daef
commit 10ce5f7ff5
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
3 changed files with 15 additions and 1 deletions

View file

@ -61,4 +61,8 @@ Some blogs might be hidden for a day or two if
I'm working on it or just need to hide it to
not show some stuff on the main page, though
nobody is stopping you from using the static API,
it's located at [/blog.json](https://blog.ari-web.xyz/blog.json)
it's located at [/blog.json](https://blog.ari-web.xyz/blog.json), also if you're using
this API generally, this API is **extremely** large, so
I implemented cache validation, just cache it,
including the sha256 hash and validate it with
the [hash on the api](https://blog.ari-web.xyz/blog_json_hash.txt)

1
blog_json_hash.txt Normal file
View file

@ -0,0 +1 @@
fe9cdebb971b9c7a0ec8da637eb91cde4663e5d871ea3ac7f107b1cd46413fac

View file

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
"""Manage blogs"""
import hashlib
import os
import random
import string
@ -651,6 +652,14 @@ def generate_metadata(config: Dict) -> Tuple[int, Dict]:
manifest,
)
with open(DEFAULT_CONFIG_FILE, "rb") as blog_api_file:
log(f"Generating hash for {DEFAULT_CONFIG_FILE!r}")
with open(
f"{DEFAULT_CONFIG_FILE.replace('.', '_')}_hash.txt", "w"
) as blog_api_hash:
blog_api_hash.write(hashlib.sha256(blog_api_file.read()).hexdigest())
return EXIT_OK, config