- 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>
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const BUILD_TIMESTAMP = Date.now();
|
|
const ASSET_VERSION = "v=" + BUILD_TIMESTAMP;
|
|
|
|
console.log('[CACHE-BUSTING] Build timestamp:', BUILD_TIMESTAMP);
|
|
console.log('[CACHE-BUSTING] Scanning for HTML files...');
|
|
|
|
const htmlFiles = [
|
|
'/home/uroma/obsidian-web-interface/public/index.html',
|
|
'/home/uroma/obsidian-web-interface/public/claude-ide/index.html',
|
|
'/home/uroma/obsidian-web-interface/public/claude-landing.html',
|
|
'/home/uroma/obsidian-web-interface/public/projects.html'
|
|
];
|
|
|
|
let updatedCount = 0;
|
|
|
|
htmlFiles.forEach(filePath => {
|
|
if (!fs.existsSync(filePath)) {
|
|
console.log('[SKIP] File not found:', filePath);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
let html = fs.readFileSync(filePath, 'utf8');
|
|
const originalLength = html.length;
|
|
|
|
html = html.replace(
|
|
/<script\s+src=(["'])(\/claude\/[^"']*\.(?:js|css))\1\s*>/g,
|
|
(match, quote, src) => {
|
|
const separator = src.includes('?') ? '&' : '?';
|
|
const cacheBustedSrc = src + separator + ASSET_VERSION;
|
|
return '<script src=' + quote + cacheBustedSrc + quote + '>';
|
|
}
|
|
);
|
|
|
|
if (html.length !== originalLength) {
|
|
fs.writeFileSync(filePath + '.backup', fs.readFileSync(filePath));
|
|
fs.writeFileSync(filePath, html);
|
|
updatedCount++;
|
|
console.log('[UPDATE]', path.basename(filePath), '-', ASSET_VERSION);
|
|
}
|
|
} catch (err) {
|
|
console.error('[ERROR] Failed to update', filePath, ':', err.message);
|
|
}
|
|
});
|
|
|
|
console.log('\n[DONE] Updated', updatedCount, 'HTML files with cache-busting');
|