Change download to blob

This commit is contained in:
kwaroran
2025-04-23 12:26:27 +09:00
parent 22a50904f8
commit 91e3a352a3
2 changed files with 11 additions and 4 deletions

View File

@@ -87,7 +87,16 @@ export async function downloadFile(name:string, dat:Uint8Array|ArrayBuffer|strin
await writeFile(name, data, {baseDir: BaseDirectory.Download})
}
else{
downloadURL(`data:png/image;base64,${Buffer.from(data).toString('base64')}`, name)
const blob = new Blob([data], { type: 'application/octet-stream' })
const url = URL.createObjectURL(blob)
downloadURL(url, name)
setTimeout(() => {
URL.revokeObjectURL(url)
}, 10000)
}
}

View File

@@ -74,9 +74,7 @@ function generateScriptCacheKey(scripts: customscript[], data: string, mode: Scr
if(script.type !== mode){
continue
}
hash += `${script.flag?.includes('<cbs>') ?
risuChatParser(script.in, { chatID: chatID, cbsConditions }) :
script.in}|||${risuChatParser(script.out, { chatID: chatID, cbsConditions})}|||${script.flag ?? ''}|||${script.ableFlag ? 1 : 0}`;
hash += `${script.flag?.includes('<cbs>') ? risuChatParser(script.in, { chatID: chatID, cbsConditions }) : script.in}|||${script.out}${chatID}|||${script.flag ?? ''}|||${script.ableFlag ? 1 : 0}`;
}
return hash;
}