# 允许为 Gravatar 匹配指定正则表达式

**URL:** https://meta.discourse.org/t/allow-specifying-regex-for-gravatar-matching/275944
**Category:** Feature
**Created:** [2023年八月20日 19:09 UTC](https://meta.discourse.org/t/allow-specifying-regex-for-gravatar-matching/275944 "2023-08-20T19:09:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![roke\_julian\_lockhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roke_julian_lockhart/32/540179_2.png) [@roke\_julian\_lockhart](https://meta.discourse.org/u/roke_julian_lockhart)
#### Post date: [2023年八月20日 19:09 UTC](https://meta.discourse.org/t/allow-specifying-regex-for-gravatar-matching/275944/1 "2023-08-20T19:09:05Z")

</div>

> [@rokejulianlockhart](#):
>
> [https://www.reddit.com/r/Gravatar/comments/15ffy6v/gravatar\_should\_enforce\_or\_at\_least\_allow\_regex/?utm\_source=share&utm\_medium=web2x&context=3](https://www.reddit.com/r/Gravatar/comments/15ffy6v/gravatar_should_enforce_or_at_least_allow_regex/?utm_source=share&utm_medium=web2x&context=3)

> 我为我的 1600 个在线账户中的每一个都使用了不同的 https://anonaddy.com 别名，并且每个别名都经过了唯一加址处理。
> 
> 这不是因为我提倡隐私。我只是想知道我的邮件来自哪里。这几乎让 Gravatar 对我来说毫无用处，因为如果没有 ，我的任何账户都与 Gravatar 相关联。
> 
> 因此，我应该能够在选择 Gravatar 选项时指定类似 Discourse 中的内容
> 
> ```regex
> [A-Za-z0-9]+\[A-Za-z0-9]+@rokejulianlockhart\.anonaddy\.com
> 
> ```
> 
> 这样它就不会因为别名不同而错过我的头像。

但是，我不知道 Gravatar 的 RPC-XML API 是否支持这一点。

---

<div class="post-metadata">

### Author: ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)
#### Post date: [2023年八月21日 20:32 UTC](https://meta.discourse.org/t/allow-specifying-regex-for-gravatar-matching/275944/2 "2023-08-21T20:32:18Z")

</div>

Gravatar 通过为电子邮件地址创建哈希值来工作：[https://en.gravatar.com/site/implement/hash/](https://en.gravatar.com/site/implement/hash/)

Gravatar 作为一项服务不支持你的用例。Discourse 提供了一个标准实现，因此需要在服务方进行更改。

看起来不太可能。🙂

---

<div class="post-metadata">

### Author: ![roke\_julian\_lockhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roke_julian_lockhart/32/540179_2.png) [@roke\_julian\_lockhart](https://meta.discourse.org/u/roke_julian_lockhart)
#### Post date: [2023年八月21日 20:45 UTC](https://meta.discourse.org/t/allow-specifying-regex-for-gravatar-matching/275944/3 "2023-08-21T20:45:40Z")

</div>

感谢您的回复。我仍然抱有希望，随着计算机素养的提高，这将成为一个更常见的用例。

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2023年八月22日 00:13 UTC](https://meta.discourse.org/t/allow-specifying-regex-for-gravatar-matching/275944/8 "2023-08-22T00:13:11Z")

</div>

此设计无法实现，因为如 @maiki 所说，gravatar 永远不会获得用户的电子邮件地址。

Gravatar 界面仅支持“给我提供_此特定电子邮件地址_的 Gravatar”。

这是一项保护用户的功能，并非设计缺陷。

---

<div class="post-metadata">

### Author: ![roke\_julian\_lockhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roke_julian_lockhart/32/540179_2.png) [@roke\_julian\_lockhart](https://meta.discourse.org/u/roke_julian_lockhart)
#### Post date: [2023年八月22日 01:31 UTC](https://meta.discourse.org/t/allow-specifying-regex-for-gravatar-matching/275944/9 "2023-08-22T01:31:52Z")

</div>

是的，似乎最好的解决方案是为使用 Libravatar 的 Discourse 实例在 [Sign in · GitLab](https://git.linux-kernel.at/oliver/ivatar/-/issues/new) 上请求此功能，尽管我仍然希望最终能以某种方式实现。
