main
Bob Mottram 2021-10-29 13:52:23 +01:00
parent 65d75b2e71
commit 09bb7f99b5
2 changed files with 14 additions and 7 deletions

View File

@ -53,6 +53,7 @@ from donate import getDonationUrl
from donate import setDonationUrl
from donate import getWebsite
from donate import setWebsite
from person import addActorUpdateTimestamp
from person import setPersonNotes
from person import getDefaultPersonContext
from person import getActorUpdateJson
@ -5863,13 +5864,7 @@ class PubServer(BaseHTTPRequestHandler):
actorJson['featuredTags'] = \
actorJson['id'] + '/collections/tags'
randomizeActorImages(actorJson)
# add an updated timestamp to the actor
updatedTime = datetime.datetime.utcnow()
actorJson['updated'] = \
updatedTime.strftime("%Y-%m-%dT%H:%M:%SZ")
# add updated timestamp to avatar and banner
actorJson['icon']['updated'] = actorJson['updated']
actorJson['image']['updated'] = actorJson['updated']
addActorUpdateTimestamp(actorJson)
# save the actor
saveJson(actorJson, actorFilename)
webfingerUpdate(baseDir,

View File

@ -11,6 +11,7 @@ import time
import os
import subprocess
import shutil
import datetime
import pyqrcode
from random import randint
from pathlib import Path
@ -1559,3 +1560,14 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {},
if '.svg' not in personJson['icon']['url'].lower():
return personJson['icon']['url']
return None
def addActorUpdateTimestamp(actorJson: {}) -> None:
"""Adds 'updated' fields with a timestamp
"""
updatedTime = datetime.datetime.utcnow()
currDateStr = updatedTime.strftime("%Y-%m-%dT%H:%M:%SZ")
actorJson['updated'] = currDateStr
# add updated timestamp to avatar and banner
actorJson['icon']['updated'] = currDateStr
actorJson['image']['updated'] = currDateStr