OAuth enabled but no valid token found. Starting authentication...

Found expired OAuth token, attempting refresh...
Token refresh successful
# CHANGES

- Removed macOS quarantine label clearing requirement from README 🎉
- Added smart caching for GitHub user profile fetching 🚀
- Enhanced leaderboard with real-time ranking notifications and improvements 📊
- Added personal best tracking for longest run achievements 🏆
- Improved markdown image rendering with better display properties 🖼️
- Added privacy note for email addresses in registration modal 🔒
- Fixed remote image toggle behavior in markdown preview 🔧
- Added quick action shortcut to open Maestro website 🌐
- Enhanced leaderboard API with ranking position feedback system 📈
- Improved GitHub analytics script performance with user caching 
This commit is contained in:
Pedram Amini
2025-12-13 02:14:29 -06:00
parent 7892b22582
commit 801bc6f9ac
8 changed files with 126 additions and 18 deletions

View File

@@ -586,24 +586,48 @@ async function main() {
uniqueUsers.join('\n')
);
// Optionally fetch user details
// Optionally fetch user details (with caching)
let userDetails = null;
if (fetchDetails) {
console.log(`\nFetching details for ${uniqueUsers.length} users (this may take a while)...`);
userDetails = {};
for (let i = 0; i < uniqueUsers.length; i++) {
const username = uniqueUsers[i];
process.stdout.write(` [${i + 1}/${uniqueUsers.length}] ${username}...`);
userDetails[username] = fetchUserDetails(username);
console.log(' done');
// Rate limiting - GitHub allows 5000 requests/hour for authenticated users
if (i > 0 && i % 50 === 0) {
console.log(' Pausing for rate limiting...');
await new Promise(r => setTimeout(r, 2000));
// Load existing cached user details
const cacheFile = path.join(OUTPUT_DIR, 'user_details.json');
let cachedDetails = {};
if (fs.existsSync(cacheFile)) {
try {
cachedDetails = JSON.parse(fs.readFileSync(cacheFile, 'utf-8'));
console.log(`\nLoaded ${Object.keys(cachedDetails).length} cached user profiles`);
} catch (e) {
console.log('\nCould not load cache, starting fresh');
}
}
// Determine which users need fetching
const usersToFetch = uniqueUsers.filter(u => !cachedDetails[u]);
const cachedUsers = uniqueUsers.filter(u => cachedDetails[u]);
console.log(` ${cachedUsers.length} users already cached`);
console.log(` ${usersToFetch.length} users need fetching`);
userDetails = { ...cachedDetails };
if (usersToFetch.length > 0) {
console.log(`\nFetching details for ${usersToFetch.length} new users...`);
for (let i = 0; i < usersToFetch.length; i++) {
const username = usersToFetch[i];
process.stdout.write(` [${i + 1}/${usersToFetch.length}] ${username}...`);
userDetails[username] = fetchUserDetails(username);
console.log(' done');
// Rate limiting - GitHub allows 5000 requests/hour for authenticated users
if (i > 0 && i % 50 === 0) {
console.log(' Pausing for rate limiting...');
await new Promise(r => setTimeout(r, 2000));
}
}
} else {
console.log('\nAll user details already cached, no API calls needed');
}
fs.writeFileSync(
path.join(OUTPUT_DIR, 'user_details.json'),
JSON.stringify(userDetails, null, 2)