mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 14:11:16 +08:00
DEV: Apply syntax_tree formatting to app/*
This commit is contained in:
@ -1,26 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HighlightJsController < ApplicationController
|
||||
skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show]
|
||||
skip_before_action :preload_json,
|
||||
:redirect_to_login_if_required,
|
||||
:check_xhr,
|
||||
:verify_authenticity_token,
|
||||
only: [:show]
|
||||
|
||||
before_action :apply_cdn_headers, only: [:show]
|
||||
|
||||
def show
|
||||
|
||||
no_cookies
|
||||
|
||||
RailsMultisite::ConnectionManagement.with_hostname(params[:hostname]) do
|
||||
|
||||
current_version = HighlightJs.version(SiteSetting.highlighted_languages)
|
||||
|
||||
if current_version != params[:version]
|
||||
return redirect_to path(HighlightJs.path)
|
||||
end
|
||||
return redirect_to path(HighlightJs.path) if current_version != params[:version]
|
||||
|
||||
# note, this can be slightly optimised by caching the bundled file, it cuts down on N reads
|
||||
# our nginx config caches this so in practical terms it does not really matter and keeps
|
||||
# code simpler
|
||||
languages = SiteSetting.highlighted_languages.split('|')
|
||||
languages = SiteSetting.highlighted_languages.split("|")
|
||||
|
||||
highlight_js = HighlightJs.bundle(languages)
|
||||
|
||||
@ -28,7 +28,7 @@ class HighlightJsController < ApplicationController
|
||||
response.headers["Content-Length"] = highlight_js.bytesize.to_s
|
||||
immutable_for 1.year
|
||||
|
||||
render plain: highlight_js, disposition: nil, content_type: 'application/javascript'
|
||||
render plain: highlight_js, disposition: nil, content_type: "application/javascript"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user