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 setDonationUrl
from donate import getWebsite from donate import getWebsite
from donate import setWebsite from donate import setWebsite
from person import addActorUpdateTimestamp
from person import setPersonNotes from person import setPersonNotes
from person import getDefaultPersonContext from person import getDefaultPersonContext
from person import getActorUpdateJson from person import getActorUpdateJson
@ -5863,13 +5864,7 @@ class PubServer(BaseHTTPRequestHandler):
actorJson['featuredTags'] = \ actorJson['featuredTags'] = \
actorJson['id'] + '/collections/tags' actorJson['id'] + '/collections/tags'
randomizeActorImages(actorJson) randomizeActorImages(actorJson)
# add an updated timestamp to the actor addActorUpdateTimestamp(actorJson)
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']
# save the actor # save the actor
saveJson(actorJson, actorFilename) saveJson(actorJson, actorFilename)
webfingerUpdate(baseDir, webfingerUpdate(baseDir,

View File

@ -11,6 +11,7 @@ import time
import os import os
import subprocess import subprocess
import shutil import shutil
import datetime
import pyqrcode import pyqrcode
from random import randint from random import randint
from pathlib import Path from pathlib import Path
@ -1559,3 +1560,14 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {},
if '.svg' not in personJson['icon']['url'].lower(): if '.svg' not in personJson['icon']['url'].lower():
return personJson['icon']['url'] return personJson['icon']['url']
return None 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