Compare commits

...

1 Commits

Author SHA1 Message Date
Alexander Whitestone
a82ea5a375 fix: #1536 - Portal hot-reload from portals.json
Some checks failed
CI / test (pull_request) Failing after 1m31s
CI / validate (pull_request) Failing after 1m34s
Review Approval Gate / verify-review (pull_request) Successful in 10s
2026-04-14 23:35:49 -04:00

27
app.js
View File

@@ -735,6 +735,33 @@ async function init() {
addChatMessage('error', 'Portal registry offline. Check logs.');
}
// Hot-reload portals.json every 5 seconds
let lastPortalHash = '';
setInterval(async () => {
try {
const response = await fetch('./portals.json?' + Date.now());
const text = await response.text();
const hash = text.length + '-' + text.slice(0, 100);
if (hash !== lastPortalHash && lastPortalHash !== '') {
console.log('[Portal Hot-Reload] portals.json changed, reloading...');
const portalData = JSON.parse(text);
// Remove existing portals from scene
portals.forEach(p => scene.remove(p));
portals.length = 0;
// Create new portals
createPortals(portalData);
addChatMessage('system', `Portals hot-reloaded: ${portalData.length} portals active`);
}
lastPortalHash = hash;
} catch (e) {
// Silent fail - file might not be available
}
}, 5000);
// Load Vision Points
try {
const response = await fetch('./vision.json');