diff --git a/lnbits/extensions/gerty/static/pieter_wuille.json b/lnbits/extensions/gerty/static/pieter_wuille.json new file mode 100644 index 00000000..986150ed --- /dev/null +++ b/lnbits/extensions/gerty/static/pieter_wuille.json @@ -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." + ] +} \ No newline at end of file diff --git a/lnbits/extensions/gerty/views_api.py b/lnbits/extensions/gerty/views_api.py index 94f473dd..c5e9df9d 100644 --- a/lnbits/extensions/gerty/views_api.py +++ b/lnbits/extensions/gerty/views_api.py @@ -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) 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)] +@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}") async def api_gerty_json( 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": text = await get_satoshi_quotes() 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": text = await get_placeholder_text() 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)) if quote['date']: 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 # A helper function get a nicely formated dict for the text