feat: Add rss endpoints
All checks were successful
Build Docker / BuildImage (push) Successful in 1m42s

This commit is contained in:
Nathan Woodburn 2024-11-12 14:08:30 +11:00
parent 42aff1f455
commit 637562f920
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 16 additions and 3 deletions

14
mail.py
View File

@ -7,6 +7,20 @@ from flask import jsonify
import os import os
# This is used to send emails via API
# The process should be something like this
# curl --request POST \
# --url https://nathan.c.woodburn.au/api/email \
# --header 'Content-Type: application/json' \
# --data '{
# "key":"api-key",
# "to": "recipient@nathan.woodburn.au",
# "from": "sender@nathan.woodburn.au",
# "sender":"Nathan.Woodburn/",
# "subject":"Test email from api",
# "body":"G'\''day\nThis is a test email from my website api\n\nRegards,\nNathan.Woodburn/"
# }'
def validateSender(email): def validateSender(email):
domains = os.getenv("EMAIL_DOMAINS").split(",") domains = os.getenv("EMAIL_DOMAINS").split(",")
for domain in domains: for domain in domains:

View File

@ -411,11 +411,8 @@ def email():
"status": 401, "status": 401,
"error": "Unauthorized 'key' invalid" "error": "Unauthorized 'key' invalid"
}) })
return sendEmail(data) return sendEmail(data)
#endregion #endregion
@ -673,6 +670,8 @@ def now_old():
) )
@app.route("/now.rss") @app.route("/now.rss")
@app.route("/now.xml")
@app.route("/rss.xml")
def now_rss(): def now_rss():
host = "https://" + request.host host = "https://" + request.host
if ":" in request.host: if ":" in request.host: