Add update to RisuRealm feature

This commit is contained in:
kwaroran
2024-03-28 18:04:51 +09:00
parent bce98a84a5
commit 949269e2d6
4 changed files with 32 additions and 11 deletions

View File

@@ -555,4 +555,6 @@ export const languageEnglish = {
heightMode: "Height Mode", heightMode: "Height Mode",
useAdvancedEditor: "Use Advanced Editor", useAdvancedEditor: "Use Advanced Editor",
noWaitForTranslate: "No Wait for Translate", noWaitForTranslate: "No Wait for Translate",
updateRealm: "Update to RisuRealm",
updateRealmDesc: "You are trying to update your character to RisuRealm. this will update your character to RisuRealm, and you can't revert it back.",
} }

View File

@@ -832,7 +832,13 @@
if(await alertTOS()){ if(await alertTOS()){
openHubUpload = true openHubUpload = true
} }
}} className="mt-2">{language.shareCloud}</Button> }} className="mt-2">
{#if currentChar.data.realmId}
{language.updateRealm}
{:else}
{language.shareCloud}
{/if}
</Button>
{/if} {/if}
{#if openHubUpload} {#if openHubUpload}

View File

@@ -18,6 +18,9 @@
<XIcon /> <XIcon />
</button> </button>
</h1> </h1>
{#if char.realmId}
<span class="text-textcolor2 text-sm">{language.updateRealmDesc}</span>
{/if}
<div class="mb-2 mt-2 w-full border-t-2 border-t-bgcolor"></div> <div class="mb-2 mt-2 w-full border-t-2 border-t-bgcolor"></div>
<span class="text-textcolor">{language.creatorNotes}</span> <span class="text-textcolor">{language.creatorNotes}</span>
<span class="text-textcolor2 text-sm">A description that displays when you search and when you first open a bot.</span> <span class="text-textcolor2 text-sm">A description that displays when you search and when you first open a bot.</span>
@@ -41,14 +44,16 @@
</SelectInput> </SelectInput>
{/if} {/if}
<div class="flex items-center flex-wrap mt-4"> {#if !char.realmId}
<button class="bg-bgcolor p-2 rounded-lg" class:ring-1={!privateMode} on:click={() => {privateMode = false}}>🌏 Show Author ID</button> <div class="flex items-center flex-wrap mt-4">
<button class="bg-bgcolor p-2 rounded-lg ml-2" class:ring-1={privateMode} on:click={() => {privateMode = true}}>🔒 Anonymized</button> <button class="bg-bgcolor p-2 rounded-lg" class:ring-1={!privateMode} on:click={() => {privateMode = false}}>🌏 Show Author ID</button>
</div> <button class="bg-bgcolor p-2 rounded-lg ml-2" class:ring-1={privateMode} on:click={() => {privateMode = true}}>🔒 Anonymized</button>
<div class="flex items-center flex-wrap mt-2"> </div>
<button class="bg-bgcolor p-2 rounded-lg" class:ring-1={!nsfwMode} on:click={() => {nsfwMode = false}}>🎖️ Safe</button> <div class="flex items-center flex-wrap mt-2">
<button class="bg-bgcolor p-2 rounded-lg ml-2" class:ring-1={nsfwMode} on:click={() => {nsfwMode = true}}>🔞 NSFW</button> <button class="bg-bgcolor p-2 rounded-lg" class:ring-1={!nsfwMode} on:click={() => {nsfwMode = false}}>🎖️ Safe</button>
</div> <button class="bg-bgcolor p-2 rounded-lg ml-2" class:ring-1={nsfwMode} on:click={() => {nsfwMode = true}}>🔞 NSFW</button>
</div>
{/if}
{#if nsfwMode} {#if nsfwMode}
<span class="text-textcolor2 text-sm">Grotesque Contents and non-adult characters with NSFW would be banned.</span> <span class="text-textcolor2 text-sm">Grotesque Contents and non-adult characters with NSFW would be banned.</span>
{/if} {/if}
@@ -69,7 +74,13 @@
license: license license: license
}) })
close() close()
}} className="mt-2" size="lg">{language.shareCloud}</Button> }} className="mt-2" size="lg">
{#if char.realmId}
{language.updateRealm}
{:else}
{language.shareCloud}
{/if}
</Button>
{/if} {/if}
</div> </div>

View File

@@ -759,7 +759,8 @@ export async function shareRisuHub2(char:character, arg:{
"x-risu-api-version": "4", "x-risu-api-version": "4",
"x-risu-token": get(DataBase)?.account?.token, "x-risu-token": get(DataBase)?.account?.token,
'x-risu-username': arg.anon ? '' : (get(DataBase)?.account?.id), 'x-risu-username': arg.anon ? '' : (get(DataBase)?.account?.id),
'x-risu-debug': 'true' 'x-risu-debug': 'true',
'x-risu-update-id': char.realmId ?? 'null'
} }
}) })
@@ -777,6 +778,7 @@ export async function shareRisuHub2(char:character, arg:{
return return
} }
currentChar.realmId = resJSON.id currentChar.realmId = resJSON.id
CurrentCharacter.set(currentChar)
} }
} catch (error) { } catch (error) {
alertError(`${error}`) alertError(`${error}`)