Merge remote-tracking branch 'parent/main' into upstream-20240610

This commit is contained in:
KMY 2024-06-10 08:19:27 +09:00
commit 90f2ea9015
125 changed files with 2266 additions and 1504 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].compact
[mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version, libvips_version].compact
end
def mastodon_version
@ -71,6 +71,17 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
nil
end
def libvips_version
return unless Rails.configuration.x.use_vips
{
key: 'libvips',
human_key: 'libvips',
value: Vips.version_string,
human_value: Vips.version_string,
}
end
def redis_info
@redis_info ||= if redis.is_a?(Redis::Namespace)
redis.redis.info

View file

@ -11,6 +11,9 @@ class ScopeTransformer < Parslet::Transform
@namespace = scope[:namespace]&.to_s
@access = scope[:access] ? [scope[:access].to_s] : DEFAULT_ACCESS.dup
@term = scope[:term]&.to_s || DEFAULT_TERM
# # override for profile scope which is read only
@access = %w(read) if @term == 'profile'
end
def key

View file

@ -41,8 +41,8 @@ class VideoMetadataExtractor
@colorspace = video_stream[:pix_fmt]
@width = video_stream[:width]
@height = video_stream[:height]
@frame_rate = video_stream[:avg_frame_rate] == '0/0' ? nil : Rational(video_stream[:avg_frame_rate])
@r_frame_rate = video_stream[:r_frame_rate] == '0/0' ? nil : Rational(video_stream[:r_frame_rate])
@frame_rate = parse_framerate(video_stream[:avg_frame_rate])
@r_frame_rate = parse_framerate(video_stream[:r_frame_rate])
# For some video streams the frame_rate reported by `ffprobe` will be 0/0, but for these streams we
# should use `r_frame_rate` instead. Video screencast generated by Gnome Screencast have this issue.
@frame_rate ||= @r_frame_rate
@ -55,4 +55,10 @@ class VideoMetadataExtractor
@invalid = true if @metadata.key?(:error)
end
def parse_framerate(raw)
Rational(raw)
rescue ZeroDivisionError
nil
end
end