このコミットが含まれているのは:
@@ -8,6 +8,43 @@
|
||||
# MovieGenre.find_or_create_by!(name: genre_name)
|
||||
# end
|
||||
|
||||
post_url_sanitisation_rules = [
|
||||
{ priority: 10,
|
||||
source_pattern: '\Ahttps?://youtu\.be/([^/?#]+)(?:[?#].*)?\z',
|
||||
replacement: 'https://www.youtube.com/watch?v=\1' },
|
||||
{ priority: 20,
|
||||
source_pattern: '\Ahttps?://(?:www\.|m\.)?youtube\.com/live/([^/?#]+)(?:[?#].*)?\z',
|
||||
replacement: 'https://www.youtube.com/watch?v=\1' },
|
||||
{ priority: 30,
|
||||
source_pattern: '\Ahttps?://(?:www\.|m\.)?youtube\.com/shorts/([^/?#]+)(?:[?#].*)?\z',
|
||||
replacement: 'https://www.youtube.com/watch?v=\1' },
|
||||
{ priority: 40,
|
||||
source_pattern: '\Ahttps?://(?:www\.|m\.)?youtube\.com/embed/([^/?#]+)(?:[?#].*)?\z',
|
||||
replacement: 'https://www.youtube.com/watch?v=\1' },
|
||||
{ priority: 50,
|
||||
source_pattern:
|
||||
'\Ahttps?://(?:www\.|m\.)?youtube\.com/watch\?(?:[^#&]+&)*v=([^&#]+)(?:[&#].*)?\z',
|
||||
replacement: 'https://www.youtube.com/watch?v=\1' },
|
||||
{ priority: 60,
|
||||
source_pattern: '\Ahttps?://nico\.ms/([^/?#]+)(?:[?#].*)?\z',
|
||||
replacement: 'https://www.nicovideo.jp/watch/\1' },
|
||||
{ priority: 70,
|
||||
source_pattern: '\Ahttps?://(?:www\.)?nicovideo\.jp/watch/([^?#/]+)(?:[?#].*)?\z',
|
||||
replacement: 'https://www.nicovideo.jp/watch/\1' }
|
||||
]
|
||||
|
||||
post_url_sanitisation_rule_scope = PostUrlSanitisationRule.unscoped
|
||||
|
||||
post_url_sanitisation_rules.each do |attributes|
|
||||
priority = attributes.fetch(:priority)
|
||||
source_pattern = attributes.fetch(:source_pattern)
|
||||
|
||||
next if post_url_sanitisation_rule_scope.exists?(priority:)
|
||||
next if post_url_sanitisation_rule_scope.exists?(source_pattern:)
|
||||
|
||||
post_url_sanitisation_rule_scope.create!(attributes)
|
||||
end
|
||||
|
||||
material_sync_source_uri = ENV['MATERIAL_SYNC_SOURCE_URI']
|
||||
material_sync_source_file_id = ENV['MATERIAL_SYNC_SOURCE_FILE_ID']
|
||||
|
||||
|
||||
新しい課題から参照
ユーザをブロックする