diff --git a/equipment/equipment.js b/equipment/equipment.js index 23129dc..2ccc386 100644 --- a/equipment/equipment.js +++ b/equipment/equipment.js @@ -4,6 +4,17 @@ fetch("../header.html") const headerContainer = document.getElementById("header-container"); headerContainer.innerHTML = html; +const logoutForm = document.getElementById("logout-form"); +if (logoutForm && typeof CONFIG !== 'undefined') { + const apiBase = CONFIG.API_BASE_URL.replace(/\/$/, ""); + logoutForm.action = apiBase + "/api/v1/spfn/logout"; + + const originInput = document.getElementById("logout_frontend_origin"); + if (originInput) { + originInput.value = window.location.origin; + } +} + const friendButton = headerContainer.querySelector('.menu-item.equipment'); if (friendButton) { friendButton.classList.add('active'); diff --git a/equipment/index.html b/equipment/index.html index f5dd2f3..5d0cd2f 100644 --- a/equipment/index.html +++ b/equipment/index.html @@ -6,6 +6,7 @@ \ +
diff --git a/friend_list/friendlist.js b/friend_list/friendlist.js index cb16550..ee2e671 100644 --- a/friend_list/friendlist.js +++ b/friend_list/friendlist.js @@ -4,6 +4,17 @@ fetch("../header.html") const headerContainer = document.getElementById("header-container"); headerContainer.innerHTML = html; +const logoutForm = document.getElementById("logout-form"); +if (logoutForm && typeof CONFIG !== 'undefined') { + const apiBase = CONFIG.API_BASE_URL.replace(/\/$/, ""); + logoutForm.action = apiBase + "/api/v1/spfn/logout"; + + const originInput = document.getElementById("logout_frontend_origin"); + if (originInput) { + originInput.value = window.location.origin; + } +} + const friendButton = headerContainer.querySelector('.menu-item.friend'); if (friendButton) { friendButton.classList.add('active'); diff --git a/friend_list/index.html b/friend_list/index.html index e2a27bc..d89e397 100644 --- a/friend_list/index.html +++ b/friend_list/index.html @@ -6,6 +6,7 @@ +
diff --git a/header.html b/header.html index 42371f1..32606e4 100644 --- a/header.html +++ b/header.html @@ -1,73 +1,79 @@ - - + + + + + \ No newline at end of file diff --git a/logout.js b/logout.js new file mode 100644 index 0000000..ae68379 --- /dev/null +++ b/logout.js @@ -0,0 +1,21 @@ +$(document).ready(function () { + const form = $("#logout-form"); + if (typeof CONFIG === 'undefined') { + alert("CRITICAL ERROR: config.js not loaded before logout.js"); + return; + } + + const apiBase = CONFIG.API_BASE_URL; + const targetAction = apiBase.replace(/\/$/, "") + "/spfn/logout"; + $("#logout_frontend_origin").val(window.location.origin); + form.attr("action", targetAction); + + console.log("Form action set to: " + targetAction); + + form.submit(function(e) { + alert("Submitting to: " + $(this).attr("action")); + + const submitBtn = $(":submit", this); + submitBtn.prop("disabled", true).css("opacity", "0.5"); + }); +}); \ No newline at end of file diff --git a/ranking/index.html b/ranking/index.html index 982d22a..a0623d9 100644 --- a/ranking/index.html +++ b/ranking/index.html @@ -6,6 +6,7 @@ +
diff --git a/ranking/rank.js b/ranking/rank.js index 155a8d3..0d61b95 100644 --- a/ranking/rank.js +++ b/ranking/rank.js @@ -4,6 +4,17 @@ fetch("../header.html") const headerContainer = document.getElementById("header-container"); headerContainer.innerHTML = html; +const logoutForm = document.getElementById("logout-form"); +if (logoutForm && typeof CONFIG !== 'undefined') { + const apiBase = CONFIG.API_BASE_URL.replace(/\/$/, ""); + logoutForm.action = apiBase + "/api/v1/spfn/logout"; + + const originInput = document.getElementById("logout_frontend_origin"); + if (originInput) { + originInput.value = window.location.origin; + } +} + const friendButton = headerContainer.querySelector('.menu-item.rank'); if (friendButton) { friendButton.classList.add('active'); diff --git a/stages/index.html b/stages/index.html index 20f1a7c..271e80f 100644 --- a/stages/index.html +++ b/stages/index.html @@ -6,6 +6,7 @@ + @@ -40,12 +41,24 @@ -