Invidious is an alternative front-end to YouTube
Add X-Frame-Options, X-XSS-Protection, and X-Content-Type-Options
Omar Roth96234e509f57
diff --git a/src/invidious.cr b/src/invidious.crindex f38a1343..6a32736c 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -106,6 +106,9 @@ spawn doendbefore_all do |env|+ env.response.headers["X-XSS-Protection"] = "1; mode=block;"+ env.response.headers["X-Content-Type-Options"] = "nosniff"+# CSRFif Kemal.config.ssl || CONFIG.https_onlyhost = env.request.headers["Host"]?@@ -2945,6 +2948,7 @@ public_folder "assets"Kemal.config.powered_by_header = falseadd_handler FilteredCompressHandler.new+add_handler DenyFrame.newadd_context_storage_type(User)Kemal.rundiff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.crindex 39538950..2af65e74 100644--- a/src/invidious/helpers/helpers.cr+++ b/src/invidious/helpers/helpers.cr@@ -41,6 +41,17 @@ class FilteredCompressHandler < Kemal::Handlerendend+class DenyFrame < Kemal::Handler+ exclude ["/embed/*"]++ def call(env)+ return call_next env if exclude_match? env++ env.response.headers["X-Frame-Options"] = "sameorigin"+ call_next env+ end+end+def rank_videos(db, n, filter, url)top = [] of {Float64, String}