Remove redundant cleanup of journal faction info

Clean up duplicate detection code
This commit is contained in:
Jonathan Harris 2019-01-08 18:58:41 +00:00
parent 2e1881fdcc
commit be7fcc2c05
2 changed files with 7 additions and 17 deletions

View File

@ -127,13 +127,6 @@ class Relay(Thread):
if 'uploaderIP' in json['header']:
del json['header']['uploaderIP']
# Remove personal data from FSDJump and Location => MyReputation
if '/journal/' in json['$schemaRef'] and 'event' in json['message']:
if json['message']['event'] in ['FSDJump', 'Location'] and 'Factions' in json['message']:
for i, values in enumerate(json['message']['Factions']):
if 'MyReputation' in values:
del json['message']['Factions'][i]['MyReputation']
# Convert message back to JSON
message = simplejson.dumps(json, sort_keys=True)

View File

@ -42,23 +42,20 @@ class DuplicateMessages(Thread):
'message': dict(json['message']),
}
# Convert starPos to avoid software modification in dupe messages
# Remove timestamp (Mainly to avoid multiple scan messages and faction influences)
jsonTest['message'].pop('timestamp')
# Convert journal starPos to avoid software modification in dupe messages
if 'StarPos' in jsonTest['message']:
jsonTest['message']['StarPos'] = [int(round(x * 32)) for x in jsonTest['message']['StarPos']]
# Prevent Docked event with small difference in distance from start
# Prevent journal Docked event with small difference in distance from start
if 'DistFromStarLS' in jsonTest['message']:
jsonTest['message']['DistFromStarLS'] = int(jsonTest['message']['DistFromStarLS'] + 0.5)
# Remove journal timestamp (Mainly to avoid multiple scan messages and faction influences)
if 'timestamp' in jsonTest['message']:
del jsonTest['message']['timestamp']
# Remove journal ScanType and DistanceFromArrivalLS (Avoid duplicate scan messages after SAAScanComplete)
if 'ScanType' in jsonTest['message']:
del jsonTest['message']['ScanType']
if 'DistanceFromArrivalLS' in jsonTest['message']:
del jsonTest['message']['DistanceFromArrivalLS']
jsonTest['message'].pop('ScanType', None)
jsonTest['message'].pop('DistanceFromArrivalLS', None)
message = simplejson.dumps(jsonTest, sort_keys=True) # Ensure most duplicate messages will get the same key
key = hashlib.sha256(message).hexdigest()