Merge branch 'master' into glitch-soc/merge-upstream

master
Thibaut Girka 5 years ago
commit 427ef4948a
  1. 16
      Gemfile.lock
  2. 11
      app/models/account.rb
  3. 4
      lib/mastodon/redis_config.rb
  4. 15
      lib/tasks/mastodon.rake

@ -202,14 +202,14 @@ GEM
dotenv (= 2.7.5) dotenv (= 2.7.5)
railties (>= 3.2, < 6.1) railties (>= 3.2, < 6.1)
e2mmap (0.1.0) e2mmap (0.1.0)
elasticsearch (7.3.0) elasticsearch (7.5.0)
elasticsearch-api (= 7.3.0) elasticsearch-api (= 7.5.0)
elasticsearch-transport (= 7.3.0) elasticsearch-transport (= 7.5.0)
elasticsearch-api (7.3.0) elasticsearch-api (7.5.0)
multi_json multi_json
elasticsearch-dsl (0.1.8) elasticsearch-dsl (0.1.8)
elasticsearch-transport (7.3.0) elasticsearch-transport (7.5.0)
faraday faraday (>= 0.14, < 1)
multi_json multi_json
encryptor (3.0.0) encryptor (3.0.0)
equatable (0.6.1) equatable (0.6.1)
@ -220,7 +220,7 @@ GEM
fabrication (2.21.0) fabrication (2.21.0)
faker (2.10.1) faker (2.10.1)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
faraday (1.0.0) faraday (0.17.3)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
fast_blank (1.0.0) fast_blank (1.0.0)
fastimage (2.1.7) fastimage (2.1.7)
@ -437,7 +437,7 @@ GEM
pry-rails (0.3.9) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
public_suffix (4.0.3) public_suffix (4.0.3)
puma (4.3.1) puma (4.3.2)
nio4r (~> 2.0) nio4r (~> 2.0)
pundit (2.1.0) pundit (2.1.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)

@ -480,7 +480,16 @@ class Account < ApplicationRecord
def from_text(text) def from_text(text)
return [] if text.blank? return [] if text.blank?
text.scan(MENTION_RE).map { |match| match.first.split('@', 2) }.uniq.map { |(username, domain)| EntityCache.instance.mention(username, domain) } text.scan(MENTION_RE).map { |match| match.first.split('@', 2) }.uniq.map do |(username, domain)|
domain = begin
if TagManager.instance.local_domain?(domain)
nil
else
TagManager.instance.normalize_domain(domain)
end
end
EntityCache.instance.mention(username, domain)
end.compact
end end
private private

@ -14,7 +14,9 @@ def setup_redis_env_url(prefix = nil, defaults = true)
ENV[prefix + 'REDIS_URL'] = if [password, host, port, db].all?(&:nil?) ENV[prefix + 'REDIS_URL'] = if [password, host, port, db].all?(&:nil?)
ENV['REDIS_URL'] ENV['REDIS_URL']
else else
"redis://#{password.blank? ? '' : ":#{password}@"}#{host}:#{port}/#{db}" Addressable::URI.parse("redis://#{host}:#{port}/#{db}").tap do |uri|
uri.password = password if password.present?
end.normalize.to_str
end end
end end

@ -336,7 +336,20 @@ namespace :mastodon do
if prompt.yes?('Save configuration?') if prompt.yes?('Save configuration?')
cmd = TTY::Command.new(printer: :quiet) cmd = TTY::Command.new(printer: :quiet)
File.write(Rails.root.join('.env.production'), "# Generated with mastodon:setup on #{Time.now.utc}\n\n" + env.each_pair.map { |key, value| "#{key}=#{value}" }.join("\n") + "\n") env_contents = env.each_pair.map do |key, value|
if value.is_a?(String) && value =~ /[\s\#\\"]/
if value =~ /[']/
value = value.to_s.gsub(/[\\"\$]/) { |x| "\\#{x}" }
"#{key}=\"#{value}\""
else
"#{key}='#{value}'"
end
else
"#{key}=#{value}"
end
end.join("\n")
File.write(Rails.root.join('.env.production'), "# Generated with mastodon:setup on #{Time.now.utc}\n\n" + env_contents + "\n")
if using_docker if using_docker
prompt.ok 'Below is your configuration, save it to an .env.production file outside Docker:' prompt.ok 'Below is your configuration, save it to an .env.production file outside Docker:'

Loading…
Cancel
Save