mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Blocking controls on profile screen
							parent
							
								
									1201934f68
								
							
						
					
					
						commit
						3a9bdea0f7
					
				
							
								
								
									
										19
									
								
								daemon.py
								
								
								
								
							
							
						
						
									
										19
									
								
								daemon.py
								
								
								
								
							|  | @ -1702,8 +1702,6 @@ class PubServer(BaseHTTPRequestHandler): | ||||||
|                                     removeMetaData(filename,filename.replace('.temp','')) |                                     removeMetaData(filename,filename.replace('.temp','')) | ||||||
|                                     os.remove(filename) |                                     os.remove(filename) | ||||||
|                                     lastImageLocation=imageLocation+1 |                                     lastImageLocation=imageLocation+1 | ||||||
|                 print('**********************************************************') |  | ||||||
|                 pprint(fields) |  | ||||||
|                                      |                                      | ||||||
|                 actorFilename=self.server.baseDir+'/accounts/'+nickname+'@'+self.server.domain+'.json' |                 actorFilename=self.server.baseDir+'/accounts/'+nickname+'@'+self.server.domain+'.json' | ||||||
|                 if os.path.isfile(actorFilename): |                 if os.path.isfile(actorFilename): | ||||||
|  | @ -1729,6 +1727,23 @@ class PubServer(BaseHTTPRequestHandler): | ||||||
|                             if approveFollowers!=actorJson['manuallyApprovesFollowers']: |                             if approveFollowers!=actorJson['manuallyApprovesFollowers']: | ||||||
|                                 actorJson['manuallyApprovesFollowers']=approveFollowers |                                 actorJson['manuallyApprovesFollowers']=approveFollowers | ||||||
|                                 actorChanged=True |                                 actorChanged=True | ||||||
|  |                         # save filtered words list | ||||||
|  |                         filterFilename=self.server.baseDir+'/accounts/'+nickname+'@'+self.server.domain+'/filters.txt' | ||||||
|  |                         if fields.get('filteredWords'): | ||||||
|  |                             with open(filterFilename, "w") as filterfile: | ||||||
|  |                                 filterfile.write(fields['filteredWords']) | ||||||
|  |                         else: | ||||||
|  |                             if os.path.isfile(filterFilename): | ||||||
|  |                                 os.remove(filterFilename) | ||||||
|  |                         # save blocked accounts list | ||||||
|  |                         blockedFilename=self.server.baseDir+'/accounts/'+nickname+'@'+self.server.domain+'/blocking.txt' | ||||||
|  |                         if fields.get('blocked'): | ||||||
|  |                             with open(blockedFilename, "w") as blockedfile: | ||||||
|  |                                 blockedfile.write(fields['blocked']) | ||||||
|  |                         else: | ||||||
|  |                             if os.path.isfile(blockedFilename): | ||||||
|  |                                 os.remove(blockedFilename) | ||||||
|  |                         # save actor json file within accounts | ||||||
|                         if actorChanged: |                         if actorChanged: | ||||||
|                             with open(actorFilename, 'w') as fp: |                             with open(actorFilename, 'w') as fp: | ||||||
|                                 commentjson.dump(actorJson, fp, indent=4, sort_keys=False) |                                 commentjson.dump(actorJson, fp, indent=4, sort_keys=False) | ||||||
|  |  | ||||||
|  | @ -55,7 +55,19 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str: | ||||||
|                 manuallyApprovesFollowers='checked' |                 manuallyApprovesFollowers='checked' | ||||||
|             else: |             else: | ||||||
|                 manuallyApprovesFollowers='' |                 manuallyApprovesFollowers='' | ||||||
|                  | 
 | ||||||
|  |     filterStr='' | ||||||
|  |     filterFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/filters.txt' | ||||||
|  |     if os.path.isfile(filterFilename): | ||||||
|  |         with open(filterFilename, 'r') as filterfile: | ||||||
|  |             filterStr=filterfile.read() | ||||||
|  | 
 | ||||||
|  |     blockedStr='' | ||||||
|  |     blockedFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/blocking.txt' | ||||||
|  |     if os.path.isfile(blockedFilename): | ||||||
|  |         with open(blockedFilename, 'r') as blockedfile: | ||||||
|  |             blockedStr=blockedfile.read() | ||||||
|  | 
 | ||||||
|     with open(baseDir+'/epicyon-profile.css', 'r') as cssFile: |     with open(baseDir+'/epicyon-profile.css', 'r') as cssFile: | ||||||
|         newPostCSS = cssFile.read() |         newPostCSS = cssFile.read() | ||||||
| 
 | 
 | ||||||
|  | @ -80,7 +92,11 @@ def htmlEditProfile(baseDir: str,path: str,domain: str,port: int) -> str: | ||||||
|         '            accept=".png">' \ |         '            accept=".png">' \ | ||||||
|         '    </div>' \ |         '    </div>' \ | ||||||
|         '    <div class="container">' \ |         '    <div class="container">' \ | ||||||
|         '      <input type="checkbox" name="approveFollowers" '+manuallyApprovesFollowers+'>Approve follower requests<br>' \ |         '      <input type="checkbox" class=profilecheckbox" name="approveFollowers" '+manuallyApprovesFollowers+'>Approve follower requests<br>' \ | ||||||
|  |         '      <br>Filtered words' \ | ||||||
|  |         '      <textarea id="message" name="filteredWords" placeholder="Filtered words or phrases (one per line)" style="height:200px">'+filterStr+'</textarea>' \ | ||||||
|  |         '      <br>Blocked accounts' \ | ||||||
|  |         '      <textarea id="message" name="blocked" placeholder="Blocked accounts, one per line, in the form nickname@domain" style="height:200px">'+blockedStr+'</textarea>' \ | ||||||
|         '    </div>' \ |         '    </div>' \ | ||||||
|         '    <div class="container">' \ |         '    <div class="container">' \ | ||||||
|         '      <input type="submit" name="submitProfile" value="Submit">' \ |         '      <input type="submit" name="submitProfile" value="Submit">' \ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue