Finished implementing sign-in procedure for API/v3. Updated guards to V3 and started rewriting /chat too. UserData updating and multi-user support is TODO

This commit is contained in:
Noel Maróti
2026-11-27 22:07:32 +01:00
parent 086d27c9a4
commit 3ef5387b8d
13 changed files with 199 additions and 41 deletions

View File

@@ -6,7 +6,7 @@ import {DatabaseAPI} from '@chatenium/chatenium-sdk/storage/database';
providedIn: 'root'
})
export class IndexedDB {
private dbVersion = 3
private dbVersion = 4
private db: IDBDatabase | null = null
getApi(): DatabaseAPI {
@@ -30,12 +30,12 @@ export class IndexedDB {
request.onupgradeneeded = (e: IDBVersionChangeEvent) => {
const db = (e.target as IDBOpenDBRequest).result;
db.createObjectStore('sessions', { keyPath: 'id' })
db.createObjectStore('chats', { keyPath: 'id' })
db.createObjectStore('networks', { keyPath: 'id' })
db.createObjectStore('userData', { keyPath: 'id' })
db.createObjectStore('contacts', { keyPath: 'id' })
db.createObjectStore('cascades', { keyPath: 'id' })
db.createObjectStore('files', { keyPath: 'id' })
db.createObjectStore('messages', { keyPath: 'id' })
db.createObjectStore('networkmessages', { keyPath: 'id' })
db.createObjectStore('threadMessages', { keyPath: 'id' })
db.createObjectStore('pictures', { keyPath: 'id' })
}
@@ -123,7 +123,7 @@ export class IndexedDB {
});
}
get(storeName: string, key: string): Promise<string> {
get(storeName: string, key: string): Promise<any> {
return new Promise((resolve, reject) => {
if (this.db) {
const transaction = this.db.transaction([storeName], "readonly");