Snake case

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

View File

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

View File

@ -419,7 +419,7 @@ def _desktopReplyToPost(session, postId: str,
screenreader: str, systemLanguage: str,
espeak, conversationId: str,
lowBandwidth: bool,
contentLicenseUrl: str,
content_license_url: str,
signingPrivateKeyPem: str) -> None:
"""Use the desktop client to send a reply to the most recent post
"""
@ -474,7 +474,7 @@ def _desktopReplyToPost(session, postId: str,
attachedImageDescription, city,
cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth,
contentLicenseUrl,
content_license_url,
debug, postId, postId,
conversationId, subject) == 0:
sayStr = 'Reply sent'
@ -490,7 +490,7 @@ def _desktopNewPost(session,
debug: bool,
screenreader: str, systemLanguage: str,
espeak, lowBandwidth: bool,
contentLicenseUrl: str,
content_license_url: str,
signingPrivateKeyPem: str) -> None:
"""Use the desktop client to create a new post
"""
@ -541,7 +541,7 @@ def _desktopNewPost(session,
attachedImageDescription, city,
cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth,
contentLicenseUrl,
content_license_url,
debug, None, None,
conversationId, subject) == 0:
sayStr = 'Post sent'
@ -1130,7 +1130,7 @@ def _desktopNewDM(session, toHandle: str,
debug: bool,
screenreader: str, systemLanguage: str,
espeak, lowBandwidth: bool,
contentLicenseUrl: str,
content_license_url: str,
signingPrivateKeyPem: str) -> None:
"""Use the desktop client to create a new direct message
which can include multiple destination handles
@ -1153,7 +1153,7 @@ def _desktopNewDM(session, toHandle: str,
debug,
screenreader, systemLanguage,
espeak, lowBandwidth,
contentLicenseUrl,
content_license_url,
signingPrivateKeyPem)
@ -1164,7 +1164,7 @@ def _desktopNewDMbase(session, toHandle: str,
debug: bool,
screenreader: str, systemLanguage: str,
espeak, lowBandwidth: bool,
contentLicenseUrl: str,
content_license_url: str,
signingPrivateKeyPem: str) -> None:
"""Use the desktop client to create a new direct message
"""
@ -1255,7 +1255,7 @@ def _desktopNewDMbase(session, toHandle: str,
attachedImageDescription, city,
cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth,
contentLicenseUrl,
content_license_url,
debug, None, None,
conversationId, subject) == 0:
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
signingPrivateKeyPem = None
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
blockedCache = {}
@ -1730,7 +1730,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
screenreader, systemLanguage,
espeak, conversationId,
lowBandwidth,
contentLicenseUrl,
content_license_url,
signingPrivateKeyPem)
refreshTimeline = True
print('')
@ -1766,7 +1766,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
debug,
screenreader, systemLanguage,
espeak, lowBandwidth,
contentLicenseUrl,
content_license_url,
signingPrivateKeyPem)
refreshTimeline = True
else:
@ -1778,7 +1778,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str,
debug,
screenreader, systemLanguage,
espeak, lowBandwidth,
contentLicenseUrl,
content_license_url,
signingPrivateKeyPem)
refreshTimeline = True
print('')

View File

@ -116,7 +116,7 @@ def str2bool(v) -> bool:
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',
help='Url of the license used for the instance content')
parser.add_argument('--listsEnabled', type=str,
@ -1323,7 +1323,7 @@ if args.message:
attachedImageDescription, city,
cachedWebfingers, personCache, isArticle,
args.language, args.lowBandwidth,
args.contentLicenseUrl, args.debug,
args.content_license_url, args.debug,
replyTo, replyTo, args.conversationId, subject)
for i in range(10):
# TODO detect send success/fail
@ -2452,7 +2452,7 @@ if args.avatar:
city = 'London, England'
if setProfileImage(base_dir, http_prefix, args.nickname, domain,
port, args.avatar, 'avatar', '128x128', city,
args.contentLicenseUrl):
args.content_license_url):
print('Avatar added for ' + args.nickname)
else:
print('Avatar was not added for ' + args.nickname)
@ -2468,7 +2468,7 @@ if args.backgroundImage:
city = 'London, England'
if setProfileImage(base_dir, http_prefix, args.nickname, domain,
port, args.backgroundImage, 'background',
'256x256', city, args.contentLicenseUrl):
'256x256', city, args.content_license_url):
print('Background image added for ' + args.nickname)
else:
print('Background image was not added for ' + args.nickname)
@ -2840,7 +2840,7 @@ if args.testdata:
"City", "0", "GBP",
"2 months",
debug, city, args.language, {}, 'shares', args.lowBandwidth,
args.contentLicenseUrl)
args.content_license_url)
addShare(base_dir,
http_prefix, nickname, domain, port,
"witch hat",
@ -2851,7 +2851,7 @@ if args.testdata:
"City", "0", "GBP",
"3 months",
debug, city, args.language, {}, 'shares', args.lowBandwidth,
args.contentLicenseUrl)
args.content_license_url)
deleteAllPosts(base_dir, nickname, domain, 'inbox')
deleteAllPosts(base_dir, nickname, domain, 'outbox')
@ -2887,7 +2887,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
createPublicPost(base_dir, nickname, domain, port, http_prefix,
"Zoiks!!!",
testFollowersOnly,
@ -2900,7 +2900,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
createPublicPost(base_dir, nickname, domain, port, http_prefix,
"Hey scoob we need like a hundred more #milkshakes",
testFollowersOnly,
@ -2913,7 +2913,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
createPublicPost(base_dir, nickname, domain, port, http_prefix,
"Getting kinda spooky around here",
testFollowersOnly,
@ -2926,7 +2926,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
createPublicPost(base_dir, nickname, domain, port, http_prefix,
"And they would have gotten away with it too" +
"if it wasn't for those pesky hackers",
@ -2940,7 +2940,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
createPublicPost(base_dir, nickname, domain, port, http_prefix,
"man these centralized sites are like the worst!",
testFollowersOnly,
@ -2953,7 +2953,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
createPublicPost(base_dir, nickname, domain, port, http_prefix,
"another mystery solved #test",
testFollowersOnly,
@ -2966,7 +2966,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
createPublicPost(base_dir, nickname, domain, port, http_prefix,
"let's go bowling",
testFollowersOnly,
@ -2979,7 +2979,7 @@ if args.testdata:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, args.language, conversationId,
lowBandwidth, args.contentLicenseUrl)
lowBandwidth, args.content_license_url)
domainFull = domain + ':' + str(port)
clearFollows(base_dir, nickname, domain)
followPerson(base_dir, nickname, domain, 'maxboardroom', domainFull,
@ -3009,12 +3009,12 @@ minimumvotes = getConfigParam(base_dir, 'minvotes')
if minimumvotes:
args.minimumvotes = int(minimumvotes)
contentLicenseUrl = ''
if args.contentLicenseUrl:
contentLicenseUrl = args.contentLicenseUrl
setConfigParam(base_dir, 'contentLicenseUrl', contentLicenseUrl)
content_license_url = ''
if args.content_license_url:
content_license_url = args.content_license_url
setConfigParam(base_dir, 'content_license_url', content_license_url)
else:
contentLicenseUrl = getConfigParam(base_dir, 'contentLicenseUrl')
content_license_url = getConfigParam(base_dir, 'content_license_url')
votingtime = getConfigParam(base_dir, 'votingtime')
if votingtime:
@ -3210,7 +3210,7 @@ if args.defaultCurrency:
print('Default currency set to ' + args.defaultCurrency)
if __name__ == "__main__":
runDaemon(contentLicenseUrl,
runDaemon(content_license_url,
listsEnabled,
args.defaultReplyIntervalHours,
args.lowBandwidth, args.maxLikeCount,

View File

@ -2795,7 +2795,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
translate: {}, debug: bool,
lastBounceMessage: [], systemLanguage: str,
signingPrivateKeyPem: str,
contentLicenseUrl: str) -> bool:
content_license_url: str) -> bool:
"""Sends a bounce message back to the sending handle
if a DM has been rejected
"""
@ -2855,7 +2855,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str,
subject, debug, schedulePost,
eventDate, eventTime, location,
systemLanguage, conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
if not postJsonObject:
print('WARN: unable to create bounce message to ' + sendingHandle)
return False
@ -2882,7 +2882,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
lastBounceMessage: [],
handle: str, systemLanguage: str,
signingPrivateKeyPem: str,
contentLicenseUrl: str) -> bool:
content_license_url: str) -> bool:
"""Is the given message a valid DM?
"""
if nickname == 'inbox':
@ -2961,7 +2961,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
lastBounceMessage,
systemLanguage,
signingPrivateKeyPem,
contentLicenseUrl)
content_license_url)
return False
# dm index will be updated
@ -3198,7 +3198,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
signingPrivateKeyPem: str,
defaultReplyIntervalHours: int,
CWlists: {}, listsEnabled: str,
contentLicenseUrl: str) -> bool:
content_license_url: str) -> bool:
""" Anything which needs to be done after initial checks have passed
"""
actor = keyId
@ -3481,7 +3481,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
lastBounceMessage,
handle, systemLanguage,
signingPrivateKeyPem,
contentLicenseUrl):
content_license_url):
return False
# get the actor being replied to
@ -4479,7 +4479,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
saveJson(queueJson['post'], sharedInboxPostFilename)
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 handle, capsId in recipientsDict.items():
@ -4513,7 +4513,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
signingPrivateKeyPem,
defaultReplyIntervalHours,
CWlists, listsEnabled,
contentLicenseUrl)
content_license_url)
if debug:
pprint(queueJson['post'])
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,
outputFilename: str, spoofCity: str,
contentLicenseUrl: str) -> None:
content_license_url: str) -> None:
"""Spoof image metadata using a decoy model for a given city
"""
if not os.path.isfile(outputFilename):
@ -151,7 +151,7 @@ def _spoofMetaData(base_dir: str, nickname: str, domain: str,
'-GPSLongitude=' + str(longitude) + ' ' +
'-GPSLatitudeRef=' + latitudeRef + ' ' +
'-GPSLatitude=' + str(latitude) + ' ' +
'-copyright="' + contentLicenseUrl + '" ' +
'-copyright="' + content_license_url + '" ' +
'-Comment="" ' +
outputFilename) != 0: # nosec
print('ERROR: exiftool failed to run')
@ -202,7 +202,7 @@ def convertImageToLowBandwidth(imageFilename: str) -> None:
def processMetaData(base_dir: str, nickname: str, domain: 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
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
_spoofMetaData(base_dir, nickname, domain, outputFilename, city,
contentLicenseUrl)
content_license_url)
def _isMedia(imageFilename: str) -> bool:
@ -298,7 +298,7 @@ def attachMedia(base_dir: str, http_prefix: str,
postJson: {}, imageFilename: str,
mediaType: str, description: str,
city: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Attaches media to a json object post
The description can be None
"""
@ -357,7 +357,7 @@ def attachMedia(base_dir: str, http_prefix: str,
convertImageToLowBandwidth(imageFilename)
processMetaData(base_dir, nickname, domain,
imageFilename, mediaFilename, city,
contentLicenseUrl)
content_license_url)
else:
copyfile(imageFilename, mediaFilename)
_updateEtag(mediaFilename)

View File

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

View File

@ -200,7 +200,7 @@ def postMessageToOutbox(session, translate: {},
maxLikeCount: int,
maxRecentPosts: int, CWlists: {},
listsEnabled: str,
contentLicenseUrl: str) -> bool:
content_license_url: str) -> bool:
"""post is received by the outbox
Client to server message post
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,
port, messageJson, debug, city,
systemLanguage, translate, lowBandwidth,
contentLicenseUrl)
content_license_url)
if debug:
print('DEBUG: handle undo share uploads')

View File

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

View File

@ -1073,7 +1073,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int,
postObjectType: str, summary: str,
inReplyToAtomUri: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Creates a new server-to-server post
"""
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,
newPost['object'], attachImageFilename,
mediaType, imageDescription, city, lowBandwidth,
contentLicenseUrl)
content_license_url)
return newPost
@ -1148,7 +1148,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int,
postObjectType: str, summary: str,
inReplyToAtomUri: str, systemLanguage: str,
conversationId: str, lowBandwidth: str,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Creates a new client-to-server post
"""
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,
newPost, attachImageFilename,
mediaType, imageDescription, city, lowBandwidth,
contentLicenseUrl)
content_license_url)
return newPost
@ -1382,7 +1382,7 @@ def _createPostBase(base_dir: str,
eventStatus: str, ticketUrl: str,
systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Creates a message
"""
content = removeInvalidChars(content)
@ -1518,7 +1518,7 @@ def _createPostBase(base_dir: str,
postObjectType, summary,
inReplyToAtomUri, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
else:
newPost = \
_createPostC2S(base_dir, nickname, domain, port,
@ -1531,7 +1531,7 @@ def _createPostBase(base_dir: str,
postObjectType, summary,
inReplyToAtomUri, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
_createPostMentions(ccUrl, newPost, toRecipients, tags)
@ -1768,7 +1768,7 @@ def createPublicPost(base_dir: str,
isArticle: bool,
systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Public post
"""
domainFull = getFullDomain(domain, port)
@ -1800,7 +1800,7 @@ def createPublicPost(base_dir: str,
anonymousParticipationEnabled,
eventStatus, ticketUrl, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
def _appendCitationsToBlogPost(base_dir: str,
@ -1844,7 +1844,7 @@ def createBlogPost(base_dir: str,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
blogJson = \
createPublicPost(base_dir,
nickname, domain, port, http_prefix,
@ -1856,7 +1856,7 @@ def createBlogPost(base_dir: str,
schedulePost,
eventDate, eventTime, location,
True, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
blogJson['object']['url'] = \
blogJson['object']['url'].replace('/@', '/users/')
_appendCitationsToBlogPost(base_dir, nickname, domain, blogJson)
@ -1871,7 +1871,7 @@ def createNewsPost(base_dir: str,
imageDescription: str, city: str,
subject: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
clientToServer = False
inReplyTo = None
inReplyToAtomUri = None
@ -1890,7 +1890,7 @@ def createNewsPost(base_dir: str,
schedulePost,
eventDate, eventTime, location,
True, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
blog['object']['type'] = 'Article'
return blog
@ -1904,7 +1904,7 @@ def createQuestionPost(base_dir: str,
imageDescription: str, city: str,
subject: str, durationDays: int,
systemLanguage: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Question post with multiple choice options
"""
domainFull = getFullDomain(domain, port)
@ -1921,7 +1921,7 @@ def createQuestionPost(base_dir: str,
False, None, None, None, None, None,
None, None, None,
None, None, None, None, None, systemLanguage,
None, lowBandwidth, contentLicenseUrl)
None, lowBandwidth, content_license_url)
messageJson['object']['type'] = 'Question'
messageJson['object']['oneOf'] = []
messageJson['object']['votersCount'] = 0
@ -1954,7 +1954,7 @@ def createUnlistedPost(base_dir: str,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Unlisted post. This has the #Public and followers links inverted.
"""
domainFull = getFullDomain(domain, port)
@ -1972,7 +1972,7 @@ def createUnlistedPost(base_dir: str,
None, None, None, None, None,
None, None, None, None, None, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
def createFollowersOnlyPost(base_dir: str,
@ -1989,7 +1989,7 @@ def createFollowersOnlyPost(base_dir: str,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Followers only post
"""
domainFull = getFullDomain(domain, port)
@ -2007,7 +2007,7 @@ def createFollowersOnlyPost(base_dir: str,
None, None, None, None, None,
None, None, None, None, None, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
def getMentionedPeople(base_dir: str, http_prefix: str,
@ -2060,7 +2060,7 @@ def createDirectMessagePost(base_dir: str,
eventDate: str, eventTime: str,
location: str, systemLanguage: str,
conversationId: str, lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Direct Message post
"""
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, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
# mentioned recipients go into To rather than Cc
messageJson['to'] = messageJson['object']['cc']
messageJson['object']['to'] = messageJson['to']
@ -2106,7 +2106,7 @@ def createReportPost(base_dir: str,
imageDescription: str, city: str,
debug: bool, subject: str, systemLanguage: str,
lowBandwidth: bool,
contentLicenseUrl: str) -> {}:
content_license_url: str) -> {}:
"""Send a report to moderators
"""
domainFull = getFullDomain(domain, port)
@ -2180,7 +2180,7 @@ def createReportPost(base_dir: str,
False, None, None, None, None, None,
None, None, None,
None, None, None, None, None, systemLanguage,
None, lowBandwidth, contentLicenseUrl)
None, lowBandwidth, content_license_url)
if not postJsonObject:
continue
@ -2276,7 +2276,7 @@ def sendPost(signingPrivateKeyPem: str, projectVersion: str,
isArticle: bool, systemLanguage: str,
sharedItemsFederatedDomains: [],
sharedItemFederationTokens: {},
lowBandwidth: bool, contentLicenseUrl: str,
lowBandwidth: bool, content_license_url: str,
debug: bool = False, inReplyTo: str = None,
inReplyToAtomUri: str = None, subject: str = None) -> int:
"""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, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
# get the senders private key
privateKeyPem = _getPersonKey(nickname, domain, base_dir, 'private')
@ -2425,7 +2425,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str,
cachedWebfingers: {}, personCache: {},
isArticle: bool, systemLanguage: str,
lowBandwidth: bool,
contentLicenseUrl: str,
content_license_url: str,
debug: bool = False,
inReplyTo: str = None,
inReplyToAtomUri: str = None,
@ -2512,7 +2512,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str,
None, None, None,
None, None, None, None, None, systemLanguage,
conversationId, lowBandwidth,
contentLicenseUrl)
content_license_url)
authHeader = createBasicAuthHeader(fromNickname, password)

View File

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

View File

@ -308,7 +308,7 @@ def addShare(base_dir: str,
price: str, currency: str,
systemLanguage: str, translate: {},
sharesFileType: str, lowBandwidth: bool,
contentLicenseUrl: str) -> None:
content_license_url: str) -> None:
"""Adds a new share
"""
if isFilteredGlobally(base_dir,
@ -363,7 +363,7 @@ def addShare(base_dir: str,
convertImageToLowBandwidth(imageFilename)
processMetaData(base_dir, nickname, domain,
imageFilename, itemIDfile + '.' + ext,
city, contentLicenseUrl)
city, content_license_url)
if moveImage:
try:
os.remove(imageFilename)
@ -1032,7 +1032,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str,
messageJson: {}, debug: bool, city: str,
systemLanguage: str, translate: {},
lowBandwidth: bool,
contentLicenseUrl: str) -> None:
content_license_url: str) -> None:
""" When a shared item is received by the outbox from c2s
"""
if not messageJson.get('type'):
@ -1094,7 +1094,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str,
messageJson['object']['itemPrice'],
messageJson['object']['itemCurrency'],
systemLanguage, translate, 'shares',
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
if debug:
print('DEBUG: shared item received via c2s')

View File

@ -728,7 +728,7 @@ def createServerAlice(path: str, domain: str, port: int,
testLocation = None
testIsArticle = False
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,
"No wise fish would go anywhere without a porpoise",
testFollowersOnly,
@ -742,7 +742,7 @@ def createServerAlice(path: str, domain: str, port: int,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"Curiouser and curiouser!",
testFollowersOnly,
@ -756,7 +756,7 @@ def createServerAlice(path: str, domain: str, port: int,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"In the gardens of memory, in the palace " +
"of dreams, that is where you and I shall meet",
@ -771,7 +771,7 @@ def createServerAlice(path: str, domain: str, port: int,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
regenerateIndexForBox(path, nickname, domain, 'outbox')
global testServerAliceRunning
testServerAliceRunning = True
@ -794,9 +794,9 @@ def createServerAlice(path: str, domain: str, port: int,
maxLikeCount = 10
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
print('Server running: Alice')
runDaemon(contentLicenseUrl,
runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
@ -870,7 +870,7 @@ def createServerBob(path: str, domain: str, port: int,
testLocation = None
testIsArticle = False
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,
"It's your life, live it your way.",
testFollowersOnly,
@ -884,7 +884,7 @@ def createServerBob(path: str, domain: str, port: int,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"One of the things I've realised is that " +
"I am very simple",
@ -899,7 +899,7 @@ def createServerBob(path: str, domain: str, port: int,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
createPublicPost(path, nickname, domain, port, http_prefix,
"Quantum physics is a bit of a passion of mine",
testFollowersOnly,
@ -913,7 +913,7 @@ def createServerBob(path: str, domain: str, port: int,
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
regenerateIndexForBox(path, nickname, domain, 'outbox')
global testServerBobRunning
testServerBobRunning = True
@ -936,9 +936,9 @@ def createServerBob(path: str, domain: str, port: int,
maxLikeCount = 10
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
print('Server running: Bob')
runDaemon(contentLicenseUrl,
runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
@ -1006,9 +1006,9 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
lowBandwidth = True
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
print('Server running: Eve')
runDaemon(contentLicenseUrl,
runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
@ -1078,9 +1078,9 @@ def createServerGroup(path: str, domain: str, port: int,
lowBandwidth = True
defaultReplyIntervalHours = 9999999999
listsEnabled = ''
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
print('Server running: Group')
runDaemon(contentLicenseUrl,
runDaemon(content_license_url,
listsEnabled, defaultReplyIntervalHours,
lowBandwidth, maxLikeCount,
sharedItemsFederatedDomains,
@ -1117,7 +1117,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
systemLanguage = 'en'
http_prefix = 'http'
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'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -1221,7 +1221,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl,
content_license_url,
inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult))
@ -1442,7 +1442,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
http_prefix = 'http'
proxyType = None
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'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -1582,7 +1582,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl,
content_license_url,
inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult))
@ -1631,7 +1631,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
http_prefix = 'http'
proxyType = None
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'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -1933,7 +1933,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl, True,
content_license_url, True,
inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult))
@ -2037,7 +2037,7 @@ def testGroupFollow(base_dir: str) -> None:
http_prefix = 'http'
proxyType = None
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'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -2356,7 +2356,7 @@ def testGroupFollow(base_dir: str) -> None:
alicePersonCache, isArticle, systemLanguage,
aliceSharedItemsFederatedDomains,
aliceSharedItemFederationTokens, lowBandwidth,
contentLicenseUrl,
content_license_url,
inReplyTo, inReplyToAtomUri, subject)
print('sendResult: ' + str(sendResult))
@ -2709,7 +2709,7 @@ def _testCreatePerson(base_dir: str):
mediaType = None
conversationId = None
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,
content, followersOnly, saveToFile, clientToServer,
commentsEnabled, attachImageFilename, mediaType,
@ -2718,7 +2718,7 @@ def _testCreatePerson(base_dir: str):
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
os.chdir(currDir)
shutil.rmtree(base_dir, ignore_errors=False, onerror=None)
@ -2781,7 +2781,7 @@ def testClientToServer(base_dir: str):
global testServerAliceRunning
global testServerBobRunning
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
testServerAliceRunning = False
testServerBobRunning = False
@ -2898,7 +2898,7 @@ def testClientToServer(base_dir: str):
attachedImageDescription, city,
cachedWebfingers, personCache, isArticle,
systemLanguage, lowBandwidth,
contentLicenseUrl,
content_license_url,
True, None, None,
conversationId, None)
print('sendResult: ' + str(sendResult))
@ -4252,7 +4252,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
testIsArticle = False
conversationId = None
lowBandwidth = True
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
reply = \
createPublicPost(base_dir, nickname, domain, port, http_prefix,
content, followersOnly, saveToFile,
@ -4263,7 +4263,7 @@ def _testReplyToPublicPost(base_dir: str) -> None:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
# print(str(reply))
assert reply['object']['content'] == \
'<p><span class=\"h-card\">' + \
@ -4797,7 +4797,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
testIsArticle = False
conversationId = None
lowBandwidth = True
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
postJsonObject = \
createPublicPost(base_dir, nickname, domain, port, http_prefix,
@ -4809,7 +4809,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
assert postJsonObject['object']['content'] == \
'<p>This is a test post with links.<br><br>' + \
@ -4846,7 +4846,7 @@ def _testLinksWithinPost(base_dir: str) -> None:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
assert postJsonObject['object']['content'] == content
assert postJsonObject['object']['contentMap'][systemLanguage] == content
@ -5784,7 +5784,7 @@ def _testCanReplyTo(base_dir: str) -> None:
testIsArticle = False
conversationId = None
lowBandwidth = True
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
postJsonObject = \
createPublicPost(base_dir, nickname, domain, port, http_prefix,
@ -5796,7 +5796,7 @@ def _testCanReplyTo(base_dir: str) -> None:
testSubject, testSchedulePost,
testEventDate, testEventTime, testLocation,
testIsArticle, systemLanguage, conversationId,
lowBandwidth, contentLicenseUrl)
lowBandwidth, content_license_url)
# set the date on the post
currDateStr = "2021-09-08T20:45:00Z"
postJsonObject['published'] = currDateStr

View File

@ -560,7 +560,7 @@ def htmlProfile(signingPrivateKeyPem: str,
extraJson: {}, pageNumber: int,
maxItemsPerPage: int,
CWlists: {}, listsEnabled: str,
contentLicenseUrl: str) -> str:
content_license_url: str) -> str:
"""Show the profile page as html
"""
nickname = profileJson['preferredUsername']
@ -1014,7 +1014,7 @@ def htmlProfile(signingPrivateKeyPem: str,
profileStr = \
htmlHeaderWithPersonMarkup(cssFilename, instanceTitle,
profileJson, city,
contentLicenseUrl) + \
content_license_url) + \
profileStr + htmlFooter()
return profileStr
@ -1312,10 +1312,10 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
getConfigParam(base_dir, 'instanceDescriptionShort')
instanceTitle = \
getConfigParam(base_dir, 'instanceTitle')
contentLicenseUrl = \
getConfigParam(base_dir, 'contentLicenseUrl')
if not contentLicenseUrl:
contentLicenseUrl = 'https://creativecommons.org/licenses/by/4.0'
content_license_url = \
getConfigParam(base_dir, 'content_license_url')
if not content_license_url:
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
instanceStr = beginEditSection(translate['Instance Settings'])
@ -1333,7 +1333,7 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
'', True)
instanceStr += \
editTextField(translate['Content License'],
'contentLicenseUrl', contentLicenseUrl)
'content_license_url', content_license_url)
instanceStr += '<br>\n'
instanceStr += \
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,
actorJson: {}, city: str,
contentLicenseUrl: str,
content_license_url: str,
lang='en') -> str:
"""html header which includes person markup
https://schema.org/Person
@ -685,7 +685,7 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
' "name": "' + nameStr + '",\n' + \
' "image": "' + actorJson['icon']['url'] + '",\n' + \
' "description": "' + description + '",\n' + \
' "license": "' + contentLicenseUrl + '"\n' + \
' "license": "' + content_license_url + '"\n' + \
' }\n' + \
' </script>\n'
@ -798,7 +798,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
published: str, modified: str,
title: str, snippet: str,
translate: {}, url: str,
contentLicenseUrl: str) -> str:
content_license_url: str) -> str:
"""html header which includes blog post markup
https://schema.org/BlogPosting
"""
@ -826,7 +826,7 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
' "name": "' + instanceTitle + '",\n' + \
' "sameAs": "' + aboutUrl + '"\n' + \
' },\n' + \
' "license": "' + contentLicenseUrl + '",\n' + \
' "license": "' + content_license_url + '",\n' + \
' "description": "' + snippet + '"\n' + \
' }\n' + \
' </script>\n'