#!/usr/bin/python import os import sqlite3 clihash = os.environ.get('TLS_CLIENT_HASH', "") if clihash == "": print("60 Please use a certificate to authenticate\r\n") exit() con = sqlite3.connect('notes.db') cur = con.cursor() rows = cur.execute("SELECT NoteIndex, Note, Completed FROM Notes WHERE hash = :thehash", {"thehash": clihash}).fetchall() print("20 text/gemini; charset=utf-8\r\n") print("# GemiNotes") print('## My notes') if (not rows): print("You don't have any notes yet.") else: for row in rows: if row[2] == 1: checkbox = "🔳 [Done] " else: checkbox = "⬜" print("### {} {}".format(checkbox, row[1])) print('=> delete.py?{} ❌ Delete note'.format(row[0])) print('=> complete.py?{} ✔ Change task completion'.format(row[0])) # Add button to set as completed print("") print("=> addnote.py ✍ Add new note") cur.close() con.close()