feat: add preset sharing

This commit is contained in:
kwaroran
2024-05-24 11:28:32 +09:00
parent 0ce01d8ca1
commit 96ccc1cdd8
10 changed files with 124 additions and 74 deletions

View File

@@ -293,35 +293,27 @@ function convertOldTavernAndJSON(charaData:OldTavernChar, imgp:string|undefined
}
}
export async function exportChar(charaID:number) {
export async function exportChar(charaID:number):Promise<string> {
const db = get(DataBase)
let char = structuredClone(db.characters[charaID])
if(char.type === 'group'){
return
return ''
}
if(!char.image){
alertError('Image Required')
return
}
const conf = await alertConfirm(language.exportConfirm)
if(!conf){
return
return ''
}
const option = await alertCardExport()
if(option.type === 'cancel'){
return
}
else if(option.type === 'rcc'){
char.license = option.license
exportSpecV2(char, 'rcc', {password:option.password})
}
else{
if(option.type === ''){
exportSpecV2(char,'png')
}
return
else{
return option.type
}
return ''
}