Skip to content

Commit

Permalink
反向代理gavatar
Browse files Browse the repository at this point in the history
  • Loading branch information
keakon committed Jan 15, 2024
1 parent 2792278 commit 1b8b54f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions conf/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ localhost {
rewrite /favicon.ico /static/favicon.ico
rewrite /robots.txt /static/robots.txt

handle_path /avatar/ {
reverse_proxy https://gravatar.com/avatar/
}

reverse_proxy doodle:8080

encode gzip
Expand Down
2 changes: 1 addition & 1 deletion doodle/core/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_by_emails(cls, emails):
return {}

def get_avatar(self):
return '//gravatar.com/avatar/' + md5(self.email).hexdigest()
return '/avatar/' + md5(self.email).hexdigest()

def is_admin(self):
return self.id == CONFIG.ADMIN_USER_ID
Expand Down

0 comments on commit 1b8b54f

Please sign in to comment.