forked from indymedia/epicyon
				
			flake8 format
							parent
							
								
									840e726753
								
							
						
					
					
						commit
						295814cd9b
					
				
							
								
								
									
										24
									
								
								metadata.py
								
								
								
								
							
							
						
						
									
										24
									
								
								metadata.py
								
								
								
								
							|  | @ -7,11 +7,11 @@ __email__="bob@freedombone.net" | ||||||
| __status__ = "Production" | __status__ = "Production" | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
| import json |  | ||||||
| from utils import loadJson | from utils import loadJson | ||||||
| from utils import noOfAccounts | from utils import noOfAccounts | ||||||
| from utils import noOfActiveAccountsMonthly | from utils import noOfActiveAccountsMonthly | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| def metaDataNodeInfo(baseDir: str, registration: bool, version: str) -> {}: | def metaDataNodeInfo(baseDir: str, registration: bool, version: str) -> {}: | ||||||
|     """ /nodeinfo/2.0 endpoint |     """ /nodeinfo/2.0 endpoint | ||||||
|     """ |     """ | ||||||
|  | @ -37,16 +37,18 @@ def metaDataNodeInfo(baseDir: str,registration: bool,version: str) -> {}: | ||||||
|     } |     } | ||||||
|     return nodeinfo |     return nodeinfo | ||||||
| 
 | 
 | ||||||
| def metaDataInstance(instanceTitle: str, \ | 
 | ||||||
|                      instanceDescriptionShort: str, \ | def metaDataInstance(instanceTitle: str, | ||||||
|                      instanceDescription: str, \ |                      instanceDescriptionShort: str, | ||||||
|                      httpPrefix: str,baseDir: str, \ |                      instanceDescription: str, | ||||||
|                      adminNickname: str,domain: str,domainFull: str, \ |                      httpPrefix: str, baseDir: str, | ||||||
|                      registration: bool,systemLanguage: str, \ |                      adminNickname: str, domain: str, domainFull: str, | ||||||
|  |                      registration: bool, systemLanguage: str, | ||||||
|                      version: str) -> {}: |                      version: str) -> {}: | ||||||
|     """ /api/v1/instance endpoint |     """ /api/v1/instance endpoint | ||||||
|     """ |     """ | ||||||
|     adminActorFilename=baseDir+'/accounts/'+adminNickname+'@'+domain+'.json' |     adminActorFilename = \ | ||||||
|  |         baseDir + '/accounts/' + adminNickname + '@' + domain + '.json' | ||||||
|     if not os.path.isfile(adminActorFilename): |     if not os.path.isfile(adminActorFilename): | ||||||
|         return {} |         return {} | ||||||
| 
 | 
 | ||||||
|  | @ -59,6 +61,10 @@ def metaDataInstance(instanceTitle: str, \ | ||||||
|     if adminActor['type'] != 'Person': |     if adminActor['type'] != 'Person': | ||||||
|         isBot = True |         isBot = True | ||||||
| 
 | 
 | ||||||
|  |     url = \ | ||||||
|  |         httpPrefix + '://' + domainFull + '/@' + \ | ||||||
|  |         adminActor['preferredUsername'] | ||||||
|  | 
 | ||||||
|     instance = { |     instance = { | ||||||
|         'approval_required': False, |         'approval_required': False, | ||||||
|         'contact_account': { |         'contact_account': { | ||||||
|  | @ -79,7 +85,7 @@ def metaDataInstance(instanceTitle: str, \ | ||||||
|             'locked': adminActor['manuallyApprovesFollowers'], |             'locked': adminActor['manuallyApprovesFollowers'], | ||||||
|             'note': '<p>Admin of '+domain+'</p>', |             'note': '<p>Admin of '+domain+'</p>', | ||||||
|             'statuses_count': 1, |             'statuses_count': 1, | ||||||
|             'url': httpPrefix+'://'+domainFull+'/@'+adminActor['preferredUsername'], |             'url': url, | ||||||
|             'username': adminActor['preferredUsername'] |             'username': adminActor['preferredUsername'] | ||||||
|         }, |         }, | ||||||
|         'description': instanceDescription, |         'description': instanceDescription, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue