diff --git a/autoredirect.js b/autoredirect.js
new file mode 100644
index 0000000..81520ef
--- /dev/null
+++ b/autoredirect.js
@@ -0,0 +1,49 @@
+document.addEventListener("DOMContentLoaded", function () {
+ const apiBase = CONFIG.API_BASE_URL;
+ const friendListUrl = "/friend_list/index.html";
+
+ async function checkExistingSession() {
+ try {
+ const response = await fetch(`${apiBase}/api/v1/users/me`, {
+ method: 'GET',
+ credentials: 'include'
+ });
+
+ if (response.ok) {
+ renderSeamlessPage();
+ } else {
+ window.location.href = "/sign_in";
+ }
+ } catch (err) {
+ console.error("Auth check failed:", err);
+ window.location.href = "/sign_in";
+ }
+ }
+
+ async function renderSeamlessPage() {
+ try {
+ const res = await fetch(friendListUrl);
+ if (!res.ok) throw new Error("Failed to fetch friend_list/index.html");
+ let html = await res.text();
+ html = html.replace(/src="\.\.\//g, 'src="/');
+ html = html.replace(/href="\.\.\//g, 'href="/');
+ const baseTag = `
If you are not redirected automatically, click here.
- - + + + \ No newline at end of file diff --git a/users/auth/splatfestival/js/base_e42dadd1.js b/users/auth/splatfestival/js/base_e42dadd1.js index 689f34f..78d3bfc 100644 --- a/users/auth/splatfestival/js/base_e42dadd1.js +++ b/users/auth/splatfestival/js/base_e42dadd1.js @@ -1,3 +1,5 @@ +//TODO: Migrate to jQuery 4.0, currently left unchanged as of now to avoid breaking changes + /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL=jquery.min.map */