move shrine files out of public. use x-sendfile to send files for security.

This commit is contained in:
Christoph Haas 2025-06-16 00:24:11 +02:00
parent 8e66fb28db
commit b601b2bbb6
11 changed files with 164 additions and 140 deletions

View file

@ -11,10 +11,12 @@ module PackagesHelper
end
def small_img(screenshot, cls: 'thumbnail')
if screenshot && screenshot.simage(:small)
if screenshot&.simage(:small)
image = screenshot.simage(:small)
# image = screenshot_image_path(name: screenshot.package.name)
image_tag(
image.url,
small_image_with_id_path(name: screenshot.package.name, screenshot_id: screenshot.id),
width: image.width,
height: image.height,
alt: screenshot.caption,
@ -40,11 +42,11 @@ module PackagesHelper
# Return a readable status of a screenshot and a matching CSS color class
def status(screenshot)
if screenshot.approved && !screenshot.hidden
[(icon('eye', class: 'icon') + ' Public'), 'public']
["#{icon('eye', class: 'icon')} Public".html_safe, 'public']
elsif screenshot.hidden
[(icon('eye-closed', class: 'icon') + ' Hidden'), 'hidden']
["#{icon('eye-closed', class: 'icon')} Hidden".html_safe, 'hidden']
elsif !screenshot.approved
[(icon('hourglass', class: 'icon') + ' Unapproved'), 'unapproved']
["#{icon('hourglass', class: 'icon')} Unapproved".html_safe, 'unapproved']
end
end
end