mirror of https://gitlab.com/bashrc2/epicyon
Fix actor upgrades
parent
8623be6939
commit
89a15fdc73
11
person.py
11
person.py
|
@ -35,6 +35,7 @@ from auth import storeBasicCredentials
|
||||||
from auth import removePassword
|
from auth import removePassword
|
||||||
from roles import setRole
|
from roles import setRole
|
||||||
from media import removeMetaData
|
from media import removeMetaData
|
||||||
|
from utils import getStatusNumber
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import validNickname
|
from utils import validNickname
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
|
@ -272,12 +273,14 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
personId + '/avatar' + \
|
personId + '/avatar' + \
|
||||||
str(randint(10000000000000, 99999999999999)) + '.png' # nosec
|
str(randint(10000000000000, 99999999999999)) + '.png' # nosec
|
||||||
|
|
||||||
|
statusNumber, published = getStatusNumber()
|
||||||
newPerson = {
|
newPerson = {
|
||||||
'@context': [
|
'@context': [
|
||||||
'https://www.w3.org/ns/activitystreams',
|
'https://www.w3.org/ns/activitystreams',
|
||||||
'https://w3id.org/security/v1',
|
'https://w3id.org/security/v1',
|
||||||
getDefaultPersonContext()
|
getDefaultPersonContext()
|
||||||
],
|
],
|
||||||
|
'published': published,
|
||||||
'alsoKnownAs': [],
|
'alsoKnownAs': [],
|
||||||
'attachment': [],
|
'attachment': [],
|
||||||
'devices': personId + '/collections/devices',
|
'devices': personId + '/collections/devices',
|
||||||
|
@ -563,11 +566,17 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
if not personJson:
|
if not personJson:
|
||||||
personJson = loadJson(filename)
|
personJson = loadJson(filename)
|
||||||
|
|
||||||
if updateActor:
|
|
||||||
# add a speaker endpoint
|
# add a speaker endpoint
|
||||||
if not personJson.get('tts'):
|
if not personJson.get('tts'):
|
||||||
personJson['tts'] = personJson['id'] + '/speaker'
|
personJson['tts'] = personJson['id'] + '/speaker'
|
||||||
|
updateActor = True
|
||||||
|
|
||||||
|
if not personJson.get('published'):
|
||||||
|
statusNumber, published = getStatusNumber()
|
||||||
|
personJson['published'] = published
|
||||||
|
updateActor = True
|
||||||
|
|
||||||
|
if updateActor:
|
||||||
saveJson(personJson, filename)
|
saveJson(personJson, filename)
|
||||||
|
|
||||||
# also update the actor within the cache
|
# also update the actor within the cache
|
||||||
|
|
Loading…
Reference in New Issue