feat: Add export without login

This commit is contained in:
kwaroran
2024-05-31 09:39:17 +09:00
parent 6b79ee872f
commit f24989c901
6 changed files with 8 additions and 16 deletions

View File

@@ -20,7 +20,7 @@
import TextAreaInput from "../UI/GUI/TextAreaInput.svelte"; import TextAreaInput from "../UI/GUI/TextAreaInput.svelte";
let btn let btn
let input = '' let input = ''
let cardExportType = '' let cardExportType = 'realm'
let cardExportPassword = '' let cardExportPassword = ''
let cardLicense = '' let cardLicense = ''
let generationInfoMenuIndex = 0 let generationInfoMenuIndex = 0
@@ -32,7 +32,7 @@
input = '' input = ''
} }
if($alertStore.type !== 'cardexport'){ if($alertStore.type !== 'cardexport'){
cardExportType = '' cardExportType = 'realm'
cardExportPassword = '' cardExportPassword = ''
cardLicense = '' cardLicense = ''
} }
@@ -418,6 +418,7 @@
{:else} {:else}
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Character Card V3</button> <button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Character Card V3</button>
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1 ml-2" class:ring-1={cardExportType === 'ccv2'} on:click={() => {cardExportType = 'ccv2'}}>Character Card V2</button> <button class="bg-bgcolor px-2 py-4 rounded-lg flex-1 ml-2" class:ring-1={cardExportType === 'ccv2'} on:click={() => {cardExportType = 'ccv2'}}>Character Card V2</button>
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'realm'} on:click={() => {cardExportType = 'realm'}}>RisuRealm</button>
{/if} {/if}
</div> </div>
<Button className="mt-4" on:click={() => { <Button className="mt-4" on:click={() => {

View File

@@ -78,10 +78,6 @@
exportModule(rmodule) exportModule(rmodule)
} }
if(data.type === 'realm'){ if(data.type === 'realm'){
if(!$DataBase.account){
alertError(language.notLoggedIn)
return
}
const index = $DataBase.modules.findIndex((v) => v.id === rmodule.id) const index = $DataBase.modules.findIndex((v) => v.id === rmodule.id)
$ShowRealmFrameStore = `module:${index}` $ShowRealmFrameStore = `module:${index}`
} }

View File

@@ -55,10 +55,6 @@
downloadPreset(i, 'json') downloadPreset(i, 'json')
} }
if(data.type === 'realm'){ if(data.type === 'realm'){
if(!$DataBase.account){
alertError(language.notLoggedIn)
return
}
$ShowRealmFrameStore = `preset:${i}` $ShowRealmFrameStore = `preset:${i}`
} }
}}> }}>

View File

@@ -933,10 +933,6 @@
&& currentChar.data.license !== 'CC BY-SA 4.0' && currentChar.data.license !== 'CC BY-SA 4.0'
} }
<Button size="lg" on:click={async () => { <Button size="lg" on:click={async () => {
if(!$DataBase.account){
alertNormal(language.notLoggedIn)
return
}
if(await alertTOS()){ if(await alertTOS()){
$ShowRealmFrameStore = 'character' $ShowRealmFrameStore = 'character'
} }

View File

@@ -92,7 +92,7 @@
}) })
const getUrl = () => { const getUrl = () => {
let url = `https://realm.risuai.net/upload?token=${tk}&token_id=${id}` let url = tk ? `https://realm.risuai.net/upload?token=${tk}&token_id=${id}` : 'https://realm.risuai.net/upload'
if($ShowRealmFrameStore.startsWith('preset') || $ShowRealmFrameStore.startsWith('module')){ if($ShowRealmFrameStore.startsWith('preset') || $ShowRealmFrameStore.startsWith('module')){
//TODO, add preset edit //TODO, add preset edit
} }

View File

@@ -6,7 +6,7 @@ import { language } from "src/lang"
import { v4 as uuidv4, v4 } from 'uuid'; import { v4 as uuidv4, v4 } from 'uuid';
import { characterFormatUpdate } from "./characters" import { characterFormatUpdate } from "./characters"
import { AppendableBuffer, checkCharOrder, downloadFile, loadAsset, LocalWriter, openURL, readImage, saveAsset, VirtualWriter } from "./storage/globalApi" import { AppendableBuffer, checkCharOrder, downloadFile, loadAsset, LocalWriter, openURL, readImage, saveAsset, VirtualWriter } from "./storage/globalApi"
import { CurrentCharacter, SettingsMenuIndex, selectedCharID, settingsOpen } from "./stores" import { CurrentCharacter, SettingsMenuIndex, ShowRealmFrameStore, selectedCharID, settingsOpen } from "./stores"
import { convertImage, hasher } from "./parser" import { convertImage, hasher } from "./parser"
import { CCardLib, type CharacterCardV3, type LorebookEntry } from '@risuai/ccardlib' import { CCardLib, type CharacterCardV3, type LorebookEntry } from '@risuai/ccardlib'
import { reencodeImage } from "./process/files/image" import { reencodeImage } from "./process/files/image"
@@ -340,6 +340,9 @@ export async function exportChar(charaID:number):Promise<string> {
else if(option.type === 'ccv2'){ else if(option.type === 'ccv2'){
exportCharacterCard(char,'png', {spec: 'v2'}) exportCharacterCard(char,'png', {spec: 'v2'})
} }
else if(option.type === 'realm'){
ShowRealmFrameStore.set("character")
}
else{ else{
return option.type return option.type
} }