File tree 6 files changed +23
-4
lines changed
6 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 18
18
get "/live" do
19
19
content_type :html
20
20
SecureHeaders . use_secure_headers_override ( request , :live )
21
- send_file File . join ( settings . public_folder , 'live.html' )
21
+ send_file File . join ( settings . public_folder , "live.html" )
22
+ end
23
+
24
+ get "/countdown" do
25
+ content_type :html
26
+ SecureHeaders . use_secure_headers_override ( request , :countdown )
27
+ send_file File . join ( settings . public_folder , "countdown.html" )
22
28
end
23
29
24
30
get "/go" do
Original file line number Diff line number Diff line change 11
11
configure do
12
12
use Rack ::SslEnforcer , only_hosts : ( ENV [ "SSL_ENFORCER_HOST" ] || /\. herokuapp\. com$/ )
13
13
use SecureHeaders ::Middleware
14
+ set :protection , :except => [ :frame_options ] # Disable things that secure_headers handles
14
15
set :erb , trim : "-"
15
16
# Look up Rack::Mime::MIME_TYPES to see rack defaults
16
17
mime_type :opensearch , "application/opensearchdescription+xml"
Original file line number Diff line number Diff line change 57
57
end
58
58
end
59
59
60
- # Live page
61
60
SecureHeaders ::Configuration . override ( :live ) do |config |
62
61
config . csp . merge! ( {
63
62
# "meta" values. these will shape the header, but the values are not included in the header.
72
71
connect_src : %w( graph.facebook.com www.googleapis.com api.twitch.tv ) ,
73
72
} )
74
73
end
74
+
75
+ SecureHeaders ::Configuration . override ( :countdown ) do |config |
76
+ config . x_frame_options = SecureHeaders ::OPT_OUT
77
+ config . csp . merge! ( {
78
+ # "meta" values. these will shape the header, but the values are not included in the header.
79
+ report_only : false ,
80
+ preserve_schemes : true ,
81
+ # directive values: these values will directly translate into source directives
82
+ default_src : %w( 'none' ) ,
83
+ style_src : %w( 'unsafe-inline' ) ,
84
+ script_src : %w( 'unsafe-inline' ) ,
85
+ } )
86
+ end
Original file line number Diff line number Diff line change 29
29
}
30
30
31
31
function init ( ) {
32
- // Parse query string, e.g: countdown.html ?date=2018-09-27T03:30:00Z
32
+ // Parse query string, e.g: / countdown?date=2018-09-27T03:30:00Z
33
33
var params = { } ;
34
34
window . location . search . substr ( 1 ) . split ( "&" ) . forEach ( function ( param ) {
35
35
param = param . split ( "=" ) ;
Original file line number Diff line number Diff line change 27
27
title += " (scheduled for #{ updated . readable ( @tz ) } )"
28
28
content_extra = <<~EOF
29
29
<p>Live broadcast scheduled to start at: #{ updated . readable ( @tz ) } .</p>
30
- <iframe width="640" height="50" src="#{ request . root_url } /countdown.html ?date=#{ updated } " frameborder="0" scrolling="yes" referrerpolicy="no-referrer"></iframe>
30
+ <iframe width="640" height="50" src="#{ request . root_url } /countdown?date=#{ updated } " frameborder="0" scrolling="yes" referrerpolicy="no-referrer"></iframe>
31
31
EOF
32
32
end
33
33
end
You can’t perform that action at this time.
0 commit comments