Snake case

merge-requests/30/head
Bob Mottram 2021-12-25 18:40:32 +00:00
parent b028216dfd
commit 71df603c37
5 changed files with 31 additions and 31 deletions

View File

@ -5562,14 +5562,14 @@ class PubServer(BaseHTTPRequestHandler):
setConfigParam(base_dir, "show_node_info_version", setConfigParam(base_dir, "show_node_info_version",
show_node_info_version) show_node_info_version)
verifyAllSignatures = False verify_all_signatures = False
if fields.get('verifyallsignatures'): if fields.get('verifyallsignatures'):
if fields['verifyallsignatures'] == 'on': if fields['verifyallsignatures'] == 'on':
verifyAllSignatures = True verify_all_signatures = True
self.server.verifyAllSignatures = \ self.server.verify_all_signatures = \
verifyAllSignatures verify_all_signatures
setConfigParam(base_dir, "verifyAllSignatures", setConfigParam(base_dir, "verify_all_signatures",
verifyAllSignatures) verify_all_signatures)
broch_mode = False broch_mode = False
if fields.get('broch_mode'): if fields.get('broch_mode'):
@ -18412,7 +18412,7 @@ def runDaemon(content_license_url: str,
show_node_info_accounts: bool, show_node_info_accounts: bool,
show_node_info_version: bool, show_node_info_version: bool,
broch_mode: bool, broch_mode: bool,
verifyAllSignatures: bool, verify_all_signatures: bool,
sendThreadsTimeoutMins: int, sendThreadsTimeoutMins: int,
dormantMonths: int, dormantMonths: int,
maxNewswirePosts: int, maxNewswirePosts: int,
@ -18579,7 +18579,7 @@ def runDaemon(content_license_url: str,
httpd.maxNewswirePosts = maxNewswirePosts httpd.maxNewswirePosts = maxNewswirePosts
# 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.verify_all_signatures = verify_all_signatures
# This counter is used to update the list of blocked domains in memory. # This counter is used to update the list of blocked domains in memory.
# It helps to avoid touching the disk and so improves flooding resistance # It helps to avoid touching the disk and so improves flooding resistance
@ -18907,7 +18907,7 @@ def runDaemon(content_license_url: str,
httpd.maxFollowers, httpd.maxFollowers,
httpd.allowLocalNetworkAccess, httpd.allowLocalNetworkAccess,
httpd.peertubeInstances, httpd.peertubeInstances,
verifyAllSignatures, verify_all_signatures,
httpd.themeName, httpd.themeName,
httpd.systemLanguage, httpd.systemLanguage,
httpd.max_like_count, httpd.max_like_count,

View File

@ -371,8 +371,8 @@ parser.add_argument("--allowLocalNetworkAccess",
help="Whether to allow access to local network " + help="Whether to allow access to local network " +
"addresses. This might be useful when deploying in " + "addresses. This might be useful when deploying in " +
"a mesh network") "a mesh network")
parser.add_argument("--verifyAllSignatures", parser.add_argument("--verify_all_signatures",
dest='verifyAllSignatures', dest='verify_all_signatures',
type=str2bool, nargs='?', type=str2bool, nargs='?',
const=True, default=False, const=True, default=False,
help="Whether to require that all incoming " + help="Whether to require that all incoming " +
@ -3108,10 +3108,10 @@ allowLocalNetworkAccess = \
if allowLocalNetworkAccess is not None: if allowLocalNetworkAccess is not None:
args.allowLocalNetworkAccess = bool(allowLocalNetworkAccess) args.allowLocalNetworkAccess = bool(allowLocalNetworkAccess)
verifyAllSignatures = \ verify_all_signatures = \
getConfigParam(base_dir, 'verifyAllSignatures') getConfigParam(base_dir, 'verify_all_signatures')
if verifyAllSignatures is not None: if verify_all_signatures is not None:
args.verifyAllSignatures = bool(verifyAllSignatures) args.verify_all_signatures = bool(verify_all_signatures)
broch_mode = \ broch_mode = \
getConfigParam(base_dir, 'broch_mode') getConfigParam(base_dir, 'broch_mode')
@ -3221,7 +3221,7 @@ if __name__ == "__main__":
args.show_node_info_accounts, args.show_node_info_accounts,
args.show_node_info_version, args.show_node_info_version,
args.broch_mode, args.broch_mode,
args.verifyAllSignatures, args.verify_all_signatures,
args.sendThreadsTimeoutMins, args.sendThreadsTimeoutMins,
args.dormantMonths, args.dormantMonths,
args.maxNewswirePosts, args.maxNewswirePosts,

View File

@ -4077,7 +4077,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
maxFollowers: int, maxFollowers: int,
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
peertubeInstances: [], peertubeInstances: [],
verifyAllSignatures: bool, verify_all_signatures: bool,
themeName: str, systemLanguage: str, themeName: str, systemLanguage: str,
max_like_count: int, signingPrivateKeyPem: str, max_like_count: int, signingPrivateKeyPem: str,
default_reply_interval_hrs: int, default_reply_interval_hrs: int,
@ -4196,9 +4196,9 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
'accounts': {} 'accounts': {}
} }
# also check if the json signature enforcement has changed # also check if the json signature enforcement has changed
verifyAllSigs = getConfigParam(base_dir, "verifyAllSignatures") verifyAllSigs = getConfigParam(base_dir, "verify_all_signatures")
if verifyAllSigs is not None: if verifyAllSigs is not None:
verifyAllSignatures = verifyAllSigs verify_all_signatures = verifyAllSigs
# change the last time that this was done # change the last time that this was done
quotasLastUpdatePerMin = currTime quotasLastUpdatePerMin = currTime
@ -4294,12 +4294,12 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
if debug: if debug:
pprint(queueJson['httpHeaders']) pprint(queueJson['httpHeaders'])
if verifyAllSignatures: if verify_all_signatures:
originalJson = queueJson['original'] originalJson = queueJson['original']
print('Queue: inbox post does not have a jsonld signature ' + print('Queue: inbox post does not have a jsonld signature ' +
keyId + ' ' + str(originalJson)) keyId + ' ' + str(originalJson))
if httpSignatureFailed or verifyAllSignatures: if httpSignatureFailed or verify_all_signatures:
if os.path.isfile(queueFilename): if os.path.isfile(queueFilename):
try: try:
os.remove(queueFilename) os.remove(queueFilename)
@ -4310,7 +4310,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
queue.pop(0) queue.pop(0)
continue continue
else: else:
if httpSignatureFailed or verifyAllSignatures: if httpSignatureFailed or verify_all_signatures:
# use the original json message received, not one which # use the original json message received, not one which
# may have been modified along the way # may have been modified along the way
originalJson = queueJson['original'] originalJson = queueJson['original']

View File

@ -784,7 +784,7 @@ def createServerAlice(path: str, domain: str, port: int,
dormantMonths = 3 dormantMonths = 3
sendThreadsTimeoutMins = 30 sendThreadsTimeoutMins = 30
maxFollowers = 10 maxFollowers = 10
verifyAllSignatures = True verify_all_signatures = True
broch_mode = False broch_mode = False
show_node_info_accounts = True show_node_info_accounts = True
show_node_info_version = True show_node_info_version = True
@ -805,7 +805,7 @@ def createServerAlice(path: str, domain: str, port: int,
show_node_info_accounts, show_node_info_accounts,
show_node_info_version, show_node_info_version,
broch_mode, broch_mode,
verifyAllSignatures, verify_all_signatures,
sendThreadsTimeoutMins, sendThreadsTimeoutMins,
dormantMonths, maxNewswirePosts, dormantMonths, maxNewswirePosts,
allowLocalNetworkAccess, allowLocalNetworkAccess,
@ -926,7 +926,7 @@ def createServerBob(path: str, domain: str, port: int,
dormantMonths = 3 dormantMonths = 3
sendThreadsTimeoutMins = 30 sendThreadsTimeoutMins = 30
maxFollowers = 10 maxFollowers = 10
verifyAllSignatures = True verify_all_signatures = True
broch_mode = False broch_mode = False
show_node_info_accounts = True show_node_info_accounts = True
show_node_info_version = True show_node_info_version = True
@ -947,7 +947,7 @@ def createServerBob(path: str, domain: str, port: int,
show_node_info_accounts, show_node_info_accounts,
show_node_info_version, show_node_info_version,
broch_mode, broch_mode,
verifyAllSignatures, verify_all_signatures,
sendThreadsTimeoutMins, sendThreadsTimeoutMins,
dormantMonths, maxNewswirePosts, dormantMonths, maxNewswirePosts,
allowLocalNetworkAccess, allowLocalNetworkAccess,
@ -995,7 +995,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
dormantMonths = 3 dormantMonths = 3
sendThreadsTimeoutMins = 30 sendThreadsTimeoutMins = 30
maxFollowers = 10 maxFollowers = 10
verifyAllSignatures = True verify_all_signatures = True
broch_mode = False broch_mode = False
show_node_info_accounts = True show_node_info_accounts = True
show_node_info_version = True show_node_info_version = True
@ -1017,7 +1017,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
show_node_info_accounts, show_node_info_accounts,
show_node_info_version, show_node_info_version,
broch_mode, broch_mode,
verifyAllSignatures, verify_all_signatures,
sendThreadsTimeoutMins, sendThreadsTimeoutMins,
dormantMonths, maxNewswirePosts, dormantMonths, maxNewswirePosts,
allowLocalNetworkAccess, allowLocalNetworkAccess,
@ -1067,7 +1067,7 @@ def createServerGroup(path: str, domain: str, port: int,
dormantMonths = 3 dormantMonths = 3
sendThreadsTimeoutMins = 30 sendThreadsTimeoutMins = 30
maxFollowers = 10 maxFollowers = 10
verifyAllSignatures = True verify_all_signatures = True
broch_mode = False broch_mode = False
show_node_info_accounts = True show_node_info_accounts = True
show_node_info_version = True show_node_info_version = True
@ -1089,7 +1089,7 @@ def createServerGroup(path: str, domain: str, port: int,
show_node_info_accounts, show_node_info_accounts,
show_node_info_version, show_node_info_version,
broch_mode, broch_mode,
verifyAllSignatures, verify_all_signatures,
sendThreadsTimeoutMins, sendThreadsTimeoutMins,
dormantMonths, maxNewswirePosts, dormantMonths, maxNewswirePosts,
allowLocalNetworkAccess, allowLocalNetworkAccess,

View File

@ -1365,7 +1365,7 @@ def _htmlEditProfileInstance(base_dir: str, translate: {},
instanceStr += \ instanceStr += \
editCheckBox(nodeInfoStr, 'show_node_info_version', False) editCheckBox(nodeInfoStr, 'show_node_info_version', False)
if getConfigParam(base_dir, "verifyAllSignatures"): if getConfigParam(base_dir, "verify_all_signatures"):
instanceStr += \ instanceStr += \
editCheckBox(translate['Verify all signatures'], editCheckBox(translate['Verify all signatures'],
'verifyallsignatures', True) 'verifyallsignatures', True)