mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
Move letter avatars out of upload system
FIX: S3 issues around system avatars FIX: reduced backup file size
This commit is contained in:
@ -3,7 +3,7 @@ require_dependency 'letter_avatar'
|
||||
class UserAvatarsController < ApplicationController
|
||||
DOT = Base64.decode64("R0lGODlhAQABALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//wBiZCH5BAEAAA8ALAAAAAABAAEAAAQC8EUAOw==")
|
||||
|
||||
skip_before_filter :check_xhr, :verify_authenticity_token, only: :show
|
||||
skip_before_filter :check_xhr, :verify_authenticity_token, only: [:show, :show_letter]
|
||||
|
||||
def refresh_gravatar
|
||||
|
||||
@ -20,6 +20,20 @@ class UserAvatarsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def show_letter
|
||||
params.require(:username)
|
||||
params.require(:version)
|
||||
params.require(:size)
|
||||
|
||||
if params[:version].to_i > LetterAvatar::VERSION
|
||||
return render_dot
|
||||
end
|
||||
|
||||
image = LetterAvatar.generate(params[:username].to_s, params[:size].to_i)
|
||||
expires_in 1.year, public: true
|
||||
send_file image, disposition: nil
|
||||
end
|
||||
|
||||
def show
|
||||
# we need multisite support to keep a single origin pull for CDNs
|
||||
RailsMultisite::ConnectionManagement.with_hostname(params[:hostname]) do
|
||||
|
Reference in New Issue
Block a user