Added Pieter Wuille facts

This commit is contained in:
Black Coffee 2022-09-29 16:44:56 +01:00
parent 84b48eac60
commit b9f8a8b4b8
2 changed files with 32 additions and 5 deletions

View file

@ -0,0 +1,14 @@
{
"facts": [
"When a woman asked Pieter Wuille to talk dirty to her, he described the OpenSSL DER implementation.",
"Pieter Wuille recently visited an event horizon and escaped with a cryptographic proof.",
"Pieter Wuille's PhD thesis defence in full: \"Pieter Wuille, thank you\".",
"Pieter Wuille is an acronym for Programmatic Intelligent Encrypted Telemetric Encapsulated Recursive Witness Upscaling Integrated Load-Balancing Logical Entity.",
"Dan Bernstein only trusts one source of random numbers: Pieter Wuille.",
"Putting Pieter Wuille in the title of an r/Bitcoin submission gets more upvotes than the same post from Pieter Wuille himself.",
"Pieter Wuille won the underhanded crypto contest but his entry was so underhanded nobody even knows he entered.",
"Greg Maxwell is a bot created by Pieter Wuille to argue on reddit while he can get code done.",
"Pieter Wuille doesn't need the public key to calculate the corresponding private key.",
"When the Wikipedia servers corrupted all data including backups, Pieter Wuille had to stay awake all night to retype it."
]
}

View file

@ -85,15 +85,20 @@ async def api_gerty_delete(
####################### #######################
with open(os.path.join(LNBITS_PATH, 'extensions/gerty/static/satoshi.json')) as fd:
satoshiQuotes = json.load(fd)
@gerty_ext.get("/api/v1/gerty/satoshiquote", status_code=HTTPStatus.OK) @gerty_ext.get("/api/v1/gerty/satoshiquote", status_code=HTTPStatus.OK)
async def api_gerty_satoshi(): async def api_gerty_satoshi():
with open(os.path.join(LNBITS_PATH, 'extensions/gerty/static/satoshi.json')) as fd:
satoshiQuotes = json.load(fd)
return satoshiQuotes[random.randint(0, 100)] return satoshiQuotes[random.randint(0, 100)]
@gerty_ext.get("/api/v1/gerty/pieterwielliequote", status_code=HTTPStatus.OK)
async def api_gerty_wuille():
with open(os.path.join(LNBITS_PATH, 'extensions/gerty/static/pieter_wuille.json')) as fd:
data = json.load(fd)
return data['facts'][random.randint(0, (len(data['facts']) - 1))]
@gerty_ext.get("/api/v1/gerty/{gerty_id}") @gerty_ext.get("/api/v1/gerty/{gerty_id}")
async def api_gerty_json( async def api_gerty_json(
gerty_id: str, gerty_id: str,
@ -191,7 +196,7 @@ async def get_screen_text(screen_num: int, screens_list: dict, gerty):
elif screen_slug == "fun_satoshi_quotes": elif screen_slug == "fun_satoshi_quotes":
text = await get_satoshi_quotes() text = await get_satoshi_quotes()
elif screen_slug == "fun_pieter_wuille_facts": elif screen_slug == "fun_pieter_wuille_facts":
text = await get_placeholder_text() text = await get_pieter_wuille_fact()
elif screen_slug == "fun_exchange_market_rate": elif screen_slug == "fun_exchange_market_rate":
text = await get_placeholder_text() text = await get_placeholder_text()
elif screen_slug == "onchain_difficulty_epoch_progress": elif screen_slug == "onchain_difficulty_epoch_progress":
@ -254,7 +259,15 @@ async def get_satoshi_quotes():
text.append(get_text_item_dict(quote['text'], 16)) text.append(get_text_item_dict(quote['text'], 16))
if quote['date']: if quote['date']:
text.append(get_text_item_dict(quote['date'], 12)) text.append(get_text_item_dict(quote['date'], 12))
return text
async def get_pieter_wuille_fact():
text = []
quote = await api_gerty_wuille()
if quote:
text.append(get_text_item_dict(quote, 16))
text.append(get_text_item_dict("Pieter Wuille facts", 12))
return text return text
# A helper function get a nicely formated dict for the text # A helper function get a nicely formated dict for the text