[feat] custom flags

This commit is contained in:
kwaroran
2023-06-29 05:16:12 +09:00
parent 1f2e9be90f
commit 3d6169b524
2 changed files with 11 additions and 3 deletions

View File

@@ -45,6 +45,15 @@
<div class="flex items-center mt-4">
<Check bind:check={$DataBase.usePlainFetch} name="Force Plain Fetch"/>
</div>
<div class="flex items-center mt-4">
<input class="text-neutral-200 mb-4 p-2 bg-transparent input-text focus:bg-selected text-sm" placeholder="experimental flags" on:input={(e) => {
const v = e.currentTarget.value
if(v.endsWith("_flag!")){
localStorage.setItem(v, "able")
e.currentTarget.value = ""
}
}}>
</div>
<button
on:click={async () => {
alertMd(getRequestLog())

View File

@@ -34,7 +34,7 @@ export class AutoStorage{
this.realStorage = new NodeStorage()
return
}
else if(window.navigator?.storage?.getDirectory && localStorage.getItem('flag_opfs')){
else if(window.navigator?.storage?.getDirectory && localStorage.getItem('opfs_flag!') === "able"){
console.log("using opfs storage")
const forage = localforage.createInstance({
@@ -53,9 +53,8 @@ export class AutoStorage{
let i = 0;
const opfs = new OpfsStorage()
for(const key of keys){
console.log(i)
alertStore.set({
type: "none",
type: "wait",
msg: `Migrating your data...(${i}/${keys.length})`
})
await opfs.setItem(key,await forage.getItem(key))