2014-02-16 20:26:25 -05:00
|
|
|
require_dependency 'site_serializer'
|
|
|
|
|
|
|
|
class SiteController < ApplicationController
|
2016-02-13 13:29:53 -05:00
|
|
|
layout false
|
2017-08-31 00:06:56 -04:00
|
|
|
skip_before_action :preload_json, :check_xhr
|
|
|
|
skip_before_action :redirect_to_login_if_required, only: ['basic_info', 'statistics']
|
2015-05-20 03:12:16 -04:00
|
|
|
|
2015-03-04 23:49:03 -05:00
|
|
|
def site
|
|
|
|
render json: Site.json_for(guardian)
|
|
|
|
end
|
|
|
|
|
|
|
|
def settings
|
|
|
|
render json: SiteSetting.client_settings_json
|
|
|
|
end
|
|
|
|
|
|
|
|
def custom_html
|
|
|
|
render json: custom_html_json
|
|
|
|
end
|
|
|
|
|
|
|
|
def banner
|
|
|
|
render json: banner_json
|
|
|
|
end
|
|
|
|
|
|
|
|
def emoji
|
|
|
|
render json: custom_emoji
|
2014-02-16 20:26:25 -05:00
|
|
|
end
|
2016-08-12 03:10:08 -04:00
|
|
|
|
|
|
|
def basic_info
|
|
|
|
results = {
|
|
|
|
logo_url: UrlHelper.absolute(SiteSetting.logo_url),
|
|
|
|
logo_small_url: UrlHelper.absolute(SiteSetting.logo_small_url),
|
|
|
|
apple_touch_icon_url: UrlHelper.absolute(SiteSetting.apple_touch_icon_url),
|
|
|
|
favicon_url: UrlHelper.absolute(SiteSetting.favicon_url),
|
|
|
|
title: SiteSetting.title,
|
|
|
|
description: SiteSetting.site_description
|
|
|
|
}
|
2017-11-03 01:19:31 -04:00
|
|
|
results[:mobile_logo_url] = SiteSetting.mobile_logo_url.presence
|
2016-08-12 03:10:08 -04:00
|
|
|
|
2017-03-27 08:47:07 -04:00
|
|
|
DiscourseHub.stats_fetched_at = Time.zone.now if request.user_agent == "Discourse Hub"
|
2016-08-12 03:10:08 -04:00
|
|
|
|
|
|
|
# this info is always available cause it can be scraped from a 404 page
|
|
|
|
render json: results
|
|
|
|
end
|
2017-03-10 08:16:00 -05:00
|
|
|
|
|
|
|
def statistics
|
|
|
|
return redirect_to path('/') unless SiteSetting.share_anonymized_statistics?
|
|
|
|
render json: About.fetch_cached_stats
|
|
|
|
end
|
2014-02-21 12:31:54 -05:00
|
|
|
end
|