You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
881 B

  1. # frozen_string_literal: true
  2. class InstancePresenter
  3. delegate(
  4. :closed_registrations_message,
  5. :site_contact_email,
  6. :open_registrations,
  7. :site_title,
  8. :site_description,
  9. :site_extended_description,
  10. :site_terms,
  11. to: Setting
  12. )
  13. def contact_account
  14. Account.find_local(Setting.site_contact_username)
  15. end
  16. def user_count
  17. Rails.cache.fetch('user_count') { User.confirmed.count }
  18. end
  19. def status_count
  20. Rails.cache.fetch('local_status_count') { Status.local.count }
  21. end
  22. def domain_count
  23. Rails.cache.fetch('distinct_domain_count') { Account.distinct.count(:domain) }
  24. end
  25. def version_number
  26. Mastodon::Version
  27. end
  28. def commit_hash
  29. current_release_file = Pathname.new('CURRENT_RELEASE').expand_path
  30. if current_release_file.file?
  31. IO.read(current_release_file)
  32. else
  33. ""
  34. end
  35. end
  36. end