Allinea replay alla UI live e corregge miniature e loghi.

Player contenuto come la diretta, fix streaming thumbnail da S3, volume persistente ActiveStorage in produzione.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-09 11:01:04 +02:00
parent 0621efb839
commit 53f9a6a884
7 changed files with 124 additions and 96 deletions

View File

@@ -6,6 +6,8 @@ module Recordings
# Serve file replay/thumbnail al browser senza esporre URL S3 interni (es. http://garage:3900).
class ServeFromStorage
CHUNK_SIZE = 256 * 1024
# Thumbnail e file piccoli: buffer completo (l'Enumerator su Puma può non completare la risposta).
SMALL_FILE_MAX = 2 * 1024 * 1024
def initialize(key:, content_type:, disposition: "inline", filename: nil)
@key = key
@@ -55,6 +57,15 @@ module Recordings
controller.status = :partial_content if range.present? && resp.content_range.present?
if range.blank? && resp.content_length.to_i.positive? && resp.content_length.to_i <= SMALL_FILE_MAX
return controller.send_data(
resp.body.read,
type: @content_type,
disposition: @disposition,
filename: @filename
)
end
body = resp.body
controller.response_body = Enumerator.new do |yielder|
while (chunk = body.read(CHUNK_SIZE))