From 486619e05f59e63e22ef42705d9b2c178d199a1b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 4 Dec 2019 11:11:18 +0000 Subject: [PATCH] Use of blurhash is optional --- daemon.py | 22 +++++++++++++++------- epicyon.py | 3 ++- tests.py | 7 ++++--- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/daemon.py b/daemon.py index dc3713c50..f92938399 100644 --- a/daemon.py +++ b/daemon.py @@ -3605,7 +3605,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ fields['message'],False,False,False, \ filename,attachmentMediaType, \ - fields['imageDescription'],True, \ + fields['imageDescription'], \ + self.server.useBlurHash, \ fields['replyTo'],fields['replyTo'], \ fields['subject'], \ fields['eventDate'],fields['eventTime'], \ @@ -3630,7 +3631,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ fields['message'],False,False,False, \ filename,attachmentMediaType, \ - fields['imageDescription'],True, \ + fields['imageDescription'], \ + self.server.useBlurHash, \ fields['replyTo'], fields['replyTo'], \ fields['subject'], \ fields['eventDate'],fields['eventTime'], \ @@ -3655,7 +3657,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ fields['message'],True,False,False, \ filename,attachmentMediaType, \ - fields['imageDescription'],True, \ + fields['imageDescription'], \ + self.server.useBlurHash, \ fields['replyTo'], fields['replyTo'], \ fields['subject'], \ fields['eventDate'],fields['eventTime'], \ @@ -3682,7 +3685,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ fields['message'],True,False,False, \ filename,attachmentMediaType, \ - fields['imageDescription'],True, \ + fields['imageDescription'], \ + self.server.useBlurHash, \ fields['replyTo'],fields['replyTo'], \ fields['subject'], \ self.server.debug, \ @@ -3718,7 +3722,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.httpPrefix, \ fields['message'],True,False,False, \ filename,attachmentMediaType, \ - fields['imageDescription'],True, \ + fields['imageDescription'], \ + self.server.useBlurHash, \ self.server.debug,fields['subject']) if messageJson: self.postToNickname=nickname @@ -3746,7 +3751,8 @@ class PubServer(BaseHTTPRequestHandler): fields['message'],qOptions, \ False,False,False, \ filename,attachmentMediaType, \ - fields['imageDescription'],True, \ + fields['imageDescription'], \ + self.server.useBlurHash, \ fields['subject'],int(fields['duration'])) if messageJson: self.postToNickname=nickname @@ -5430,7 +5436,8 @@ def runDaemon(mediaInstance: bool,maxRecentPosts: int, \ useTor=False,maxReplies=64, \ domainMaxPostsPerDay=8640,accountMaxPostsPerDay=8640, \ allowDeletion=False,debug=False,unitTest=False, \ - instanceOnlySkillsSearch=False,sendThreads=[]) -> None: + instanceOnlySkillsSearch=False,sendThreads=[], \ + useBlurHash=False) -> None: if len(domain)==0: domain='localhost' if '.' not in domain: @@ -5444,6 +5451,7 @@ def runDaemon(mediaInstance: bool,maxRecentPosts: int, \ else: httpd = ThreadingHTTPServer(serverAddress, PubServer) + httpd.useBlurHash=useBlurHash httpd.mediaInstance=mediaInstance httpd.defaultTimeline='inbox' if mediaInstance: diff --git a/epicyon.py b/epicyon.py index 0fd2cd5d4..e7f8529ab 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1506,4 +1506,5 @@ runDaemon(args.mediainstance,args.maxRecentPosts, \ useTor,args.maxReplies, \ args.domainMaxPostsPerDay,args.accountMaxPostsPerDay, \ args.allowdeletion,debug,False, \ - args.instanceOnlySkillsSearch) + args.instanceOnlySkillsSearch,[], \ + args.blurhash) diff --git a/tests.py b/tests.py index a542a4b2e..042c71fcf 100644 --- a/tests.py +++ b/tests.py @@ -239,7 +239,7 @@ def createServerAlice(path: str,domain: str,port: int,federationList: [], \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ useTor,maxReplies, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \ - allowDeletion,True,True,False,sendThreads) + allowDeletion,True,True,False,sendThreads,False) def createServerBob(path: str,domain: str,port: int,federationList: [], \ hasFollows: bool,hasPosts :bool,ocapAlways :bool,sendThreads: []): @@ -295,7 +295,7 @@ def createServerBob(path: str,domain: str,port: int,federationList: [], \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ useTor,maxReplies, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \ - allowDeletion,True,True,False,sendThreads) + allowDeletion,True,True,False,sendThreads,False) def createServerEve(path: str,domain: str,port: int,federationList: [], \ hasFollows: bool,hasPosts :bool,ocapAlways :bool,sendThreads: []): @@ -329,7 +329,8 @@ def createServerEve(path: str,domain: str,port: int,federationList: [], \ "instanceId",False,path,domain,port,port, \ httpPrefix,federationList,maxMentions,maxEmoji,False, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ - useTor,maxReplies,allowDeletion,True,True,False,sendThreads) + useTor,maxReplies,allowDeletion,True,True,False, \ + sendThreads,False) def testPostMessageBetweenServers(): print('Testing sending message from one server to the inbox of another')