[feat] download enchantments
This commit is contained in:
@@ -49,10 +49,9 @@
|
|||||||
</button>
|
</button>
|
||||||
<span class="text-neutral-200 mt-4">{language.username}</span>
|
<span class="text-neutral-200 mt-4">{language.username}</span>
|
||||||
<input class="text-neutral-200 mt-2 mb-4 p-2 bg-transparent input-text focus:bg-selected" placeholder="User" bind:value={$DataBase.username}>
|
<input class="text-neutral-200 mt-2 mb-4 p-2 bg-transparent input-text focus:bg-selected" placeholder="User" bind:value={$DataBase.username}>
|
||||||
{#if $DataBase.useExperimental}
|
|
||||||
<div class="bg-darkbg p-3 rounded-md mb-2 flex flex-col items-start">
|
<div class="bg-darkbg p-3 rounded-md mb-2 flex flex-col items-start">
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<h1 class="text-3xl font-black min-w-0">Risu Account{#if $DataBase.account} <Help key="experimental"/>
|
<h1 class="text-3xl font-black min-w-0">Risu Account{#if $DataBase.account}
|
||||||
<button class="bg-selected p-1 text-sm font-light rounded-md hover:bg-green-500 transition-colors float-right" on:click={async () => {
|
<button class="bg-selected p-1 text-sm font-light rounded-md hover:bg-green-500 transition-colors float-right" on:click={async () => {
|
||||||
$DataBase.account = undefined
|
$DataBase.account = undefined
|
||||||
}}>Logout</button>
|
}}>Logout</button>
|
||||||
@@ -60,19 +59,23 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if $DataBase.account}
|
{#if $DataBase.account}
|
||||||
<span class="mb-4 text-gray-400">ID: {$DataBase.account.id}</span>
|
<span class="mb-4 text-gray-400">ID: {$DataBase.account.id}</span>
|
||||||
<h1 class="text-xl font-bold mt-2">{language.googleDriveConnection}</h1>
|
{#if $DataBase.useExperimental}
|
||||||
{#if !$DataBase.account.data.refresh_token}
|
|
||||||
<span class="text-sm font-light mb-2 text-gray-400">{language.googleDriveInfo}</span>
|
<h1 class="text-xl font-bold mt-2">{language.googleDriveConnection} <Help key="experimental"/></h1>
|
||||||
<button class="bg-selected p-2 rounded-md hover:bg-green-500 transition-colors" on:click={async () => {
|
{#if !$DataBase.account.data.refresh_token}
|
||||||
if((!popup) || popup.closed){
|
<span class="text-sm font-light mb-2 text-gray-400">{language.googleDriveInfo}</span>
|
||||||
popup = window.open(await checkDriver('reftoken'))
|
<button class="bg-selected p-2 rounded-md hover:bg-green-500 transition-colors" on:click={async () => {
|
||||||
}
|
if((!popup) || popup.closed){
|
||||||
}}>
|
popup = window.open(await checkDriver('reftoken'))
|
||||||
Connect to Google Drive
|
}
|
||||||
</button>
|
}}>
|
||||||
{:else}
|
Connect to Google Drive
|
||||||
<span class="text-sm font-light mb-2 text-gray-400">{language.googleDriveConnected}</span>
|
</button>
|
||||||
|
{:else}
|
||||||
|
<span class="text-sm font-light mb-2 text-gray-400">{language.googleDriveConnected}</span>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
<span>{language.notLoggedIn}</span>
|
<span>{language.notLoggedIn}</span>
|
||||||
<button class="bg-selected p-2 rounded-md mt-2 hover:bg-green-500 transition-colors" on:click={() => {
|
<button class="bg-selected p-2 rounded-md mt-2 hover:bg-green-500 transition-colors" on:click={() => {
|
||||||
@@ -83,7 +86,6 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
|
||||||
{#if openIframe}
|
{#if openIframe}
|
||||||
<div class="fixed top-0 left-0 bg-black bg-opacity-50 w-full h-full flex justify-center items-center">
|
<div class="fixed top-0 left-0 bg-black bg-opacity-50 w-full h-full flex justify-center items-center">
|
||||||
<iframe src={openIframeURL} title="login" class="w-full h-full">
|
<iframe src={openIframeURL} title="login" class="w-full h-full">
|
||||||
|
|||||||
@@ -663,12 +663,9 @@
|
|||||||
<button on:click={async () => {
|
<button on:click={async () => {
|
||||||
exportChar($selectedCharID)
|
exportChar($selectedCharID)
|
||||||
}} class="text-neutral-200 mt-6 text-lg bg-transparent border-solid border-1 border-borderc p-4 hover:bg-green-500 transition-colors cursor-pointer">{language.exportCharacter}</button>
|
}} class="text-neutral-200 mt-6 text-lg bg-transparent border-solid border-1 border-borderc p-4 hover:bg-green-500 transition-colors cursor-pointer">{language.exportCharacter}</button>
|
||||||
|
<button on:click={async () => {
|
||||||
{#if $DataBase.useExperimental}
|
openHubUpload = true
|
||||||
<button on:click={async () => {
|
}} class="text-neutral-200 mt-2 text-lg bg-transparent border-solid border-1 border-borderc p-4 hover:bg-green-500 transition-colors cursor-pointer">{language.shareCloud}</button>
|
||||||
openHubUpload = true
|
|
||||||
}} class="text-neutral-200 mt-2 text-lg bg-transparent border-solid border-1 border-borderc p-4 hover:bg-green-500 transition-colors cursor-pointer">{language.shareCloud} <Help key="experimental" /></button>
|
|
||||||
{/if}
|
|
||||||
{#if openHubUpload}
|
{#if openHubUpload}
|
||||||
<HubUpload bind:char={currentChar.data} close={() => {openHubUpload=false}}/>
|
<HubUpload bind:char={currentChar.data} close={() => {openHubUpload=false}}/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { downloadRisuHub, getRisuHub, hubURL, type hubType } from "src/ts/characterCards";
|
import { downloadRisuHub, getRisuHub, hubURL, type hubType } from "src/ts/characterCards";
|
||||||
import { ArrowLeft, ArrowRight, BookIcon, DownloadIcon, FlagIcon, MenuIcon, SearchIcon, SmileIcon, XIcon } from "lucide-svelte";
|
import { ArrowLeft, ArrowRight, BookIcon, DownloadIcon, FlagIcon, MenuIcon, SearchIcon, SmileIcon, TrashIcon, XIcon } from "lucide-svelte";
|
||||||
import { alertConfirm, alertInput, alertNormal } from "src/ts/alert";
|
import { alertConfirm, alertInput, alertNormal } from "src/ts/alert";
|
||||||
import { parseMarkdownSafe } from "src/ts/parser";
|
import { parseMarkdownSafe } from "src/ts/parser";
|
||||||
import { language } from "src/lang";
|
import { language } from "src/lang";
|
||||||
import RisuHubIcon from "./RisuHubIcon.svelte";
|
import RisuHubIcon from "./RisuHubIcon.svelte";
|
||||||
|
import { DataBase } from "src/ts/storage/database";
|
||||||
|
|
||||||
let openedData:null|hubType = null
|
let openedData:null|hubType = null
|
||||||
|
|
||||||
@@ -125,6 +126,10 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-wrap w-full flex-row gap-1 mt-2">
|
<div class="flex flex-wrap w-full flex-row gap-1 mt-2">
|
||||||
|
<span class="text-gray-500">
|
||||||
|
{openedData.download} {language.downloads}
|
||||||
|
</span>
|
||||||
|
<div class="border-l-selected border-l ml-1 mr-1"></div>
|
||||||
{#if openedData.viewScreen === 'emotion'}
|
{#if openedData.viewScreen === 'emotion'}
|
||||||
<button class="text-gray-500 hover:text-green-500 transition-colors" on:click|stopPropagation={() => {alertNormal("This character includes emotion images")}}><SmileIcon /></button>
|
<button class="text-gray-500 hover:text-green-500 transition-colors" on:click|stopPropagation={() => {alertNormal("This character includes emotion images")}}><SmileIcon /></button>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -150,6 +155,23 @@
|
|||||||
}}>
|
}}>
|
||||||
<FlagIcon />
|
<FlagIcon />
|
||||||
</button>
|
</button>
|
||||||
|
{#if ($DataBase.account?.token?.split('-') ?? [])[1] === openedData.creator}
|
||||||
|
<button class="text-gray-400 hover:text-red-500" on:click|stopPropagation={async () => {
|
||||||
|
const conf = await alertConfirm('Do you want to remove this character from Realm?')
|
||||||
|
if(conf){
|
||||||
|
const da = await fetch(hubURL + '/hub/remove', {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: openedData.id,
|
||||||
|
token: $DataBase.account?.token
|
||||||
|
})
|
||||||
|
})
|
||||||
|
alertNormal(await da.text())
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
<TrashIcon />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
<button class="bg-selected hover:ring flex-grow p-2 font-bold rounded-md mr-2" on:click={() => {
|
<button class="bg-selected hover:ring flex-grow p-2 font-bold rounded-md mr-2" on:click={() => {
|
||||||
downloadRisuHub(openedData.id)
|
downloadRisuHub(openedData.id)
|
||||||
openedData = null
|
openedData = null
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<div class="fixed top-0 left-0 h-full w-full bg-black bg-opacity-50 flex flex-col z-50 items-center justify-center" on:click={close}>
|
<div class="fixed top-0 left-0 h-full w-full bg-black bg-opacity-50 flex flex-col z-50 items-center justify-center" on:click={close}>
|
||||||
<div class="bg-darkbg rounded-md p-4 max-w-full flex flex-col w-2xl" on:click|stopPropagation>
|
<div class="bg-darkbg rounded-md p-4 max-w-full flex flex-col w-2xl" on:click|stopPropagation>
|
||||||
|
|
||||||
|
{#if !$DataBase.account}
|
||||||
|
<span class="font-bold text-2xl w-full">You must login to Risu Account upload to RisuRealm</span>
|
||||||
|
<span class="text-gray-500">You can login in app settings 🡲 account</span>
|
||||||
|
<button on:click={async () => {
|
||||||
|
close()
|
||||||
|
}} class="text-neutral-200 mt-2 text-lg bg-transparent border-solid border-1 border-borderc p-4 hover:bg-green-800 transition-colors cursor-pointer">OK</button>
|
||||||
|
|
||||||
|
{:else}
|
||||||
<h1 class="font-bold text-2xl w-full">
|
<h1 class="font-bold text-2xl w-full">
|
||||||
<span>
|
<span>
|
||||||
Share {char.name} to {language.hub}
|
Share {char.name} to {language.hub}
|
||||||
@@ -46,6 +55,8 @@
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
}} class="text-neutral-200 mt-2 text-lg bg-transparent border-solid border-1 border-borderc p-4 hover:bg-green-800 transition-colors cursor-pointer">{language.shareCloud}</button>
|
}} class="text-neutral-200 mt-2 text-lg bg-transparent border-solid border-1 border-borderc p-4 hover:bg-green-800 transition-colors cursor-pointer">{language.shareCloud}</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -55,7 +66,7 @@
|
|||||||
import { language } from "src/lang";
|
import { language } from "src/lang";
|
||||||
import { alertError } from "src/ts/alert";
|
import { alertError } from "src/ts/alert";
|
||||||
import { shareRisuHub } from "src/ts/characterCards";
|
import { shareRisuHub } from "src/ts/characterCards";
|
||||||
import type { character } from "src/ts/storage/database";
|
import { DataBase, type character } from "src/ts/storage/database";
|
||||||
export let close = () => {}
|
export let close = () => {}
|
||||||
export let char:character
|
export let char:character
|
||||||
let tags=""
|
let tags=""
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { DataBase, appVer } from "src/ts/storage/database";
|
import { appVer } from "src/ts/storage/database";
|
||||||
import GithubStars from "../Others/GithubStars.svelte";
|
import GithubStars from "../Others/GithubStars.svelte";
|
||||||
import Hub from "./Hub.svelte";
|
import Hub from "./Hub.svelte";
|
||||||
import { sideBarStore } from "src/ts/stores";
|
import { sideBarStore } from "src/ts/stores";
|
||||||
import Help from "../Others/Help.svelte";
|
import { ArrowLeft } from "lucide-svelte";
|
||||||
import { ArrowLeft, HomeIcon } from "lucide-svelte";
|
|
||||||
import { openURL } from "src/ts/storage/globalApi";
|
import { openURL } from "src/ts/storage/globalApi";
|
||||||
import { language } from "src/lang";
|
import { language } from "src/lang";
|
||||||
import { getRisuHub, hubURL } from "src/ts/characterCards";
|
import { getRisuHub } from "src/ts/characterCards";
|
||||||
import RisuHubIcon from "./RisuHubIcon.svelte";
|
import RisuHubIcon from "./RisuHubIcon.svelte";
|
||||||
let openHub = false
|
let openHub = false
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -663,6 +663,7 @@ export type hubType = {
|
|||||||
tags: string[],
|
tags: string[],
|
||||||
viewScreen: "none" | "emotion" | "imggen"
|
viewScreen: "none" | "emotion" | "imggen"
|
||||||
hasLore:boolean
|
hasLore:boolean
|
||||||
|
creator?:string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getRisuHub(arg?:{
|
export async function getRisuHub(arg?:{
|
||||||
|
|||||||
Reference in New Issue
Block a user