Snake case

merge-requests/30/head
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, systemLanguage: str,
projectVersion: str, projectVersion: str,
customEmoji: [], customEmoji: [],
showNodeInfoAccounts: bool) -> bool: show_node_info_accounts: bool) -> bool:
"""This is a vestigil mastodon API for the purpose """This is a vestigil mastodon API for the purpose
of returning an empty result to sites like of returning an empty result to sites like
https://mastopeek.app-dist.eu https://mastopeek.app-dist.eu
@ -1077,7 +1077,7 @@ class PubServer(BaseHTTPRequestHandler):
systemLanguage, systemLanguage,
projectVersion, projectVersion,
customEmoji, customEmoji,
showNodeInfoAccounts, show_node_info_accounts,
brochMode) brochMode)
if sendJson is not None: if sendJson is not None:
@ -1113,13 +1113,13 @@ class PubServer(BaseHTTPRequestHandler):
systemLanguage: str, systemLanguage: str,
projectVersion: str, projectVersion: str,
customEmoji: [], customEmoji: [],
showNodeInfoAccounts: bool) -> bool: show_node_info_accounts: bool) -> bool:
return self._mastoApiV1(path, callingDomain, uaStr, authorized, return self._mastoApiV1(path, callingDomain, uaStr, authorized,
http_prefix, base_dir, nickname, domain, http_prefix, base_dir, nickname, domain,
domainFull, onionDomain, i2pDomain, domainFull, onionDomain, i2pDomain,
translate, registration, systemLanguage, translate, registration, systemLanguage,
projectVersion, customEmoji, projectVersion, customEmoji,
showNodeInfoAccounts) show_node_info_accounts)
def _nodeinfo(self, uaStr: str, callingDomain: str) -> bool: def _nodeinfo(self, uaStr: str, callingDomain: str) -> bool:
if not self.path.startswith('/nodeinfo/2.0'): if not self.path.startswith('/nodeinfo/2.0'):
@ -1139,9 +1139,9 @@ class PubServer(BaseHTTPRequestHandler):
if not self.server.showNodeInfoVersion or brochMode: if not self.server.showNodeInfoVersion or brochMode:
nodeInfoVersion = '0.0.0' nodeInfoVersion = '0.0.0'
showNodeInfoAccounts = self.server.showNodeInfoAccounts show_node_info_accounts = self.server.show_node_info_accounts
if brochMode: if brochMode:
showNodeInfoAccounts = False show_node_info_accounts = False
instanceUrl = self._getInstanceUrl(callingDomain) instanceUrl = self._getInstanceUrl(callingDomain)
aboutUrl = instanceUrl + '/about' aboutUrl = instanceUrl + '/about'
@ -1150,7 +1150,7 @@ class PubServer(BaseHTTPRequestHandler):
aboutUrl, termsOfServiceUrl, aboutUrl, termsOfServiceUrl,
self.server.registration, self.server.registration,
nodeInfoVersion, nodeInfoVersion,
showNodeInfoAccounts) show_node_info_accounts)
if info: if info:
msg = json.dumps(info).encode('utf-8') msg = json.dumps(info).encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -5544,14 +5544,14 @@ class PubServer(BaseHTTPRequestHandler):
# on all incoming posts # on all incoming posts
if path.startswith('/users/' + if path.startswith('/users/' +
adminNickname + '/'): adminNickname + '/'):
showNodeInfoAccounts = False show_node_info_accounts = False
if fields.get('showNodeInfoAccounts'): if fields.get('show_node_info_accounts'):
if fields['showNodeInfoAccounts'] == 'on': if fields['show_node_info_accounts'] == 'on':
showNodeInfoAccounts = True show_node_info_accounts = True
self.server.showNodeInfoAccounts = \ self.server.show_node_info_accounts = \
showNodeInfoAccounts show_node_info_accounts
setConfigParam(base_dir, "showNodeInfoAccounts", setConfigParam(base_dir, "show_node_info_accounts",
showNodeInfoAccounts) show_node_info_accounts)
showNodeInfoVersion = False showNodeInfoVersion = False
if fields.get('showNodeInfoVersion'): if fields.get('showNodeInfoVersion'):
@ -13672,7 +13672,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.systemLanguage, self.server.systemLanguage,
self.server.projectVersion, self.server.projectVersion,
self.server.customEmoji, self.server.customEmoji,
self.server.showNodeInfoAccounts): self.server.show_node_info_accounts):
return return
fitnessPerformance(GETstartTime, self.server.fitness, fitnessPerformance(GETstartTime, self.server.fitness,
@ -18409,7 +18409,7 @@ def runDaemon(content_license_url: str,
user_agents_blocked: [], user_agents_blocked: [],
log_login_failures: bool, log_login_failures: bool,
city: str, city: str,
showNodeInfoAccounts: bool, show_node_info_accounts: bool,
showNodeInfoVersion: bool, showNodeInfoVersion: bool,
brochMode: bool, brochMode: bool,
verifyAllSignatures: bool, verifyAllSignatures: bool,
@ -18503,7 +18503,7 @@ def runDaemon(content_license_url: str,
# initialize authorized fetch key # initialize authorized fetch key
httpd.signingPrivateKeyPem = None httpd.signingPrivateKeyPem = None
httpd.showNodeInfoAccounts = showNodeInfoAccounts httpd.show_node_info_accounts = show_node_info_accounts
httpd.showNodeInfoVersion = showNodeInfoVersion httpd.showNodeInfoVersion = showNodeInfoVersion
# ASCII/ANSI text banner used in shell browsers, such as Lynx # 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, const=True, default=False,
help="Enable broch mode") help="Enable broch mode")
parser.add_argument("--nodeinfoaccounts", parser.add_argument("--nodeinfoaccounts",
dest='showNodeInfoAccounts', dest='show_node_info_accounts',
type=str2bool, nargs='?', type=str2bool, nargs='?',
const=True, default=False, const=True, default=False,
help="Show numbers of accounts within nodeinfo metadata") help="Show numbers of accounts within nodeinfo metadata")
@ -3123,10 +3123,10 @@ log_login_failures = \
if log_login_failures is not None: if log_login_failures is not None:
args.log_login_failures = bool(log_login_failures) args.log_login_failures = bool(log_login_failures)
showNodeInfoAccounts = \ show_node_info_accounts = \
getConfigParam(base_dir, 'showNodeInfoAccounts') getConfigParam(base_dir, 'show_node_info_accounts')
if showNodeInfoAccounts is not None: if show_node_info_accounts is not None:
args.showNodeInfoAccounts = bool(showNodeInfoAccounts) args.show_node_info_accounts = bool(show_node_info_accounts)
showNodeInfoVersion = \ showNodeInfoVersion = \
getConfigParam(base_dir, 'showNodeInfoVersion') getConfigParam(base_dir, 'showNodeInfoVersion')
@ -3218,7 +3218,7 @@ if __name__ == "__main__":
user_agents_blocked, user_agents_blocked,
args.log_login_failures, args.log_login_failures,
args.city, args.city,
args.showNodeInfoAccounts, args.show_node_info_accounts,
args.showNodeInfoVersion, args.showNodeInfoVersion,
args.brochMode, args.brochMode,
args.verifyAllSignatures, args.verifyAllSignatures,

View File

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

View File

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

View File

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