mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-14 22:32:20 +03:00
Remove redundant cleanup of journal faction info
Clean up duplicate detection code
This commit is contained in:
parent
2e1881fdcc
commit
be7fcc2c05
@ -127,13 +127,6 @@ class Relay(Thread):
|
|||||||
if 'uploaderIP' in json['header']:
|
if 'uploaderIP' in json['header']:
|
||||||
del json['header']['uploaderIP']
|
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
|
# Convert message back to JSON
|
||||||
message = simplejson.dumps(json, sort_keys=True)
|
message = simplejson.dumps(json, sort_keys=True)
|
||||||
|
|
||||||
|
@ -42,23 +42,20 @@ class DuplicateMessages(Thread):
|
|||||||
'message': dict(json['message']),
|
'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']:
|
if 'StarPos' in jsonTest['message']:
|
||||||
jsonTest['message']['StarPos'] = [int(round(x * 32)) for x in jsonTest['message']['StarPos']]
|
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']:
|
if 'DistFromStarLS' in jsonTest['message']:
|
||||||
jsonTest['message']['DistFromStarLS'] = int(jsonTest['message']['DistFromStarLS'] + 0.5)
|
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)
|
# Remove journal ScanType and DistanceFromArrivalLS (Avoid duplicate scan messages after SAAScanComplete)
|
||||||
if 'ScanType' in jsonTest['message']:
|
jsonTest['message'].pop('ScanType', None)
|
||||||
del jsonTest['message']['ScanType']
|
jsonTest['message'].pop('DistanceFromArrivalLS', None)
|
||||||
if 'DistanceFromArrivalLS' in jsonTest['message']:
|
|
||||||
del jsonTest['message']['DistanceFromArrivalLS']
|
|
||||||
|
|
||||||
message = simplejson.dumps(jsonTest, sort_keys=True) # Ensure most duplicate messages will get the same key
|
message = simplejson.dumps(jsonTest, sort_keys=True) # Ensure most duplicate messages will get the same key
|
||||||
key = hashlib.sha256(message).hexdigest()
|
key = hashlib.sha256(message).hexdigest()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user