Add storage-backed story history

This commit is contained in:
2026-05-15 21:58:30 +02:00
parent f2e786d5bc
commit 42582352d6
16 changed files with 1048 additions and 113 deletions
+11 -1
View File
@@ -32,7 +32,7 @@ class TTSFactoryModule extends BaseModule {
this.db = null; // Will hold the DB connection
this.dbName = 'ttsAudioCacheDB';
this.storeName = 'audioCacheStore';
this.dbVersion = 1;
this.dbVersion = 2;
this.currentCacheSize = 0; // Track current size in bytes
this.maxCacheSizeBytes = 100 * 1024 * 1024; // 100 MB by default
this.cacheInitialized = false;
@@ -1537,6 +1537,16 @@ class TTSFactoryModule extends BaseModule {
console.log("Created 'size' index.");
}
}
if (!db.objectStoreNames.contains('storyHistoryStore')) {
const historyStore = db.createObjectStore('storyHistoryStore', { keyPath: 'key' });
historyStore.createIndex('gameId', 'gameId', { unique: false });
historyStore.createIndex('gameOrder', ['gameId', 'blockId'], { unique: true });
console.log("Object store 'storyHistoryStore' created.");
}
if (!db.objectStoreNames.contains('storySaveStore')) {
db.createObjectStore('storySaveStore', { keyPath: 'slot' });
console.log("Object store 'storySaveStore' created.");
}
};
});
}