mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Set broch mode on daemon start
							parent
							
								
									1adc343ebd
								
							
						
					
					
						commit
						0f1b7eb67b
					
				|  | @ -378,6 +378,10 @@ def setBrochMode(baseDir: str, domainFull: str, enabled: bool) -> None: | ||||||
|             os.remove(allowFilename) |             os.remove(allowFilename) | ||||||
|             print('Broch mode turned off') |             print('Broch mode turned off') | ||||||
|     else: |     else: | ||||||
|  |         if os.path.isfile(allowFilename): | ||||||
|  |             lastModified = fileLastModified(allowFilename) | ||||||
|  |             print('Broch mode already activated ' + lastModified) | ||||||
|  |             return | ||||||
|         # generate instance allow list |         # generate instance allow list | ||||||
|         allowedDomains = [domainFull] |         allowedDomains = [domainFull] | ||||||
|         followFiles = ('following.txt', 'followers.txt') |         followFiles = ('following.txt', 'followers.txt') | ||||||
|  |  | ||||||
|  | @ -4554,7 +4554,6 @@ class PubServer(BaseHTTPRequestHandler): | ||||||
|                                 setBrochMode(self.server.baseDir, |                                 setBrochMode(self.server.baseDir, | ||||||
|                                              self.server.domainFull, |                                              self.server.domainFull, | ||||||
|                                              brochMode) |                                              brochMode) | ||||||
|                                 self.server.brochMode = brochMode |  | ||||||
|                                 setConfigParam(baseDir, "brochMode", brochMode) |                                 setConfigParam(baseDir, "brochMode", brochMode) | ||||||
| 
 | 
 | ||||||
|                         # change moderators list |                         # change moderators list | ||||||
|  | @ -14022,9 +14021,6 @@ def runDaemon(brochMode: bool, | ||||||
|     # maximum number of posts to appear in the newswire on the right column |     # maximum number of posts to appear in the newswire on the right column | ||||||
|     httpd.maxNewswirePosts = maxNewswirePosts |     httpd.maxNewswirePosts = maxNewswirePosts | ||||||
| 
 | 
 | ||||||
|     # whether to enable broch mode, which locks down the instance |  | ||||||
|     httpd.brochMode = brochMode |  | ||||||
| 
 |  | ||||||
|     # whether to require that all incoming posts have valid jsonld signatures |     # whether to require that all incoming posts have valid jsonld signatures | ||||||
|     httpd.verifyAllSignatures = verifyAllSignatures |     httpd.verifyAllSignatures = verifyAllSignatures | ||||||
| 
 | 
 | ||||||
|  | @ -14195,6 +14191,9 @@ def runDaemon(brochMode: bool, | ||||||
|     # cache to store css files |     # cache to store css files | ||||||
|     httpd.cssCache = {} |     httpd.cssCache = {} | ||||||
| 
 | 
 | ||||||
|  |     # whether to enable broch mode, which locks down the instance | ||||||
|  |     setBrochMode(baseDir, httpd.domainFull, brochMode) | ||||||
|  | 
 | ||||||
|     if not os.path.isdir(baseDir + '/accounts/inbox@' + domain): |     if not os.path.isdir(baseDir + '/accounts/inbox@' + domain): | ||||||
|         print('Creating shared inbox: inbox@' + domain) |         print('Creating shared inbox: inbox@' + domain) | ||||||
|         createSharedInbox(baseDir, 'inbox', domain, port, httpPrefix) |         createSharedInbox(baseDir, 'inbox', domain, port, httpPrefix) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue