require_relative 'mastodon/emoji_cli'
require_relative 'mastodon/accounts_cli'
require_relative 'mastodon/feeds_cli'
+require_relative 'mastodon/settings_cli'
module Mastodon
class CLI < Thor
desc 'feeds SUBCOMMAND ...ARGS', 'Manage feeds'
subcommand 'feeds', Mastodon::FeedsCLI
+
+ desc 'settings SUBCOMMAND ...ARGS', 'Manage dynamic settings'
+ subcommand 'settings', Mastodon::SettingsCLI
end
end
--- /dev/null
+# frozen_string_literal: true
+
+require_relative '../../config/boot'
+require_relative '../../config/environment'
+require_relative 'cli_helper'
+
+module Mastodon
+ class RegistrationsCLI < Thor
+ desc 'open', 'Open registrations'
+ def open
+ Setting.open_registrations = true
+ say('OK', :green)
+ end
+
+ desc 'close', 'Close registrations'
+ def close
+ Setting.open_registrations = false
+ say('OK', :green)
+ end
+ end
+
+ class SettingsCLI < Thor
+ desc 'registrations SUBCOMMAND ...ARGS', 'Manage state of registrations'
+ subcommand 'registrations', RegistrationsCLI
+ end
+end
# frozen_string_literal: true
-require 'optparse'
-require 'colorize'
require 'tty-command'
require 'tty-prompt'
end
end
- namespace :push do
- desc 'Unsubscribes from PuSH updates of feeds nobody follows locally'
- task clear: :environment do
- Pubsubhubbub::UnsubscribeWorker.push_bulk(Account.remote.without_followers.where.not(subscription_expires_at: nil).pluck(:id))
- end
- end
-
- namespace :settings do
- desc 'Open registrations on this instance'
- task open_registrations: :environment do
- Setting.open_registrations = true
- end
-
- desc 'Close registrations on this instance'
- task close_registrations: :environment do
- Setting.open_registrations = false
- end
- end
-
namespace :webpush do
desc 'Generate VAPID key'
task generate_vapid_key: :environment do
HttpLog.configuration.logger = dev_null
Paperclip.options[:log] = false
end
-
-def prepare_for_options!
- 2.times { ARGV.shift }
-end