Store unknown contexts

main
Bob Mottram 2021-05-04 13:51:08 +01:00
parent 73f1fea0b0
commit c3a91fc574
1 changed files with 17 additions and 1 deletions

View File

@ -2973,8 +2973,24 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
if hasValidContext(originalJson):
hasJsonSignature = True
else:
unknownContextsFile = \
baseDir + '/accounts/unknownContexts.txt'
unknownContext = str(originalJson['@context'])
print('unrecognized @context: ' +
str(originalJson['@context']))
unknownContext)
alreadyUnknown = False
if os.path.isfile(unknownContextsFile):
if unknownContext in \
open(unknownContextsFile).read():
alreadyUnknown = True
if not alreadyUnknown:
unknownFile = open(unknownContextsFile, "a+")
if unknownFile:
unknownFile.write(unknownContext + '\n')
unknownFile.close()
# strict enforcement of json signatures
if not hasJsonSignature: