fix: gravatar add default d=identicon

This commit is contained in:
shuai 2022-10-31 11:58:04 +08:00
parent 810fbe8ae3
commit fce82bdda1
4 changed files with 6 additions and 24 deletions

View File

@ -41,7 +41,6 @@
"lodash": "^4.17.21",
"marked": "^4.0.19",
"md5": "^2.3.0",
"md5.js": "^1.3.5",
"mermaid": "^9.1.7",
"next-share": "^0.18.1",
"qs": "^6.11.0",

View File

@ -58,7 +58,6 @@ specifiers:
lodash: ^4.17.21
marked: ^4.0.19
md5: ^2.3.0
md5.js: ^1.3.5
mermaid: ^9.1.7
next-share: ^0.18.1
postcss: ^8.0.0
@ -99,7 +98,6 @@ dependencies:
lodash: 4.17.21
marked: 4.1.0
md5: 2.3.0
md5.js: 1.3.5
mermaid: 9.1.7
next-share: 0.18.1_lbqamd2wfmenkveygahn4wdfcq
qs: 6.11.0
@ -6461,15 +6459,6 @@ packages:
dependencies:
function-bind: 1.1.1
/hash-base/3.1.0:
resolution: {integrity: sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==}
engines: {node: '>=4'}
dependencies:
inherits: 2.0.4
readable-stream: 3.6.0
safe-buffer: 5.2.1
dev: false
/he/1.2.0:
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
hasBin: true
@ -7991,14 +7980,6 @@ packages:
hasBin: true
dev: false
/md5.js/1.3.5:
resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==}
dependencies:
hash-base: 3.1.0
inherits: 2.0.4
safe-buffer: 5.2.1
dev: false
/md5/2.3.0:
resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==}
dependencies:

View File

@ -18,8 +18,10 @@ const Index: FC<IProps> = ({ avatar, size, className, searchStr = '' }) => {
if (avatar.length > 1) {
url = `${avatar}?${searchStr}`;
}
} else if (avatar?.type !== 'default') {
url = `${avatar[avatar.type]}?${searchStr}`;
} else if (avatar?.type === 'gravatar') {
url = `${avatar.gravatar}?${searchStr}&d=identicon`;
} else if (avatar?.type === 'custom') {
url = `${avatar.custom}?${searchStr}`;
}
return (

View File

@ -312,8 +312,8 @@ const Index: React.FC = () => {
<Avatar
size="128px"
avatar={formData.avatar.gravatar}
searchStr={`s=128&d=identicon&t=${
new Date().valueOf() + count
searchStr={`s=128&d=identicon${
count > 0 ? `&t=${new Date().valueOf()}` : ''
}`}
className="me-3 rounded"
/>