misfin.py

This commit is contained in:
Satya Benson 2023-05-08 18:54:06 +00:00
parent c8761bbc58
commit 6c5bcbe396
1 changed files with 5 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import sys
import time import time
import socket import socket
import datetime import datetime
import pytz
import OpenSSL.SSL as ossl import OpenSSL.SSL as ossl
import OpenSSL.crypto as ocrypt import OpenSSL.crypto as ocrypt
@ -302,8 +302,10 @@ def send_as(sender, request, port=default_port, check_valid_method=_validate_not
return True return True
def write_message(message, blurb, address): def write_message(message, blurb, address):
with open("../gemini/content/satch.xyz/messages.gmi","a") as file: tz = pytz.timezone('America/New_York')
file.write("### message from {} ({}):\n{}\n\n".format(blurb, address, message)) now = datetime.datetime.now(tz)
with open("messages.gmi","a") as file:
file.write("### message from {} ({}):\n@ {}\n{}\n\n".format(blurb, address, now.strftime("%Y-%m-%dT%H:%M:%S"), message))
def _allow_anything(server, peer, request): def _allow_anything(server, peer, request):
""" Callback that accepts any message to the server's mailbox. """ """ Callback that accepts any message to the server's mailbox. """