Fix project isolation: Make loadChatHistory respect active project sessions
- 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>
This commit is contained in:
43
test_middleware.js
Normal file
43
test_middleware.js
Normal file
@@ -0,0 +1,43 @@
|
||||
// Test if the middleware pattern works
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
let middlewareCalled = false;
|
||||
let sendFileCalled = false;
|
||||
|
||||
// Test middleware
|
||||
app.use((req, res, next) => {
|
||||
middlewareCalled = true;
|
||||
const originalSendFile = res.sendFile.bind(res);
|
||||
|
||||
res.sendFile = function(...args) {
|
||||
sendFileCalled = true;
|
||||
console.log('Custom sendFile called with args:', args);
|
||||
return originalSendFile(...args);
|
||||
};
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
// Test route
|
||||
app.get('/test', (req, res) => {
|
||||
res.sendFile('/home/uroma/obsidian-web-interface/public/index.html');
|
||||
});
|
||||
|
||||
// Start server
|
||||
const server = app.listen(3011, () => {
|
||||
console.log('Test server listening on port 3011');
|
||||
|
||||
// Make a test request
|
||||
const http = require('http');
|
||||
http.get('http://localhost:3011/test', (res) => {
|
||||
let data = '';
|
||||
res.on('data', chunk => data += chunk);
|
||||
res.on('end', () => {
|
||||
console.log('Response received, length:', data.length);
|
||||
console.log('Middleware called:', middlewareCalled);
|
||||
console.log('sendFile called:', sendFileCalled);
|
||||
server.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user