diff --git a/daemon.py b/daemon.py index a70fc75ae..3734628ac 100644 --- a/daemon.py +++ b/daemon.py @@ -517,7 +517,7 @@ class PubServer(BaseHTTPRequestHandler): location, False, self.server.systemLanguage, conversationId, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: # name field contains the answer @@ -1300,7 +1300,7 @@ class PubServer(BaseHTTPRequestHandler): city, self.server.systemLanguage, self.server.shared_items_federated_domains, self.server.sharedItemFederationTokens, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.signingPrivateKeyPem, self.server.peertubeInstances, self.server.themeName, @@ -4816,7 +4816,7 @@ class PubServer(BaseHTTPRequestHandler): city = getSpoofedCity(self.server.city, base_dir, nickname, domain) - if self.server.lowBandwidth: + if self.server.low_bandwidth: convertImageToLowBandwidth(filename) processMetaData(base_dir, nickname, domain, filename, postImageFilename, city, @@ -6203,15 +6203,15 @@ class PubServer(BaseHTTPRequestHandler): if path.startswith('/users/' + adminNickname + '/') or \ isArtist(base_dir, nickname): currLowBandwidth = \ - getConfigParam(base_dir, 'lowBandwidth') - lowBandwidth = False - if fields.get('lowBandwidth'): - if fields['lowBandwidth'] == 'on': - lowBandwidth = True - if currLowBandwidth != lowBandwidth: - setConfigParam(base_dir, 'lowBandwidth', - lowBandwidth) - self.server.lowBandwidth = lowBandwidth + getConfigParam(base_dir, 'low_bandwidth') + low_bandwidth = False + if fields.get('low_bandwidth'): + if fields['low_bandwidth'] == 'on': + low_bandwidth = True + if currLowBandwidth != low_bandwidth: + setConfigParam(base_dir, 'low_bandwidth', + low_bandwidth) + self.server.low_bandwidth = low_bandwidth # save filtered words list filterFilename = \ @@ -16471,7 +16471,7 @@ class PubServer(BaseHTTPRequestHandler): city = getSpoofedCity(self.server.city, self.server.base_dir, nickname, self.server.domain) - if self.server.lowBandwidth: + if self.server.low_bandwidth: convertImageToLowBandwidth(filename) processMetaData(self.server.base_dir, nickname, self.server.domain, @@ -16602,7 +16602,7 @@ class PubServer(BaseHTTPRequestHandler): fields['location'], False, self.server.systemLanguage, conversationId, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: if fields['schedulePost']: @@ -16687,7 +16687,7 @@ class PubServer(BaseHTTPRequestHandler): fields['location'], self.server.systemLanguage, conversationId, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: if fields['schedulePost']: @@ -16779,7 +16779,7 @@ class PubServer(BaseHTTPRequestHandler): attachmentMediaType, imgDescription, city, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) replaceYouTube(postJsonObject, @@ -16838,7 +16838,7 @@ class PubServer(BaseHTTPRequestHandler): fields['location'], self.server.systemLanguage, conversationId, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: if fields['schedulePost']: @@ -16890,7 +16890,7 @@ class PubServer(BaseHTTPRequestHandler): fields['location'], self.server.systemLanguage, conversationId, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: if fields['schedulePost']: @@ -16947,7 +16947,7 @@ class PubServer(BaseHTTPRequestHandler): fields['location'], self.server.systemLanguage, conversationId, - self.server.lowBandwidth, + self.server.low_bandwidth, content_license_url) if messageJson: if fields['schedulePost']: @@ -17001,7 +17001,7 @@ class PubServer(BaseHTTPRequestHandler): fields['location'], self.server.systemLanguage, conversationId, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: if fields['schedulePost']: @@ -17038,7 +17038,7 @@ class PubServer(BaseHTTPRequestHandler): city, self.server.debug, fields['subject'], self.server.systemLanguage, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: if self._postToOutbox(messageJson, @@ -17080,7 +17080,7 @@ class PubServer(BaseHTTPRequestHandler): fields['subject'], intDuration, self.server.systemLanguage, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if messageJson: if self.server.debug: @@ -17153,7 +17153,7 @@ class PubServer(BaseHTTPRequestHandler): city, itemPrice, itemCurrency, self.server.systemLanguage, self.server.translate, sharesFileType, - self.server.lowBandwidth, + self.server.low_bandwidth, self.server.content_license_url) if filename: if os.path.isfile(filename): @@ -18402,7 +18402,7 @@ def loadTokens(base_dir: str, tokensDict: {}, tokensLookup: {}) -> None: def runDaemon(content_license_url: str, lists_enabled: str, default_reply_interval_hrs: int, - lowBandwidth: bool, + low_bandwidth: bool, maxLikeCount: int, shared_items_federated_domains: [], userAgentsBlocked: [], @@ -18558,7 +18558,7 @@ def runDaemon(content_license_url: str, loadAccessKeysForAccounts(base_dir, httpd.keyShortcuts, httpd.accessKeys) # wheither to use low bandwidth images - httpd.lowBandwidth = lowBandwidth + httpd.low_bandwidth = low_bandwidth # list of blocked user agent types within the User-Agent header httpd.userAgentsBlocked = userAgentsBlocked diff --git a/desktop_client.py b/desktop_client.py index ea7b20a6d..2da3d8a90 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -418,7 +418,7 @@ def _desktopReplyToPost(session, postId: str, debug: bool, subject: str, screenreader: str, systemLanguage: str, espeak, conversationId: str, - lowBandwidth: bool, + low_bandwidth: bool, content_license_url: str, signingPrivateKeyPem: str) -> None: """Use the desktop client to send a reply to the most recent post @@ -473,7 +473,7 @@ def _desktopReplyToPost(session, postId: str, commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - systemLanguage, lowBandwidth, + systemLanguage, low_bandwidth, content_license_url, debug, postId, postId, conversationId, subject) == 0: @@ -489,7 +489,7 @@ def _desktopNewPost(session, cachedWebfingers: {}, personCache: {}, debug: bool, screenreader: str, systemLanguage: str, - espeak, lowBandwidth: bool, + espeak, low_bandwidth: bool, content_license_url: str, signingPrivateKeyPem: str) -> None: """Use the desktop client to create a new post @@ -540,7 +540,7 @@ def _desktopNewPost(session, commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - systemLanguage, lowBandwidth, + systemLanguage, low_bandwidth, content_license_url, debug, None, None, conversationId, subject) == 0: @@ -1129,7 +1129,7 @@ def _desktopNewDM(session, toHandle: str, cachedWebfingers: {}, personCache: {}, debug: bool, screenreader: str, systemLanguage: str, - espeak, lowBandwidth: bool, + espeak, low_bandwidth: bool, content_license_url: str, signingPrivateKeyPem: str) -> None: """Use the desktop client to create a new direct message @@ -1152,7 +1152,7 @@ def _desktopNewDM(session, toHandle: str, cachedWebfingers, personCache, debug, screenreader, systemLanguage, - espeak, lowBandwidth, + espeak, low_bandwidth, content_license_url, signingPrivateKeyPem) @@ -1163,7 +1163,7 @@ def _desktopNewDMbase(session, toHandle: str, cachedWebfingers: {}, personCache: {}, debug: bool, screenreader: str, systemLanguage: str, - espeak, lowBandwidth: bool, + espeak, low_bandwidth: bool, content_license_url: str, signingPrivateKeyPem: str) -> None: """Use the desktop client to create a new direct message @@ -1254,7 +1254,7 @@ def _desktopNewDMbase(session, toHandle: str, commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - systemLanguage, lowBandwidth, + systemLanguage, low_bandwidth, content_license_url, debug, None, None, conversationId, subject) == 0: @@ -1322,7 +1322,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str, storeInboxPosts: bool, showNewPosts: bool, language: str, - debug: bool, lowBandwidth: bool) -> None: + debug: bool, low_bandwidth: bool) -> None: """Runs the desktop and screen reader client, which announces new inbox items """ @@ -1729,7 +1729,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str, debug, subject, screenreader, systemLanguage, espeak, conversationId, - lowBandwidth, + low_bandwidth, content_license_url, signingPrivateKeyPem) refreshTimeline = True @@ -1765,7 +1765,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str, cachedWebfingers, personCache, debug, screenreader, systemLanguage, - espeak, lowBandwidth, + espeak, low_bandwidth, content_license_url, signingPrivateKeyPem) refreshTimeline = True @@ -1777,7 +1777,7 @@ def runDesktopClient(base_dir: str, proxyType: str, http_prefix: str, cachedWebfingers, personCache, debug, screenreader, systemLanguage, - espeak, lowBandwidth, + espeak, low_bandwidth, content_license_url, signingPrivateKeyPem) refreshTimeline = True diff --git a/epicyon.py b/epicyon.py index 5f7d56de1..6305b1ca4 100644 --- a/epicyon.py +++ b/epicyon.py @@ -353,8 +353,8 @@ parser.add_argument("--rssIconAtTop", const=True, default=True, help="Whether to show the rss icon at teh top or bottom" + "of the timeline") -parser.add_argument("--lowBandwidth", - dest='lowBandwidth', +parser.add_argument("--low_bandwidth", + dest='low_bandwidth', type=str2bool, nargs='?', const=True, default=True, help="Whether to use low bandwidth images") @@ -1322,7 +1322,7 @@ if args.message: args.commentsEnabled, attach, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - args.language, args.lowBandwidth, + args.language, args.low_bandwidth, args.content_license_url, args.debug, replyTo, replyTo, args.conversationId, subject) for i in range(10): @@ -2598,7 +2598,7 @@ if args.desktop: storeInboxPosts, args.notifyShowNewPosts, args.language, - args.debug, args.lowBandwidth) + args.debug, args.low_bandwidth) sys.exit() if federationList: @@ -2839,7 +2839,7 @@ if args.testdata: "mechanical", "City", "0", "GBP", "2 months", - debug, city, args.language, {}, 'shares', args.lowBandwidth, + debug, city, args.language, {}, 'shares', args.low_bandwidth, args.content_license_url) addShare(base_dir, http_prefix, nickname, domain, port, @@ -2850,7 +2850,7 @@ if args.testdata: "clothing", "City", "0", "GBP", "3 months", - debug, city, args.language, {}, 'shares', args.lowBandwidth, + debug, city, args.language, {}, 'shares', args.low_bandwidth, args.content_license_url) deleteAllPosts(base_dir, nickname, domain, 'inbox') @@ -2873,7 +2873,7 @@ if args.testdata: testLocation = None testIsArticle = False conversationId = None - lowBandwidth = False + low_bandwidth = False createPublicPost(base_dir, nickname, domain, port, http_prefix, "like this is totally just a #test man", @@ -2887,7 +2887,7 @@ if args.testdata: testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, args.language, conversationId, - lowBandwidth, args.content_license_url) + low_bandwidth, 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.content_license_url) + low_bandwidth, 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.content_license_url) + low_bandwidth, 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.content_license_url) + low_bandwidth, 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.content_license_url) + low_bandwidth, 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.content_license_url) + low_bandwidth, 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.content_license_url) + low_bandwidth, 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.content_license_url) + low_bandwidth, args.content_license_url) domainFull = domain + ':' + str(port) clearFollows(base_dir, nickname, domain) followPerson(base_dir, nickname, domain, 'maxboardroom', domainFull, @@ -3133,10 +3133,10 @@ showNodeInfoVersion = \ if showNodeInfoVersion is not None: args.showNodeInfoVersion = bool(showNodeInfoVersion) -lowBandwidth = \ - getConfigParam(base_dir, 'lowBandwidth') -if lowBandwidth is not None: - args.lowBandwidth = bool(lowBandwidth) +low_bandwidth = \ + getConfigParam(base_dir, 'low_bandwidth') +if low_bandwidth is not None: + args.low_bandwidth = bool(low_bandwidth) userAgentsBlocked = [] if args.userAgentBlocks: @@ -3213,7 +3213,7 @@ if __name__ == "__main__": runDaemon(content_license_url, lists_enabled, args.default_reply_interval_hrs, - args.lowBandwidth, args.maxLikeCount, + args.low_bandwidth, args.maxLikeCount, shared_items_federated_domains, userAgentsBlocked, args.logLoginFailures, diff --git a/inbox.py b/inbox.py index 142b3cb3e..c427f711c 100644 --- a/inbox.py +++ b/inbox.py @@ -2843,7 +2843,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str, eventTime = None location = None conversationId = None - lowBandwidth = False + low_bandwidth = False postJsonObject = \ createDirectMessagePost(base_dir, nickname, domain, port, http_prefix, content, followersOnly, @@ -2854,7 +2854,7 @@ def _bounceDM(senderPostId: str, session, http_prefix: str, inReplyTo, inReplyToAtomUri, subject, debug, schedulePost, eventDate, eventTime, location, - systemLanguage, conversationId, lowBandwidth, + systemLanguage, conversationId, low_bandwidth, content_license_url) if not postJsonObject: print('WARN: unable to create bounce message to ' + sendingHandle) diff --git a/media.py b/media.py index 59b6cffbb..974beb2c2 100644 --- a/media.py +++ b/media.py @@ -163,41 +163,41 @@ def _spoofMetaData(base_dir: str, nickname: str, domain: str, def convertImageToLowBandwidth(imageFilename: str) -> None: """Converts an image to a low bandwidth version """ - lowBandwidthFilename = imageFilename + '.low' - if os.path.isfile(lowBandwidthFilename): + low_bandwidthFilename = imageFilename + '.low' + if os.path.isfile(low_bandwidthFilename): try: - os.remove(lowBandwidthFilename) + os.remove(low_bandwidthFilename) except OSError: print('EX: convertImageToLowBandwidth unable to delete ' + - lowBandwidthFilename) + low_bandwidthFilename) cmd = \ '/usr/bin/convert +noise Multiplicative ' + \ '-evaluate median 10% -dither Floyd-Steinberg ' + \ - '-monochrome ' + imageFilename + ' ' + lowBandwidthFilename + '-monochrome ' + imageFilename + ' ' + low_bandwidthFilename print('Low bandwidth image conversion: ' + cmd) subprocess.call(cmd, shell=True) # wait for conversion to happen ctr = 0 - while not os.path.isfile(lowBandwidthFilename): + while not os.path.isfile(low_bandwidthFilename): print('Waiting for low bandwidth image conversion ' + str(ctr)) time.sleep(0.2) ctr += 1 if ctr > 100: print('WARN: timed out waiting for low bandwidth image conversion') break - if os.path.isfile(lowBandwidthFilename): + if os.path.isfile(low_bandwidthFilename): try: os.remove(imageFilename) except OSError: print('EX: convertImageToLowBandwidth unable to delete ' + imageFilename) - os.rename(lowBandwidthFilename, imageFilename) + os.rename(low_bandwidthFilename, imageFilename) if os.path.isfile(imageFilename): print('Image converted to low bandwidth ' + imageFilename) else: print('Low bandwidth converted image not found: ' + - lowBandwidthFilename) + low_bandwidthFilename) def processMetaData(base_dir: str, nickname: str, domain: str, @@ -297,7 +297,7 @@ def attachMedia(base_dir: str, http_prefix: str, nickname: str, domain: str, port: int, postJson: {}, imageFilename: str, mediaType: str, description: str, - city: str, lowBandwidth: bool, + city: str, low_bandwidth: bool, content_license_url: str) -> {}: """Attaches media to a json object post The description can be None @@ -353,7 +353,7 @@ def attachMedia(base_dir: str, http_prefix: str, if base_dir: if mediaType.startswith('image/'): - if lowBandwidth: + if low_bandwidth: convertImageToLowBandwidth(imageFilename) processMetaData(base_dir, nickname, domain, imageFilename, mediaFilename, city, diff --git a/newsdaemon.py b/newsdaemon.py index c0ee52e6c..3d50cf247 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -545,7 +545,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str, maxMirroredArticles: int, allowLocalNetworkAccess: bool, systemLanguage: str, - lowBandwidth: bool, + low_bandwidth: bool, content_license_url: str) -> None: """Converts rss items in a newswire into posts """ @@ -638,7 +638,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str, attachImageFilename, mediaType, imageDescription, city, rssTitle, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) if not blog: continue @@ -836,7 +836,7 @@ def runNewswireDaemon(base_dir: str, httpd, httpd.maxMirroredArticles, httpd.allowLocalNetworkAccess, httpd.systemLanguage, - httpd.lowBandwidth, + httpd.low_bandwidth, httpd.content_license_url) print('Newswire feed converted to ActivityPub') diff --git a/outbox.py b/outbox.py index 03593ad03..0a7dc924d 100644 --- a/outbox.py +++ b/outbox.py @@ -194,7 +194,7 @@ def postMessageToOutbox(session, translate: {}, city: str, systemLanguage: str, shared_items_federated_domains: [], sharedItemFederationTokens: {}, - lowBandwidth: bool, + low_bandwidth: bool, signingPrivateKeyPem: str, peertubeInstances: str, theme: str, maxLikeCount: int, @@ -625,7 +625,7 @@ def postMessageToOutbox(session, translate: {}, print('DEBUG: handle share uploads') outboxShareUpload(base_dir, http_prefix, postToNickname, domain, port, messageJson, debug, city, - systemLanguage, translate, lowBandwidth, + systemLanguage, translate, low_bandwidth, content_license_url) if debug: diff --git a/posts.py b/posts.py index 48b019ad9..e30fab15d 100644 --- a/posts.py +++ b/posts.py @@ -1072,7 +1072,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int, mediaType: str, imageDescription: str, city: str, postObjectType: str, summary: str, inReplyToAtomUri: str, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: """Creates a new server-to-server post """ @@ -1133,7 +1133,7 @@ def _createPostS2S(base_dir: str, nickname: str, domain: str, port: int, newPost['object'] = \ attachMedia(base_dir, http_prefix, nickname, domain, port, newPost['object'], attachImageFilename, - mediaType, imageDescription, city, lowBandwidth, + mediaType, imageDescription, city, low_bandwidth, content_license_url) return newPost @@ -1147,7 +1147,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int, mediaType: str, imageDescription: str, city: str, postObjectType: str, summary: str, inReplyToAtomUri: str, systemLanguage: str, - conversationId: str, lowBandwidth: str, + conversationId: str, low_bandwidth: str, content_license_url: str) -> {}: """Creates a new client-to-server post """ @@ -1198,7 +1198,7 @@ def _createPostC2S(base_dir: str, nickname: str, domain: str, port: int, newPost = \ attachMedia(base_dir, http_prefix, nickname, domain, port, newPost, attachImageFilename, - mediaType, imageDescription, city, lowBandwidth, + mediaType, imageDescription, city, low_bandwidth, content_license_url) return newPost @@ -1381,7 +1381,7 @@ def _createPostBase(base_dir: str, anonymousParticipationEnabled: bool, eventStatus: str, ticketUrl: str, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: """Creates a message """ @@ -1517,7 +1517,7 @@ def _createPostBase(base_dir: str, mediaType, imageDescription, city, postObjectType, summary, inReplyToAtomUri, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) else: newPost = \ @@ -1530,7 +1530,7 @@ def _createPostBase(base_dir: str, mediaType, imageDescription, city, postObjectType, summary, inReplyToAtomUri, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) _createPostMentions(ccUrl, newPost, toRecipients, tags) @@ -1767,7 +1767,7 @@ def createPublicPost(base_dir: str, location: str, isArticle: bool, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: """Public post """ @@ -1799,7 +1799,7 @@ def createPublicPost(base_dir: str, repliesModerationOption, anonymousParticipationEnabled, eventStatus, ticketUrl, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) @@ -1843,7 +1843,7 @@ def createBlogPost(base_dir: str, subject: str, schedulePost: bool, eventDate: str, eventTime: str, location: str, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: blogJson = \ createPublicPost(base_dir, @@ -1856,7 +1856,7 @@ def createBlogPost(base_dir: str, schedulePost, eventDate, eventTime, location, True, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) blogJson['object']['url'] = \ blogJson['object']['url'].replace('/@', '/users/') _appendCitationsToBlogPost(base_dir, nickname, domain, blogJson) @@ -1870,7 +1870,7 @@ def createNewsPost(base_dir: str, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, subject: str, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: clientToServer = False inReplyTo = None @@ -1890,7 +1890,7 @@ def createNewsPost(base_dir: str, schedulePost, eventDate, eventTime, location, True, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) blog['object']['type'] = 'Article' return blog @@ -1903,7 +1903,7 @@ def createQuestionPost(base_dir: str, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, subject: str, durationDays: int, - systemLanguage: str, lowBandwidth: bool, + systemLanguage: str, low_bandwidth: bool, content_license_url: str) -> {}: """Question post with multiple choice options """ @@ -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, content_license_url) + None, low_bandwidth, content_license_url) messageJson['object']['type'] = 'Question' messageJson['object']['oneOf'] = [] messageJson['object']['votersCount'] = 0 @@ -1953,7 +1953,7 @@ def createUnlistedPost(base_dir: str, subject: str, schedulePost: bool, eventDate: str, eventTime: str, location: str, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: """Unlisted post. This has the #Public and followers links inverted. """ @@ -1971,7 +1971,7 @@ def createUnlistedPost(base_dir: str, schedulePost, eventDate, eventTime, location, None, None, None, None, None, None, None, None, None, None, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) @@ -1988,7 +1988,7 @@ def createFollowersOnlyPost(base_dir: str, subject: str, schedulePost: bool, eventDate: str, eventTime: str, location: str, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: """Followers only post """ @@ -2006,7 +2006,7 @@ def createFollowersOnlyPost(base_dir: str, schedulePost, eventDate, eventTime, location, None, None, None, None, None, None, None, None, None, None, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) @@ -2059,7 +2059,7 @@ def createDirectMessagePost(base_dir: str, schedulePost: bool, eventDate: str, eventTime: str, location: str, systemLanguage: str, - conversationId: str, lowBandwidth: bool, + conversationId: str, low_bandwidth: bool, content_license_url: str) -> {}: """Direct Message post """ @@ -2084,7 +2084,7 @@ def createDirectMessagePost(base_dir: str, schedulePost, eventDate, eventTime, location, None, None, None, None, None, None, None, None, None, None, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) # mentioned recipients go into To rather than Cc messageJson['to'] = messageJson['object']['cc'] @@ -2105,7 +2105,7 @@ def createReportPost(base_dir: str, attachImageFilename: str, mediaType: str, imageDescription: str, city: str, debug: bool, subject: str, systemLanguage: str, - lowBandwidth: bool, + low_bandwidth: bool, content_license_url: str) -> {}: """Send a report to moderators """ @@ -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, content_license_url) + None, low_bandwidth, content_license_url) if not postJsonObject: continue @@ -2276,7 +2276,7 @@ def sendPost(signingPrivateKeyPem: str, projectVersion: str, isArticle: bool, systemLanguage: str, shared_items_federated_domains: [], sharedItemFederationTokens: {}, - lowBandwidth: bool, content_license_url: str, + low_bandwidth: 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. @@ -2342,7 +2342,7 @@ def sendPost(signingPrivateKeyPem: str, projectVersion: str, False, None, None, None, None, None, None, None, None, None, None, None, None, None, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) # get the senders private key @@ -2424,7 +2424,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str, imageDescription: str, city: str, cachedWebfingers: {}, personCache: {}, isArticle: bool, systemLanguage: str, - lowBandwidth: bool, + low_bandwidth: bool, content_license_url: str, debug: bool = False, inReplyTo: str = None, @@ -2511,7 +2511,7 @@ def sendPostViaServer(signingPrivateKeyPem: str, projectVersion: str, False, None, None, None, None, None, None, None, None, None, None, None, None, None, systemLanguage, - conversationId, lowBandwidth, + conversationId, low_bandwidth, content_license_url) authHeader = createBasicAuthHeader(fromNickname, password) diff --git a/schedule.py b/schedule.py index e4dff22c6..0a251b575 100644 --- a/schedule.py +++ b/schedule.py @@ -121,7 +121,7 @@ def _updatePostSchedule(base_dir: str, handle: str, httpd, httpd.city, httpd.systemLanguage, httpd.shared_items_federated_domains, httpd.sharedItemFederationTokens, - httpd.lowBandwidth, + httpd.low_bandwidth, httpd.signingPrivateKeyPem, httpd.peertubeInstances, httpd.themeName, diff --git a/shares.py b/shares.py index 23e07071b..31302775d 100644 --- a/shares.py +++ b/shares.py @@ -307,7 +307,7 @@ def addShare(base_dir: str, duration: str, debug: bool, city: str, price: str, currency: str, systemLanguage: str, translate: {}, - sharesFileType: str, lowBandwidth: bool, + sharesFileType: str, low_bandwidth: bool, content_license_url: str) -> None: """Adds a new share """ @@ -359,7 +359,7 @@ def addShare(base_dir: str, for ext in formats: if not imageFilename.endswith('.' + ext): continue - if lowBandwidth: + if low_bandwidth: convertImageToLowBandwidth(imageFilename) processMetaData(base_dir, nickname, domain, imageFilename, itemIDfile + '.' + ext, @@ -1031,7 +1031,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str, nickname: str, domain: str, port: int, messageJson: {}, debug: bool, city: str, systemLanguage: str, translate: {}, - lowBandwidth: bool, + low_bandwidth: bool, content_license_url: str) -> None: """ When a shared item is received by the outbox from c2s """ @@ -1094,7 +1094,7 @@ def outboxShareUpload(base_dir: str, http_prefix: str, messageJson['object']['itemPrice'], messageJson['object']['itemCurrency'], systemLanguage, translate, 'shares', - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) if debug: print('DEBUG: shared item received via c2s') diff --git a/tests.py b/tests.py index 3abd2d8b4..ea4114899 100644 --- a/tests.py +++ b/tests.py @@ -697,7 +697,7 @@ def createServerAlice(path: str, domain: str, port: int, domainMaxPostsPerDay = 1000 accountMaxPostsPerDay = 1000 allowDeletion = True - lowBandwidth = True + low_bandwidth = True privateKeyPem, publicKeyPem, person, wfEndpoint = \ createPerson(path, nickname, domain, port, http_prefix, True, False, password) @@ -742,7 +742,7 @@ def createServerAlice(path: str, domain: str, port: int, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, 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, content_license_url) + low_bandwidth, 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, content_license_url) + low_bandwidth, content_license_url) regenerateIndexForBox(path, nickname, domain, 'outbox') global testServerAliceRunning testServerAliceRunning = True @@ -798,7 +798,7 @@ def createServerAlice(path: str, domain: str, port: int, print('Server running: Alice') runDaemon(content_license_url, lists_enabled, default_reply_interval_hrs, - lowBandwidth, maxLikeCount, + low_bandwidth, maxLikeCount, shared_items_federated_domains, userAgentsBlocked, logLoginFailures, city, @@ -842,7 +842,7 @@ def createServerBob(path: str, domain: str, port: int, domainMaxPostsPerDay = 1000 accountMaxPostsPerDay = 1000 allowDeletion = True - lowBandwidth = True + low_bandwidth = True privateKeyPem, publicKeyPem, person, wfEndpoint = \ createPerson(path, nickname, domain, port, http_prefix, True, False, password) @@ -884,7 +884,7 @@ def createServerBob(path: str, domain: str, port: int, testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, 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, content_license_url) + low_bandwidth, 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, content_license_url) + low_bandwidth, content_license_url) regenerateIndexForBox(path, nickname, domain, 'outbox') global testServerBobRunning testServerBobRunning = True @@ -940,7 +940,7 @@ def createServerBob(path: str, domain: str, port: int, print('Server running: Bob') runDaemon(content_license_url, lists_enabled, default_reply_interval_hrs, - lowBandwidth, maxLikeCount, + low_bandwidth, maxLikeCount, shared_items_federated_domains, userAgentsBlocked, logLoginFailures, city, @@ -1003,14 +1003,14 @@ def createServerEve(path: str, domain: str, port: int, federationList: [], logLoginFailures = False userAgentsBlocked = [] maxLikeCount = 10 - lowBandwidth = True + low_bandwidth = True default_reply_interval_hrs = 9999999999 lists_enabled = '' content_license_url = 'https://creativecommons.org/licenses/by/4.0' print('Server running: Eve') runDaemon(content_license_url, lists_enabled, default_reply_interval_hrs, - lowBandwidth, maxLikeCount, + low_bandwidth, maxLikeCount, shared_items_federated_domains, userAgentsBlocked, logLoginFailures, city, @@ -1075,14 +1075,14 @@ def createServerGroup(path: str, domain: str, port: int, logLoginFailures = False userAgentsBlocked = [] maxLikeCount = 10 - lowBandwidth = True + low_bandwidth = True default_reply_interval_hrs = 9999999999 lists_enabled = '' content_license_url = 'https://creativecommons.org/licenses/by/4.0' print('Server running: Group') runDaemon(content_license_url, lists_enabled, default_reply_interval_hrs, - lowBandwidth, maxLikeCount, + low_bandwidth, maxLikeCount, shared_items_federated_domains, userAgentsBlocked, logLoginFailures, city, @@ -1205,7 +1205,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None: outboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/outbox' assert len([name for name in os.listdir(outboxPath) if os.path.isfile(os.path.join(outboxPath, name))]) == 0 - lowBandwidth = False + low_bandwidth = False signingPrivateKeyPem = None sendResult = \ sendPost(signingPrivateKeyPem, __version__, @@ -1220,7 +1220,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None: aliceSendThreads, alicePostLog, aliceCachedWebfingers, alicePersonCache, isArticle, systemLanguage, aliceSharedItemsFederatedDomains, - aliceSharedItemFederationTokens, lowBandwidth, + aliceSharedItemFederationTokens, low_bandwidth, content_license_url, inReplyTo, inReplyToAtomUri, subject) print('sendResult: ' + str(sendResult)) @@ -1569,7 +1569,7 @@ def testFollowBetweenServers(base_dir: str) -> None: alicePostLog = [] isArticle = False city = 'London, England' - lowBandwidth = False + low_bandwidth = False signingPrivateKeyPem = None sendResult = \ sendPost(signingPrivateKeyPem, __version__, @@ -1581,7 +1581,7 @@ def testFollowBetweenServers(base_dir: str) -> None: aliceSendThreads, alicePostLog, aliceCachedWebfingers, alicePersonCache, isArticle, systemLanguage, aliceSharedItemsFederatedDomains, - aliceSharedItemFederationTokens, lowBandwidth, + aliceSharedItemFederationTokens, low_bandwidth, content_license_url, inReplyTo, inReplyToAtomUri, subject) print('sendResult: ' + str(sendResult)) @@ -1920,7 +1920,7 @@ def testSharedItemsFederation(base_dir: str) -> None: alicePostLog = [] isArticle = False city = 'London, England' - lowBandwidth = False + low_bandwidth = False signingPrivateKeyPem = None sendResult = \ sendPost(signingPrivateKeyPem, __version__, @@ -1932,7 +1932,7 @@ def testSharedItemsFederation(base_dir: str) -> None: aliceSendThreads, alicePostLog, aliceCachedWebfingers, alicePersonCache, isArticle, systemLanguage, aliceSharedItemsFederatedDomains, - aliceSharedItemFederationTokens, lowBandwidth, + aliceSharedItemFederationTokens, low_bandwidth, content_license_url, True, inReplyTo, inReplyToAtomUri, subject) print('sendResult: ' + str(sendResult)) @@ -2328,7 +2328,7 @@ def testGroupFollow(base_dir: str) -> None: alicePostLog = [] isArticle = False city = 'London, England' - lowBandwidth = False + low_bandwidth = False signingPrivateKeyPem = None queuePath = \ @@ -2355,7 +2355,7 @@ def testGroupFollow(base_dir: str) -> None: aliceSendThreads, alicePostLog, aliceCachedWebfingers, alicePersonCache, isArticle, systemLanguage, aliceSharedItemsFederatedDomains, - aliceSharedItemFederationTokens, lowBandwidth, + aliceSharedItemFederationTokens, low_bandwidth, content_license_url, inReplyTo, inReplyToAtomUri, subject) print('sendResult: ' + str(sendResult)) @@ -2708,7 +2708,7 @@ def _testCreatePerson(base_dir: str): attachImageFilename = None mediaType = None conversationId = None - lowBandwidth = True + low_bandwidth = True content_license_url = 'https://creativecommons.org/licenses/by/4.0' createPublicPost(base_dir, nickname, domain, port, http_prefix, content, followersOnly, saveToFile, clientToServer, @@ -2718,7 +2718,7 @@ def _testCreatePerson(base_dir: str): testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) os.chdir(currDir) shutil.rmtree(base_dir, ignore_errors=False, onerror=None) @@ -2789,7 +2789,7 @@ def testClientToServer(base_dir: str): http_prefix = 'http' proxyType = None federationList = [] - lowBandwidth = False + low_bandwidth = False if os.path.isdir(base_dir + '/.tests'): shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None) @@ -2897,7 +2897,7 @@ def testClientToServer(base_dir: str): attachedImageFilename, mediaType, attachedImageDescription, city, cachedWebfingers, personCache, isArticle, - systemLanguage, lowBandwidth, + systemLanguage, low_bandwidth, content_license_url, True, None, None, conversationId, None) @@ -4251,7 +4251,7 @@ def _testReplyToPublicPost(base_dir: str) -> None: testLocation = None testIsArticle = False conversationId = None - lowBandwidth = True + low_bandwidth = True content_license_url = 'https://creativecommons.org/licenses/by/4.0' reply = \ createPublicPost(base_dir, nickname, domain, port, http_prefix, @@ -4263,7 +4263,7 @@ def _testReplyToPublicPost(base_dir: str) -> None: testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) # print(str(reply)) assert reply['object']['content'] == \ '

' + \ @@ -4796,7 +4796,7 @@ def _testLinksWithinPost(base_dir: str) -> None: testLocation = None testIsArticle = False conversationId = None - lowBandwidth = True + low_bandwidth = True content_license_url = 'https://creativecommons.org/licenses/by/4.0' postJsonObject = \ @@ -4809,7 +4809,7 @@ def _testLinksWithinPost(base_dir: str) -> None: testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) assert postJsonObject['object']['content'] == \ '

This is a test post with links.

' + \ @@ -4846,7 +4846,7 @@ def _testLinksWithinPost(base_dir: str) -> None: testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) assert postJsonObject['object']['content'] == content assert postJsonObject['object']['contentMap'][systemLanguage] == content @@ -5783,7 +5783,7 @@ def _testCanReplyTo(base_dir: str) -> None: testLocation = None testIsArticle = False conversationId = None - lowBandwidth = True + low_bandwidth = True content_license_url = 'https://creativecommons.org/licenses/by/4.0' postJsonObject = \ @@ -5796,7 +5796,7 @@ def _testCanReplyTo(base_dir: str) -> None: testSubject, testSchedulePost, testEventDate, testEventTime, testLocation, testIsArticle, systemLanguage, conversationId, - lowBandwidth, content_license_url) + low_bandwidth, content_license_url) # set the date on the post currDateStr = "2021-09-08T20:45:00Z" postJsonObject['published'] = currDateStr diff --git a/webapp_profile.py b/webapp_profile.py index d8cfe7ca8..586d8ce87 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1251,9 +1251,9 @@ def _htmlEditProfileGraphicDesign(base_dir: str, translate: {}) -> str: graphicsStr = beginEditSection(translate['Graphic Design']) - lowBandwidth = getConfigParam(base_dir, 'lowBandwidth') - if not lowBandwidth: - lowBandwidth = False + low_bandwidth = getConfigParam(base_dir, 'low_bandwidth') + if not low_bandwidth: + low_bandwidth = False graphicsStr += _htmlThemesDropdown(base_dir, translate) graphicsStr += \ '