Load shared items federation tokens from file

main
Bob Mottram 2021-07-26 12:13:59 +01:00
parent ceaefc6ee9
commit 2cfd87d802
2 changed files with 23 additions and 12 deletions

View File

@ -15072,7 +15072,15 @@ def runDaemon(sharedItemsFederatedDomains: [],
httpd.httpPrefix = httpPrefix
httpd.debug = debug
httpd.federationList = fedList.copy()
if not sharedItemsFederatedDomains:
sharedItemsTokensFilename = \
baseDir + '/accounts/sharedItemsFederationTokens.json'
if os.path.isfile(sharedItemsTokensFilename):
sharedItemsFederatedDomains = loadJson(sharedItemsTokensFilename)
httpd.sharedItemsFederatedDomains = sharedItemsFederatedDomains.copy()
if httpd.sharedItemsFederatedDomains:
if domain not in httpd.sharedItemsFederatedDomains:
httpd.sharedItemsFederatedDomains.append(domain)
httpd.baseDir = baseDir
httpd.instanceId = instanceId
httpd.personCache = {}

View File

@ -1028,16 +1028,6 @@ else:
if configFederationList:
federationList = configFederationList
sharedItemsFederatedDomains = []
if args.sharedItemsFederatedDomains:
setConfigParam(baseDir, 'sharedItemsFederatedDomains',
sharedItemsFederatedDomains)
else:
configSharedItemsFederatedDomains = \
getConfigParam(baseDir, 'sharedItemsFederatedDomains')
if configSharedItemsFederatedDomains:
sharedItemsFederatedDomains = configSharedItemsFederatedDomains
proxyType = None
if args.tor or domain.endswith('.onion'):
proxyType = 'tor'
@ -2156,9 +2146,22 @@ if args.desktop:
if federationList:
print('Federating with: ' + str(federationList))
if sharedItemsFederatedDomains:
if args.sharedItemsFederatedDomains:
print('Federating shared items with: ' +
str(sharedItemsFederatedDomains))
args.sharedItemsFederatedDomains)
sharedItemsFederatedDomains = []
if args.sharedItemsFederatedDomains:
sharedItemsFederatedDomainsStr = args.sharedItemsFederatedDomains
setConfigParam(baseDir, 'sharedItemsFederatedDomains',
sharedItemsFederatedDomainsStr)
else:
sharedItemsFederatedDomainsStr = \
getConfigParam(baseDir, 'sharedItemsFederatedDomains')
if sharedItemsFederatedDomainsStr:
sharedItemsFederatedDomainsList = sharedItemsFederatedDomainsStr.split(',')
for sharedFederatedDomain in sharedItemsFederatedDomainsList:
sharedItemsFederatedDomains.append(sharedFederatedDomain.strip())
if args.block:
if not nickname: