Invidious is an alternative front-end to YouTube
Add cookie sharing with subdomains
Omar Rothbf867c3fcf34
diff --git a/src/invidious.cr b/src/invidious.crindex 8c558ccf..87480e12 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -846,8 +846,13 @@ post "/login" do |env|secure = falseend- env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.now + 2.years,- secure: secure, http_only: true)+ if CONFIG.domain+ env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", domain: ".#{CONFIG.domain}", value: sid, expires: Time.now + 2.years,+ secure: secure, http_only: true)+ else+ env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.now + 2.years,+ secure: secure, http_only: true)+ endelseerror_message = "Invalid username or password"next templated "error"@@ -891,8 +896,13 @@ post "/login" do |env|secure = falseend- env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.now + 2.years,- secure: secure, http_only: true)+ if CONFIG.domain+ env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", domain: ".#{CONFIG.domain}", value: sid, expires: Time.now + 2.years,+ secure: secure, http_only: true)+ else+ env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.now + 2.years,+ secure: secure, http_only: true)+ endendenv.redirect refererdiff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.crindex 92a2e1b1..aa9c0433 100644--- a/src/invidious/helpers/helpers.cr+++ b/src/invidious/helpers/helpers.cr@@ -16,6 +16,7 @@ class Confighmac_key: String?,full_refresh: Bool,geo_bypass: Bool,+ domain: String?,})end