Class: I18nProofreading::WidgetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- I18nProofreading::WidgetsController
- Defined in:
- app/controllers/i18n_proofreading/widgets_controller.rb
Overview
Serves the widget JavaScript as a plain same-origin script. Same-origin
matters: under a script-src 'self' (or nonce-based) CSP, an external
script from the app's own host is always allowed — including when Turbo
Drive swaps the
Instance Method Summary collapse
-
#show ⇒ Object
The script URL carries a content fingerprint (?v=
), so stale code is structurally impossible: new code means a new URL.
Instance Method Details
#show ⇒ Object
The script URL carries a content fingerprint (?v=
19 20 21 22 23 24 |
# File 'app/controllers/i18n_proofreading/widgets_controller.rb', line 19 def show expires_in 1.year, public: true if params[:v] == Widget.fingerprint return unless stale?(etag: [I18nProofreading::VERSION, Widget.fingerprint]) render plain: Widget.javascript, content_type: 'text/javascript' end |