mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
5afc4e9e9b
commit
e6f605bdd8
50
daemon.py
50
daemon.py
|
@ -517,7 +517,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
location, False,
|
location, False,
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
conversationId,
|
conversationId,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
# name field contains the answer
|
# name field contains the answer
|
||||||
|
@ -1300,7 +1300,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
city, self.server.systemLanguage,
|
city, self.server.systemLanguage,
|
||||||
self.server.shared_items_federated_domains,
|
self.server.shared_items_federated_domains,
|
||||||
self.server.sharedItemFederationTokens,
|
self.server.sharedItemFederationTokens,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.signingPrivateKeyPem,
|
self.server.signingPrivateKeyPem,
|
||||||
self.server.peertubeInstances,
|
self.server.peertubeInstances,
|
||||||
self.server.themeName,
|
self.server.themeName,
|
||||||
|
@ -4816,7 +4816,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
city = getSpoofedCity(self.server.city,
|
city = getSpoofedCity(self.server.city,
|
||||||
base_dir, nickname, domain)
|
base_dir, nickname, domain)
|
||||||
|
|
||||||
if self.server.lowBandwidth:
|
if self.server.low_bandwidth:
|
||||||
convertImageToLowBandwidth(filename)
|
convertImageToLowBandwidth(filename)
|
||||||
processMetaData(base_dir, nickname, domain,
|
processMetaData(base_dir, nickname, domain,
|
||||||
filename, postImageFilename, city,
|
filename, postImageFilename, city,
|
||||||
|
@ -6203,15 +6203,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if path.startswith('/users/' + adminNickname + '/') or \
|
if path.startswith('/users/' + adminNickname + '/') or \
|
||||||
isArtist(base_dir, nickname):
|
isArtist(base_dir, nickname):
|
||||||
currLowBandwidth = \
|
currLowBandwidth = \
|
||||||
getConfigParam(base_dir, 'lowBandwidth')
|
getConfigParam(base_dir, 'low_bandwidth')
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
if fields.get('lowBandwidth'):
|
if fields.get('low_bandwidth'):
|
||||||
if fields['lowBandwidth'] == 'on':
|
if fields['low_bandwidth'] == 'on':
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
if currLowBandwidth != lowBandwidth:
|
if currLowBandwidth != low_bandwidth:
|
||||||
setConfigParam(base_dir, 'lowBandwidth',
|
setConfigParam(base_dir, 'low_bandwidth',
|
||||||
lowBandwidth)
|
low_bandwidth)
|
||||||
self.server.lowBandwidth = lowBandwidth
|
self.server.low_bandwidth = low_bandwidth
|
||||||
|
|
||||||
# save filtered words list
|
# save filtered words list
|
||||||
filterFilename = \
|
filterFilename = \
|
||||||
|
@ -16471,7 +16471,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
city = getSpoofedCity(self.server.city,
|
city = getSpoofedCity(self.server.city,
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
nickname, self.server.domain)
|
nickname, self.server.domain)
|
||||||
if self.server.lowBandwidth:
|
if self.server.low_bandwidth:
|
||||||
convertImageToLowBandwidth(filename)
|
convertImageToLowBandwidth(filename)
|
||||||
processMetaData(self.server.base_dir,
|
processMetaData(self.server.base_dir,
|
||||||
nickname, self.server.domain,
|
nickname, self.server.domain,
|
||||||
|
@ -16602,7 +16602,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['location'], False,
|
fields['location'], False,
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
conversationId,
|
conversationId,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
|
@ -16687,7 +16687,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
conversationId,
|
conversationId,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
|
@ -16779,7 +16779,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
attachmentMediaType,
|
attachmentMediaType,
|
||||||
imgDescription,
|
imgDescription,
|
||||||
city,
|
city,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
|
|
||||||
replaceYouTube(postJsonObject,
|
replaceYouTube(postJsonObject,
|
||||||
|
@ -16838,7 +16838,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
conversationId,
|
conversationId,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
|
@ -16890,7 +16890,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
conversationId,
|
conversationId,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
|
@ -16947,7 +16947,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
conversationId,
|
conversationId,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
|
@ -17001,7 +17001,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['location'],
|
fields['location'],
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
conversationId,
|
conversationId,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if fields['schedulePost']:
|
if fields['schedulePost']:
|
||||||
|
@ -17038,7 +17038,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
city,
|
city,
|
||||||
self.server.debug, fields['subject'],
|
self.server.debug, fields['subject'],
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if self._postToOutbox(messageJson,
|
if self._postToOutbox(messageJson,
|
||||||
|
@ -17080,7 +17080,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
fields['subject'],
|
fields['subject'],
|
||||||
intDuration,
|
intDuration,
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if messageJson:
|
if messageJson:
|
||||||
if self.server.debug:
|
if self.server.debug:
|
||||||
|
@ -17153,7 +17153,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
city, itemPrice, itemCurrency,
|
city, itemPrice, itemCurrency,
|
||||||
self.server.systemLanguage,
|
self.server.systemLanguage,
|
||||||
self.server.translate, sharesFileType,
|
self.server.translate, sharesFileType,
|
||||||
self.server.lowBandwidth,
|
self.server.low_bandwidth,
|
||||||
self.server.content_license_url)
|
self.server.content_license_url)
|
||||||
if filename:
|
if filename:
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
|
@ -18402,7 +18402,7 @@ def loadTokens(base_dir: str, tokensDict: {}, tokensLookup: {}) -> None:
|
||||||
def runDaemon(content_license_url: str,
|
def runDaemon(content_license_url: str,
|
||||||
lists_enabled: str,
|
lists_enabled: str,
|
||||||
default_reply_interval_hrs: int,
|
default_reply_interval_hrs: int,
|
||||||
lowBandwidth: bool,
|
low_bandwidth: bool,
|
||||||
maxLikeCount: int,
|
maxLikeCount: int,
|
||||||
shared_items_federated_domains: [],
|
shared_items_federated_domains: [],
|
||||||
userAgentsBlocked: [],
|
userAgentsBlocked: [],
|
||||||
|
@ -18558,7 +18558,7 @@ def runDaemon(content_license_url: str,
|
||||||
loadAccessKeysForAccounts(base_dir, httpd.keyShortcuts, httpd.accessKeys)
|
loadAccessKeysForAccounts(base_dir, httpd.keyShortcuts, httpd.accessKeys)
|
||||||
|
|
||||||
# wheither to use low bandwidth images
|
# wheither to use low bandwidth images
|
||||||
httpd.lowBandwidth = lowBandwidth
|
httpd.low_bandwidth = low_bandwidth
|
||||||
|
|
||||||
# list of blocked user agent types within the User-Agent header
|
# list of blocked user agent types within the User-Agent header
|
||||||
httpd.userAgentsBlocked = userAgentsBlocked
|
httpd.userAgentsBlocked = userAgentsBlocked
|
||||||
|
|
|
@ -418,7 +418,7 @@ def _desktopReplyToPost(session, postId: str,
|
||||||
debug: bool, subject: str,
|
debug: bool, subject: str,
|
||||||
screenreader: str, systemLanguage: str,
|
screenreader: str, systemLanguage: str,
|
||||||
espeak, conversationId: str,
|
espeak, conversationId: str,
|
||||||
lowBandwidth: bool,
|
low_bandwidth: bool,
|
||||||
content_license_url: str,
|
content_license_url: str,
|
||||||
signingPrivateKeyPem: str) -> None:
|
signingPrivateKeyPem: str) -> None:
|
||||||
"""Use the desktop client to send a reply to the most recent post
|
"""Use the desktop client to send a reply to the most recent post
|
||||||
|
@ -473,7 +473,7 @@ def _desktopReplyToPost(session, postId: str,
|
||||||
commentsEnabled, attach, mediaType,
|
commentsEnabled, attach, mediaType,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, lowBandwidth,
|
systemLanguage, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
debug, postId, postId,
|
debug, postId, postId,
|
||||||
conversationId, subject) == 0:
|
conversationId, subject) == 0:
|
||||||
|
@ -489,7 +489,7 @@ def _desktopNewPost(session,
|
||||||
cachedWebfingers: {}, personCache: {},
|
cachedWebfingers: {}, personCache: {},
|
||||||
debug: bool,
|
debug: bool,
|
||||||
screenreader: str, systemLanguage: str,
|
screenreader: str, systemLanguage: str,
|
||||||
espeak, lowBandwidth: bool,
|
espeak, low_bandwidth: bool,
|
||||||
content_license_url: str,
|
content_license_url: str,
|
||||||
signingPrivateKeyPem: str) -> None:
|
signingPrivateKeyPem: str) -> None:
|
||||||
"""Use the desktop client to create a new post
|
"""Use the desktop client to create a new post
|
||||||
|
@ -540,7 +540,7 @@ def _desktopNewPost(session,
|
||||||
commentsEnabled, attach, mediaType,
|
commentsEnabled, attach, mediaType,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, lowBandwidth,
|
systemLanguage, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
debug, None, None,
|
debug, None, None,
|
||||||
conversationId, subject) == 0:
|
conversationId, subject) == 0:
|
||||||
|
@ -1129,7 +1129,7 @@ def _desktopNewDM(session, toHandle: str,
|
||||||
cachedWebfingers: {}, personCache: {},
|
cachedWebfingers: {}, personCache: {},
|
||||||
debug: bool,
|
debug: bool,
|
||||||
screenreader: str, systemLanguage: str,
|
screenreader: str, systemLanguage: str,
|
||||||
espeak, lowBandwidth: bool,
|
espeak, low_bandwidth: bool,
|
||||||
content_license_url: str,
|
content_license_url: str,
|
||||||
signingPrivateKeyPem: str) -> None:
|
signingPrivateKeyPem: str) -> None:
|
||||||
"""Use the desktop client to create a new direct message
|
"""Use the desktop client to create a new direct message
|
||||||
|
@ -1152,7 +1152,7 @@ def _desktopNewDM(session, toHandle: str,
|
||||||
cachedWebfingers, personCache,
|
cachedWebfingers, personCache,
|
||||||
debug,
|
debug,
|
||||||
screenreader, systemLanguage,
|
screenreader, systemLanguage,
|
||||||
espeak, lowBandwidth,
|
espeak, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
signingPrivateKeyPem)
|
signingPrivateKeyPem)
|
||||||
|
|
||||||
|
@ -1163,7 +1163,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
||||||
cachedWebfingers: {}, personCache: {},
|
cachedWebfingers: {}, personCache: {},
|
||||||
debug: bool,
|
debug: bool,
|
||||||
screenreader: str, systemLanguage: str,
|
screenreader: str, systemLanguage: str,
|
||||||
espeak, lowBandwidth: bool,
|
espeak, low_bandwidth: bool,
|
||||||
content_license_url: str,
|
content_license_url: str,
|
||||||
signingPrivateKeyPem: str) -> None:
|
signingPrivateKeyPem: str) -> None:
|
||||||
"""Use the desktop client to create a new direct message
|
"""Use the desktop client to create a new direct message
|
||||||
|
@ -1254,7 +1254,7 @@ def _desktopNewDMbase(session, toHandle: str,
|
||||||
commentsEnabled, attach, mediaType,
|
commentsEnabled, attach, mediaType,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, lowBandwidth,
|
systemLanguage, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
debug, None, None,
|
debug, None, None,
|
||||||
conversationId, subject) == 0:
|
conversationId, subject) == 0:
|
||||||
|
@ -1322,7 +1322,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
|
||||||
storeInboxPosts: bool,
|
storeInboxPosts: bool,
|
||||||
showNewPosts: bool,
|
showNewPosts: bool,
|
||||||
language: str,
|
language: str,
|
||||||
debug: bool, lowBandwidth: bool) -> None:
|
debug: bool, low_bandwidth: bool) -> None:
|
||||||
"""Runs the desktop and screen reader client,
|
"""Runs the desktop and screen reader client,
|
||||||
which announces new inbox items
|
which announces new inbox items
|
||||||
"""
|
"""
|
||||||
|
@ -1729,7 +1729,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
|
||||||
debug, subject,
|
debug, subject,
|
||||||
screenreader, systemLanguage,
|
screenreader, systemLanguage,
|
||||||
espeak, conversationId,
|
espeak, conversationId,
|
||||||
lowBandwidth,
|
low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
signingPrivateKeyPem)
|
signingPrivateKeyPem)
|
||||||
refreshTimeline = True
|
refreshTimeline = True
|
||||||
|
@ -1765,7 +1765,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
|
||||||
cachedWebfingers, personCache,
|
cachedWebfingers, personCache,
|
||||||
debug,
|
debug,
|
||||||
screenreader, systemLanguage,
|
screenreader, systemLanguage,
|
||||||
espeak, lowBandwidth,
|
espeak, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
signingPrivateKeyPem)
|
signingPrivateKeyPem)
|
||||||
refreshTimeline = True
|
refreshTimeline = True
|
||||||
|
@ -1777,7 +1777,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
|
||||||
cachedWebfingers, personCache,
|
cachedWebfingers, personCache,
|
||||||
debug,
|
debug,
|
||||||
screenreader, systemLanguage,
|
screenreader, systemLanguage,
|
||||||
espeak, lowBandwidth,
|
espeak, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
signingPrivateKeyPem)
|
signingPrivateKeyPem)
|
||||||
refreshTimeline = True
|
refreshTimeline = True
|
||||||
|
|
40
epicyon.py
40
epicyon.py
|
@ -353,8 +353,8 @@ parser.add_argument("--rssIconAtTop",
|
||||||
const=True, default=True,
|
const=True, default=True,
|
||||||
help="Whether to show the rss icon at teh top or bottom" +
|
help="Whether to show the rss icon at teh top or bottom" +
|
||||||
"of the timeline")
|
"of the timeline")
|
||||||
parser.add_argument("--lowBandwidth",
|
parser.add_argument("--low_bandwidth",
|
||||||
dest='lowBandwidth',
|
dest='low_bandwidth',
|
||||||
type=str2bool, nargs='?',
|
type=str2bool, nargs='?',
|
||||||
const=True, default=True,
|
const=True, default=True,
|
||||||
help="Whether to use low bandwidth images")
|
help="Whether to use low bandwidth images")
|
||||||
|
@ -1322,7 +1322,7 @@ if args.message:
|
||||||
args.commentsEnabled, attach, mediaType,
|
args.commentsEnabled, attach, mediaType,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
args.language, args.lowBandwidth,
|
args.language, args.low_bandwidth,
|
||||||
args.content_license_url, args.debug,
|
args.content_license_url, args.debug,
|
||||||
replyTo, replyTo, args.conversationId, subject)
|
replyTo, replyTo, args.conversationId, subject)
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
|
@ -2598,7 +2598,7 @@ if args.desktop:
|
||||||
storeInboxPosts,
|
storeInboxPosts,
|
||||||
args.notifyShowNewPosts,
|
args.notifyShowNewPosts,
|
||||||
args.language,
|
args.language,
|
||||||
args.debug, args.lowBandwidth)
|
args.debug, args.low_bandwidth)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if federationList:
|
if federationList:
|
||||||
|
@ -2839,7 +2839,7 @@ if args.testdata:
|
||||||
"mechanical",
|
"mechanical",
|
||||||
"City", "0", "GBP",
|
"City", "0", "GBP",
|
||||||
"2 months",
|
"2 months",
|
||||||
debug, city, args.language, {}, 'shares', args.lowBandwidth,
|
debug, city, args.language, {}, 'shares', args.low_bandwidth,
|
||||||
args.content_license_url)
|
args.content_license_url)
|
||||||
addShare(base_dir,
|
addShare(base_dir,
|
||||||
http_prefix, nickname, domain, port,
|
http_prefix, nickname, domain, port,
|
||||||
|
@ -2850,7 +2850,7 @@ if args.testdata:
|
||||||
"clothing",
|
"clothing",
|
||||||
"City", "0", "GBP",
|
"City", "0", "GBP",
|
||||||
"3 months",
|
"3 months",
|
||||||
debug, city, args.language, {}, 'shares', args.lowBandwidth,
|
debug, city, args.language, {}, 'shares', args.low_bandwidth,
|
||||||
args.content_license_url)
|
args.content_license_url)
|
||||||
|
|
||||||
deleteAllPosts(base_dir, nickname, domain, 'inbox')
|
deleteAllPosts(base_dir, nickname, domain, 'inbox')
|
||||||
|
@ -2873,7 +2873,7 @@ if args.testdata:
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
conversationId = None
|
conversationId = None
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
|
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"like this is totally just a #test man",
|
"like this is totally just a #test man",
|
||||||
|
@ -2887,7 +2887,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"Zoiks!!!",
|
"Zoiks!!!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2900,7 +2900,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"Hey scoob we need like a hundred more #milkshakes",
|
"Hey scoob we need like a hundred more #milkshakes",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2913,7 +2913,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"Getting kinda spooky around here",
|
"Getting kinda spooky around here",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2926,7 +2926,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"And they would have gotten away with it too" +
|
"And they would have gotten away with it too" +
|
||||||
"if it wasn't for those pesky hackers",
|
"if it wasn't for those pesky hackers",
|
||||||
|
@ -2940,7 +2940,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"man these centralized sites are like the worst!",
|
"man these centralized sites are like the worst!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2953,7 +2953,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"another mystery solved #test",
|
"another mystery solved #test",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2966,7 +2966,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
"let's go bowling",
|
"let's go bowling",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -2979,7 +2979,7 @@ if args.testdata:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, args.language, conversationId,
|
testIsArticle, args.language, conversationId,
|
||||||
lowBandwidth, args.content_license_url)
|
low_bandwidth, args.content_license_url)
|
||||||
domainFull = domain + ':' + str(port)
|
domainFull = domain + ':' + str(port)
|
||||||
clearFollows(base_dir, nickname, domain)
|
clearFollows(base_dir, nickname, domain)
|
||||||
followPerson(base_dir, nickname, domain, 'maxboardroom', domainFull,
|
followPerson(base_dir, nickname, domain, 'maxboardroom', domainFull,
|
||||||
|
@ -3133,10 +3133,10 @@ showNodeInfoVersion = \
|
||||||
if showNodeInfoVersion is not None:
|
if showNodeInfoVersion is not None:
|
||||||
args.showNodeInfoVersion = bool(showNodeInfoVersion)
|
args.showNodeInfoVersion = bool(showNodeInfoVersion)
|
||||||
|
|
||||||
lowBandwidth = \
|
low_bandwidth = \
|
||||||
getConfigParam(base_dir, 'lowBandwidth')
|
getConfigParam(base_dir, 'low_bandwidth')
|
||||||
if lowBandwidth is not None:
|
if low_bandwidth is not None:
|
||||||
args.lowBandwidth = bool(lowBandwidth)
|
args.low_bandwidth = bool(low_bandwidth)
|
||||||
|
|
||||||
userAgentsBlocked = []
|
userAgentsBlocked = []
|
||||||
if args.userAgentBlocks:
|
if args.userAgentBlocks:
|
||||||
|
@ -3213,7 +3213,7 @@ if __name__ == "__main__":
|
||||||
runDaemon(content_license_url,
|
runDaemon(content_license_url,
|
||||||
lists_enabled,
|
lists_enabled,
|
||||||
args.default_reply_interval_hrs,
|
args.default_reply_interval_hrs,
|
||||||
args.lowBandwidth, args.maxLikeCount,
|
args.low_bandwidth, args.maxLikeCount,
|
||||||
shared_items_federated_domains,
|
shared_items_federated_domains,
|
||||||
userAgentsBlocked,
|
userAgentsBlocked,
|
||||||
args.logLoginFailures,
|
args.logLoginFailures,
|
||||||
|
|
4
inbox.py
4
inbox.py
|
@ -2843,7 +2843,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
|
||||||
eventTime = None
|
eventTime = None
|
||||||
location = None
|
location = None
|
||||||
conversationId = None
|
conversationId = None
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
createDirectMessagePost(base_dir, nickname, domain, port,
|
createDirectMessagePost(base_dir, nickname, domain, port,
|
||||||
http_prefix, content, followersOnly,
|
http_prefix, content, followersOnly,
|
||||||
|
@ -2854,7 +2854,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
|
||||||
inReplyTo, inReplyToAtomUri,
|
inReplyTo, inReplyToAtomUri,
|
||||||
subject, debug, schedulePost,
|
subject, debug, schedulePost,
|
||||||
eventDate, eventTime, location,
|
eventDate, eventTime, location,
|
||||||
systemLanguage, conversationId, lowBandwidth,
|
systemLanguage, conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
if not postJsonObject:
|
if not postJsonObject:
|
||||||
print('WARN: unable to create bounce message to ' + sendingHandle)
|
print('WARN: unable to create bounce message to ' + sendingHandle)
|
||||||
|
|
22
media.py
22
media.py
|
@ -163,41 +163,41 @@ def _spoofMetaData(base_dir: str, nickname: str, domain: str,
|
||||||
def convertImageToLowBandwidth(imageFilename: str) -> None:
|
def convertImageToLowBandwidth(imageFilename: str) -> None:
|
||||||
"""Converts an image to a low bandwidth version
|
"""Converts an image to a low bandwidth version
|
||||||
"""
|
"""
|
||||||
lowBandwidthFilename = imageFilename + '.low'
|
low_bandwidthFilename = imageFilename + '.low'
|
||||||
if os.path.isfile(lowBandwidthFilename):
|
if os.path.isfile(low_bandwidthFilename):
|
||||||
try:
|
try:
|
||||||
os.remove(lowBandwidthFilename)
|
os.remove(low_bandwidthFilename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: convertImageToLowBandwidth unable to delete ' +
|
print('EX: convertImageToLowBandwidth unable to delete ' +
|
||||||
lowBandwidthFilename)
|
low_bandwidthFilename)
|
||||||
|
|
||||||
cmd = \
|
cmd = \
|
||||||
'/usr/bin/convert +noise Multiplicative ' + \
|
'/usr/bin/convert +noise Multiplicative ' + \
|
||||||
'-evaluate median 10% -dither Floyd-Steinberg ' + \
|
'-evaluate median 10% -dither Floyd-Steinberg ' + \
|
||||||
'-monochrome ' + imageFilename + ' ' + lowBandwidthFilename
|
'-monochrome ' + imageFilename + ' ' + low_bandwidthFilename
|
||||||
print('Low bandwidth image conversion: ' + cmd)
|
print('Low bandwidth image conversion: ' + cmd)
|
||||||
subprocess.call(cmd, shell=True)
|
subprocess.call(cmd, shell=True)
|
||||||
# wait for conversion to happen
|
# wait for conversion to happen
|
||||||
ctr = 0
|
ctr = 0
|
||||||
while not os.path.isfile(lowBandwidthFilename):
|
while not os.path.isfile(low_bandwidthFilename):
|
||||||
print('Waiting for low bandwidth image conversion ' + str(ctr))
|
print('Waiting for low bandwidth image conversion ' + str(ctr))
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
ctr += 1
|
ctr += 1
|
||||||
if ctr > 100:
|
if ctr > 100:
|
||||||
print('WARN: timed out waiting for low bandwidth image conversion')
|
print('WARN: timed out waiting for low bandwidth image conversion')
|
||||||
break
|
break
|
||||||
if os.path.isfile(lowBandwidthFilename):
|
if os.path.isfile(low_bandwidthFilename):
|
||||||
try:
|
try:
|
||||||
os.remove(imageFilename)
|
os.remove(imageFilename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: convertImageToLowBandwidth unable to delete ' +
|
print('EX: convertImageToLowBandwidth unable to delete ' +
|
||||||
imageFilename)
|
imageFilename)
|
||||||
os.rename(lowBandwidthFilename, imageFilename)
|
os.rename(low_bandwidthFilename, imageFilename)
|
||||||
if os.path.isfile(imageFilename):
|
if os.path.isfile(imageFilename):
|
||||||
print('Image converted to low bandwidth ' + imageFilename)
|
print('Image converted to low bandwidth ' + imageFilename)
|
||||||
else:
|
else:
|
||||||
print('Low bandwidth converted image not found: ' +
|
print('Low bandwidth converted image not found: ' +
|
||||||
lowBandwidthFilename)
|
low_bandwidthFilename)
|
||||||
|
|
||||||
|
|
||||||
def processMetaData(base_dir: str, nickname: str, domain: str,
|
def processMetaData(base_dir: str, nickname: str, domain: str,
|
||||||
|
@ -297,7 +297,7 @@ def attachMedia(base_dir: str, http_prefix: str,
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str, port: int,
|
||||||
postJson: {}, imageFilename: str,
|
postJson: {}, imageFilename: str,
|
||||||
mediaType: str, description: str,
|
mediaType: str, description: str,
|
||||||
city: str, lowBandwidth: bool,
|
city: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Attaches media to a json object post
|
"""Attaches media to a json object post
|
||||||
The description can be None
|
The description can be None
|
||||||
|
@ -353,7 +353,7 @@ def attachMedia(base_dir: str, http_prefix: str,
|
||||||
|
|
||||||
if base_dir:
|
if base_dir:
|
||||||
if mediaType.startswith('image/'):
|
if mediaType.startswith('image/'):
|
||||||
if lowBandwidth:
|
if low_bandwidth:
|
||||||
convertImageToLowBandwidth(imageFilename)
|
convertImageToLowBandwidth(imageFilename)
|
||||||
processMetaData(base_dir, nickname, domain,
|
processMetaData(base_dir, nickname, domain,
|
||||||
imageFilename, mediaFilename, city,
|
imageFilename, mediaFilename, city,
|
||||||
|
|
|
@ -545,7 +545,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
||||||
maxMirroredArticles: int,
|
maxMirroredArticles: int,
|
||||||
allowLocalNetworkAccess: bool,
|
allowLocalNetworkAccess: bool,
|
||||||
systemLanguage: str,
|
systemLanguage: str,
|
||||||
lowBandwidth: bool,
|
low_bandwidth: bool,
|
||||||
content_license_url: str) -> None:
|
content_license_url: str) -> None:
|
||||||
"""Converts rss items in a newswire into posts
|
"""Converts rss items in a newswire into posts
|
||||||
"""
|
"""
|
||||||
|
@ -638,7 +638,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
|
||||||
attachImageFilename, mediaType,
|
attachImageFilename, mediaType,
|
||||||
imageDescription, city,
|
imageDescription, city,
|
||||||
rssTitle, systemLanguage,
|
rssTitle, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
if not blog:
|
if not blog:
|
||||||
continue
|
continue
|
||||||
|
@ -836,7 +836,7 @@ def runNewswireDaemon(base_dir: str, httpd,
|
||||||
httpd.maxMirroredArticles,
|
httpd.maxMirroredArticles,
|
||||||
httpd.allowLocalNetworkAccess,
|
httpd.allowLocalNetworkAccess,
|
||||||
httpd.systemLanguage,
|
httpd.systemLanguage,
|
||||||
httpd.lowBandwidth,
|
httpd.low_bandwidth,
|
||||||
httpd.content_license_url)
|
httpd.content_license_url)
|
||||||
print('Newswire feed converted to ActivityPub')
|
print('Newswire feed converted to ActivityPub')
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ def postMessageToOutbox(session, translate: {},
|
||||||
city: str, systemLanguage: str,
|
city: str, systemLanguage: str,
|
||||||
shared_items_federated_domains: [],
|
shared_items_federated_domains: [],
|
||||||
sharedItemFederationTokens: {},
|
sharedItemFederationTokens: {},
|
||||||
lowBandwidth: bool,
|
low_bandwidth: bool,
|
||||||
signingPrivateKeyPem: str,
|
signingPrivateKeyPem: str,
|
||||||
peertubeInstances: str, theme: str,
|
peertubeInstances: str, theme: str,
|
||||||
maxLikeCount: int,
|
maxLikeCount: int,
|
||||||
|
@ -625,7 +625,7 @@ def postMessageToOutbox(session, translate: {},
|
||||||
print('DEBUG: handle share uploads')
|
print('DEBUG: handle share uploads')
|
||||||
outboxShareUpload(base_dir, http_prefix, postToNickname, domain,
|
outboxShareUpload(base_dir, http_prefix, postToNickname, domain,
|
||||||
port, messageJson, debug, city,
|
port, messageJson, debug, city,
|
||||||
systemLanguage, translate, lowBandwidth,
|
systemLanguage, translate, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
|
54
posts.py
54
posts.py
|
@ -1072,7 +1072,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
mediaType: str, imageDescription: str, city: str,
|
mediaType: str, imageDescription: str, city: str,
|
||||||
postObjectType: str, summary: str,
|
postObjectType: str, summary: str,
|
||||||
inReplyToAtomUri: str, systemLanguage: str,
|
inReplyToAtomUri: str, systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Creates a new server-to-server post
|
"""Creates a new server-to-server post
|
||||||
"""
|
"""
|
||||||
|
@ -1133,7 +1133,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
newPost['object'] = \
|
newPost['object'] = \
|
||||||
attachMedia(base_dir, http_prefix, nickname, domain, port,
|
attachMedia(base_dir, http_prefix, nickname, domain, port,
|
||||||
newPost['object'], attachImageFilename,
|
newPost['object'], attachImageFilename,
|
||||||
mediaType, imageDescription, city, lowBandwidth,
|
mediaType, imageDescription, city, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
return newPost
|
return newPost
|
||||||
|
|
||||||
|
@ -1147,7 +1147,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
mediaType: str, imageDescription: str, city: str,
|
mediaType: str, imageDescription: str, city: str,
|
||||||
postObjectType: str, summary: str,
|
postObjectType: str, summary: str,
|
||||||
inReplyToAtomUri: str, systemLanguage: str,
|
inReplyToAtomUri: str, systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: str,
|
conversationId: str, low_bandwidth: str,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Creates a new client-to-server post
|
"""Creates a new client-to-server post
|
||||||
"""
|
"""
|
||||||
|
@ -1198,7 +1198,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
newPost = \
|
newPost = \
|
||||||
attachMedia(base_dir, http_prefix, nickname, domain, port,
|
attachMedia(base_dir, http_prefix, nickname, domain, port,
|
||||||
newPost, attachImageFilename,
|
newPost, attachImageFilename,
|
||||||
mediaType, imageDescription, city, lowBandwidth,
|
mediaType, imageDescription, city, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
return newPost
|
return newPost
|
||||||
|
|
||||||
|
@ -1381,7 +1381,7 @@ def _createPostBase(base_dir: str,
|
||||||
anonymousParticipationEnabled: bool,
|
anonymousParticipationEnabled: bool,
|
||||||
eventStatus: str, ticketUrl: str,
|
eventStatus: str, ticketUrl: str,
|
||||||
systemLanguage: str,
|
systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Creates a message
|
"""Creates a message
|
||||||
"""
|
"""
|
||||||
|
@ -1517,7 +1517,7 @@ def _createPostBase(base_dir: str,
|
||||||
mediaType, imageDescription, city,
|
mediaType, imageDescription, city,
|
||||||
postObjectType, summary,
|
postObjectType, summary,
|
||||||
inReplyToAtomUri, systemLanguage,
|
inReplyToAtomUri, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
else:
|
else:
|
||||||
newPost = \
|
newPost = \
|
||||||
|
@ -1530,7 +1530,7 @@ def _createPostBase(base_dir: str,
|
||||||
mediaType, imageDescription, city,
|
mediaType, imageDescription, city,
|
||||||
postObjectType, summary,
|
postObjectType, summary,
|
||||||
inReplyToAtomUri, systemLanguage,
|
inReplyToAtomUri, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
|
|
||||||
_createPostMentions(ccUrl, newPost, toRecipients, tags)
|
_createPostMentions(ccUrl, newPost, toRecipients, tags)
|
||||||
|
@ -1767,7 +1767,7 @@ def createPublicPost(base_dir: str,
|
||||||
location: str,
|
location: str,
|
||||||
isArticle: bool,
|
isArticle: bool,
|
||||||
systemLanguage: str,
|
systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Public post
|
"""Public post
|
||||||
"""
|
"""
|
||||||
|
@ -1799,7 +1799,7 @@ def createPublicPost(base_dir: str,
|
||||||
repliesModerationOption,
|
repliesModerationOption,
|
||||||
anonymousParticipationEnabled,
|
anonymousParticipationEnabled,
|
||||||
eventStatus, ticketUrl, systemLanguage,
|
eventStatus, ticketUrl, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1843,7 +1843,7 @@ def createBlogPost(base_dir: str,
|
||||||
subject: str, schedulePost: bool,
|
subject: str, schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str,
|
location: str, systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
blogJson = \
|
blogJson = \
|
||||||
createPublicPost(base_dir,
|
createPublicPost(base_dir,
|
||||||
|
@ -1856,7 +1856,7 @@ def createBlogPost(base_dir: str,
|
||||||
schedulePost,
|
schedulePost,
|
||||||
eventDate, eventTime, location,
|
eventDate, eventTime, location,
|
||||||
True, systemLanguage, conversationId,
|
True, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
blogJson['object']['url'] = \
|
blogJson['object']['url'] = \
|
||||||
blogJson['object']['url'].replace('/@', '/users/')
|
blogJson['object']['url'].replace('/@', '/users/')
|
||||||
_appendCitationsToBlogPost(base_dir, nickname, domain, blogJson)
|
_appendCitationsToBlogPost(base_dir, nickname, domain, blogJson)
|
||||||
|
@ -1870,7 +1870,7 @@ def createNewsPost(base_dir: str,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, city: str,
|
imageDescription: str, city: str,
|
||||||
subject: str, systemLanguage: str,
|
subject: str, systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
clientToServer = False
|
clientToServer = False
|
||||||
inReplyTo = None
|
inReplyTo = None
|
||||||
|
@ -1890,7 +1890,7 @@ def createNewsPost(base_dir: str,
|
||||||
schedulePost,
|
schedulePost,
|
||||||
eventDate, eventTime, location,
|
eventDate, eventTime, location,
|
||||||
True, systemLanguage, conversationId,
|
True, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
blog['object']['type'] = 'Article'
|
blog['object']['type'] = 'Article'
|
||||||
return blog
|
return blog
|
||||||
|
|
||||||
|
@ -1903,7 +1903,7 @@ def createQuestionPost(base_dir: str,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, city: str,
|
imageDescription: str, city: str,
|
||||||
subject: str, durationDays: int,
|
subject: str, durationDays: int,
|
||||||
systemLanguage: str, lowBandwidth: bool,
|
systemLanguage: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Question post with multiple choice options
|
"""Question post with multiple choice options
|
||||||
"""
|
"""
|
||||||
|
@ -1921,7 +1921,7 @@ def createQuestionPost(base_dir: str,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage,
|
None, None, None, None, None, systemLanguage,
|
||||||
None, lowBandwidth, content_license_url)
|
None, low_bandwidth, content_license_url)
|
||||||
messageJson['object']['type'] = 'Question'
|
messageJson['object']['type'] = 'Question'
|
||||||
messageJson['object']['oneOf'] = []
|
messageJson['object']['oneOf'] = []
|
||||||
messageJson['object']['votersCount'] = 0
|
messageJson['object']['votersCount'] = 0
|
||||||
|
@ -1953,7 +1953,7 @@ def createUnlistedPost(base_dir: str,
|
||||||
subject: str, schedulePost: bool,
|
subject: str, schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str,
|
location: str, systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Unlisted post. This has the #Public and followers links inverted.
|
"""Unlisted post. This has the #Public and followers links inverted.
|
||||||
"""
|
"""
|
||||||
|
@ -1971,7 +1971,7 @@ def createUnlistedPost(base_dir: str,
|
||||||
schedulePost, eventDate, eventTime, location,
|
schedulePost, eventDate, eventTime, location,
|
||||||
None, None, None, None, None,
|
None, None, None, None, None,
|
||||||
None, None, None, None, None, systemLanguage,
|
None, None, None, None, None, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1988,7 +1988,7 @@ def createFollowersOnlyPost(base_dir: str,
|
||||||
subject: str, schedulePost: bool,
|
subject: str, schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str,
|
location: str, systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Followers only post
|
"""Followers only post
|
||||||
"""
|
"""
|
||||||
|
@ -2006,7 +2006,7 @@ def createFollowersOnlyPost(base_dir: str,
|
||||||
schedulePost, eventDate, eventTime, location,
|
schedulePost, eventDate, eventTime, location,
|
||||||
None, None, None, None, None,
|
None, None, None, None, None,
|
||||||
None, None, None, None, None, systemLanguage,
|
None, None, None, None, None, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2059,7 +2059,7 @@ def createDirectMessagePost(base_dir: str,
|
||||||
schedulePost: bool,
|
schedulePost: bool,
|
||||||
eventDate: str, eventTime: str,
|
eventDate: str, eventTime: str,
|
||||||
location: str, systemLanguage: str,
|
location: str, systemLanguage: str,
|
||||||
conversationId: str, lowBandwidth: bool,
|
conversationId: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Direct Message post
|
"""Direct Message post
|
||||||
"""
|
"""
|
||||||
|
@ -2084,7 +2084,7 @@ def createDirectMessagePost(base_dir: str,
|
||||||
schedulePost, eventDate, eventTime, location,
|
schedulePost, eventDate, eventTime, location,
|
||||||
None, None, None, None, None,
|
None, None, None, None, None,
|
||||||
None, None, None, None, None, systemLanguage,
|
None, None, None, None, None, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
# mentioned recipients go into To rather than Cc
|
# mentioned recipients go into To rather than Cc
|
||||||
messageJson['to'] = messageJson['object']['cc']
|
messageJson['to'] = messageJson['object']['cc']
|
||||||
|
@ -2105,7 +2105,7 @@ def createReportPost(base_dir: str,
|
||||||
attachImageFilename: str, mediaType: str,
|
attachImageFilename: str, mediaType: str,
|
||||||
imageDescription: str, city: str,
|
imageDescription: str, city: str,
|
||||||
debug: bool, subject: str, systemLanguage: str,
|
debug: bool, subject: str, systemLanguage: str,
|
||||||
lowBandwidth: bool,
|
low_bandwidth: bool,
|
||||||
content_license_url: str) -> {}:
|
content_license_url: str) -> {}:
|
||||||
"""Send a report to moderators
|
"""Send a report to moderators
|
||||||
"""
|
"""
|
||||||
|
@ -2180,7 +2180,7 @@ def createReportPost(base_dir: str,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage,
|
None, None, None, None, None, systemLanguage,
|
||||||
None, lowBandwidth, content_license_url)
|
None, low_bandwidth, content_license_url)
|
||||||
if not postJsonObject:
|
if not postJsonObject:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -2276,7 +2276,7 @@ def sendPost(signingPrivateKeyPem: str, projectVersion: str,
|
||||||
isArticle: bool, systemLanguage: str,
|
isArticle: bool, systemLanguage: str,
|
||||||
shared_items_federated_domains: [],
|
shared_items_federated_domains: [],
|
||||||
sharedItemFederationTokens: {},
|
sharedItemFederationTokens: {},
|
||||||
lowBandwidth: bool, content_license_url: str,
|
low_bandwidth: bool, content_license_url: str,
|
||||||
debug: bool = False, inReplyTo: str = None,
|
debug: bool = False, inReplyTo: str = None,
|
||||||
inReplyToAtomUri: str = None, subject: str = None) -> int:
|
inReplyToAtomUri: str = None, subject: str = None) -> int:
|
||||||
"""Post to another inbox. Used by unit tests.
|
"""Post to another inbox. Used by unit tests.
|
||||||
|
@ -2342,7 +2342,7 @@ def sendPost(signingPrivateKeyPem: str, projectVersion: str,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage,
|
None, None, None, None, None, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
|
|
||||||
# get the senders private key
|
# get the senders private key
|
||||||
|
@ -2424,7 +2424,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str,
|
||||||
imageDescription: str, city: str,
|
imageDescription: str, city: str,
|
||||||
cachedWebfingers: {}, personCache: {},
|
cachedWebfingers: {}, personCache: {},
|
||||||
isArticle: bool, systemLanguage: str,
|
isArticle: bool, systemLanguage: str,
|
||||||
lowBandwidth: bool,
|
low_bandwidth: bool,
|
||||||
content_license_url: str,
|
content_license_url: str,
|
||||||
debug: bool = False,
|
debug: bool = False,
|
||||||
inReplyTo: str = None,
|
inReplyTo: str = None,
|
||||||
|
@ -2511,7 +2511,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str,
|
||||||
False, None, None, None, None, None,
|
False, None, None, None, None, None,
|
||||||
None, None, None,
|
None, None, None,
|
||||||
None, None, None, None, None, systemLanguage,
|
None, None, None, None, None, systemLanguage,
|
||||||
conversationId, lowBandwidth,
|
conversationId, low_bandwidth,
|
||||||
content_license_url)
|
content_license_url)
|
||||||
|
|
||||||
authHeader = createBasicAuthHeader(fromNickname, password)
|
authHeader = createBasicAuthHeader(fromNickname, password)
|
||||||
|
|
|
@ -121,7 +121,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
|
||||||
httpd.city, httpd.systemLanguage,
|
httpd.city, httpd.systemLanguage,
|
||||||
httpd.shared_items_federated_domains,
|
httpd.shared_items_federated_domains,
|
||||||
httpd.sharedItemFederationTokens,
|
httpd.sharedItemFederationTokens,
|
||||||
httpd.lowBandwidth,
|
httpd.low_bandwidth,
|
||||||
httpd.signingPrivateKeyPem,
|
httpd.signingPrivateKeyPem,
|
||||||
httpd.peertubeInstances,
|
httpd.peertubeInstances,
|
||||||
httpd.themeName,
|
httpd.themeName,
|
||||||
|
|
|
@ -307,7 +307,7 @@ def addShare(base_dir: str,
|
||||||
duration: str, debug: bool, city: str,
|
duration: str, debug: bool, city: str,
|
||||||
price: str, currency: str,
|
price: str, currency: str,
|
||||||
systemLanguage: str, translate: {},
|
systemLanguage: str, translate: {},
|
||||||
sharesFileType: str, lowBandwidth: bool,
|
sharesFileType: str, low_bandwidth: bool,
|
||||||
content_license_url: str) -> None:
|
content_license_url: str) -> None:
|
||||||
"""Adds a new share
|
"""Adds a new share
|
||||||
"""
|
"""
|
||||||
|
@ -359,7 +359,7 @@ def addShare(base_dir: str,
|
||||||
for ext in formats:
|
for ext in formats:
|
||||||
if not imageFilename.endswith('.' + ext):
|
if not imageFilename.endswith('.' + ext):
|
||||||
continue
|
continue
|
||||||
if lowBandwidth:
|
if low_bandwidth:
|
||||||
convertImageToLowBandwidth(imageFilename)
|
convertImageToLowBandwidth(imageFilename)
|
||||||
processMetaData(base_dir, nickname, domain,
|
processMetaData(base_dir, nickname, domain,
|
||||||
imageFilename, itemIDfile + '.' + ext,
|
imageFilename, itemIDfile + '.' + ext,
|
||||||
|
@ -1031,7 +1031,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str,
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str, port: int,
|
||||||
messageJson: {}, debug: bool, city: str,
|
messageJson: {}, debug: bool, city: str,
|
||||||
systemLanguage: str, translate: {},
|
systemLanguage: str, translate: {},
|
||||||
lowBandwidth: bool,
|
low_bandwidth: bool,
|
||||||
content_license_url: str) -> None:
|
content_license_url: str) -> None:
|
||||||
""" When a shared item is received by the outbox from c2s
|
""" When a shared item is received by the outbox from c2s
|
||||||
"""
|
"""
|
||||||
|
@ -1094,7 +1094,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str,
|
||||||
messageJson['object']['itemPrice'],
|
messageJson['object']['itemPrice'],
|
||||||
messageJson['object']['itemCurrency'],
|
messageJson['object']['itemCurrency'],
|
||||||
systemLanguage, translate, 'shares',
|
systemLanguage, translate, 'shares',
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: shared item received via c2s')
|
print('DEBUG: shared item received via c2s')
|
||||||
|
|
||||||
|
|
66
tests.py
66
tests.py
|
@ -697,7 +697,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
domainMaxPostsPerDay = 1000
|
domainMaxPostsPerDay = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
accountMaxPostsPerDay = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||||
createPerson(path, nickname, domain, port, http_prefix, True,
|
createPerson(path, nickname, domain, port, http_prefix, True,
|
||||||
False, password)
|
False, password)
|
||||||
|
@ -742,7 +742,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||||
"Curiouser and curiouser!",
|
"Curiouser and curiouser!",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -756,7 +756,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||||
"In the gardens of memory, in the palace " +
|
"In the gardens of memory, in the palace " +
|
||||||
"of dreams, that is where you and I shall meet",
|
"of dreams, that is where you and I shall meet",
|
||||||
|
@ -771,7 +771,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
||||||
global testServerAliceRunning
|
global testServerAliceRunning
|
||||||
testServerAliceRunning = True
|
testServerAliceRunning = True
|
||||||
|
@ -798,7 +798,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
print('Server running: Alice')
|
print('Server running: Alice')
|
||||||
runDaemon(content_license_url,
|
runDaemon(content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
lowBandwidth, maxLikeCount,
|
low_bandwidth, maxLikeCount,
|
||||||
shared_items_federated_domains,
|
shared_items_federated_domains,
|
||||||
userAgentsBlocked,
|
userAgentsBlocked,
|
||||||
logLoginFailures, city,
|
logLoginFailures, city,
|
||||||
|
@ -842,7 +842,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
domainMaxPostsPerDay = 1000
|
domainMaxPostsPerDay = 1000
|
||||||
accountMaxPostsPerDay = 1000
|
accountMaxPostsPerDay = 1000
|
||||||
allowDeletion = True
|
allowDeletion = True
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
privateKeyPem, publicKeyPem, person, wfEndpoint = \
|
||||||
createPerson(path, nickname, domain, port, http_prefix, True,
|
createPerson(path, nickname, domain, port, http_prefix, True,
|
||||||
False, password)
|
False, password)
|
||||||
|
@ -884,7 +884,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||||
"One of the things I've realised is that " +
|
"One of the things I've realised is that " +
|
||||||
"I am very simple",
|
"I am very simple",
|
||||||
|
@ -899,7 +899,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
createPublicPost(path, nickname, domain, port, http_prefix,
|
createPublicPost(path, nickname, domain, port, http_prefix,
|
||||||
"Quantum physics is a bit of a passion of mine",
|
"Quantum physics is a bit of a passion of mine",
|
||||||
testFollowersOnly,
|
testFollowersOnly,
|
||||||
|
@ -913,7 +913,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
regenerateIndexForBox(path, nickname, domain, 'outbox')
|
||||||
global testServerBobRunning
|
global testServerBobRunning
|
||||||
testServerBobRunning = True
|
testServerBobRunning = True
|
||||||
|
@ -940,7 +940,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
print('Server running: Bob')
|
print('Server running: Bob')
|
||||||
runDaemon(content_license_url,
|
runDaemon(content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
lowBandwidth, maxLikeCount,
|
low_bandwidth, maxLikeCount,
|
||||||
shared_items_federated_domains,
|
shared_items_federated_domains,
|
||||||
userAgentsBlocked,
|
userAgentsBlocked,
|
||||||
logLoginFailures, city,
|
logLoginFailures, city,
|
||||||
|
@ -1003,14 +1003,14 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
||||||
logLoginFailures = False
|
logLoginFailures = False
|
||||||
userAgentsBlocked = []
|
userAgentsBlocked = []
|
||||||
maxLikeCount = 10
|
maxLikeCount = 10
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
default_reply_interval_hrs = 9999999999
|
default_reply_interval_hrs = 9999999999
|
||||||
lists_enabled = ''
|
lists_enabled = ''
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
print('Server running: Eve')
|
print('Server running: Eve')
|
||||||
runDaemon(content_license_url,
|
runDaemon(content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
lowBandwidth, maxLikeCount,
|
low_bandwidth, maxLikeCount,
|
||||||
shared_items_federated_domains,
|
shared_items_federated_domains,
|
||||||
userAgentsBlocked,
|
userAgentsBlocked,
|
||||||
logLoginFailures, city,
|
logLoginFailures, city,
|
||||||
|
@ -1075,14 +1075,14 @@ def createServerGroup(path: str, domain: str, port: int,
|
||||||
logLoginFailures = False
|
logLoginFailures = False
|
||||||
userAgentsBlocked = []
|
userAgentsBlocked = []
|
||||||
maxLikeCount = 10
|
maxLikeCount = 10
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
default_reply_interval_hrs = 9999999999
|
default_reply_interval_hrs = 9999999999
|
||||||
lists_enabled = ''
|
lists_enabled = ''
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
print('Server running: Group')
|
print('Server running: Group')
|
||||||
runDaemon(content_license_url,
|
runDaemon(content_license_url,
|
||||||
lists_enabled, default_reply_interval_hrs,
|
lists_enabled, default_reply_interval_hrs,
|
||||||
lowBandwidth, maxLikeCount,
|
low_bandwidth, maxLikeCount,
|
||||||
shared_items_federated_domains,
|
shared_items_federated_domains,
|
||||||
userAgentsBlocked,
|
userAgentsBlocked,
|
||||||
logLoginFailures, city,
|
logLoginFailures, city,
|
||||||
|
@ -1205,7 +1205,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
||||||
outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox'
|
outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox'
|
||||||
assert len([name for name in os.listdir(outboxPath)
|
assert len([name for name in os.listdir(outboxPath)
|
||||||
if os.path.isfile(os.path.join(outboxPath, name))]) == 0
|
if os.path.isfile(os.path.join(outboxPath, name))]) == 0
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
signingPrivateKeyPem = None
|
signingPrivateKeyPem = None
|
||||||
sendResult = \
|
sendResult = \
|
||||||
sendPost(signingPrivateKeyPem, __version__,
|
sendPost(signingPrivateKeyPem, __version__,
|
||||||
|
@ -1220,7 +1220,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
|
||||||
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
||||||
alicePersonCache, isArticle, systemLanguage,
|
alicePersonCache, isArticle, systemLanguage,
|
||||||
aliceSharedItemsFederatedDomains,
|
aliceSharedItemsFederatedDomains,
|
||||||
aliceSharedItemFederationTokens, lowBandwidth,
|
aliceSharedItemFederationTokens, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
inReplyTo, inReplyToAtomUri, subject)
|
inReplyTo, inReplyToAtomUri, subject)
|
||||||
print('sendResult: ' + str(sendResult))
|
print('sendResult: ' + str(sendResult))
|
||||||
|
@ -1569,7 +1569,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
|
||||||
alicePostLog = []
|
alicePostLog = []
|
||||||
isArticle = False
|
isArticle = False
|
||||||
city = 'London, England'
|
city = 'London, England'
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
signingPrivateKeyPem = None
|
signingPrivateKeyPem = None
|
||||||
sendResult = \
|
sendResult = \
|
||||||
sendPost(signingPrivateKeyPem, __version__,
|
sendPost(signingPrivateKeyPem, __version__,
|
||||||
|
@ -1581,7 +1581,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
|
||||||
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
||||||
alicePersonCache, isArticle, systemLanguage,
|
alicePersonCache, isArticle, systemLanguage,
|
||||||
aliceSharedItemsFederatedDomains,
|
aliceSharedItemsFederatedDomains,
|
||||||
aliceSharedItemFederationTokens, lowBandwidth,
|
aliceSharedItemFederationTokens, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
inReplyTo, inReplyToAtomUri, subject)
|
inReplyTo, inReplyToAtomUri, subject)
|
||||||
print('sendResult: ' + str(sendResult))
|
print('sendResult: ' + str(sendResult))
|
||||||
|
@ -1920,7 +1920,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
||||||
alicePostLog = []
|
alicePostLog = []
|
||||||
isArticle = False
|
isArticle = False
|
||||||
city = 'London, England'
|
city = 'London, England'
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
signingPrivateKeyPem = None
|
signingPrivateKeyPem = None
|
||||||
sendResult = \
|
sendResult = \
|
||||||
sendPost(signingPrivateKeyPem, __version__,
|
sendPost(signingPrivateKeyPem, __version__,
|
||||||
|
@ -1932,7 +1932,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
||||||
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
||||||
alicePersonCache, isArticle, systemLanguage,
|
alicePersonCache, isArticle, systemLanguage,
|
||||||
aliceSharedItemsFederatedDomains,
|
aliceSharedItemsFederatedDomains,
|
||||||
aliceSharedItemFederationTokens, lowBandwidth,
|
aliceSharedItemFederationTokens, low_bandwidth,
|
||||||
content_license_url, True,
|
content_license_url, True,
|
||||||
inReplyTo, inReplyToAtomUri, subject)
|
inReplyTo, inReplyToAtomUri, subject)
|
||||||
print('sendResult: ' + str(sendResult))
|
print('sendResult: ' + str(sendResult))
|
||||||
|
@ -2328,7 +2328,7 @@ def testGroupFollow(base_dir: str) -> None:
|
||||||
alicePostLog = []
|
alicePostLog = []
|
||||||
isArticle = False
|
isArticle = False
|
||||||
city = 'London, England'
|
city = 'London, England'
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
signingPrivateKeyPem = None
|
signingPrivateKeyPem = None
|
||||||
|
|
||||||
queuePath = \
|
queuePath = \
|
||||||
|
@ -2355,7 +2355,7 @@ def testGroupFollow(base_dir: str) -> None:
|
||||||
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
aliceSendThreads, alicePostLog, aliceCachedWebfingers,
|
||||||
alicePersonCache, isArticle, systemLanguage,
|
alicePersonCache, isArticle, systemLanguage,
|
||||||
aliceSharedItemsFederatedDomains,
|
aliceSharedItemsFederatedDomains,
|
||||||
aliceSharedItemFederationTokens, lowBandwidth,
|
aliceSharedItemFederationTokens, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
inReplyTo, inReplyToAtomUri, subject)
|
inReplyTo, inReplyToAtomUri, subject)
|
||||||
print('sendResult: ' + str(sendResult))
|
print('sendResult: ' + str(sendResult))
|
||||||
|
@ -2708,7 +2708,7 @@ def _testCreatePerson(base_dir: str):
|
||||||
attachImageFilename = None
|
attachImageFilename = None
|
||||||
mediaType = None
|
mediaType = None
|
||||||
conversationId = None
|
conversationId = None
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
content, followersOnly, saveToFile, clientToServer,
|
content, followersOnly, saveToFile, clientToServer,
|
||||||
|
@ -2718,7 +2718,7 @@ def _testCreatePerson(base_dir: str):
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
|
|
||||||
os.chdir(currDir)
|
os.chdir(currDir)
|
||||||
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
|
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
|
||||||
|
@ -2789,7 +2789,7 @@ def testClientToServer(base_dir: str):
|
||||||
http_prefix = 'http'
|
http_prefix = 'http'
|
||||||
proxyType = None
|
proxyType = None
|
||||||
federationList = []
|
federationList = []
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
|
|
||||||
if os.path.isdir(base_dir + '/.tests'):
|
if os.path.isdir(base_dir + '/.tests'):
|
||||||
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
|
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
|
||||||
|
@ -2897,7 +2897,7 @@ def testClientToServer(base_dir: str):
|
||||||
attachedImageFilename, mediaType,
|
attachedImageFilename, mediaType,
|
||||||
attachedImageDescription, city,
|
attachedImageDescription, city,
|
||||||
cachedWebfingers, personCache, isArticle,
|
cachedWebfingers, personCache, isArticle,
|
||||||
systemLanguage, lowBandwidth,
|
systemLanguage, low_bandwidth,
|
||||||
content_license_url,
|
content_license_url,
|
||||||
True, None, None,
|
True, None, None,
|
||||||
conversationId, None)
|
conversationId, None)
|
||||||
|
@ -4251,7 +4251,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
conversationId = None
|
conversationId = None
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
reply = \
|
reply = \
|
||||||
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
createPublicPost(base_dir, nickname, domain, port, http_prefix,
|
||||||
|
@ -4263,7 +4263,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
# print(str(reply))
|
# print(str(reply))
|
||||||
assert reply['object']['content'] == \
|
assert reply['object']['content'] == \
|
||||||
'<p><span class=\"h-card\">' + \
|
'<p><span class=\"h-card\">' + \
|
||||||
|
@ -4796,7 +4796,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
conversationId = None
|
conversationId = None
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
|
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
|
@ -4809,7 +4809,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
|
|
||||||
assert postJsonObject['object']['content'] == \
|
assert postJsonObject['object']['content'] == \
|
||||||
'<p>This is a test post with links.<br><br>' + \
|
'<p>This is a test post with links.<br><br>' + \
|
||||||
|
@ -4846,7 +4846,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
assert postJsonObject['object']['content'] == content
|
assert postJsonObject['object']['content'] == content
|
||||||
assert postJsonObject['object']['contentMap'][systemLanguage] == content
|
assert postJsonObject['object']['contentMap'][systemLanguage] == content
|
||||||
|
|
||||||
|
@ -5783,7 +5783,7 @@ def _testCanReplyTo(base_dir: str) -> None:
|
||||||
testLocation = None
|
testLocation = None
|
||||||
testIsArticle = False
|
testIsArticle = False
|
||||||
conversationId = None
|
conversationId = None
|
||||||
lowBandwidth = True
|
low_bandwidth = True
|
||||||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||||
|
|
||||||
postJsonObject = \
|
postJsonObject = \
|
||||||
|
@ -5796,7 +5796,7 @@ def _testCanReplyTo(base_dir: str) -> None:
|
||||||
testSubject, testSchedulePost,
|
testSubject, testSchedulePost,
|
||||||
testEventDate, testEventTime, testLocation,
|
testEventDate, testEventTime, testLocation,
|
||||||
testIsArticle, systemLanguage, conversationId,
|
testIsArticle, systemLanguage, conversationId,
|
||||||
lowBandwidth, content_license_url)
|
low_bandwidth, content_license_url)
|
||||||
# set the date on the post
|
# set the date on the post
|
||||||
currDateStr = "2021-09-08T20:45:00Z"
|
currDateStr = "2021-09-08T20:45:00Z"
|
||||||
postJsonObject['published'] = currDateStr
|
postJsonObject['published'] = currDateStr
|
||||||
|
|
|
@ -1251,9 +1251,9 @@ def _htmlEditProfileGraphicDesign(base_dir: str, translate: {}) -> str:
|
||||||
|
|
||||||
graphicsStr = beginEditSection(translate['Graphic Design'])
|
graphicsStr = beginEditSection(translate['Graphic Design'])
|
||||||
|
|
||||||
lowBandwidth = getConfigParam(base_dir, 'lowBandwidth')
|
low_bandwidth = getConfigParam(base_dir, 'low_bandwidth')
|
||||||
if not lowBandwidth:
|
if not low_bandwidth:
|
||||||
lowBandwidth = False
|
low_bandwidth = False
|
||||||
graphicsStr += _htmlThemesDropdown(base_dir, translate)
|
graphicsStr += _htmlThemesDropdown(base_dir, translate)
|
||||||
graphicsStr += \
|
graphicsStr += \
|
||||||
' <label class="labels">' + \
|
' <label class="labels">' + \
|
||||||
|
@ -1268,8 +1268,8 @@ def _htmlEditProfileGraphicDesign(base_dir: str, translate: {}) -> str:
|
||||||
' <button type="submit" class="button" ' + \
|
' <button type="submit" class="button" ' + \
|
||||||
'name="submitExportTheme">➤</button><br>\n'
|
'name="submitExportTheme">➤</button><br>\n'
|
||||||
graphicsStr += \
|
graphicsStr += \
|
||||||
editCheckBox(translate['Low Bandwidth'], 'lowBandwidth',
|
editCheckBox(translate['Low Bandwidth'], 'low_bandwidth',
|
||||||
bool(lowBandwidth))
|
bool(low_bandwidth))
|
||||||
|
|
||||||
graphicsStr += endEditSection()
|
graphicsStr += endEditSection()
|
||||||
return graphicsStr
|
return graphicsStr
|
||||||
|
|
Loading…
Reference in New Issue