Class: Sentiero::Web::DashboardApp
- Defined in:
- lib/sentiero/web/dashboard_app.rb
Constant Summary
Constants inherited from BaseApp
BaseApp::ASSETS_DIR, BaseApp::AUTH_WARNING_LOCK, BaseApp::CONTENT_TYPES, BaseApp::CSP_POLICY
Constants included from Escaping
Escaping::HTML_UNSAFE_IN_SCRIPT, Escaping::HTML_UNSAFE_IN_SCRIPT_PATTERN
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize ⇒ DashboardApp
constructor
A new instance of DashboardApp.
Methods inherited from BaseApp
reset_auth_warning!, warn_unauthenticated_once
Methods included from Formatting
#format_duration, #format_vital, #parse_browser, #parse_device
Methods included from Escaping
#escape_html, #escape_js_string, #escape_json
Constructor Details
#initialize ⇒ DashboardApp
Returns a new instance of DashboardApp.
10 11 12 13 |
# File 'lib/sentiero/web/dashboard_app.rb', line 10 def initialize super BaseApp.warn_unauthenticated_once end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/sentiero/web/dashboard_app.rb', line 15 def call(env) # Rack::Builder#map "/sentiero" leaves PATH_INFO empty (not "/") for a # request to the bare mount point; treat it as the index. path = env["PATH_INFO"] path = "/" if path.nil? || path.empty? method = env["REQUEST_METHOD"] # Static assets are served before auth: they carry no session data, and # the standalone AssetsApp endpoint serves the same files unauthenticated. if (asset_path = path[%r{\A/assets/(.+)\z}, 1]) return handle_asset(asset_path) end # Stable alias for the content-hashed recorder bundle, so pages outside # the Ruby helpers (static HTML) can hardcode one URL that survives # rebuilds. Sibling of the /events mount, so the recorder's # currentScript fallback derives eventsUrl correctly from it. return handle_recorder_alias if path == "/recorder.js" return unless (env) case path when "/" handle_index(env) when %r{\A/sessions/([^/]+)/windows/([^/]+)\z} sid, wid = $1, $2 guard(sid, wid) || (delete_request?(method, env) ? handle_delete_window(env, sid, wid) : handle_show(env, sid, wid)) when %r{\A/api/sessions/([^/]+)/windows/([^/]+)/events\z} sid, wid = $1, $2 guard(sid, wid) || handle_events_api(env, sid, wid) when "/sessions/bulk_delete" post_only(method) || handle_bulk_delete(env) when %r{\A/sessions/([^/]+)\z} sid = $1 # The delete branch keys off delete_request? (DELETE, or POST with # ?_method=delete), so the id guard nests inside the method dispatch # rather than using the get_only/post_only combinators. if method == "GET" guard(sid) || handle_session_redirect(env, sid) elsif delete_request?(method, env) guard(sid) || handle_delete(env, sid) else not_found end when %r{\A/custom-events(?:/.*)?\z} Sentiero::Web::MonitoringApp.new.call(env) when %r{\A/issues(?:/.*)?\z} Sentiero::Web::MonitoringApp.new.call(env) when %r{\A/analytics(?:/.*)?\z} Sentiero::Web::AnalyticsApp.new.call(env) else not_found end end |