mirror of https://gitlab.com/bashrc2/epicyon
Maximum newswire posts per source is configurable
parent
5c5a25e534
commit
876b29b7be
|
@ -11951,7 +11951,8 @@ def loadTokens(baseDir: str, tokensDict: {}, tokensLookup: {}) -> None:
|
|||
tokensLookup[token] = nickname
|
||||
|
||||
|
||||
def runDaemon(showPublishedDateOnly: bool,
|
||||
def runDaemon(maxNewswirePostsPerSource: int,
|
||||
showPublishedDateOnly: bool,
|
||||
votingTimeMins: int,
|
||||
positiveVoting: bool,
|
||||
newswireVotesThreshold: int,
|
||||
|
@ -12072,6 +12073,12 @@ def runDaemon(showPublishedDateOnly: bool,
|
|||
# or if positive voting is anabled to add the item to the news timeline
|
||||
httpd.newswireVotesThreshold = newswireVotesThreshold
|
||||
|
||||
# For each newswire source (account or rss feed)
|
||||
# this is the maximum number of posts to show for each.
|
||||
# This avoids one or two sources from dominating the news,
|
||||
# and also prevents big feeds from slowing down page load times
|
||||
httpd.maxNewswirePostsPerSource = maxNewswirePostsPerSource
|
||||
|
||||
# Show only the date at the bottom of posts, and not the time
|
||||
httpd.showPublishedDateOnly = showPublishedDateOnly
|
||||
|
||||
|
|
|
@ -112,6 +112,10 @@ parser.add_argument('--i2pDomain', dest='i2pDomain', type=str,
|
|||
parser.add_argument('-p', '--port', dest='port', type=int,
|
||||
default=None,
|
||||
help='Port number to run on')
|
||||
parser.add_argument('--postsPerSource',
|
||||
dest='maxNewswirePostsPerSource', type=int,
|
||||
default=5,
|
||||
help='Maximum newswire posts per feed or account')
|
||||
parser.add_argument('--postcache', dest='maxRecentPosts', type=int,
|
||||
default=512,
|
||||
help='The maximum number of recent posts to store in RAM')
|
||||
|
@ -1938,7 +1942,8 @@ if setTheme(baseDir, themeName, domain):
|
|||
print('Theme set to ' + themeName)
|
||||
|
||||
if __name__ == "__main__":
|
||||
runDaemon(args.dateonly,
|
||||
runDaemon(args.maxNewswirePostsPerSource,
|
||||
args.dateonly,
|
||||
args.votingtime,
|
||||
args.positivevoting,
|
||||
args.minimumvotes,
|
||||
|
|
|
@ -225,7 +225,9 @@ def runNewswireDaemon(baseDir: str, httpd,
|
|||
# try to update the feeds
|
||||
newNewswire = None
|
||||
try:
|
||||
newNewswire = getDictFromNewswire(httpd.session, baseDir)
|
||||
newNewswire = \
|
||||
getDictFromNewswire(httpd.session, baseDir,
|
||||
httpd.maxNewswirePostsPerSource)
|
||||
except Exception as e:
|
||||
print('WARN: unable to update newswire ' + str(e))
|
||||
time.sleep(120)
|
||||
|
|
|
@ -396,7 +396,7 @@ def addBlogsToNewswire(baseDir: str, newswire: {},
|
|||
os.remove(newswireModerationFilename)
|
||||
|
||||
|
||||
def getDictFromNewswire(session, baseDir: str) -> {}:
|
||||
def getDictFromNewswire(session, baseDir: str, maxPostsPerSource: int) -> {}:
|
||||
"""Gets rss feeds as a dictionary from newswire file
|
||||
"""
|
||||
subscriptionsFilename = baseDir + '/accounts/newswire.txt'
|
||||
|
|
6
tests.py
6
tests.py
|
@ -288,7 +288,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
|||
onionDomain = None
|
||||
i2pDomain = None
|
||||
print('Server running: Alice')
|
||||
runDaemon(False, 0, False, 1, False, False, False,
|
||||
runDaemon(5, False, 0, False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
"instanceId", False, path, domain,
|
||||
onionDomain, i2pDomain, None, port, port,
|
||||
|
@ -351,7 +351,7 @@ def createServerBob(path: str, domain: str, port: int,
|
|||
onionDomain = None
|
||||
i2pDomain = None
|
||||
print('Server running: Bob')
|
||||
runDaemon(False, 0, False, 1, False, False, False,
|
||||
runDaemon(5, False, 0, False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
"instanceId", False, path, domain,
|
||||
onionDomain, i2pDomain, None, port, port,
|
||||
|
@ -388,7 +388,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
|||
onionDomain = None
|
||||
i2pDomain = None
|
||||
print('Server running: Eve')
|
||||
runDaemon(False, 0, False, 1, False, False, False,
|
||||
runDaemon(5, False, 0, False, 1, False, False, False,
|
||||
5, True, True, 'en', __version__,
|
||||
"instanceId", False, path, domain,
|
||||
onionDomain, i2pDomain, None, port, port,
|
||||
|
|
Loading…
Reference in New Issue