- Modified loadChatHistory() to check for active project before fetching all sessions - When active project exists, use project.sessions instead of fetching from API - Added detailed console logging to debug session filtering - This prevents ALL sessions from appearing in every project's sidebar Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
243 lines
8.7 KiB
HTML
243 lines
8.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Cache Buster - Force Reload</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
background: #0d0d0d;
|
|
color: #e0e0e0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
}
|
|
.container {
|
|
max-width: 600px;
|
|
text-align: center;
|
|
}
|
|
h1 {
|
|
font-size: 32px;
|
|
margin-bottom: 20px;
|
|
background: linear-gradient(135deg, #4a9eff 0%, #a78bfa 100%);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
}
|
|
.status {
|
|
padding: 20px;
|
|
background: #1a1a1a;
|
|
border: 1px solid #333;
|
|
border-radius: 12px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.status-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 10px 0;
|
|
border-bottom: 1px solid #252525;
|
|
}
|
|
.status-item:last-child { border-bottom: none; }
|
|
.label { color: #888; }
|
|
.value { color: #4a9eff; font-weight: 600; }
|
|
.btn {
|
|
padding: 15px 30px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
border: none;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
margin: 10px 5px;
|
|
}
|
|
.btn-primary {
|
|
background: linear-gradient(135deg, #4a9eff 0%, #a78bfa 100%);
|
|
color: white;
|
|
}
|
|
.btn-primary:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
|
|
}
|
|
.btn-danger {
|
|
background: #ff6b6b;
|
|
color: white;
|
|
}
|
|
.btn-danger:hover {
|
|
background: #fa5252;
|
|
}
|
|
.log {
|
|
background: #1a1a1a;
|
|
border: 1px solid #333;
|
|
border-radius: 8px;
|
|
padding: 15px;
|
|
text-align: left;
|
|
font-family: 'Monaco', 'Courier New', monospace;
|
|
font-size: 12px;
|
|
max-height: 200px;
|
|
overflow-y: auto;
|
|
margin-top: 20px;
|
|
}
|
|
.log-entry {
|
|
padding: 5px 0;
|
|
border-bottom: 1px solid #252525;
|
|
}
|
|
.log-entry.success { color: #51cf66; }
|
|
.log-entry.error { color: #ff6b6b; }
|
|
.log-entry.info { color: #4a9eff; }
|
|
.hidden { display: none; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🔄 Cache Buster</h1>
|
|
|
|
<div class="status">
|
|
<div class="status-item">
|
|
<span class="label">Status</span>
|
|
<span class="value" id="status">Initializing...</span>
|
|
</div>
|
|
<div class="status-item">
|
|
<span class="label">Cached Files</span>
|
|
<span class="value" id="cache-count">Checking...</span>
|
|
</div>
|
|
<div class="status-item">
|
|
<span class="label">JavaScript Version</span>
|
|
<span class="value" id="js-version">Checking...</span>
|
|
</div>
|
|
</div>
|
|
|
|
<button class="btn btn-primary" onclick="clearAllCaches()">
|
|
🗑️ Clear All Caches & Reload
|
|
</button>
|
|
<button class="btn btn-danger" onclick="forceHardReload()">
|
|
⚡ Force Hard Reload
|
|
</button>
|
|
|
|
<div id="log" class="log hidden"></div>
|
|
</div>
|
|
|
|
<script>
|
|
const CACHE_NAME = 'claude-ide-v1';
|
|
const logContainer = document.getElementById('log');
|
|
|
|
function log(message, type = 'info') {
|
|
const entry = document.createElement('div');
|
|
entry.className = `log-entry ${type}`;
|
|
entry.textContent = `[${new Date().toLocaleTimeString()}] ${message}`;
|
|
logContainer.appendChild(entry);
|
|
logContainer.scrollTop = logContainer.scrollHeight;
|
|
logContainer.classList.remove('hidden');
|
|
console.log(`[CacheBuster] ${message}`);
|
|
}
|
|
|
|
async function checkCacheStatus() {
|
|
document.getElementById('status').textContent = 'Checking cache...';
|
|
|
|
// Check if caches API is available
|
|
if ('caches' in window) {
|
|
const cacheNames = await caches.keys();
|
|
document.getElementById('cache-count').textContent = cacheNames.length;
|
|
|
|
if (cacheNames.length > 0) {
|
|
log(`Found ${cacheNames.length} cache(s): ${cacheNames.join(', ')}`, 'info');
|
|
}
|
|
} else {
|
|
document.getElementById('cache-count').textContent = 'N/A';
|
|
log('Cache API not available', 'info');
|
|
}
|
|
|
|
// Check which JS file is loaded
|
|
const scripts = document.querySelectorAll('script[src*="ide-build"]');
|
|
if (scripts.length > 0) {
|
|
document.getElementById('js-version').textContent = scripts[0].src;
|
|
} else {
|
|
document.getElementById('js-version').textContent = 'Not loaded';
|
|
}
|
|
|
|
document.getElementById('status').textContent = 'Ready to clear cache';
|
|
}
|
|
|
|
async function clearAllCaches() {
|
|
log('Starting cache clearance...', 'info');
|
|
document.getElementById('status').textContent = 'Clearing...';
|
|
|
|
try {
|
|
// Clear Service Worker caches
|
|
if ('caches' in window) {
|
|
const cacheNames = await caches.keys();
|
|
log(`Found ${cacheNames.length} cache(s) to delete`, 'info');
|
|
|
|
for (const cacheName of cacheNames) {
|
|
await caches.delete(cacheName);
|
|
log(`Deleted cache: ${cacheName}`, 'success');
|
|
}
|
|
}
|
|
|
|
// Unregister Service Workers
|
|
if ('serviceWorker' in navigator) {
|
|
const registrations = await navigator.serviceWorker.getRegistrations();
|
|
log(`Found ${registrations.length} service worker(s)`, 'info');
|
|
|
|
for (const registration of registrations) {
|
|
await registration.unregister();
|
|
log(`Unregistered service worker`, 'success');
|
|
}
|
|
}
|
|
|
|
// Clear localStorage
|
|
if (window.localStorage) {
|
|
const keys = Object.keys(localStorage);
|
|
log(`Clearing ${keys.length} localStorage items`, 'info');
|
|
localStorage.clear();
|
|
log('localStorage cleared', 'success');
|
|
}
|
|
|
|
// Clear sessionStorage
|
|
if (window.sessionStorage) {
|
|
sessionStorage.clear();
|
|
log('sessionStorage cleared', 'success');
|
|
}
|
|
|
|
log('All caches cleared successfully!', 'success');
|
|
document.getElementById('status').textContent = 'Cleared! Reloading...';
|
|
|
|
// Add timestamp to force reload
|
|
setTimeout(() => {
|
|
const url = new URL('/claude/ide', window.location.origin);
|
|
url.searchParams.set('_t', Date.now());
|
|
window.location.href = url.toString();
|
|
}, 1000);
|
|
|
|
} catch (error) {
|
|
log(`Error clearing cache: ${error.message}`, 'error');
|
|
document.getElementById('status').textContent = 'Error!';
|
|
}
|
|
}
|
|
|
|
function forceHardReload() {
|
|
log('Forcing hard reload with location.reload(true)...', 'info');
|
|
|
|
// Add cache-busting parameter
|
|
const url = new URL(window.location.href);
|
|
url.searchParams.set('_nocache', Date.now().toString());
|
|
url.searchParams.set('_force', 'true');
|
|
|
|
log(`Reloading with: ${url.search}`, 'info');
|
|
|
|
// Hard reload
|
|
window.location.href = url.toString();
|
|
}
|
|
|
|
// Auto-check on load
|
|
checkCacheStatus();
|
|
|
|
// Log current page info
|
|
log(`Current URL: ${window.location.href}`, 'info');
|
|
log(`User Agent: ${navigator.userAgent.substring(0, 50)}...`, 'info');
|
|
</script>
|
|
</body>
|
|
</html>
|