[feat] nocheck
This commit is contained in:
@@ -21,7 +21,8 @@ export class AccountStorage{
|
|||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
'x-risu-key': key,
|
'x-risu-key': key,
|
||||||
'x-risu-auth': this.auth
|
'x-risu-auth': this.auth,
|
||||||
|
'X-Format': 'nocheck'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(da.status === 304){
|
if(da.status === 304){
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { NodeStorage } from "./nodeStorage"
|
|||||||
import { OpfsStorage } from "./opfsStorage"
|
import { OpfsStorage } from "./opfsStorage"
|
||||||
import { alertConfirm, alertSelect, alertStore } from "../alert"
|
import { alertConfirm, alertSelect, alertStore } from "../alert"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import { DataBase } from "./database"
|
import { DataBase, type Database } from "./database"
|
||||||
import { AccountStorage } from "./accountStorage"
|
import { AccountStorage } from "./accountStorage"
|
||||||
import { encodeRisuSave } from "./risuSave";
|
import { decodeRisuSave, encodeRisuSave } from "./risuSave";
|
||||||
import { language } from "src/lang"
|
import { language } from "src/lang"
|
||||||
|
|
||||||
export class AutoStorage{
|
export class AutoStorage{
|
||||||
@@ -80,8 +80,15 @@ export class AutoStorage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dba = replaceDbResources(db, replaced)
|
const dba = replaceDbResources(db, replaced)
|
||||||
await accountStorage.setItem('database/database.bin', encodeRisuSave(dba))
|
const comp = encodeRisuSave(dba, 'compression')
|
||||||
|
//try decoding
|
||||||
|
try {
|
||||||
|
const z:Database = decodeRisuSave(comp)
|
||||||
|
if(z.formatversion){
|
||||||
|
await accountStorage.setItem('database/database.bin', comp)
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {}
|
||||||
this.realStorage = accountStorage
|
this.realStorage = accountStorage
|
||||||
alertStore.set({
|
alertStore.set({
|
||||||
type: "none",
|
type: "none",
|
||||||
|
|||||||
@@ -225,11 +225,16 @@ export async function saveDb(){
|
|||||||
await writeBinaryFile(`database/dbbackup-${(Date.now()/100).toFixed()}.bin`, dbData, {dir: BaseDirectory.AppData})
|
await writeBinaryFile(`database/dbbackup-${(Date.now()/100).toFixed()}.bin`, dbData, {dir: BaseDirectory.AppData})
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
await forageStorage.setItem('database/database.bin', dbData)
|
|
||||||
if(!forageStorage.isAccount){
|
if(!forageStorage.isAccount){
|
||||||
|
await forageStorage.setItem('database/database.bin', dbData)
|
||||||
await forageStorage.setItem(`database/dbbackup-${(Date.now()/100).toFixed()}.bin`, dbData)
|
await forageStorage.setItem(`database/dbbackup-${(Date.now()/100).toFixed()}.bin`, dbData)
|
||||||
}
|
}
|
||||||
if(forageStorage.isAccount){
|
if(forageStorage.isAccount){
|
||||||
|
const dbData = encodeRisuSave(db, 'compression')
|
||||||
|
const z:Database = decodeRisuSave(dbData)
|
||||||
|
if(z.formatversion){
|
||||||
|
await forageStorage.setItem('database/database.bin', dbData)
|
||||||
|
}
|
||||||
await sleep(5000);
|
await sleep(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user