Snake case

merge-requests/30/head
Bob Mottram 2021-12-25 17:13:38 +00:00
parent 49e7432076
commit bfb3915407
15 changed files with 179 additions and 176 deletions

View File

@ -441,7 +441,7 @@ def htmlBlogPost(session, authorized: bool,
postJsonObject: {}, postJsonObject: {},
peertubeInstances: [], peertubeInstances: [],
systemLanguage: str, personCache: {}, systemLanguage: str, personCache: {},
debug: bool, contentLicenseUrl: str) -> str: debug: bool, content_license_url: str) -> str:
"""Returns a html blog post """Returns a html blog post
""" """
blogStr = '' blogStr = ''
@ -464,7 +464,7 @@ def htmlBlogPost(session, authorized: bool,
http_prefix, domainFull, nickname, http_prefix, domainFull, nickname,
systemLanguage, published, modified, systemLanguage, published, modified,
title, snippet, translate, url, title, snippet, translate, url,
contentLicenseUrl) content_license_url)
_htmlBlogRemoveCwButton(blogStr, translate) _htmlBlogRemoveCwButton(blogStr, translate)
blogStr += _htmlBlogPostContent(debug, session, authorized, base_dir, blogStr += _htmlBlogPostContent(debug, session, authorized, base_dir,

View File

@ -518,7 +518,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
conversationId, conversationId,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
# name field contains the answer # name field contains the answer
messageJson['object']['name'] = answer messageJson['object']['name'] = answer
@ -1308,7 +1308,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.maxRecentPosts, self.server.maxRecentPosts,
self.server.CWlists, self.server.CWlists,
self.server.listsEnabled, self.server.listsEnabled,
self.server.contentLicenseUrl) self.server.content_license_url)
def _getOutboxThreadIndex(self, nickname: str, def _getOutboxThreadIndex(self, nickname: str,
maxOutboxThreadsPerAccount: int) -> int: maxOutboxThreadsPerAccount: int) -> int:
@ -4674,7 +4674,7 @@ class PubServer(BaseHTTPRequestHandler):
domain: str, domainFull: str, domain: str, domainFull: str,
onionDomain: str, i2pDomain: str, onionDomain: str, i2pDomain: str,
debug: bool, allowLocalNetworkAccess: bool, debug: bool, allowLocalNetworkAccess: bool,
systemLanguage: str, contentLicenseUrl: str) -> None: systemLanguage: str, content_license_url: str) -> None:
"""Updates your user profile after editing via the Edit button """Updates your user profile after editing via the Edit button
on the profile screen on the profile screen
""" """
@ -4820,7 +4820,7 @@ class PubServer(BaseHTTPRequestHandler):
convertImageToLowBandwidth(filename) convertImageToLowBandwidth(filename)
processMetaData(base_dir, nickname, domain, processMetaData(base_dir, nickname, domain,
filename, postImageFilename, city, filename, postImageFilename, city,
contentLicenseUrl) content_license_url)
if os.path.isfile(postImageFilename): if os.path.isfile(postImageFilename):
print('profile update POST ' + mType + print('profile update POST ' + mType +
' image, zip or font saved to ' + ' image, zip or font saved to ' +
@ -5220,22 +5220,22 @@ class PubServer(BaseHTTPRequestHandler):
'libretranslateApiKey', '') 'libretranslateApiKey', '')
# change instance short description # change instance short description
if fields.get('contentLicenseUrl'): if fields.get('content_license_url'):
if fields['contentLicenseUrl'] != \ if fields['content_license_url'] != \
self.server.contentLicenseUrl: self.server.content_license_url:
licenseStr = fields['contentLicenseUrl'] licenseStr = fields['content_license_url']
setConfigParam(base_dir, setConfigParam(base_dir,
'contentLicenseUrl', 'content_license_url',
licenseStr) licenseStr)
self.server.contentLicenseUrl = \ self.server.content_license_url = \
licenseStr licenseStr
else: else:
licenseStr = \ licenseStr = \
'https://creativecommons.org/licenses/by/4.0' 'https://creativecommons.org/licenses/by/4.0'
setConfigParam(base_dir, setConfigParam(base_dir,
'contentLicenseUrl', 'content_license_url',
licenseStr) licenseStr)
self.server.contentLicenseUrl = licenseStr self.server.content_license_url = licenseStr
# change instance short description # change instance short description
currInstanceDescriptionShort = \ currInstanceDescriptionShort = \
@ -9714,7 +9714,7 @@ class PubServer(BaseHTTPRequestHandler):
rolesList, rolesList,
None, None, self.server.CWlists, None, None, self.server.CWlists,
self.server.listsEnabled, self.server.listsEnabled,
self.server.contentLicenseUrl) self.server.content_license_url)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -9796,6 +9796,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.sharedItemsFederatedDomains self.server.sharedItemsFederatedDomains
signingPrivateKeyPem = \ signingPrivateKeyPem = \
self.server.signingPrivateKeyPem self.server.signingPrivateKeyPem
content_license_url = \
self.server.content_license_url
msg = \ msg = \
htmlProfile(signingPrivateKeyPem, htmlProfile(signingPrivateKeyPem,
self.server.rssIconAtTop, self.server.rssIconAtTop,
@ -9829,7 +9831,7 @@ class PubServer(BaseHTTPRequestHandler):
None, None, None, None,
self.server.CWlists, self.server.CWlists,
self.server.listsEnabled, self.server.listsEnabled,
self.server.contentLicenseUrl) content_license_url)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -11825,7 +11827,7 @@ class PubServer(BaseHTTPRequestHandler):
pageNumber, sharesPerPage, pageNumber, sharesPerPage,
self.server.CWlists, self.server.CWlists,
self.server.listsEnabled, self.server.listsEnabled,
self.server.contentLicenseUrl) self.server.content_license_url)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -11910,8 +11912,8 @@ class PubServer(BaseHTTPRequestHandler):
city = getSpoofedCity(self.server.city, city = getSpoofedCity(self.server.city,
base_dir, nickname, domain) base_dir, nickname, domain)
contentLicenseUrl = \ content_license_url = \
self.server.contentLicenseUrl self.server.content_license_url
msg = \ msg = \
htmlProfile(self.server.signingPrivateKeyPem, htmlProfile(self.server.signingPrivateKeyPem,
self.server.rssIconAtTop, self.server.rssIconAtTop,
@ -11947,7 +11949,7 @@ class PubServer(BaseHTTPRequestHandler):
followsPerPage, followsPerPage,
self.server.CWlists, self.server.CWlists,
self.server.listsEnabled, self.server.listsEnabled,
contentLicenseUrl).encode('utf-8') content_license_url).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', self._set_headers('text/html',
msglen, cookie, callingDomain, False) msglen, cookie, callingDomain, False)
@ -12029,8 +12031,8 @@ class PubServer(BaseHTTPRequestHandler):
city = getSpoofedCity(self.server.city, city = getSpoofedCity(self.server.city,
base_dir, nickname, domain) base_dir, nickname, domain)
contentLicenseUrl = \ content_license_url = \
self.server.contentLicenseUrl self.server.content_license_url
msg = \ msg = \
htmlProfile(self.server.signingPrivateKeyPem, htmlProfile(self.server.signingPrivateKeyPem,
self.server.rssIconAtTop, self.server.rssIconAtTop,
@ -12067,7 +12069,7 @@ class PubServer(BaseHTTPRequestHandler):
followsPerPage, followsPerPage,
self.server.CWlists, self.server.CWlists,
self.server.listsEnabled, self.server.listsEnabled,
contentLicenseUrl).encode('utf-8') content_license_url).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, callingDomain, False) cookie, callingDomain, False)
@ -12201,7 +12203,7 @@ class PubServer(BaseHTTPRequestHandler):
None, None, None, None, None, None,
self.server.CWlists, self.server.CWlists,
self.server.listsEnabled, self.server.listsEnabled,
self.server.contentLicenseUrl).encode('utf-8') self.server.content_license_url).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, callingDomain, False) cookie, callingDomain, False)
@ -14129,7 +14131,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
self.server.personCache, self.server.personCache,
self.server.debug, self.server.debug,
self.server.contentLicenseUrl) self.server.content_license_url)
if msg is not None: if msg is not None:
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -16388,7 +16390,7 @@ class PubServer(BaseHTTPRequestHandler):
length: int, postBytes, boundary: str, length: int, postBytes, boundary: str,
callingDomain: str, cookie: str, callingDomain: str, cookie: str,
authorized: bool, authorized: bool,
contentLicenseUrl: str) -> int: content_license_url: str) -> int:
# Note: this needs to happen synchronously # Note: this needs to happen synchronously
# 0=this is not a new post # 0=this is not a new post
# 1=new post success # 1=new post success
@ -16466,7 +16468,7 @@ class PubServer(BaseHTTPRequestHandler):
processMetaData(self.server.base_dir, processMetaData(self.server.base_dir,
nickname, self.server.domain, nickname, self.server.domain,
filename, postImageFilename, city, filename, postImageFilename, city,
contentLicenseUrl) content_license_url)
if os.path.isfile(postImageFilename): if os.path.isfile(postImageFilename):
print('POST media saved to ' + postImageFilename) print('POST media saved to ' + postImageFilename)
else: else:
@ -16593,7 +16595,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
conversationId, conversationId,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
if fields['schedulePost']: if fields['schedulePost']:
return 1 return 1
@ -16678,7 +16680,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
conversationId, conversationId,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
if fields['schedulePost']: if fields['schedulePost']:
return 1 return 1
@ -16770,7 +16772,7 @@ class PubServer(BaseHTTPRequestHandler):
imgDescription, imgDescription,
city, city,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
replaceYouTube(postJsonObject, replaceYouTube(postJsonObject,
self.server.YTReplacementDomain, self.server.YTReplacementDomain,
@ -16829,7 +16831,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
conversationId, conversationId,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
if fields['schedulePost']: if fields['schedulePost']:
return 1 return 1
@ -16881,7 +16883,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
conversationId, conversationId,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
if fields['schedulePost']: if fields['schedulePost']:
return 1 return 1
@ -16912,6 +16914,7 @@ class PubServer(BaseHTTPRequestHandler):
conversationId = None conversationId = None
if fields.get('conversationId'): if fields.get('conversationId'):
conversationId = fields['conversationId'] conversationId = fields['conversationId']
content_license_url = self.server.content_license_url
messageJson = \ messageJson = \
createDirectMessagePost(self.server.base_dir, createDirectMessagePost(self.server.base_dir,
@ -16937,7 +16940,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
conversationId, conversationId,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) content_license_url)
if messageJson: if messageJson:
if fields['schedulePost']: if fields['schedulePost']:
return 1 return 1
@ -16991,7 +16994,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
conversationId, conversationId,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
if fields['schedulePost']: if fields['schedulePost']:
return 1 return 1
@ -17028,7 +17031,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.debug, fields['subject'], self.server.debug, fields['subject'],
self.server.systemLanguage, self.server.systemLanguage,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
if self._postToOutbox(messageJson, if self._postToOutbox(messageJson,
self.server.projectVersion, self.server.projectVersion,
@ -17070,7 +17073,7 @@ class PubServer(BaseHTTPRequestHandler):
intDuration, intDuration,
self.server.systemLanguage, self.server.systemLanguage,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if messageJson: if messageJson:
if self.server.debug: if self.server.debug:
print('DEBUG: new Question') print('DEBUG: new Question')
@ -17143,7 +17146,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
self.server.translate, sharesFileType, self.server.translate, sharesFileType,
self.server.lowBandwidth, self.server.lowBandwidth,
self.server.contentLicenseUrl) self.server.content_license_url)
if filename: if filename:
if os.path.isfile(filename): if os.path.isfile(filename):
try: try:
@ -17158,7 +17161,7 @@ class PubServer(BaseHTTPRequestHandler):
def _receiveNewPost(self, postType: str, path: str, def _receiveNewPost(self, postType: str, path: str,
callingDomain: str, cookie: str, callingDomain: str, cookie: str,
authorized: bool, authorized: bool,
contentLicenseUrl: str) -> int: content_license_url: str) -> int:
"""A new post has been created """A new post has been created
This creates a thread to send the new post This creates a thread to send the new post
""" """
@ -17262,7 +17265,7 @@ class PubServer(BaseHTTPRequestHandler):
postBytes, boundary, postBytes, boundary,
callingDomain, cookie, callingDomain, cookie,
authorized, authorized,
contentLicenseUrl) content_license_url)
return pageNumber return pageNumber
def _cryptoAPIreadHandle(self): def _cryptoAPIreadHandle(self):
@ -17561,7 +17564,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.i2pDomain, self.server.debug, self.server.i2pDomain, self.server.debug,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.systemLanguage, self.server.systemLanguage,
self.server.contentLicenseUrl) self.server.content_license_url)
self.server.POSTbusy = False self.server.POSTbusy = False
return return
@ -17971,7 +17974,7 @@ class PubServer(BaseHTTPRequestHandler):
self._receiveNewPost(currPostType, self.path, self._receiveNewPost(currPostType, self.path,
callingDomain, cookie, callingDomain, cookie,
authorized, authorized,
self.server.contentLicenseUrl) self.server.content_license_url)
if pageNumber: if pageNumber:
print(currPostType + ' post received') print(currPostType + ' post received')
nickname = self.path.split('/users/')[1] nickname = self.path.split('/users/')[1]
@ -18387,7 +18390,7 @@ def loadTokens(base_dir: str, tokensDict: {}, tokensLookup: {}) -> None:
break break
def runDaemon(contentLicenseUrl: str, def runDaemon(content_license_url: str,
listsEnabled: str, listsEnabled: str,
defaultReplyIntervalHours: int, defaultReplyIntervalHours: int,
lowBandwidth: bool, lowBandwidth: bool,
@ -18477,9 +18480,9 @@ def runDaemon(contentLicenseUrl: str,
assert not scanThemesForScripts(base_dir) assert not scanThemesForScripts(base_dir)
# license for content of the instance # license for content of the instance
if not contentLicenseUrl: if not content_license_url:
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
httpd.contentLicenseUrl = contentLicenseUrl httpd.content_license_url = content_license_url
# fitness metrics # fitness metrics
fitnessFilename = base_dir + '/accounts/fitness.json' fitnessFilename = base_dir + '/accounts/fitness.json'

View File

@ -419,7 +419,7 @@ def _desktopReplyToPost(session, postId: str,
screenreader: str, systemLanguage: str, screenreader: str, systemLanguage: str,
espeak, conversationId: str, espeak, conversationId: str,
lowBandwidth: bool, lowBandwidth: bool,
contentLicenseUrl: 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
""" """
@ -474,7 +474,7 @@ def _desktopReplyToPost(session, postId: str,
attachedImageDescription, city, attachedImageDescription, city,
cachedWebfingers, personCache, isArticle, cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth, systemLanguage, lowBandwidth,
contentLicenseUrl, content_license_url,
debug, postId, postId, debug, postId, postId,
conversationId, subject) == 0: conversationId, subject) == 0:
sayStr = 'Reply sent' sayStr = 'Reply sent'
@ -490,7 +490,7 @@ def _desktopNewPost(session,
debug: bool, debug: bool,
screenreader: str, systemLanguage: str, screenreader: str, systemLanguage: str,
espeak, lowBandwidth: bool, espeak, lowBandwidth: bool,
contentLicenseUrl: 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
""" """
@ -541,7 +541,7 @@ def _desktopNewPost(session,
attachedImageDescription, city, attachedImageDescription, city,
cachedWebfingers, personCache, isArticle, cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth, systemLanguage, lowBandwidth,
contentLicenseUrl, content_license_url,
debug, None, None, debug, None, None,
conversationId, subject) == 0: conversationId, subject) == 0:
sayStr = 'Post sent' sayStr = 'Post sent'
@ -1130,7 +1130,7 @@ def _desktopNewDM(session, toHandle: str,
debug: bool, debug: bool,
screenreader: str, systemLanguage: str, screenreader: str, systemLanguage: str,
espeak, lowBandwidth: bool, espeak, lowBandwidth: bool,
contentLicenseUrl: 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
which can include multiple destination handles which can include multiple destination handles
@ -1153,7 +1153,7 @@ def _desktopNewDM(session, toHandle: str,
debug, debug,
screenreader, systemLanguage, screenreader, systemLanguage,
espeak, lowBandwidth, espeak, lowBandwidth,
contentLicenseUrl, content_license_url,
signingPrivateKeyPem) signingPrivateKeyPem)
@ -1164,7 +1164,7 @@ def _desktopNewDMbase(session, toHandle: str,
debug: bool, debug: bool,
screenreader: str, systemLanguage: str, screenreader: str, systemLanguage: str,
espeak, lowBandwidth: bool, espeak, lowBandwidth: bool,
contentLicenseUrl: 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
""" """
@ -1255,7 +1255,7 @@ def _desktopNewDMbase(session, toHandle: str,
attachedImageDescription, city, attachedImageDescription, city,
cachedWebfingers, personCache, isArticle, cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth, systemLanguage, lowBandwidth,
contentLicenseUrl, content_license_url,
debug, None, None, debug, None, None,
conversationId, subject) == 0: conversationId, subject) == 0:
sayStr = 'Direct message sent' sayStr = 'Direct message sent'
@ -1329,7 +1329,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
# TODO: this should probably be retrieved somehow from the server # TODO: this should probably be retrieved somehow from the server
signingPrivateKeyPem = None signingPrivateKeyPem = None
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
blockedCache = {} blockedCache = {}
@ -1730,7 +1730,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
screenreader, systemLanguage, screenreader, systemLanguage,
espeak, conversationId, espeak, conversationId,
lowBandwidth, lowBandwidth,
contentLicenseUrl, content_license_url,
signingPrivateKeyPem) signingPrivateKeyPem)
refreshTimeline = True refreshTimeline = True
print('') print('')
@ -1766,7 +1766,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
debug, debug,
screenreader, systemLanguage, screenreader, systemLanguage,
espeak, lowBandwidth, espeak, lowBandwidth,
contentLicenseUrl, content_license_url,
signingPrivateKeyPem) signingPrivateKeyPem)
refreshTimeline = True refreshTimeline = True
else: else:
@ -1778,7 +1778,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
debug, debug,
screenreader, systemLanguage, screenreader, systemLanguage,
espeak, lowBandwidth, espeak, lowBandwidth,
contentLicenseUrl, content_license_url,
signingPrivateKeyPem) signingPrivateKeyPem)
refreshTimeline = True refreshTimeline = True
print('') print('')

View File

@ -116,7 +116,7 @@ def str2bool(v) -> bool:
parser = argparse.ArgumentParser(description='ActivityPub Server') parser = argparse.ArgumentParser(description='ActivityPub Server')
parser.add_argument('--contentLicenseUrl', type=str, parser.add_argument('--content_license_url', type=str,
default='https://creativecommons.org/licenses/by/4.0', default='https://creativecommons.org/licenses/by/4.0',
help='Url of the license used for the instance content') help='Url of the license used for the instance content')
parser.add_argument('--listsEnabled', type=str, parser.add_argument('--listsEnabled', type=str,
@ -1323,7 +1323,7 @@ if args.message:
attachedImageDescription, city, attachedImageDescription, city,
cachedWebfingers, personCache, isArticle, cachedWebfingers, personCache, isArticle,
args.language, args.lowBandwidth, args.language, args.lowBandwidth,
args.contentLicenseUrl, 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):
# TODO detect send success/fail # TODO detect send success/fail
@ -2452,7 +2452,7 @@ if args.avatar:
city = 'London, England' city = 'London, England'
if setProfileImage(base_dir, http_prefix, args.nickname, domain, if setProfileImage(base_dir, http_prefix, args.nickname, domain,
port, args.avatar, 'avatar', '128x128', city, port, args.avatar, 'avatar', '128x128', city,
args.contentLicenseUrl): args.content_license_url):
print('Avatar added for ' + args.nickname) print('Avatar added for ' + args.nickname)
else: else:
print('Avatar was not added for ' + args.nickname) print('Avatar was not added for ' + args.nickname)
@ -2468,7 +2468,7 @@ if args.backgroundImage:
city = 'London, England' city = 'London, England'
if setProfileImage(base_dir, http_prefix, args.nickname, domain, if setProfileImage(base_dir, http_prefix, args.nickname, domain,
port, args.backgroundImage, 'background', port, args.backgroundImage, 'background',
'256x256', city, args.contentLicenseUrl): '256x256', city, args.content_license_url):
print('Background image added for ' + args.nickname) print('Background image added for ' + args.nickname)
else: else:
print('Background image was not added for ' + args.nickname) print('Background image was not added for ' + args.nickname)
@ -2840,7 +2840,7 @@ if args.testdata:
"City", "0", "GBP", "City", "0", "GBP",
"2 months", "2 months",
debug, city, args.language, {}, 'shares', args.lowBandwidth, debug, city, args.language, {}, 'shares', args.lowBandwidth,
args.contentLicenseUrl) args.content_license_url)
addShare(base_dir, addShare(base_dir,
http_prefix, nickname, domain, port, http_prefix, nickname, domain, port,
"witch hat", "witch hat",
@ -2851,7 +2851,7 @@ if args.testdata:
"City", "0", "GBP", "City", "0", "GBP",
"3 months", "3 months",
debug, city, args.language, {}, 'shares', args.lowBandwidth, debug, city, args.language, {}, 'shares', args.lowBandwidth,
args.contentLicenseUrl) args.content_license_url)
deleteAllPosts(base_dir, nickname, domain, 'inbox') deleteAllPosts(base_dir, nickname, domain, 'inbox')
deleteAllPosts(base_dir, nickname, domain, 'outbox') deleteAllPosts(base_dir, nickname, domain, 'outbox')
@ -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.contentLicenseUrl) lowBandwidth, 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.contentLicenseUrl) lowBandwidth, 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.contentLicenseUrl) lowBandwidth, 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.contentLicenseUrl) lowBandwidth, 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.contentLicenseUrl) lowBandwidth, 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.contentLicenseUrl) lowBandwidth, 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.contentLicenseUrl) lowBandwidth, 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.contentLicenseUrl) lowBandwidth, 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,
@ -3009,12 +3009,12 @@ minimumvotes = getConfigParam(base_dir, 'minvotes')
if minimumvotes: if minimumvotes:
args.minimumvotes = int(minimumvotes) args.minimumvotes = int(minimumvotes)
contentLicenseUrl = '' content_license_url = ''
if args.contentLicenseUrl: if args.content_license_url:
contentLicenseUrl = args.contentLicenseUrl content_license_url = args.content_license_url
setConfigParam(base_dir, 'contentLicenseUrl', contentLicenseUrl) setConfigParam(base_dir, 'content_license_url', content_license_url)
else: else:
contentLicenseUrl = getConfigParam(base_dir, 'contentLicenseUrl') content_license_url = getConfigParam(base_dir, 'content_license_url')
votingtime = getConfigParam(base_dir, 'votingtime') votingtime = getConfigParam(base_dir, 'votingtime')
if votingtime: if votingtime:
@ -3210,7 +3210,7 @@ if args.defaultCurrency:
print('Default currency set to ' + args.defaultCurrency) print('Default currency set to ' + args.defaultCurrency)
if __name__ == "__main__": if __name__ == "__main__":
runDaemon(contentLicenseUrl, runDaemon(content_license_url,
listsEnabled, listsEnabled,
args.defaultReplyIntervalHours, args.defaultReplyIntervalHours,
args.lowBandwidth, args.maxLikeCount, args.lowBandwidth, args.maxLikeCount,

View File

@ -2795,7 +2795,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
translate: {}, debug: bool, translate: {}, debug: bool,
lastBounceMessage: [], systemLanguage: str, lastBounceMessage: [], systemLanguage: str,
signingPrivateKeyPem: str, signingPrivateKeyPem: str,
contentLicenseUrl: str) -> bool: content_license_url: str) -> bool:
"""Sends a bounce message back to the sending handle """Sends a bounce message back to the sending handle
if a DM has been rejected if a DM has been rejected
""" """
@ -2855,7 +2855,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
subject, debug, schedulePost, subject, debug, schedulePost,
eventDate, eventTime, location, eventDate, eventTime, location,
systemLanguage, conversationId, lowBandwidth, systemLanguage, conversationId, lowBandwidth,
contentLicenseUrl) 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)
return False return False
@ -2882,7 +2882,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
lastBounceMessage: [], lastBounceMessage: [],
handle: str, systemLanguage: str, handle: str, systemLanguage: str,
signingPrivateKeyPem: str, signingPrivateKeyPem: str,
contentLicenseUrl: str) -> bool: content_license_url: str) -> bool:
"""Is the given message a valid DM? """Is the given message a valid DM?
""" """
if nickname == 'inbox': if nickname == 'inbox':
@ -2961,7 +2961,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
lastBounceMessage, lastBounceMessage,
systemLanguage, systemLanguage,
signingPrivateKeyPem, signingPrivateKeyPem,
contentLicenseUrl) content_license_url)
return False return False
# dm index will be updated # dm index will be updated
@ -3198,7 +3198,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
signingPrivateKeyPem: str, signingPrivateKeyPem: str,
defaultReplyIntervalHours: int, defaultReplyIntervalHours: int,
CWlists: {}, listsEnabled: str, CWlists: {}, listsEnabled: str,
contentLicenseUrl: str) -> bool: content_license_url: str) -> bool:
""" Anything which needs to be done after initial checks have passed """ Anything which needs to be done after initial checks have passed
""" """
actor = keyId actor = keyId
@ -3481,7 +3481,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
lastBounceMessage, lastBounceMessage,
handle, systemLanguage, handle, systemLanguage,
signingPrivateKeyPem, signingPrivateKeyPem,
contentLicenseUrl): content_license_url):
return False return False
# get the actor being replied to # get the actor being replied to
@ -4479,7 +4479,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
saveJson(queueJson['post'], sharedInboxPostFilename) saveJson(queueJson['post'], sharedInboxPostFilename)
listsEnabled = getConfigParam(base_dir, "listsEnabled") listsEnabled = getConfigParam(base_dir, "listsEnabled")
contentLicenseUrl = getConfigParam(base_dir, "contentLicenseUrl") content_license_url = getConfigParam(base_dir, "content_license_url")
# for posts addressed to specific accounts # for posts addressed to specific accounts
for handle, capsId in recipientsDict.items(): for handle, capsId in recipientsDict.items():
@ -4513,7 +4513,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
signingPrivateKeyPem, signingPrivateKeyPem,
defaultReplyIntervalHours, defaultReplyIntervalHours,
CWlists, listsEnabled, CWlists, listsEnabled,
contentLicenseUrl) content_license_url)
if debug: if debug:
pprint(queueJson['post']) pprint(queueJson['post'])
print('Queue: Queue post accepted') print('Queue: Queue post accepted')

View File

@ -108,7 +108,7 @@ def _removeMetaData(imageFilename: str, outputFilename: str) -> None:
def _spoofMetaData(base_dir: str, nickname: str, domain: str, def _spoofMetaData(base_dir: str, nickname: str, domain: str,
outputFilename: str, spoofCity: str, outputFilename: str, spoofCity: str,
contentLicenseUrl: str) -> None: content_license_url: str) -> None:
"""Spoof image metadata using a decoy model for a given city """Spoof image metadata using a decoy model for a given city
""" """
if not os.path.isfile(outputFilename): if not os.path.isfile(outputFilename):
@ -151,7 +151,7 @@ def _spoofMetaData(base_dir: str, nickname: str, domain: str,
'-GPSLongitude=' + str(longitude) + ' ' + '-GPSLongitude=' + str(longitude) + ' ' +
'-GPSLatitudeRef=' + latitudeRef + ' ' + '-GPSLatitudeRef=' + latitudeRef + ' ' +
'-GPSLatitude=' + str(latitude) + ' ' + '-GPSLatitude=' + str(latitude) + ' ' +
'-copyright="' + contentLicenseUrl + '" ' + '-copyright="' + content_license_url + '" ' +
'-Comment="" ' + '-Comment="" ' +
outputFilename) != 0: # nosec outputFilename) != 0: # nosec
print('ERROR: exiftool failed to run') print('ERROR: exiftool failed to run')
@ -202,7 +202,7 @@ def convertImageToLowBandwidth(imageFilename: str) -> None:
def processMetaData(base_dir: str, nickname: str, domain: str, def processMetaData(base_dir: str, nickname: str, domain: str,
imageFilename: str, outputFilename: str, imageFilename: str, outputFilename: str,
city: str, contentLicenseUrl: str) -> None: city: str, content_license_url: str) -> None:
"""Handles image metadata. This tries to spoof the metadata """Handles image metadata. This tries to spoof the metadata
if possible, but otherwise just removes it if possible, but otherwise just removes it
""" """
@ -211,7 +211,7 @@ def processMetaData(base_dir: str, nickname: str, domain: str,
# now add some spoofed data to misdirect surveillance capitalists # now add some spoofed data to misdirect surveillance capitalists
_spoofMetaData(base_dir, nickname, domain, outputFilename, city, _spoofMetaData(base_dir, nickname, domain, outputFilename, city,
contentLicenseUrl) content_license_url)
def _isMedia(imageFilename: str) -> bool: def _isMedia(imageFilename: str) -> bool:
@ -298,7 +298,7 @@ def attachMedia(base_dir: str, http_prefix: str,
postJson: {}, imageFilename: str, postJson: {}, imageFilename: str,
mediaType: str, description: str, mediaType: str, description: str,
city: str, lowBandwidth: bool, city: str, lowBandwidth: bool,
contentLicenseUrl: 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
""" """
@ -357,7 +357,7 @@ def attachMedia(base_dir: str, http_prefix: str,
convertImageToLowBandwidth(imageFilename) convertImageToLowBandwidth(imageFilename)
processMetaData(base_dir, nickname, domain, processMetaData(base_dir, nickname, domain,
imageFilename, mediaFilename, city, imageFilename, mediaFilename, city,
contentLicenseUrl) content_license_url)
else: else:
copyfile(imageFilename, mediaFilename) copyfile(imageFilename, mediaFilename)
_updateEtag(mediaFilename) _updateEtag(mediaFilename)

View File

@ -546,7 +546,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
systemLanguage: str, systemLanguage: str,
lowBandwidth: bool, lowBandwidth: bool,
contentLicenseUrl: str) -> None: content_license_url: str) -> None:
"""Converts rss items in a newswire into posts """Converts rss items in a newswire into posts
""" """
if not newswire: if not newswire:
@ -639,7 +639,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str,
imageDescription, city, imageDescription, city,
rssTitle, systemLanguage, rssTitle, systemLanguage,
conversationId, lowBandwidth, conversationId, lowBandwidth,
contentLicenseUrl) content_license_url)
if not blog: if not blog:
continue continue
@ -837,7 +837,7 @@ def runNewswireDaemon(base_dir: str, httpd,
httpd.allowLocalNetworkAccess, httpd.allowLocalNetworkAccess,
httpd.systemLanguage, httpd.systemLanguage,
httpd.lowBandwidth, httpd.lowBandwidth,
httpd.contentLicenseUrl) httpd.content_license_url)
print('Newswire feed converted to ActivityPub') print('Newswire feed converted to ActivityPub')
if httpd.maxNewsPosts > 0: if httpd.maxNewsPosts > 0:

View File

@ -200,7 +200,7 @@ def postMessageToOutbox(session, translate: {},
maxLikeCount: int, maxLikeCount: int,
maxRecentPosts: int, CWlists: {}, maxRecentPosts: int, CWlists: {},
listsEnabled: str, listsEnabled: str,
contentLicenseUrl: str) -> bool: content_license_url: str) -> bool:
"""post is received by the outbox """post is received by the outbox
Client to server message post Client to server message post
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
@ -626,7 +626,7 @@ def postMessageToOutbox(session, translate: {},
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, lowBandwidth,
contentLicenseUrl) content_license_url)
if debug: if debug:
print('DEBUG: handle undo share uploads') print('DEBUG: handle undo share uploads')

View File

@ -95,7 +95,7 @@ def setProfileImage(base_dir: str, http_prefix: str,
nickname: str, domain: str, nickname: str, domain: str,
port: int, imageFilename: str, imageType: str, port: int, imageFilename: str, imageType: str,
resolution: str, city: str, resolution: str, city: str,
contentLicenseUrl: str) -> bool: content_license_url: str) -> bool:
"""Saves the given image file as an avatar or background """Saves the given image file as an avatar or background
image for the given person image for the given person
""" """
@ -159,7 +159,7 @@ def setProfileImage(base_dir: str, http_prefix: str,
subprocess.call(cmd, shell=True) subprocess.call(cmd, shell=True)
processMetaData(base_dir, nickname, domain, processMetaData(base_dir, nickname, domain,
profileFilename, profileFilename, city, profileFilename, profileFilename, city,
contentLicenseUrl) content_license_url)
return True return True
return False return False

View File

@ -1073,7 +1073,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
postObjectType: str, summary: str, postObjectType: str, summary: str,
inReplyToAtomUri: str, systemLanguage: str, inReplyToAtomUri: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Creates a new server-to-server post """Creates a new server-to-server post
""" """
actorUrl = localActorUrl(http_prefix, nickname, domain) actorUrl = localActorUrl(http_prefix, nickname, domain)
@ -1134,7 +1134,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
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, lowBandwidth,
contentLicenseUrl) content_license_url)
return newPost return newPost
@ -1148,7 +1148,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
postObjectType: str, summary: str, postObjectType: str, summary: str,
inReplyToAtomUri: str, systemLanguage: str, inReplyToAtomUri: str, systemLanguage: str,
conversationId: str, lowBandwidth: str, conversationId: str, lowBandwidth: str,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Creates a new client-to-server post """Creates a new client-to-server post
""" """
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -1199,7 +1199,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
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, lowBandwidth,
contentLicenseUrl) content_license_url)
return newPost return newPost
@ -1382,7 +1382,7 @@ def _createPostBase(base_dir: str,
eventStatus: str, ticketUrl: str, eventStatus: str, ticketUrl: str,
systemLanguage: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Creates a message """Creates a message
""" """
content = removeInvalidChars(content) content = removeInvalidChars(content)
@ -1518,7 +1518,7 @@ def _createPostBase(base_dir: str,
postObjectType, summary, postObjectType, summary,
inReplyToAtomUri, systemLanguage, inReplyToAtomUri, systemLanguage,
conversationId, lowBandwidth, conversationId, lowBandwidth,
contentLicenseUrl) content_license_url)
else: else:
newPost = \ newPost = \
_createPostC2S(base_dir, nickname, domain, port, _createPostC2S(base_dir, nickname, domain, port,
@ -1531,7 +1531,7 @@ def _createPostBase(base_dir: str,
postObjectType, summary, postObjectType, summary,
inReplyToAtomUri, systemLanguage, inReplyToAtomUri, systemLanguage,
conversationId, lowBandwidth, conversationId, lowBandwidth,
contentLicenseUrl) content_license_url)
_createPostMentions(ccUrl, newPost, toRecipients, tags) _createPostMentions(ccUrl, newPost, toRecipients, tags)
@ -1768,7 +1768,7 @@ def createPublicPost(base_dir: str,
isArticle: bool, isArticle: bool,
systemLanguage: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Public post """Public post
""" """
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -1800,7 +1800,7 @@ def createPublicPost(base_dir: str,
anonymousParticipationEnabled, anonymousParticipationEnabled,
eventStatus, ticketUrl, systemLanguage, eventStatus, ticketUrl, systemLanguage,
conversationId, lowBandwidth, conversationId, lowBandwidth,
contentLicenseUrl) content_license_url)
def _appendCitationsToBlogPost(base_dir: str, def _appendCitationsToBlogPost(base_dir: str,
@ -1844,7 +1844,7 @@ def createBlogPost(base_dir: str,
eventDate: str, eventTime: str, eventDate: str, eventTime: str,
location: str, systemLanguage: str, location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
blogJson = \ blogJson = \
createPublicPost(base_dir, createPublicPost(base_dir,
nickname, domain, port, http_prefix, nickname, domain, port, http_prefix,
@ -1856,7 +1856,7 @@ def createBlogPost(base_dir: str,
schedulePost, schedulePost,
eventDate, eventTime, location, eventDate, eventTime, location,
True, systemLanguage, conversationId, True, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl) lowBandwidth, 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)
@ -1871,7 +1871,7 @@ def createNewsPost(base_dir: str,
imageDescription: str, city: str, imageDescription: str, city: str,
subject: str, systemLanguage: str, subject: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
clientToServer = False clientToServer = False
inReplyTo = None inReplyTo = None
inReplyToAtomUri = None inReplyToAtomUri = 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, contentLicenseUrl) lowBandwidth, content_license_url)
blog['object']['type'] = 'Article' blog['object']['type'] = 'Article'
return blog return blog
@ -1904,7 +1904,7 @@ def createQuestionPost(base_dir: str,
imageDescription: str, city: str, imageDescription: str, city: str,
subject: str, durationDays: int, subject: str, durationDays: int,
systemLanguage: str, lowBandwidth: bool, systemLanguage: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Question post with multiple choice options """Question post with multiple choice options
""" """
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -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, contentLicenseUrl) None, lowBandwidth, 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
@ -1954,7 +1954,7 @@ def createUnlistedPost(base_dir: str,
eventDate: str, eventTime: str, eventDate: str, eventTime: str,
location: str, systemLanguage: str, location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: 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.
""" """
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -1972,7 +1972,7 @@ def createUnlistedPost(base_dir: str,
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, lowBandwidth,
contentLicenseUrl) content_license_url)
def createFollowersOnlyPost(base_dir: str, def createFollowersOnlyPost(base_dir: str,
@ -1989,7 +1989,7 @@ def createFollowersOnlyPost(base_dir: str,
eventDate: str, eventTime: str, eventDate: str, eventTime: str,
location: str, systemLanguage: str, location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Followers only post """Followers only post
""" """
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -2007,7 +2007,7 @@ def createFollowersOnlyPost(base_dir: str,
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, lowBandwidth,
contentLicenseUrl) content_license_url)
def getMentionedPeople(base_dir: str, http_prefix: str, def getMentionedPeople(base_dir: str, http_prefix: str,
@ -2060,7 +2060,7 @@ def createDirectMessagePost(base_dir: str,
eventDate: str, eventTime: str, eventDate: str, eventTime: str,
location: str, systemLanguage: str, location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool, conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Direct Message post """Direct Message post
""" """
content = resolvePetnames(base_dir, nickname, domain, content) content = resolvePetnames(base_dir, nickname, domain, content)
@ -2085,7 +2085,7 @@ def createDirectMessagePost(base_dir: str,
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, lowBandwidth,
contentLicenseUrl) 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']
messageJson['object']['to'] = messageJson['to'] messageJson['object']['to'] = messageJson['to']
@ -2106,7 +2106,7 @@ def createReportPost(base_dir: str,
imageDescription: str, city: str, imageDescription: str, city: str,
debug: bool, subject: str, systemLanguage: str, debug: bool, subject: str, systemLanguage: str,
lowBandwidth: bool, lowBandwidth: bool,
contentLicenseUrl: str) -> {}: content_license_url: str) -> {}:
"""Send a report to moderators """Send a report to moderators
""" """
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
@ -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, contentLicenseUrl) None, lowBandwidth, 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,
sharedItemsFederatedDomains: [], sharedItemsFederatedDomains: [],
sharedItemFederationTokens: {}, sharedItemFederationTokens: {},
lowBandwidth: bool, contentLicenseUrl: str, lowBandwidth: 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.
@ -2343,7 +2343,7 @@ def sendPost(signingPrivateKeyPem: str, projectVersion: str,
None, None, None, None, None, None,
None, None, None, None, None, systemLanguage, None, None, None, None, None, systemLanguage,
conversationId, lowBandwidth, conversationId, lowBandwidth,
contentLicenseUrl) content_license_url)
# get the senders private key # get the senders private key
privateKeyPem = _getPersonKey(nickname, domain, base_dir, 'private') privateKeyPem = _getPersonKey(nickname, domain, base_dir, 'private')
@ -2425,7 +2425,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str,
cachedWebfingers: {}, personCache: {}, cachedWebfingers: {}, personCache: {},
isArticle: bool, systemLanguage: str, isArticle: bool, systemLanguage: str,
lowBandwidth: bool, lowBandwidth: bool,
contentLicenseUrl: str, content_license_url: str,
debug: bool = False, debug: bool = False,
inReplyTo: str = None, inReplyTo: str = None,
inReplyToAtomUri: str = None, inReplyToAtomUri: str = None,
@ -2512,7 +2512,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str,
None, None, None, None, None, None,
None, None, None, None, None, systemLanguage, None, None, None, None, None, systemLanguage,
conversationId, lowBandwidth, conversationId, lowBandwidth,
contentLicenseUrl) content_license_url)
authHeader = createBasicAuthHeader(fromNickname, password) authHeader = createBasicAuthHeader(fromNickname, password)

View File

@ -129,7 +129,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd,
httpd.maxRecentPosts, httpd.maxRecentPosts,
httpd.CWlists, httpd.CWlists,
httpd.listsEnabled, httpd.listsEnabled,
httpd.contentLicenseUrl): httpd.content_license_url):
indexLines.remove(line) indexLines.remove(line)
try: try:
os.remove(postFilename) os.remove(postFilename)

View File

@ -308,7 +308,7 @@ def addShare(base_dir: str,
price: str, currency: str, price: str, currency: str,
systemLanguage: str, translate: {}, systemLanguage: str, translate: {},
sharesFileType: str, lowBandwidth: bool, sharesFileType: str, lowBandwidth: bool,
contentLicenseUrl: str) -> None: content_license_url: str) -> None:
"""Adds a new share """Adds a new share
""" """
if isFilteredGlobally(base_dir, if isFilteredGlobally(base_dir,
@ -363,7 +363,7 @@ def addShare(base_dir: str,
convertImageToLowBandwidth(imageFilename) convertImageToLowBandwidth(imageFilename)
processMetaData(base_dir, nickname, domain, processMetaData(base_dir, nickname, domain,
imageFilename, itemIDfile + '.' + ext, imageFilename, itemIDfile + '.' + ext,
city, contentLicenseUrl) city, content_license_url)
if moveImage: if moveImage:
try: try:
os.remove(imageFilename) os.remove(imageFilename)
@ -1032,7 +1032,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str,
messageJson: {}, debug: bool, city: str, messageJson: {}, debug: bool, city: str,
systemLanguage: str, translate: {}, systemLanguage: str, translate: {},
lowBandwidth: bool, lowBandwidth: bool,
contentLicenseUrl: 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
""" """
if not messageJson.get('type'): if not messageJson.get('type'):
@ -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, contentLicenseUrl) lowBandwidth, content_license_url)
if debug: if debug:
print('DEBUG: shared item received via c2s') print('DEBUG: shared item received via c2s')

View File

@ -728,7 +728,7 @@ def createServerAlice(path: str, domain: str, port: int,
testLocation = None testLocation = None
testIsArticle = False testIsArticle = False
conversationId = None conversationId = None
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
createPublicPost(path, nickname, domain, port, http_prefix, createPublicPost(path, nickname, domain, port, http_prefix,
"No wise fish would go anywhere without a porpoise", "No wise fish would go anywhere without a porpoise",
testFollowersOnly, testFollowersOnly,
@ -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, contentLicenseUrl) lowBandwidth, 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, contentLicenseUrl) lowBandwidth, 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, contentLicenseUrl) lowBandwidth, content_license_url)
regenerateIndexForBox(path, nickname, domain, 'outbox') regenerateIndexForBox(path, nickname, domain, 'outbox')
global testServerAliceRunning global testServerAliceRunning
testServerAliceRunning = True testServerAliceRunning = True
@ -794,9 +794,9 @@ def createServerAlice(path: str, domain: str, port: int,
maxLikeCount = 10 maxLikeCount = 10
defaultReplyIntervalHours = 9999999999 defaultReplyIntervalHours = 9999999999
listsEnabled = '' listsEnabled = ''
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
print('Server running: Alice') print('Server running: Alice')
runDaemon(contentLicenseUrl, runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours, listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount, lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains, sharedItemsFederatedDomains,
@ -870,7 +870,7 @@ def createServerBob(path: str, domain: str, port: int,
testLocation = None testLocation = None
testIsArticle = False testIsArticle = False
conversationId = None conversationId = None
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
createPublicPost(path, nickname, domain, port, http_prefix, createPublicPost(path, nickname, domain, port, http_prefix,
"It's your life, live it your way.", "It's your life, live it your way.",
testFollowersOnly, testFollowersOnly,
@ -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, contentLicenseUrl) lowBandwidth, 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, contentLicenseUrl) lowBandwidth, 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, contentLicenseUrl) lowBandwidth, content_license_url)
regenerateIndexForBox(path, nickname, domain, 'outbox') regenerateIndexForBox(path, nickname, domain, 'outbox')
global testServerBobRunning global testServerBobRunning
testServerBobRunning = True testServerBobRunning = True
@ -936,9 +936,9 @@ def createServerBob(path: str, domain: str, port: int,
maxLikeCount = 10 maxLikeCount = 10
defaultReplyIntervalHours = 9999999999 defaultReplyIntervalHours = 9999999999
listsEnabled = '' listsEnabled = ''
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
print('Server running: Bob') print('Server running: Bob')
runDaemon(contentLicenseUrl, runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours, listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount, lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains, sharedItemsFederatedDomains,
@ -1006,9 +1006,9 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
lowBandwidth = True lowBandwidth = True
defaultReplyIntervalHours = 9999999999 defaultReplyIntervalHours = 9999999999
listsEnabled = '' listsEnabled = ''
contentLicenseUrl = '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(contentLicenseUrl, runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours, listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount, lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains, sharedItemsFederatedDomains,
@ -1078,9 +1078,9 @@ def createServerGroup(path: str, domain: str, port: int,
lowBandwidth = True lowBandwidth = True
defaultReplyIntervalHours = 9999999999 defaultReplyIntervalHours = 9999999999
listsEnabled = '' listsEnabled = ''
contentLicenseUrl = '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(contentLicenseUrl, runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours, listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount, lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains, sharedItemsFederatedDomains,
@ -1117,7 +1117,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
systemLanguage = 'en' systemLanguage = 'en'
http_prefix = 'http' http_prefix = 'http'
proxyType = None proxyType = None
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
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)
@ -1221,7 +1221,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage, alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains, aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth, aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl, content_license_url,
inReplyTo, inReplyToAtomUri, subject) inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult)) print('sendResult: ' + str(sendResult))
@ -1442,7 +1442,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
http_prefix = 'http' http_prefix = 'http'
proxyType = None proxyType = None
federationList = [] federationList = []
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
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)
@ -1582,7 +1582,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage, alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains, aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth, aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl, content_license_url,
inReplyTo, inReplyToAtomUri, subject) inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult)) print('sendResult: ' + str(sendResult))
@ -1631,7 +1631,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
http_prefix = 'http' http_prefix = 'http'
proxyType = None proxyType = None
federationList = [] federationList = []
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
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)
@ -1933,7 +1933,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage, alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains, aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth, aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl, True, content_license_url, True,
inReplyTo, inReplyToAtomUri, subject) inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult)) print('sendResult: ' + str(sendResult))
@ -2037,7 +2037,7 @@ def testGroupFollow(base_dir: str) -> None:
http_prefix = 'http' http_prefix = 'http'
proxyType = None proxyType = None
federationList = [] federationList = []
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
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)
@ -2356,7 +2356,7 @@ def testGroupFollow(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage, alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains, aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth, aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl, content_license_url,
inReplyTo, inReplyToAtomUri, subject) inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult)) print('sendResult: ' + str(sendResult))
@ -2709,7 +2709,7 @@ def _testCreatePerson(base_dir: str):
mediaType = None mediaType = None
conversationId = None conversationId = None
lowBandwidth = True lowBandwidth = True
contentLicenseUrl = '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,
commentsEnabled, attachImageFilename, mediaType, commentsEnabled, attachImageFilename, mediaType,
@ -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, contentLicenseUrl) lowBandwidth, 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)
@ -2781,7 +2781,7 @@ def testClientToServer(base_dir: str):
global testServerAliceRunning global testServerAliceRunning
global testServerBobRunning global testServerBobRunning
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
testServerAliceRunning = False testServerAliceRunning = False
testServerBobRunning = False testServerBobRunning = False
@ -2898,7 +2898,7 @@ def testClientToServer(base_dir: str):
attachedImageDescription, city, attachedImageDescription, city,
cachedWebfingers, personCache, isArticle, cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth, systemLanguage, lowBandwidth,
contentLicenseUrl, content_license_url,
True, None, None, True, None, None,
conversationId, None) conversationId, None)
print('sendResult: ' + str(sendResult)) print('sendResult: ' + str(sendResult))
@ -4252,7 +4252,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
testIsArticle = False testIsArticle = False
conversationId = None conversationId = None
lowBandwidth = True lowBandwidth = True
contentLicenseUrl = '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,
content, followersOnly, saveToFile, content, followersOnly, saveToFile,
@ -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, contentLicenseUrl) lowBandwidth, 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\">' + \
@ -4797,7 +4797,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
testIsArticle = False testIsArticle = False
conversationId = None conversationId = None
lowBandwidth = True lowBandwidth = True
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
postJsonObject = \ postJsonObject = \
createPublicPost(base_dir, nickname, domain, port, http_prefix, createPublicPost(base_dir, nickname, domain, port, http_prefix,
@ -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, contentLicenseUrl) lowBandwidth, 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, contentLicenseUrl) lowBandwidth, 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
@ -5784,7 +5784,7 @@ def _testCanReplyTo(base_dir: str) -> None:
testIsArticle = False testIsArticle = False
conversationId = None conversationId = None
lowBandwidth = True lowBandwidth = True
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
postJsonObject = \ postJsonObject = \
createPublicPost(base_dir, nickname, domain, port, http_prefix, createPublicPost(base_dir, nickname, domain, port, http_prefix,
@ -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, contentLicenseUrl) lowBandwidth, 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

View File

@ -560,7 +560,7 @@ def htmlProfile(signingPrivateKeyPem: str,
extraJson: {}, pageNumber: int, extraJson: {}, pageNumber: int,
maxItemsPerPage: int, maxItemsPerPage: int,
CWlists: {}, listsEnabled: str, CWlists: {}, listsEnabled: str,
contentLicenseUrl: str) -> str: content_license_url: str) -> str:
"""Show the profile page as html """Show the profile page as html
""" """
nickname = profileJson['preferredUsername'] nickname = profileJson['preferredUsername']
@ -1014,7 +1014,7 @@ def htmlProfile(signingPrivateKeyPem: str,
profileStr = \ profileStr = \
htmlHeaderWithPersonMarkup(cssFilename, instanceTitle, htmlHeaderWithPersonMarkup(cssFilename, instanceTitle,
profileJson, city, profileJson, city,
contentLicenseUrl) + \ content_license_url) + \
profileStr + htmlFooter() profileStr + htmlFooter()
return profileStr return profileStr
@ -1312,10 +1312,10 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
getConfigParam(base_dir, 'instanceDescriptionShort') getConfigParam(base_dir, 'instanceDescriptionShort')
instanceTitle = \ instanceTitle = \
getConfigParam(base_dir, 'instanceTitle') getConfigParam(base_dir, 'instanceTitle')
contentLicenseUrl = \ content_license_url = \
getConfigParam(base_dir, 'contentLicenseUrl') getConfigParam(base_dir, 'content_license_url')
if not contentLicenseUrl: if not content_license_url:
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0' content_license_url = 'https://creativecommons.org/licenses/by/4.0'
instanceStr = beginEditSection(translate['Instance Settings']) instanceStr = beginEditSection(translate['Instance Settings'])
@ -1333,7 +1333,7 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
'', True) '', True)
instanceStr += \ instanceStr += \
editTextField(translate['Content License'], editTextField(translate['Content License'],
'contentLicenseUrl', contentLicenseUrl) 'content_license_url', content_license_url)
instanceStr += '<br>\n' instanceStr += '<br>\n'
instanceStr += \ instanceStr += \
editTextField(translate['Custom post submit button text'], editTextField(translate['Custom post submit button text'],

View File

@ -551,7 +551,7 @@ def htmlHeaderWithExternalStyle(cssFilename: str, instanceTitle: str,
def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
actorJson: {}, city: str, actorJson: {}, city: str,
contentLicenseUrl: str, content_license_url: str,
lang='en') -> str: lang='en') -> str:
"""html header which includes person markup """html header which includes person markup
https://schema.org/Person https://schema.org/Person
@ -685,7 +685,7 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
' "name": "' + nameStr + '",\n' + \ ' "name": "' + nameStr + '",\n' + \
' "image": "' + actorJson['icon']['url'] + '",\n' + \ ' "image": "' + actorJson['icon']['url'] + '",\n' + \
' "description": "' + description + '",\n' + \ ' "description": "' + description + '",\n' + \
' "license": "' + contentLicenseUrl + '"\n' + \ ' "license": "' + content_license_url + '"\n' + \
' }\n' + \ ' }\n' + \
' </script>\n' ' </script>\n'
@ -798,7 +798,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
published: str, modified: str, published: str, modified: str,
title: str, snippet: str, title: str, snippet: str,
translate: {}, url: str, translate: {}, url: str,
contentLicenseUrl: str) -> str: content_license_url: str) -> str:
"""html header which includes blog post markup """html header which includes blog post markup
https://schema.org/BlogPosting https://schema.org/BlogPosting
""" """
@ -826,7 +826,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
' "name": "' + instanceTitle + '",\n' + \ ' "name": "' + instanceTitle + '",\n' + \
' "sameAs": "' + aboutUrl + '"\n' + \ ' "sameAs": "' + aboutUrl + '"\n' + \
' },\n' + \ ' },\n' + \
' "license": "' + contentLicenseUrl + '",\n' + \ ' "license": "' + content_license_url + '",\n' + \
' "description": "' + snippet + '"\n' + \ ' "description": "' + snippet + '"\n' + \
' }\n' + \ ' }\n' + \
' </script>\n' ' </script>\n'