diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mastodon/accounts_cli.rb | 7 | ||||
-rw-r--r-- | lib/mastodon/migration_helpers.rb | 8 | ||||
-rw-r--r-- | lib/mastodon/redis_config.rb | 4 | ||||
-rw-r--r-- | lib/mastodon/version.rb | 2 | ||||
-rw-r--r-- | lib/tasks/mastodon.rake | 15 |
5 files changed, 9 insertions, 27 deletions
diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index 8c91c3013..6dbb75689 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -120,7 +120,6 @@ module Mastodon option :disable, type: :boolean option :disable_2fa, type: :boolean option :approve, type: :boolean - option :reset_password, type: :boolean desc 'modify USERNAME', 'Modify a user' long_desc <<-LONG_DESC Modify a user account. @@ -139,9 +138,6 @@ module Mastodon With the --disable-2fa option, the two-factor authentication requirement for the user can be removed. - - With the --reset-password option, the user's password is replaced by - a randomly-generated one, printed in the output. LONG_DESC def modify(username) user = Account.find_local(username)&.user @@ -156,8 +152,6 @@ module Mastodon user.moderator = options[:role] == 'moderator' end - password = SecureRandom.hex if options[:reset_password] - user.password = password if options[:reset_password] user.email = options[:email] if options[:email] user.disabled = false if options[:enable] user.disabled = true if options[:disable] @@ -167,7 +161,6 @@ module Mastodon if user.save say('OK', :green) - say("New password: #{password}") if options[:reset_password] else user.errors.to_h.each do |key, error| say('Failure/Error: ', :red) diff --git a/lib/mastodon/migration_helpers.rb b/lib/mastodon/migration_helpers.rb index bf2314ecb..146eba8ec 100644 --- a/lib/mastodon/migration_helpers.rb +++ b/lib/mastodon/migration_helpers.rb @@ -886,12 +886,16 @@ module Mastodon Your database user is not allowed to create, drop, or execute triggers on the table #{table}. -If you are using PostgreSQL you can solve this by logging in to the Mastodon +If you are using PostgreSQL you can solve this by logging in to the GitLab database (#{dbname}) using a super user and running: ALTER USER #{user} WITH SUPERUSER -The query will grant the user super user permissions, ensuring you don't run +For MySQL you instead need to run: + + GRANT ALL PRIVILEGES ON *.* TO #{user}@'%' + +Both queries will grant the user super user permissions, ensuring you don't run into similar problems in the future (e.g. when new tables are created). EOF end diff --git a/lib/mastodon/redis_config.rb b/lib/mastodon/redis_config.rb index e9db9122f..f11d94a45 100644 --- a/lib/mastodon/redis_config.rb +++ b/lib/mastodon/redis_config.rb @@ -14,9 +14,7 @@ def setup_redis_env_url(prefix = nil, defaults = true) ENV[prefix + 'REDIS_URL'] = if [password, host, port, db].all?(&:nil?) ENV['REDIS_URL'] else - Addressable::URI.parse("redis://#{host}:#{port}/#{db}").tap do |uri| - uri.password = password if password.present? - end.normalize.to_str + "redis://#{password.blank? ? '' : ":#{password}@"}#{host}:#{port}/#{db}" end end diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 49fe73043..c3e288eee 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -13,7 +13,7 @@ module Mastodon end def patch - 2 + 0 end def flags diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index a873335d4..2e92e8ded 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -336,20 +336,7 @@ namespace :mastodon do if prompt.yes?('Save configuration?') cmd = TTY::Command.new(printer: :quiet) - 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") + 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") if using_docker prompt.ok 'Below is your configuration, save it to an .env.production file outside Docker:' |