diff --git a/src/invidious/jsonify/api_v1/common.cr b/src/invidious/jsonify/api_v1/common.cr
index 64b06465..e5095abb 100644
--- a/src/invidious/jsonify/api_v1/common.cr
+++ b/src/invidious/jsonify/api_v1/common.cr
@@ -8,7 +8,7 @@ module Invidious::JSONify::APIv1
build_thumbnails(id).each do |thumbnail|
json.object do
json.field "quality", thumbnail[:name]
- json.field "url", "#{thumbnail[:host]}/vi/#{id}/#{thumbnail["url"]}.jpg"
+ json.field "url", "/vi/#{id}/#{thumbnail["url"]}.jpg"
json.field "width", thumbnail[:width]
json.field "height", thumbnail[:height]
end
diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr
index 729a40b8..4e2a1b50 100644
--- a/src/invidious/routes/api/manifest.cr
+++ b/src/invidious/routes/api/manifest.cr
@@ -224,7 +224,7 @@ module Invidious::Routes::API::Manifest
if !proxy.empty?
"#{proxy}/videoplayback?#{raw_params}"
else
- "#{HOST_URL}/videoplayback?#{raw_params}"
+ "#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
end
end
end
@@ -248,7 +248,7 @@ module Invidious::Routes::API::Manifest
manifest = response.body
if local
- manifest = manifest.gsub("https://www.youtube.com", HOST_URL)
+ manifest = manifest.gsub("https://www.youtube.com", env.request.headers["Host"])
manifest = manifest.gsub("index.m3u8", "index.m3u8?local=true")
end
diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.cr
index a35d2f2b..738a43de 100644
--- a/src/invidious/routes/api/v1/authenticated.cr
+++ b/src/invidious/routes/api/v1/authenticated.cr
@@ -226,7 +226,7 @@ module Invidious::Routes::API::V1::Authenticated
end
playlist = create_playlist(title, privacy, user)
- env.response.headers["Location"] = "#{HOST_URL}/api/v1/auth/playlists/#{playlist.id}"
+ env.response.headers["Location"] = "#{env.request.headers["Host"]}/api/v1/auth/playlists/#{playlist.id}"
env.response.status_code = 201
{
"title" => title,
diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr
index a84e44bc..4400b8ea 100644
--- a/src/invidious/views/channel.ecr
+++ b/src/invidious/views/channel.ecr
@@ -2,6 +2,7 @@
ucid = channel.ucid
author = HTML.escape(channel.author)
channel_profile_pic = URI.parse(channel.author_thumbnail).request_target
+ host = env.request.headers["Host"]
relative_url =
case selected_tab
@@ -28,15 +29,15 @@
<%- if selected_tab.videos? -%>
-
+
-
+
-
+
-
+
<%- end -%>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index e77b0b14..9f9c171c 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -1,6 +1,7 @@
<% ucid = video.ucid %>
<% title = HTML.escape(video.title) %>
<% author = HTML.escape(video.author) %>
+<% host = env.request.headers["Host"] %>
<% content_for "header" do %>
@@ -8,9 +9,9 @@
">
-
+
-
+
@@ -21,11 +22,11 @@
-
+
-
-
+
+