alt-html-css
Bob Mottram 2020-12-24 10:18:34 +00:00
parent f40739e986
commit 670bbd2984
2 changed files with 22 additions and 7 deletions

View File

@ -136,6 +136,7 @@ from webapp_timeline import htmlInboxBlogs
from webapp_timeline import htmlInboxNews
from webapp_timeline import htmlInboxFeatures
from webapp_timeline import htmlOutbox
from webapp_media import loadPeertubeInstances
from webapp_moderation import htmlAccountInfo
from webapp_moderation import htmlModeration
from webapp_moderation import htmlModerationInfo
@ -13637,13 +13638,7 @@ def runDaemon(sendThreadsTimeoutMins: int,
# load peertube instances from file into a list
httpd.peertubeInstances = []
peertubeInstancesFilename = baseDir + '/accounts/peertube.txt'
if os.path.isfile(peertubeInstancesFilename):
with open(peertubeInstancesFilename, 'r') as fp:
peertubeStr = fp.read()
if peertubeStr:
peertubeStr = peertubeStr.replace('\r', '')
httpd.peertubeInstances = peertubeStr.split('\n')
loadPeertubeInstances(baseDir, httpd.peertubeInstances)
createInitialLastSeen(baseDir, httpPrefix)

View File

@ -6,6 +6,26 @@ __maintainer__ = "Bob Mottram"
__email__ = "bob@freedombone.net"
__status__ = "Production"
import os
def loadPeertubeInstances(baseDir: str, peertubeInstances: []) -> None:
"""Loads peertube instances from file into the given list
"""
peertubeList = None
peertubeInstancesFilename = baseDir + '/accounts/peertube.txt'
if os.path.isfile(peertubeInstancesFilename):
with open(peertubeInstancesFilename, 'r') as fp:
peertubeStr = fp.read()
if peertubeStr:
peertubeStr = peertubeStr.replace('\r', '')
peertubeList = peertubeStr.split('\n')
if peertubeList:
for url in peertubeList:
if url in peertubeInstances:
continue
peertubeInstances.append(url)
def _addEmbeddedVideoFromSites(translate: {}, content: str,
peertubeInstances: [],