Refactor code for improved readability and consistency
- Updated CSRF middleware to enhance cookie value decoding. - Reformatted OAuth proxy token store initialization for better clarity. - Adjusted Challonge proxy router for consistent line breaks and readability. - Enhanced OAuth router error handling and response formatting. - Improved session router for better readability and consistency in fetching provider records. - Refactored OAuth token store to improve key derivation logging. - Cleaned up cookie options utility for better readability. - Enhanced Challonge client credentials composable for consistent API calls. - Streamlined OAuth composable for improved logging. - Refactored main.js for better readability in session initialization. - Improved Challonge v2.1 service error handling for better clarity. - Cleaned up API client utility for improved readability. - Enhanced ApiKeyManager.vue for better text formatting. - Refactored ChallongeTest.vue for improved readability in composable usage.
This commit is contained in:
@@ -27,7 +27,9 @@ function getEncryptionKey(sessionSecret) {
|
||||
}
|
||||
|
||||
// Dev fallback: derive from session secret (still better than plaintext)
|
||||
logger.warn('OAUTH_TOKEN_ENC_KEY not set; deriving key from SESSION_SECRET (dev only).');
|
||||
logger.warn(
|
||||
'OAUTH_TOKEN_ENC_KEY not set; deriving key from SESSION_SECRET (dev only).'
|
||||
);
|
||||
return crypto.createHash('sha256').update(sessionSecret).digest();
|
||||
}
|
||||
|
||||
@@ -149,7 +151,10 @@ export function createOAuthTokenStore({ sessionSecret }) {
|
||||
const ts = now();
|
||||
if (existing) {
|
||||
existing.lastSeenAt = ts;
|
||||
existing.expiresAt = Math.min(existing.createdAt + SEVEN_DAYS_MS, ts + ONE_DAY_MS);
|
||||
existing.expiresAt = Math.min(
|
||||
existing.createdAt + SEVEN_DAYS_MS,
|
||||
ts + ONE_DAY_MS
|
||||
);
|
||||
return existing;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user