server: Emit scores with hash value.

We'll ultimately be using this as another trait to classify users by
(whether the avatar has been seen before).  The UI will therefore need
this information.
This commit is contained in:
Stuart Longland 2018-11-27 21:15:42 +10:00
parent cd3c444f26
commit f67dc7ea20
Signed by: stuartl
GPG Key ID: 6AA32EFB18079BAA

View File

@ -242,8 +242,14 @@ class AvatarHashHandler(AuthRequestHandler):
db.commit()
self.set_status(200)
self.set_header('Content-Type', 'text/plain')
self.write(avatar_hash.hashstr)
self.set_header('Content-Type', 'application/json')
self.write(json.dumps({
'id': avatar_hash.hash_id,
'algo': avatar_hash.hashalgo,
'hash': avatar_hash.hashstr.decode(),
'score': avatar_hash.score,
'count': avatar_hash.count
}))
self.finish()
finally:
db.close()