Add ffmpeg and ImageMagick versions to admin dashboard (#30710)

main-rebase-security-fix
Michael Stanclift 2024-06-14 10:36:57 -05:00 committed by GitHub
parent 09dca8ba3d
commit 4a5442edaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 29 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
protected
def perform_query
[mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version, libvips_version].compact
[mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version, libvips_version, imagemagick_version, ffmpeg_version].compact
end
def mastodon_version
@ -82,6 +82,34 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
}
end
def imagemagick_version
return if Rails.configuration.x.use_vips
version = `convert -version`.match(/Version: ImageMagick ([\d\.]+)/)[1]
{
key: 'imagemagick',
human_key: 'ImageMagick',
value: version,
human_value: version,
}
rescue Errno::ENOENT
nil
end
def ffmpeg_version
version = `ffmpeg -version`.match(/ffmpeg version ([\d\.]+)/)[1]
{
key: 'ffmpeg',
human_key: 'FFmpeg',
value: version,
human_value: version,
}
rescue Errno::ENOENT
nil
end
def redis_info
@redis_info ||= if redis.is_a?(Redis::Namespace)
redis.redis.info