From 958c78641e8adb2ebf6abb71c126622c0399866c Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 5 Oct 2021 13:29:18 -0700 Subject: [PATCH] Replaces redirect of /embed URLs to return content directly. (#1453) - Removes relative imports from embedded player, chat. - Replaces `Redirect` calls with `ServeFile` in `embed.go`. --- controllers/embed.go | 6 +++--- webroot/index-standalone-chat-readonly.html | 6 +++--- webroot/index-standalone-chat-readwrite.html | 6 +++--- webroot/index-video-only.html | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/controllers/embed.go b/controllers/embed.go index b42dfa1f7..bd8396997 100644 --- a/controllers/embed.go +++ b/controllers/embed.go @@ -6,15 +6,15 @@ import ( // GetChatEmbedreadwrite gets the embed for readwrite chat. func GetChatEmbedreadwrite(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/index-standalone-chat-readwrite.html", http.StatusTemporaryRedirect) + http.ServeFile(w, r, "webroot/index-standalone-chat-readwrite.html") } // GetChatEmbedreadonly gets the embed for readonly chat. func GetChatEmbedreadonly(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/index-standalone-chat-readonly.html", http.StatusTemporaryRedirect) + http.ServeFile(w, r, "webroot/index-standalone-chat-readonly.html") } // GetVideoEmbed gets the embed for video. func GetVideoEmbed(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/index-video-only.html", http.StatusTemporaryRedirect) + http.ServeFile(w, r, "webroot/index-video-only.html") } diff --git a/webroot/index-standalone-chat-readonly.html b/webroot/index-standalone-chat-readonly.html index 6e1834089..e1e9d4258 100644 --- a/webroot/index-standalone-chat-readonly.html +++ b/webroot/index-standalone-chat-readonly.html @@ -5,8 +5,8 @@ - - + + @@ -17,7 +17,7 @@ import htm from '/js/web_modules/htm.js'; const html = htm.bind(h); - import StandaloneChat from './js/app-standalone-chat.js'; + import StandaloneChat from '/js/app-standalone-chat.js'; render( html`<${StandaloneChat} readonly />`, document.getElementById("messages-only") ); diff --git a/webroot/index-standalone-chat-readwrite.html b/webroot/index-standalone-chat-readwrite.html index 5033316fb..159454cac 100644 --- a/webroot/index-standalone-chat-readwrite.html +++ b/webroot/index-standalone-chat-readwrite.html @@ -5,8 +5,8 @@ - - + + @@ -17,7 +17,7 @@ import htm from '/js/web_modules/htm.js'; const html = htm.bind(h); - import StandaloneChat from './js/app-standalone-chat.js'; + import StandaloneChat from '/js/app-standalone-chat.js'; render( html`<${StandaloneChat} />`, document.getElementById("messages-only") ); diff --git a/webroot/index-video-only.html b/webroot/index-video-only.html index 975291289..c02acd6e1 100644 --- a/webroot/index-video-only.html +++ b/webroot/index-video-only.html @@ -8,8 +8,8 @@ - - + + @@ -21,7 +21,7 @@ import htm from '/js/web_modules/htm.js'; const html = htm.bind(h); - import VideoOnly from './js/app-video-only.js'; + import VideoOnly from '/js/app-video-only.js'; render(html`<${VideoOnly} />`, document.getElementById("video-only"));