Optionally pass session

main
Bob Mottram 2020-09-25 10:05:23 +00:00
parent d354b8a339
commit 148fb121b3
2 changed files with 10 additions and 6 deletions

View File

@ -472,7 +472,8 @@ if args.postDomains:
elif args.gnunet: elif args.gnunet:
proxyType = 'gnunet' proxyType = 'gnunet'
domainList = [] domainList = []
domainList = getPublicPostDomains(baseDir, nickname, domain, domainList = getPublicPostDomains(None,
baseDir, nickname, domain,
proxyType, args.port, proxyType, args.port,
httpPrefix, debug, httpPrefix, debug,
__version__, domainList) __version__, domainList)
@ -510,7 +511,8 @@ if args.postDomainsBlocked:
elif args.gnunet: elif args.gnunet:
proxyType = 'gnunet' proxyType = 'gnunet'
domainList = [] domainList = []
domainList = getPublicPostDomainsBlocked(baseDir, nickname, domain, domainList = getPublicPostDomainsBlocked(None,
baseDir, nickname, domain,
proxyType, args.port, proxyType, args.port,
httpPrefix, debug, httpPrefix, debug,
__version__, domainList) __version__, domainList)

View File

@ -3240,13 +3240,14 @@ def getPublicPostsOfPerson(baseDir: str, nickname: str, domain: str,
projectVersion, httpPrefix, domain) projectVersion, httpPrefix, domain)
def getPublicPostDomains(baseDir: str, nickname: str, domain: str, def getPublicPostDomains(session, baseDir: str, nickname: str, domain: str,
proxyType: str, port: int, httpPrefix: str, proxyType: str, port: int, httpPrefix: str,
debug: bool, projectVersion: str, debug: bool, projectVersion: str,
domainList=[]) -> []: domainList=[]) -> []:
""" Returns a list of domains referenced within public posts """ Returns a list of domains referenced within public posts
""" """
session = createSession(proxyType) if not session:
session = createSession(proxyType)
if not session: if not session:
return domainList return domainList
personCache = {} personCache = {}
@ -3288,7 +3289,8 @@ def getPublicPostDomains(baseDir: str, nickname: str, domain: str,
return postDomains return postDomains
def getPublicPostDomainsBlocked(baseDir: str, nickname: str, domain: str, def getPublicPostDomainsBlocked(session, baseDir: str,
nickname: str, domain: str,
proxyType: str, port: int, httpPrefix: str, proxyType: str, port: int, httpPrefix: str,
debug: bool, projectVersion: str, debug: bool, projectVersion: str,
domainList=[]) -> []: domainList=[]) -> []:
@ -3296,7 +3298,7 @@ def getPublicPostDomainsBlocked(baseDir: str, nickname: str, domain: str,
are globally blocked on this instance are globally blocked on this instance
""" """
postDomains = \ postDomains = \
getPublicPostDomains(baseDir, nickname, domain, getPublicPostDomains(session, baseDir, nickname, domain,
proxyType, port, httpPrefix, proxyType, port, httpPrefix,
debug, projectVersion, debug, projectVersion,
domainList) domainList)