diff --git a/templates/threads.html b/templates/threads.html index fe3a426..36977a5 100644 --- a/templates/threads.html +++ b/templates/threads.html @@ -237,7 +237,15 @@ diff --git a/threads.py b/threads.py index 62f808d..49dc870 100755 --- a/threads.py +++ b/threads.py @@ -1,5 +1,6 @@ from flask import Blueprint, render_template import requests +import datetime threads = Blueprint('threads', __name__, template_folder='template') @@ -12,10 +13,20 @@ app = { } attribution = { "owner": "Ayo Ayco", - "year": "2024" + "year": "2022" # earliest year in featured posts } ########################################################### +@threads.before_request +def middleware(): + # check current year and put ange as attribution + currentDateTime = datetime.datetime.now() + date = currentDateTime.date() + year = date.strftime("%Y") + if year != attribution['year']: + attribution['current_year'] = year + + @threads.route('/') def home(): statuses = fetch_statuses()