Change download to blob
This commit is contained in:
@@ -87,7 +87,16 @@ export async function downloadFile(name:string, dat:Uint8Array|ArrayBuffer|strin
|
|||||||
await writeFile(name, data, {baseDir: BaseDirectory.Download})
|
await writeFile(name, data, {baseDir: BaseDirectory.Download})
|
||||||
}
|
}
|
||||||
else{
|
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)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,7 @@ function generateScriptCacheKey(scripts: customscript[], data: string, mode: Scr
|
|||||||
if(script.type !== mode){
|
if(script.type !== mode){
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
hash += `${script.flag?.includes('<cbs>') ?
|
hash += `${script.flag?.includes('<cbs>') ? risuChatParser(script.in, { chatID: chatID, cbsConditions }) : script.in}|||${script.out}${chatID}|||${script.flag ?? ''}|||${script.ableFlag ? 1 : 0}`;
|
||||||
risuChatParser(script.in, { chatID: chatID, cbsConditions }) :
|
|
||||||
script.in}|||${risuChatParser(script.out, { chatID: chatID, cbsConditions})}|||${script.flag ?? ''}|||${script.ableFlag ? 1 : 0}`;
|
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user