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

@ -74,7 +74,8 @@ Doorkeeper.configure do
# For more information go to
# https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
default_scopes :read
optional_scopes :write,
optional_scopes :profile,
:write,
:'write:accounts',
:'write:blocks',
:'write:bookmarks',
@ -89,7 +90,6 @@ Doorkeeper.configure do
:'write:reports',
:'write:statuses',
:read,
:'read:me',
:'read:accounts',
:'read:blocks',
:'read:bookmarks',

View file

@ -3,6 +3,8 @@
Paperclip::DataUriAdapter.register
Paperclip::ResponseWithLimitAdapter.register
PATH = ':prefix_url:class/:attachment/:id_partition/:style/:filename'
Paperclip.interpolates :filename do |attachment, style|
if style == :original
attachment.original_filename
@ -29,7 +31,7 @@ end
Paperclip::Attachment.default_options.merge!(
use_timestamp: false,
path: ':prefix_url:class/:attachment/:id_partition/:style/:filename',
path: PATH,
storage: :fog
)
@ -40,6 +42,8 @@ if ENV['S3_ENABLED'] == 'true'
s3_protocol = ENV.fetch('S3_PROTOCOL') { 'https' }
s3_hostname = ENV.fetch('S3_HOSTNAME') { "s3-#{s3_region}.amazonaws.com" }
Paperclip::Attachment.default_options[:path] = ENV.fetch('S3_KEY_PREFIX') + "/#{PATH}" if ENV.has_key?('S3_KEY_PREFIX')
Paperclip::Attachment.default_options.merge!(
storage: :s3,
s3_protocol: s3_protocol,
@ -64,7 +68,7 @@ if ENV['S3_ENABLED'] == 'true'
http_open_timeout: ENV.fetch('S3_OPEN_TIMEOUT') { '5' }.to_i,
http_read_timeout: ENV.fetch('S3_READ_TIMEOUT') { '5' }.to_i,
http_idle_timeout: 5,
retry_limit: 0,
retry_limit: ENV.fetch('S3_RETRY_LIMIT') { '0' }.to_i,
}
)
@ -159,7 +163,7 @@ else
Paperclip::Attachment.default_options.merge!(
storage: :filesystem,
path: File.join(ENV.fetch('PAPERCLIP_ROOT_PATH', File.join(':rails_root', 'public', 'system')), ':prefix_path:class', ':attachment', ':id_partition', ':style', ':filename'),
url: "#{ENV.fetch('PAPERCLIP_ROOT_URL', '/system')}/:prefix_url:class/:attachment/:id_partition/:style/:filename"
url: ENV.fetch('PAPERCLIP_ROOT_URL', '/system') + "/#{PATH}"
)
end

View file

@ -0,0 +1,27 @@
# frozen_string_literal: true
if Rails.configuration.x.use_vips
ENV['VIPS_BLOCK_UNTRUSTED'] = 'true'
require 'vips'
abort('Incompatible libvips version, please install libvips >= 8.13') unless Vips.at_least_libvips?(8, 13)
Vips.block('VipsForeign', true)
%w(
VipsForeignLoadNsgif
VipsForeignLoadJpeg
VipsForeignLoadPng
VipsForeignLoadWebp
VipsForeignLoadHeif
VipsForeignSavePng
VipsForeignSaveSpng
VipsForeignSaveJpeg
VipsForeignSaveWebp
).each do |operation|
Vips.block(operation, false)
end
Vips.block_untrusted(true)
end