Skip to content

Commit

Permalink
use cache
Browse files Browse the repository at this point in the history
  • Loading branch information
morimoriysmoon authored and scroix committed Apr 1, 2024
1 parent b5c89ae commit 21a3cac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nodel-webui-js/src/nodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,15 +777,22 @@ var updateFavicon = function(host){
document.getElementsByTagName('head')[0].appendChild(link);
}

var hostIconMap = {};
var generateHostIcon = function(host) {
var icon = hostIconMap[encodr(host)];
if (icon) {
return icon;
}
var hash = XXH.h64(host, 0x4e6f64656c).toString(16).padStart(16,'0');
var options = {
background: [255, 255, 255, 0],
margin: 0.1,
size: 20,
format: 'svg'
};
return new Identicon(hash, options).toString();
icon = new Identicon(hash, options).toString();
hostIconMap[encodr(host)] = icon;
return icon;
}

var updateHost = function(host, targetList) {
Expand Down

0 comments on commit 21a3cac

Please sign in to comment.