Merge pull request #1331 from ThibG/glitch-soc/merge-upstream

Merge upstream changes
This commit is contained in:
ThibG 2020-05-20 18:38:36 +02:00 committed by GitHub
commit 4dcabe6f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 124 additions and 26 deletions

View File

@ -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)

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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?

View File

@ -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)