summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-03-03 11:55:14 -0600
committerOmar Roth <omarroth@hotmail.com>2019-03-03 12:02:15 -0600
commit17cf0772fb9ab483391942a33fec6e71aa25128d (patch)
tree3eb8bceafe7377e3c4ac8841d077305cbee66a64
parent66605196ad9f2a7ebc733c946f7b1c14a7b61db4 (diff)
downloadinvidious-17cf0772fb9ab483391942a33fec6e71aa25128d.tar.gz
invidious-17cf0772fb9ab483391942a33fec6e71aa25128d.tar.bz2
invidious-17cf0772fb9ab483391942a33fec6e71aa25128d.zip
Set domain to be nil by default
-rw-r--r--config/config.yml2
-rw-r--r--src/invidious.cr4
-rw-r--r--src/invidious/helpers/utils.cr7
3 files changed, 9 insertions, 4 deletions
diff --git a/config/config.yml b/config/config.yml
index f981a398..c6f8420a 100644
--- a/config/config.yml
+++ b/config/config.yml
@@ -10,4 +10,4 @@ db:
dbname: invidious
full_refresh: false
https_only: false
-domain: invidio.us
+domain:
diff --git a/src/invidious.cr b/src/invidious.cr
index d9b88a0c..88f258c6 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -1056,7 +1056,7 @@ post "/login" do |env|
end
if config.domain
- env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", domain: ".#{config.domain}", value: sid, expires: Time.now + 2.years,
+ 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,
@@ -1118,7 +1118,7 @@ post "/login" do |env|
end
if config.domain
- env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", domain: ".#{config.domain}", value: sid, expires: Time.now + 2.years,
+ 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,
diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr
index f5838622..5ccc1009 100644
--- a/src/invidious/helpers/utils.cr
+++ b/src/invidious/helpers/utils.cr
@@ -200,7 +200,12 @@ def make_host_url(ssl, host)
scheme = "http://"
end
- return "#{scheme}#{host}"
+ if host
+ host = host.lchop(".")
+ return "#{scheme}#{host}"
+ else
+ return ""
+ end
end
def get_referer(env, fallback = "/")