.circleci
.dependabot
.github
app
chewy
controllers
activitypub
admin
account_actions_controller.rb
account_moderation_notes_controller.rb
accounts_controller.rb
action_logs_controller.rb
base_controller.rb
change_emails_controller.rb
confirmations_controller.rb
custom_emojis_controller.rb
dashboard_controller.rb
domain_allows_controller.rb
domain_blocks_controller.rb
email_domain_blocks_controller.rb
followers_controller.rb
instances_controller.rb
invites_controller.rb
pending_accounts_controller.rb
relays_controller.rb
report_notes_controller.rb
reported_statuses_controller.rb
reports_controller.rb
resets_controller.rb
roles_controller.rb
settings_controller.rb
statuses_controller.rb
subscriptions_controller.rb
tags_controller.rb
two_factor_authentications_controller.rb
warning_presets_controller.rb
api
auth
concerns
oauth
settings
well_known
about_controller.rb
account_follow_controller.rb
account_unfollow_controller.rb
accounts_controller.rb
application_controller.rb
authorize_interactions_controller.rb
custom_css_controller.rb
directories_controller.rb
emojis_controller.rb
filters_controller.rb
follower_accounts_controller.rb
following_accounts_controller.rb
home_controller.rb
instance_actors_controller.rb
intents_controller.rb
invites_controller.rb
manifests_controller.rb
media_controller.rb
media_proxy_controller.rb
public_timelines_controller.rb
relationships_controller.rb
remote_follow_controller.rb
remote_interaction_controller.rb
shares_controller.rb
statuses_controller.rb
tags_controller.rb
helpers
javascript
lib
mailers
models
policies
presenters
serializers
services
validators
views
workers
bin
config
db
dist
lib
log
nanobox
public
spec
streaming
vendor
.buildpacks
.codeclimate.yml
.dockerignore
.editorconfig
.env.nanobox
.env.production.sample
.env.test
.env.vagrant
.eslintignore
.eslintrc.js
.foreman
.gitattributes
.gitignore
.haml-lint.yml
.nanoignore
.nvmrc
.profile
.rspec
.rubocop.yml
.ruby-version
.sass-lint.yml
.slugignore
.yarnclean
AUTHORS.md
Aptfile
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Capfile
Dockerfile
Gemfile
Gemfile.lock
LICENSE
Procfile
Procfile.dev
README.md
Rakefile
Vagrantfile
app.json
babel.config.js
boxfile.yml
config.ru
crowdin.yml
docker-compose.yml
package.json
postcss.config.js
priv-config
scalingo.json
yarn.lock
58 lines
2.5 KiB
Ruby
58 lines
2.5 KiB
Ruby
# frozen_string_literal: true
|
|
require 'sidekiq/api'
|
|
|
|
module Admin
|
|
class DashboardController < BaseController
|
|
def index
|
|
@users_count = User.count
|
|
@pending_users_count = User.pending.count
|
|
@registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0
|
|
@logins_week = Redis.current.pfcount("activity:logins:#{current_week}")
|
|
@interactions_week = Redis.current.get("activity:interactions:#{current_week}") || 0
|
|
@relay_enabled = Relay.enabled.exists?
|
|
@single_user_mode = Rails.configuration.x.single_user_mode
|
|
@registrations_enabled = Setting.registrations_mode != 'none'
|
|
@deletions_enabled = Setting.open_deletion
|
|
@invites_enabled = Setting.min_invite_role == 'user'
|
|
@search_enabled = Chewy.enabled?
|
|
@version = Mastodon::Version.to_s
|
|
@database_version = ActiveRecord::Base.connection.execute('SELECT VERSION()').first['version'].match(/\A(?:PostgreSQL |)([^\s]+).*\z/)[1]
|
|
@redis_version = redis_info['redis_version']
|
|
@reports_count = Report.unresolved.count
|
|
@queue_backlog = Sidekiq::Stats.new.enqueued
|
|
@recent_users = User.confirmed.recent.includes(:account).limit(8)
|
|
@database_size = ActiveRecord::Base.connection.execute('SELECT pg_database_size(current_database())').first['pg_database_size']
|
|
@redis_size = redis_info['used_memory']
|
|
@ldap_enabled = ENV['LDAP_ENABLED'] == 'true'
|
|
@cas_enabled = ENV['CAS_ENABLED'] == 'true'
|
|
@saml_enabled = ENV['SAML_ENABLED'] == 'true'
|
|
@pam_enabled = ENV['PAM_ENABLED'] == 'true'
|
|
@hidden_service = ENV['ALLOW_ACCESS_TO_HIDDEN_SERVICE'] == 'true'
|
|
@trending_hashtags = TrendingTags.get(10, filtered: false)
|
|
@pending_tags_count = Tag.pending_review.count
|
|
@authorized_fetch = authorized_fetch_mode?
|
|
@whitelist_enabled = whitelist_mode?
|
|
@profile_directory = Setting.profile_directory
|
|
@timeline_preview = Setting.timeline_preview
|
|
@spam_check_enabled = Setting.spam_check_enabled
|
|
@trends_enabled = Setting.trends
|
|
end
|
|
|
|
private
|
|
|
|
def current_week
|
|
@current_week ||= Time.now.utc.to_date.cweek
|
|
end
|
|
|
|
def redis_info
|
|
@redis_info ||= begin
|
|
if Redis.current.is_a?(Redis::Namespace)
|
|
Redis.current.redis.info
|
|
else
|
|
Redis.current.info
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|