log slow processing of the fingerprint
parent
cef4d5bc2e
commit
2e032cfbab
|
@ -8,7 +8,7 @@ import play.api.Play.current
|
|||
|
||||
import lila.api.Context
|
||||
import lila.app._
|
||||
import lila.common.LilaCookie
|
||||
import lila.common.{ LilaCookie, HTTPRequest }
|
||||
import lila.user.{ UserRepo, User => UserModel }
|
||||
import views._
|
||||
|
||||
|
@ -155,8 +155,9 @@ object Auth extends LilaController {
|
|||
html = Unauthorized(html.auth.tor()).fuccess,
|
||||
api = _ => Unauthorized(Json.obj("error" -> "Can't login from TOR, sorry!")).fuccess)
|
||||
|
||||
def setFingerprint(hash: String) = Auth { ctx =>
|
||||
def setFingerprint(hash: String, ms: Int) = Auth { ctx =>
|
||||
me =>
|
||||
if (ms > 1000) logwarn(s"[Fingerprint] ${me.username} $ms ms / ${~HTTPRequest.userAgent(ctx.req)}")
|
||||
api.setFingerprint(ctx.req, hash) inject Ok
|
||||
}
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ POST /password/reset/send controllers.Auth.passwordResetApply
|
|||
GET /password/reset/sent/:email controllers.Auth.passwordResetSent(email: String)
|
||||
GET /password/reset/confirm/:token controllers.Auth.passwordResetConfirm(token: String)
|
||||
POST /password/reset/confirm/:token controllers.Auth.passwordResetConfirmApply(token: String)
|
||||
POST /set-fingerprint/:hash controllers.Auth.setFingerprint(hash: String)
|
||||
POST /set-fingerprint/:hash/:ms controllers.Auth.setFingerprint(hash: String, ms: Int)
|
||||
|
||||
# Mod
|
||||
POST /mod/:username/engine controllers.Mod.engine(username: String)
|
||||
|
|
|
@ -1049,10 +1049,12 @@ lichess.storage = {
|
|||
});
|
||||
|
||||
if (window.Fingerprint2) setTimeout(function() {
|
||||
var t = +new Date();
|
||||
new Fingerprint2({
|
||||
excludeJsFonts: true
|
||||
}).get(function(res) {
|
||||
$.post('/set-fingerprint/' + res);
|
||||
var time = (+new Date()) - t;
|
||||
$.post('/set-fingerprint/' + res + '/' + time);
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue