mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 08:49:59 +00:00
Update Gravatar (#313)
* Update help.html with a section about user avatars * Update Gravatar implementation to use the rating feature
This commit is contained in:
parent
2424639bf9
commit
ab6193d01d
|
@ -501,13 +501,17 @@ class User(db.Model):
|
|||
|
||||
def gravatar_url(self):
|
||||
# from http://en.gravatar.com/site/implement/images/python/
|
||||
size = 120
|
||||
params = {
|
||||
# Image size (https://en.gravatar.com/site/implement/images/#size)
|
||||
's': 120,
|
||||
# Default image (https://en.gravatar.com/site/implement/images/#default-image)
|
||||
'd': flask.url_for('static', filename='img/avatar/default.png', _external=True),
|
||||
# Image rating (https://en.gravatar.com/site/implement/images/#rating)
|
||||
'r': 'pg' if app.SITE_FLAVOR['nyaa'] else 'x', # Nyaa: PG-rated, Sukebei: X-rated
|
||||
}
|
||||
# construct the url
|
||||
default_avatar = flask.url_for('static', filename='img/avatar/default.png', _external=True)
|
||||
gravatar_url = 'https://www.gravatar.com/avatar/{}?{}'.format(
|
||||
md5(self.email.encode('utf-8').lower()).hexdigest(),
|
||||
urlencode({'d': default_avatar, 's': str(size)}))
|
||||
return gravatar_url
|
||||
return 'https://www.gravatar.com/avatar/{}?{}'.format(
|
||||
md5(self.email.encode('utf-8').lower()).hexdigest(), urlencode(params))
|
||||
|
||||
@property
|
||||
def userlevel_str(self):
|
||||
|
|
|
@ -81,6 +81,12 @@
|
|||
to have an image embedded in your comment or description. Note the <kbd>!</kbd>
|
||||
exclamation mark at the beginning, denoting that this link is an image.
|
||||
</div>
|
||||
|
||||
{{ linkable_header("Changing Your User's Avatar", "avatar") }}
|
||||
<div>
|
||||
The site uses the <a href="https://www.gravatar.com">Gravatar</a> service for user avatars.
|
||||
Check out <a href="https://www.gravatar.com/support/">Gravatar's help section</a> for more detailed instructions.
|
||||
</div>
|
||||
{# <div class="content">
|
||||
<h1>Help</h1>
|
||||
<p><b>The search engine</b> is located at the top right, and it allows users to search through the torrent titles available on the site. Results matching either word A or B can be included by typing a vertical bar between them (|). Results matching a certain word can be excluded by prefixing that word with a hyphen-minus (-). Phrases can be matched by surrounding them with double-quotes (). Search results can be filtered by category, remake, trusted, and/or A+ status, and then narrowed down further by age and size ranges as well as excluding specific users. Sorting can be done in ascending or descending order by date, amount of seeders/leechers/downloads, size, or name. The search engine adapts to the current view and makes it possible to search for specific torrents in a specific subcategory from a specific user.</p>
|
||||
|
|
Loading…
Reference in a new issue