mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-05 19:42:39 +02:00
Fix saving app list in the new format
This commit is contained in:
parent
89e9b85bda
commit
83619eb98e
2 changed files with 22 additions and 19 deletions
|
@ -16,12 +16,32 @@
|
|||
*/
|
||||
|
||||
import { UpdateInstalledAppsAction } from '../../../../action'
|
||||
import { types } from '../../../../database/encryptedapplist'
|
||||
import { generateVersionId } from '../../../../util/token'
|
||||
import { Cache } from '../cache'
|
||||
|
||||
export async function dispatchUpdateInstalledApps (_: {
|
||||
export async function dispatchUpdateInstalledApps ({ deviceId, action, cache }: {
|
||||
deviceId: string
|
||||
action: UpdateInstalledAppsAction
|
||||
cache: Cache
|
||||
}) {
|
||||
// do nothing
|
||||
async function upsert({ type, data }: { type: number, data: Buffer }) {
|
||||
await cache.database.encryptedAppList.upsert({
|
||||
familyId: cache.familyId,
|
||||
deviceId,
|
||||
type,
|
||||
version: generateVersionId(),
|
||||
data
|
||||
}, { transaction: cache.transaction })
|
||||
}
|
||||
|
||||
if (action.base) {
|
||||
await upsert({ type: types.base, data: action.base })
|
||||
}
|
||||
|
||||
if (action.diff) {
|
||||
await upsert({ type: types.diff, data: action.diff })
|
||||
}
|
||||
|
||||
cache.incrementTriggeredSyncLevel(1)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue