#!/usr/bin/python3 import os import subprocess import sys import urllib.parse import datetime from datetime import date query = os.environ["QUERY_STRING"] if not query: print("10 Напишите сообщение и нажмите \"Enter\".") sys.exit() text = urllib.parse.unquote(query) print("20 text/gemini") #print (text) #today = date.today() file1 = open("/opt/gemini/gb.gmi", "a") # append mode file1.write('%s.\n' % (datetime.datetime.now())) file1.write(" ") file1.write(text) file1.write("\n\n") file1.close() try: proc = subprocess.run( ["/usr/bin/cat","/opt/gemini/gb.gmi"], # input="/var/gemini/gb.gmi", capture_output=True, check=True, text=True, ) except: print("42 Unexpected Error") else: # print("20 text/plain") print(proc.stdout) #print("=> /cgi-bin/rgb.cgi Читать гостевую") print("=> gemini://gemini.phreedom.club:1968/cgi-bin/gb.cgi Писать в гостевую") print("=> gemini://gemini.phreedom.club:1968/index.gmi Выйти из гостевой")