mirror of
https://gitea.invidious.io/iv-org/invidious
synced 2024-12-28 09:41:09 +01:00
Add cookie sharing with subdomains
This commit is contained in:
parent
6db235becf
commit
bf867c3fcf
@ -846,8 +846,13 @@ post "/login" do |env|
|
|||||||
secure = false
|
secure = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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,
|
env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.now + 2.years,
|
||||||
secure: secure, http_only: true)
|
secure: secure, http_only: true)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
error_message = "Invalid username or password"
|
error_message = "Invalid username or password"
|
||||||
next templated "error"
|
next templated "error"
|
||||||
@ -891,9 +896,14 @@ post "/login" do |env|
|
|||||||
secure = false
|
secure = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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,
|
env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.now + 2.years,
|
||||||
secure: secure, http_only: true)
|
secure: secure, http_only: true)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
env.redirect referer
|
env.redirect referer
|
||||||
end
|
end
|
||||||
|
@ -16,6 +16,7 @@ class Config
|
|||||||
hmac_key: String?,
|
hmac_key: String?,
|
||||||
full_refresh: Bool,
|
full_refresh: Bool,
|
||||||
geo_bypass: Bool,
|
geo_bypass: Bool,
|
||||||
|
domain: String?,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user