From 148fb121b3be125c0f2c6d8b6b7886514dbad7ee Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 25 Sep 2020 10:05:23 +0000 Subject: [PATCH] Optionally pass session --- epicyon.py | 6 ++++-- posts.py | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/epicyon.py b/epicyon.py index 0fae722f..edb04cbf 100644 --- a/epicyon.py +++ b/epicyon.py @@ -472,7 +472,8 @@ if args.postDomains: elif args.gnunet: proxyType = 'gnunet' domainList = [] - domainList = getPublicPostDomains(baseDir, nickname, domain, + domainList = getPublicPostDomains(None, + baseDir, nickname, domain, proxyType, args.port, httpPrefix, debug, __version__, domainList) @@ -510,7 +511,8 @@ if args.postDomainsBlocked: elif args.gnunet: proxyType = 'gnunet' domainList = [] - domainList = getPublicPostDomainsBlocked(baseDir, nickname, domain, + domainList = getPublicPostDomainsBlocked(None, + baseDir, nickname, domain, proxyType, args.port, httpPrefix, debug, __version__, domainList) diff --git a/posts.py b/posts.py index cee86d53..6fb17239 100644 --- a/posts.py +++ b/posts.py @@ -3240,13 +3240,14 @@ def getPublicPostsOfPerson(baseDir: str, nickname: str, domain: str, 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, debug: bool, projectVersion: str, domainList=[]) -> []: """ Returns a list of domains referenced within public posts """ - session = createSession(proxyType) + if not session: + session = createSession(proxyType) if not session: return domainList personCache = {} @@ -3288,7 +3289,8 @@ def getPublicPostDomains(baseDir: str, nickname: str, domain: str, 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, debug: bool, projectVersion: str, domainList=[]) -> []: @@ -3296,7 +3298,7 @@ def getPublicPostDomainsBlocked(baseDir: str, nickname: str, domain: str, are globally blocked on this instance """ postDomains = \ - getPublicPostDomains(baseDir, nickname, domain, + getPublicPostDomains(session, baseDir, nickname, domain, proxyType, port, httpPrefix, debug, projectVersion, domainList)