|
|
@ -27,7 +27,6 @@ CONFIG = Config.from_yaml(File.read("config/config.yml"))
|
|
|
|
|
|
|
|
|
|
|
|
pool_size = CONFIG.pool_size
|
|
|
|
pool_size = CONFIG.pool_size
|
|
|
|
threads = CONFIG.threads
|
|
|
|
threads = CONFIG.threads
|
|
|
|
redirect = CONFIG.redirect
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Kemal.config.extra_options do |parser|
|
|
|
|
Kemal.config.extra_options do |parser|
|
|
|
|
parser.banner = "Usage: invidious [arguments]"
|
|
|
|
parser.banner = "Usage: invidious [arguments]"
|
|
|
@ -47,16 +46,6 @@ Kemal.config.extra_options do |parser|
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
parser.on("-r REDIRECT", "--redirect=BOOL", "Whether insecure requests should be forced to HTTPS, requires -s (default #{redirect})") do |boolean|
|
|
|
|
|
|
|
|
if boolean == "true"
|
|
|
|
|
|
|
|
redirect = true
|
|
|
|
|
|
|
|
elsif boolean == "false"
|
|
|
|
|
|
|
|
redirect = false
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
puts "REDIRECT must be 'true' or 'false'"
|
|
|
|
|
|
|
|
exit
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
Kemal::CLI.new
|
|
|
|
Kemal::CLI.new
|
|
|
@ -537,8 +526,8 @@ error 500 do |env|
|
|
|
|
templated "error"
|
|
|
|
templated "error"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Add redirect if SSL is enabled and redirect is enabled
|
|
|
|
# Add redirect if SSL is enabled
|
|
|
|
if Kemal.config.ssl && redirect
|
|
|
|
if Kemal.config.ssl
|
|
|
|
spawn do
|
|
|
|
spawn do
|
|
|
|
server = HTTP::Server.new("0.0.0.0", 80) do |context|
|
|
|
|
server = HTTP::Server.new("0.0.0.0", 80) do |context|
|
|
|
|
redirect_url = "https://#{context.request.host}#{context.request.path}"
|
|
|
|
redirect_url = "https://#{context.request.host}#{context.request.path}"
|
|
|
|