chore: remove unused code
This commit is contained in:
parent
e6ce48723f
commit
ea192308d9
65
app.js
65
app.js
@ -121,71 +121,6 @@ const processJsonOutput = (data, options = { sanitize: true, replaceKeys: true }
|
||||
return processedData;
|
||||
};
|
||||
|
||||
/*
|
||||
// Combined function to sanitize and replace keys
|
||||
const processJsonOutput = (data, options = { sanitize: true, replaceKeys: true }) => {
|
||||
// Create a deep copy of the data to avoid reference issues
|
||||
let processedData = JSON.parse(JSON.stringify(data));
|
||||
|
||||
// Apply sanitization if needed
|
||||
if (options.sanitize) {
|
||||
processedData = sanitizeJsonOutput(processedData);
|
||||
}
|
||||
|
||||
// Apply key replacement if needed - make sure this is correctly receiving the option
|
||||
if (options.replaceKeys) {
|
||||
processedData = replaceJsonKeys(processedData);
|
||||
}
|
||||
|
||||
return processedData;
|
||||
}; */
|
||||
|
||||
/*
|
||||
// Improved token management with auto-refresh
|
||||
const tokenManager = {
|
||||
tokens: new Map(),
|
||||
|
||||
async getValidToken(ssoToken) {
|
||||
// Check if we have a stored token and if it's still valid
|
||||
const storedToken = this.tokens.get(ssoToken);
|
||||
const currentTime = Date.now();
|
||||
|
||||
if (storedToken && (currentTime - storedToken.timestamp < 1800000)) { // 30 minutes expiry
|
||||
console.log(`Attempting to validate token for SSO: ${ssoToken.substring(0, 5)}...`);
|
||||
console.log("Using cached token");
|
||||
return storedToken.token;
|
||||
}
|
||||
|
||||
// We need to login and get a new token
|
||||
try {
|
||||
console.log(`Attempting to login with SSO token: ${ssoToken.substring(0, 5)}...`);
|
||||
console.log(`Current active sessions: ${this.activeSessions.size}`);
|
||||
const loginResult = await Promise.race([
|
||||
API.login(ssoToken),
|
||||
timeoutPromise(10000), // 10 second timeout
|
||||
]);
|
||||
|
||||
// Store the new token with timestamp
|
||||
this.tokens.set(ssoToken, {
|
||||
token: loginResult,
|
||||
timestamp: currentTime
|
||||
});
|
||||
|
||||
console.log(`Authentication successful - Token: ${loginResult.substring(0, 5)}...`);
|
||||
console.log(`Token cached at: ${new Date().toISOString()}`);
|
||||
return loginResult;
|
||||
} catch (error) {
|
||||
console.error("Authentication failed:", error);
|
||||
throw new Error("Failed to authenticate with SSO token");
|
||||
}
|
||||
},
|
||||
|
||||
invalidateToken(ssoToken) {
|
||||
this.tokens.delete(ssoToken);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
// Store active sessions to avoid repeated logins
|
||||
const activeSessions = new Map();
|
||||
|
||||
|
@ -370,40 +370,6 @@ function displayError(message) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function addEnterKeyListeners() {
|
||||
document.getElementById("ssoToken").addEventListener("keypress", function(event) {
|
||||
if (event.key === "Enter") {
|
||||
triggerActiveTabButton();
|
||||
}
|
||||
});
|
||||
document.getElementById("username").addEventListener("keypress", function(event) {
|
||||
if (event.key === "Enter") {
|
||||
triggerActiveTabButton();
|
||||
}
|
||||
});
|
||||
document.getElementById("matchUsername").addEventListener("keypress", function(event) {
|
||||
if (event.key === "Enter") {
|
||||
document.getElementById("fetchMatches").click();
|
||||
}
|
||||
});
|
||||
document.getElementById("matchId").addEventListener("keypress", function(event) {
|
||||
if (event.key === "Enter") {
|
||||
document.getElementById("fetchMatchInfo").click();
|
||||
}
|
||||
});
|
||||
document.getElementById("userUsername").addEventListener("keypress", function(event) {
|
||||
if (event.key === "Enter") {
|
||||
document.getElementById("fetchUserInfo").click();
|
||||
}
|
||||
});
|
||||
document.getElementById("searchUsername").addEventListener("keypress", function(event) {
|
||||
if (event.key === "Enter") {
|
||||
document.getElementById("fuzzySearch").click();
|
||||
}
|
||||
});
|
||||
} */
|
||||
|
||||
function addEnterKeyListeners() {
|
||||
// Use event delegation for handling Enter key press
|
||||
document.addEventListener("keypress", function(event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user