2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 09:10:25 +08:00

FEATURE: generate (avatar) thumbnails in a background task

FIX: keep the "uploading..." indicator until the server replies via the MessageBus
FIX: text was disapearing when uploading an avatar

PERF: always use a region for S3 (defaults to 'us-east-1')
FEATURE: ApplyCDN middleware when using S3
FIX: use the same pattern to store files on S3 and locally
PERF: keep a local cache of uploads when generating thumbnails
FEATURE: migrate_to_s3 rake task
This commit is contained in:
Régis Hanol 2015-05-25 17:59:00 +02:00
parent 675e2c6e13
commit bb0c2813ac
22 changed files with 303 additions and 94 deletions

View file

@ -0,0 +1,24 @@
module Middleware
class ApplyCDN
def initialize(app, settings={})
@app = app
end
def call(env)
status, headers, response = @app.call(env)
if Discourse.asset_host.present? &&
Discourse.store.external? &&
(headers["Content-Type"].start_with?("text/") ||
headers["Content-Type"].start_with?("application/json"))
response.body = response.body.gsub(Discourse.store.absolute_base_url, Discourse.asset_host)
end
[status, headers, response]
end
end
end