mirror of https://github.com/Siphonay/mastodon
Merge pull request #1331 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
This commit is contained in:
commit
4dcabe6f9c
10
Gemfile.lock
10
Gemfile.lock
|
@ -201,13 +201,13 @@ GEM
|
|||
dotenv (= 2.7.5)
|
||||
railties (>= 3.2, < 6.1)
|
||||
e2mmap (0.1.0)
|
||||
elasticsearch (7.6.0)
|
||||
elasticsearch-api (= 7.6.0)
|
||||
elasticsearch-transport (= 7.6.0)
|
||||
elasticsearch-api (7.6.0)
|
||||
elasticsearch (7.7.0)
|
||||
elasticsearch-api (= 7.7.0)
|
||||
elasticsearch-transport (= 7.7.0)
|
||||
elasticsearch-api (7.7.0)
|
||||
multi_json
|
||||
elasticsearch-dsl (0.1.9)
|
||||
elasticsearch-transport (7.6.0)
|
||||
elasticsearch-transport (7.7.0)
|
||||
faraday (~> 1)
|
||||
multi_json
|
||||
encryptor (3.0.0)
|
||||
|
|
|
@ -8,7 +8,8 @@ module WellKnown
|
|||
before_action :set_account
|
||||
before_action :check_account_suspension
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound, ActionController::ParameterMissing, with: :not_found
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
||||
rescue_from ActionController::ParameterMissing, WebfingerResource::InvalidRequest, with: :bad_request
|
||||
|
||||
def show
|
||||
expires_in 3.days, public: true
|
||||
|
@ -37,6 +38,10 @@ module WellKnown
|
|||
expires_in(3.minutes, public: true) && gone if @account.suspended?
|
||||
end
|
||||
|
||||
def bad_request
|
||||
head 400
|
||||
end
|
||||
|
||||
def not_found
|
||||
head 404
|
||||
end
|
||||
|
|
|
@ -201,7 +201,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
|
||||
begin
|
||||
href = Addressable::URI.parse(attachment['url']).normalize.to_s
|
||||
media_attachment = MediaAttachment.create(account: @account, remote_url: href, description: attachment['name'].presence, focus: attachment['focalPoint'], blurhash: supported_blurhash?(attachment['blurhash']) ? attachment['blurhash'] : nil)
|
||||
media_attachment = MediaAttachment.create(account: @account, remote_url: href, description: attachment['summary'].presence || attachment['name'].presence, focus: attachment['focalPoint'], blurhash: supported_blurhash?(attachment['blurhash']) ? attachment['blurhash'] : nil)
|
||||
media_attachments << media_attachment
|
||||
|
||||
next if unsupported_media_type?(attachment['mediaType']) || skip_download?
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class WebfingerResource
|
||||
attr_reader :resource
|
||||
|
||||
class InvalidRequest < StandardError; end
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
@ -14,7 +16,7 @@ class WebfingerResource
|
|||
when /\@/
|
||||
username_from_acct
|
||||
else
|
||||
raise(ActiveRecord::RecordNotFound)
|
||||
raise InvalidRequest
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class SearchService < BaseService
|
|||
end
|
||||
|
||||
def account_searchable?
|
||||
account_search? && !(@query.include?('@') && @query.include?(' '))
|
||||
account_search? && !(@query.start_with?('#') || (@query.include?('@') && @query.include?(' ')))
|
||||
end
|
||||
|
||||
def hashtag_searchable?
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||
|
||||
require_relative '../config/boot'
|
||||
require_relative '../lib/cli'
|
||||
Mastodon::CLI.start(ARGV)
|
||||
|
||||
begin
|
||||
Mastodon::CLI.start(ARGV)
|
||||
rescue Interrupt
|
||||
exit(130)
|
||||