Change encodeRisuSave function to encodeRisuSaveLegacy
This commit is contained in:
@@ -4,7 +4,7 @@ import { hubURL } from "../characterCards"
|
||||
import localforage from "localforage"
|
||||
import { alertLogin, alertStore, alertWait } from "../alert"
|
||||
import { forageStorage, getUnpargeables } from "../globalApi"
|
||||
import { encodeRisuSave } from "./risuSave"
|
||||
import { encodeRisuSaveLegacy } from "./risuSave"
|
||||
import { v4 } from "uuid"
|
||||
import { language } from "src/lang"
|
||||
|
||||
@@ -136,7 +136,7 @@ export async function unMigrationAccount() {
|
||||
}
|
||||
|
||||
db.account = null
|
||||
await MigrationStorage.setItem('database/database.bin', encodeRisuSave(db))
|
||||
await MigrationStorage.setItem('database/database.bin', encodeRisuSaveLegacy(db))
|
||||
|
||||
alertStore.set({
|
||||
type: "none",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { OpfsStorage } from "./opfsStorage"
|
||||
import { alertInput, alertSelect, alertStore } from "../alert"
|
||||
import { getDatabase, type Database } from "./database.svelte"
|
||||
import { AccountStorage } from "./accountStorage"
|
||||
import { decodeRisuSave, encodeRisuSave } from "./risuSave";
|
||||
import { decodeRisuSave, encodeRisuSaveLegacy } from "./risuSave";
|
||||
import { language } from "src/lang"
|
||||
import { MobileStorage } from "./mobileStorage"
|
||||
import { Capacitor } from "@capacitor/core"
|
||||
@@ -88,7 +88,7 @@ export class AutoStorage{
|
||||
}
|
||||
|
||||
const dba = replaceDbResources(db, replaced)
|
||||
const comp = encodeRisuSave(dba, 'compression')
|
||||
const comp = encodeRisuSaveLegacy(dba, 'compression')
|
||||
//try decoding
|
||||
try {
|
||||
const z:Database = decodeRisuSave(comp)
|
||||
|
||||
@@ -14,7 +14,7 @@ const unpackr = new Unpackr({
|
||||
const magicHeader = new Uint8Array([0, 82, 73, 83, 85, 83, 65, 86, 69, 0, 7]);
|
||||
const magicCompressedHeader = new Uint8Array([0, 82, 73, 83, 85, 83, 65, 86, 69, 0, 8]);
|
||||
|
||||
export function encodeRisuSave(data:any, compression:'noCompression'|'compression' = 'noCompression'){
|
||||
export function encodeRisuSaveLegacy(data:any, compression:'noCompression'|'compression' = 'noCompression'){
|
||||
let encoded:Uint8Array = packr.encode(data)
|
||||
if(compression === 'compression'){
|
||||
encoded = fflate.compressSync(encoded)
|
||||
|
||||
Reference in New Issue
Block a user