Snake case

main
Bob Mottram 2021-12-25 18:32:17 +00:00
parent d5479e55d5
commit 72727ef690
5 changed files with 38 additions and 38 deletions

View File

@ -1049,7 +1049,7 @@ class PubServer(BaseHTTPRequestHandler):
systemLanguage: str,
projectVersion: str,
customEmoji: [],
showNodeInfoAccounts: bool) -> bool:
show_node_info_accounts: bool) -> bool:
"""This is a vestigil mastodon API for the purpose
of returning an empty result to sites like
https://mastopeek.app-dist.eu
@ -1077,7 +1077,7 @@ class PubServer(BaseHTTPRequestHandler):
systemLanguage,
projectVersion,
customEmoji,
showNodeInfoAccounts,
show_node_info_accounts,
brochMode)
if sendJson is not None:
@ -1113,13 +1113,13 @@ class PubServer(BaseHTTPRequestHandler):
systemLanguage: str,
projectVersion: str,
customEmoji: [],
showNodeInfoAccounts: bool) -> bool:
show_node_info_accounts: bool) -> bool:
return self._mastoApiV1(path, callingDomain, uaStr, authorized,
http_prefix, base_dir, nickname, domain,
domainFull, onionDomain, i2pDomain,
translate, registration, systemLanguage,
projectVersion, customEmoji,
showNodeInfoAccounts)
show_node_info_accounts)
def _nodeinfo(self, uaStr: str, callingDomain: str) -> bool:
if not self.path.startswith('/nodeinfo/2.0'):
@ -1139,9 +1139,9 @@ class PubServer(BaseHTTPRequestHandler):
if not self.server.showNodeInfoVersion or brochMode:
nodeInfoVersion = '0.0.0'
showNodeInfoAccounts = self.server.showNodeInfoAccounts
show_node_info_accounts = self.server.show_node_info_accounts
if brochMode:
showNodeInfoAccounts = False
show_node_info_accounts = False
instanceUrl = self._getInstanceUrl(callingDomain)
aboutUrl = instanceUrl + '/about'
@ -1150,7 +1150,7 @@ class PubServer(BaseHTTPRequestHandler):
aboutUrl, termsOfServiceUrl,
self.server.registration,
nodeInfoVersion,
showNodeInfoAccounts)
show_node_info_accounts)
if info:
msg = json.dumps(info).encode('utf-8')
msglen = len(msg)
@ -5544,14 +5544,14 @@ class PubServer(BaseHTTPRequestHandler):
# on all incoming posts
if path.startswith('/users/' +
adminNickname + '/'):
showNodeInfoAccounts = False
if fields.get('showNodeInfoAccounts'):
if fields['showNodeInfoAccounts'] == 'on':
showNodeInfoAccounts = True
self.server.showNodeInfoAccounts = \
showNodeInfoAccounts
setConfigParam(base_dir, "showNodeInfoAccounts",
showNodeInfoAccounts)
show_node_info_accounts = False
if fields.get('show_node_info_accounts'):
if fields['show_node_info_accounts'] == 'on':
show_node_info_accounts = True
self.server.show_node_info_accounts = \
show_node_info_accounts
setConfigParam(base_dir, "show_node_info_accounts",
show_node_info_accounts)
showNodeInfoVersion = False
if fields.get('showNodeInfoVersion'):
@ -13672,7 +13672,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage,
self.server.projectVersion,
self.server.customEmoji,
self.server.showNodeInfoAccounts):
self.server.show_node_info_accounts):
return
fitnessPerformance(GETstartTime, self.server.fitness,
@ -18409,7 +18409,7 @@ def runDaemon(content_license_url: str,
user_agents_blocked: [],
log_login_failures: bool,
city: str,
showNodeInfoAccounts: bool,
show_node_info_accounts: bool,
showNodeInfoVersion: bool,
brochMode: bool,
verifyAllSignatures: bool,
@ -18503,7 +18503,7 @@ def runDaemon(content_license_url: str,
# initialize authorized fetch key
httpd.signingPrivateKeyPem = None
httpd.showNodeInfoAccounts = showNodeInfoAccounts
httpd.show_node_info_accounts = show_node_info_accounts
httpd.showNodeInfoVersion = showNodeInfoVersion
# ASCII/ANSI text banner used in shell browsers, such as Lynx

View File

@ -383,7 +383,7 @@ parser.add_argument("--brochMode",
const=True, default=False,
help="Enable broch mode")
parser.add_argument("--nodeinfoaccounts",
dest='showNodeInfoAccounts',
dest='show_node_info_accounts',
type=str2bool, nargs='?',
const=True, default=False,
help="Show numbers of accounts within nodeinfo metadata")
@ -3123,10 +3123,10 @@ log_login_failures = \
if log_login_failures is not None:
args.log_login_failures = bool(log_login_failures)
showNodeInfoAccounts = \
getConfigParam(base_dir, 'showNodeInfoAccounts')
if showNodeInfoAccounts is not None:
args.showNodeInfoAccounts = bool(showNodeInfoAccounts)
show_node_info_accounts = \
getConfigParam(base_dir, 'show_node_info_accounts')
if show_node_info_accounts is not None:
args.show_node_info_accounts = bool(show_node_info_accounts)
showNodeInfoVersion = \
getConfigParam(base_dir, 'showNodeInfoVersion')
@ -3218,7 +3218,7 @@ if __name__ == "__main__":
user_agents_blocked,
args.log_login_failures,
args.city,
args.showNodeInfoAccounts,
args.show_node_info_accounts,
args.showNodeInfoVersion,
args.brochMode,
args.verifyAllSignatures,

View File

@ -93,7 +93,7 @@ def mastoApiV1Response(path: str, callingDomain: str,
systemLanguage: str,
projectVersion: str,
customEmoji: [],
showNodeInfoAccounts: bool,
show_node_info_accounts: bool,
brochMode: bool) -> ({}, str):
"""This is a vestigil mastodon API for the purpose
of returning an empty result to sites like
@ -216,10 +216,10 @@ def mastoApiV1Response(path: str, callingDomain: str,
http_prefix = 'http'
if brochMode:
showNodeInfoAccounts = False
show_node_info_accounts = False
sendJson = \
metaDataInstance(showNodeInfoAccounts,
metaDataInstance(show_node_info_accounts,
instanceTitle,
instanceDescriptionShort,
instanceDescription,

View File

@ -786,7 +786,7 @@ def createServerAlice(path: str, domain: str, port: int,
maxFollowers = 10
verifyAllSignatures = True
brochMode = False
showNodeInfoAccounts = True
show_node_info_accounts = True
showNodeInfoVersion = True
city = 'London, England'
log_login_failures = False
@ -802,7 +802,7 @@ def createServerAlice(path: str, domain: str, port: int,
shared_items_federated_domains,
user_agents_blocked,
log_login_failures, city,
showNodeInfoAccounts,
show_node_info_accounts,
showNodeInfoVersion,
brochMode,
verifyAllSignatures,
@ -928,7 +928,7 @@ def createServerBob(path: str, domain: str, port: int,
maxFollowers = 10
verifyAllSignatures = True
brochMode = False
showNodeInfoAccounts = True
show_node_info_accounts = True
showNodeInfoVersion = True
city = 'London, England'
log_login_failures = False
@ -944,7 +944,7 @@ def createServerBob(path: str, domain: str, port: int,
shared_items_federated_domains,
user_agents_blocked,
log_login_failures, city,
showNodeInfoAccounts,
show_node_info_accounts,
showNodeInfoVersion,
brochMode,
verifyAllSignatures,
@ -997,7 +997,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
maxFollowers = 10
verifyAllSignatures = True
brochMode = False
showNodeInfoAccounts = True
show_node_info_accounts = True
showNodeInfoVersion = True
city = 'London, England'
log_login_failures = False
@ -1014,7 +1014,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
shared_items_federated_domains,
user_agents_blocked,
log_login_failures, city,
showNodeInfoAccounts,
show_node_info_accounts,
showNodeInfoVersion,
brochMode,
verifyAllSignatures,
@ -1069,7 +1069,7 @@ def createServerGroup(path: str, domain: str, port: int,
maxFollowers = 10
verifyAllSignatures = True
brochMode = False
showNodeInfoAccounts = True
show_node_info_accounts = True
showNodeInfoVersion = True
city = 'London, England'
log_login_failures = False
@ -1086,7 +1086,7 @@ def createServerGroup(path: str, domain: str, port: int,
shared_items_federated_domains,
user_agents_blocked,
log_login_failures, city,
showNodeInfoAccounts,
show_node_info_accounts,
showNodeInfoVersion,
brochMode,
verifyAllSignatures,

View File

@ -1349,12 +1349,12 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
nodeInfoStr = \
translate['Show numbers of accounts within instance metadata']
if getConfigParam(base_dir, "showNodeInfoAccounts"):
if getConfigParam(base_dir, "show_node_info_accounts"):
instanceStr += \
editCheckBox(nodeInfoStr, 'showNodeInfoAccounts', True)
editCheckBox(nodeInfoStr, 'show_node_info_accounts', True)
else:
instanceStr += \
editCheckBox(nodeInfoStr, 'showNodeInfoAccounts', False)
editCheckBox(nodeInfoStr, 'show_node_info_accounts', False)
nodeInfoStr = \
translate['Show version number within instance metadata']