#!/usr/bin/python import os import sqlite3 clihash = os.environ.get('TLS_CLIENT_HASH', "") qstr = os.environ.get('QUERY_STRING', "") if clihash == "": print("60 Please use a certificate to authenticate\r\n") exit() if qstr == "": print("30 notesapp.py\r\n") exit() if qstr.isnumeric(): con = sqlite3.connect('notes.db') cur = con.cursor() try: cur.execute("UPDATE Notes SET Completed = CASE Completed WHEN 1 THEN 0 ELSE 1 END WHERE NoteIndex=? and Hash=?", (qstr, clihash)) con.commit() except sqlite3.Error as e: print("20 text/gemini; charset=utf-8\r\n") print(e.args[0]) exit() print("30 notesapp.py\r\n")