From 355081226e96b599bb44a108ff7645bffbe5583a Mon Sep 17 00:00:00 2001 From: mukaiu Date: Sun, 1 Mar 2020 17:21:47 +0800 Subject: [PATCH] #301 add rnd in Fingerprint --- .../resources/templates/apps/im/point.html | 18 +++++++++++++++++- .../main/resources/templates/apps/im/text.html | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/contact-center/app/src/main/resources/templates/apps/im/point.html b/contact-center/app/src/main/resources/templates/apps/im/point.html index 61536f10..8b4ae647 100644 --- a/contact-center/app/src/main/resources/templates/apps/im/point.html +++ b/contact-center/app/src/main/resources/templates/apps/im/point.html @@ -451,7 +451,23 @@ function openAgentChatDialog(url){ } <#if webimexist == true > - Fingerprint2.get({extraComponents: [<#if channelVisitorSeparate?? && channelVisitorSeparate == true>{key: "cskefuAppId", getData: function(done, options){done("${appid!''}")}}]}, function(components){ + Fingerprint2.get({extraComponents: [<#if channelVisitorSeparate?? && channelVisitorSeparate == true>{key: "cskefuAppId", getData: function(done, options){done("${appid!''}")}}, + { + key: "rndId", + getData(done, options){ + var rnd = ''; + if(localStorage){ + rnd = localStorage.finger; + if(!rnd){ + rnd = Math.random(); + localStorage.finger = rnd; + } + } + + done(rnd); + } + } + ]}, function(components){ var glue = components.map(function (component) { return component.value }) cskefuOnlineUserId = Fingerprint2.x64hash128(glue.join(''), 31); cskefu.ajax(cskefu.in+"&userid="+cskefuOnlineUserId+"&t="+new Date().getTime() , function(data){ diff --git a/contact-center/app/src/main/resources/templates/apps/im/text.html b/contact-center/app/src/main/resources/templates/apps/im/text.html index f85a6fee..b42b10e2 100644 --- a/contact-center/app/src/main/resources/templates/apps/im/text.html +++ b/contact-center/app/src/main/resources/templates/apps/im/text.html @@ -33,7 +33,23 @@ var ukefu = { window.location.replace(url+"&t="+new Date().getTime()); } } -Fingerprint2.get({extraComponents: [<#if channelVisitorSeparate?? && channelVisitorSeparate == true>{key: "cskefuAppId", getData: function(done, options){done("${appid!''}")}}]}, function(components){ +Fingerprint2.get({extraComponents: [<#if channelVisitorSeparate?? && channelVisitorSeparate == true>{key: "cskefuAppId", getData: function(done, options){done("${appid!''}")}}, +{ + key: "rndId", + getData(done, options){ + var rnd = ''; + if(localStorage){ + rnd = localStorage.finger; + if(!rnd){ + rnd = Math.random(); + localStorage.finger = rnd; + } + } + + done(rnd); + } + } +]}, function(components){ var glue = components.map(function (component) { return component.value }) cskefuOnlineUserId = Fingerprint2.x64hash128(glue.join(''), 31) ukefu.chat = ukefu.chat + "<#if userid??>&userid=${userid}<#else>&userid="+cskefuOnlineUserId+"&sessionid=${sessionid!''}<#if ai??>&ai=${ai}<#if title??>&title=${title?url}<#if traceid??>&url=${url?url}<#if traceid??>&traceid=${traceid}";