💾 Archived View for pub.phreedom.club › ~milkspace › wall_code.gmi captured on 2023-03-20 at 17:58:13. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
DIRECTORY = "path/to/folder/with/wall/inscriptions"
#!/bin/python3 import os from config import DIRECTORY print("20 text/gemini; charset=utf-8") count = 32 inscriptions = os.listdir(DIRECTORY) if not inscriptions: print("Тут пусто") else: print(f"=> wall_full.cgi полная версия стены ({len(inscriptions)} записей)") print(f"Последние {count} записи:\n") for inscription in sorted(inscriptions)[-1 * count:]: with open(f'{DIRECTORY}/{inscription}') as f: print(f.read(), '\n') print("=> write_something.cgi Написать что-нибудь")
#!/bin/python3 import os from config import DIRECTORY # DIRECTORY = "cgi-bin/python/wall/inscriptions" print("20 text/gemini; charset=utf-8") inscriptions = os.listdir(DIRECTORY) if not inscriptions: print("Тут пусто") else: print("На стене написано:\n") for inscription in sorted(inscriptions): with open(f'{DIRECTORY}/{inscription}') as f: print(f.read(), '\n') print("=> write_something.cgi Написать что-нибудь")
#!/bin/python3 import os import urllib.parse import datetime from config import DIRECTORY query = os.environ.get("QUERY_STRING") if not query: print("10 Enter something") else: print("20 text/gemini") text = urllib.parse.unquote(query) with open( f"{DIRECTORY}/{datetime.datetime.now()}", 'w') as f: f.write(text) print(f"Вы написали:\n{text}\nи оставили свой след в истории этой стены\n" f"=> gemini://pub.phreedom.club/cgi-bin/milkspace/wall/wall.cgi Вернуться обратно\n" f"(если ваша запись не видна, обновите страницу)")