[feat] added license

This commit is contained in:
kwaroran
2023-07-19 22:31:47 +09:00
parent 07f6117a01
commit a208623621
6 changed files with 38 additions and 18 deletions

View File

@@ -107,7 +107,7 @@
}}>{n}</Button>
{/each}
{:else if $alertStore.type === 'error' || $alertStore.type === 'normal' || $alertStore.type === 'markdown'}
<Button bind:this={btn} className="mt-4" on:click={() => {
<Button className="mt-4" on:click={() => {
alertStore.set({
type: 'none',
msg: ''

View File

@@ -18,7 +18,7 @@
import { getElevenTTSVoices, getWebSpeechTTSVoices, getVOICEVOXVoices } from "src/ts/process/tts";
import { checkCharOrder, getFileSrc } from "src/ts/storage/globalApi";
import { addGroupChar, rmCharFromGroup } from "src/ts/process/group";
import HubUpload from "../UI/Realm/RealmUpload.svelte";
import RealmUpload from "../UI/Realm/RealmUpload.svelte";
import TextInput from "../UI/GUI/TextInput.svelte";
import NumberInput from "../UI/GUI/NumberInput.svelte";
import TextAreaInput from "../UI/GUI/TextAreaInput.svelte";
@@ -711,14 +711,26 @@
</div>
{/if}
<Button size="lg" on:click={async () => {
exportChar($selectedCharID)
}} className="mt-2">{language.exportCharacter}</Button>
<Button size="lg" on:click={async () => {
openHubUpload = true
}} className="mt-2">{language.shareCloud}</Button>
{#if currentChar.data.license !== 'CC BY-NC-SA 4.0'
&& currentChar.data.license !== 'CC BY-SA 4.0'
&& currentChar.data.license !== 'CC BY-ND 4.0'
&& currentChar.data.license !== 'CC BY-NC-ND 4.0'
}
<Button size="lg" on:click={async () => {
exportChar($selectedCharID)
}} className="mt-2">{language.exportCharacter}</Button>
{/if}
{#if currentChar.data.license !== 'CC BY-NC-SA 4.0'
&& currentChar.data.license !== 'CC BY-SA 4.0'
}
<Button size="lg" on:click={async () => {
openHubUpload = true
}} className="mt-2">{language.shareCloud}</Button>
{/if}
{#if openHubUpload}
<HubUpload bind:char={currentChar.data} close={() => {openHubUpload=false}}/>
<RealmUpload bind:char={currentChar.data} close={() => {openHubUpload=false}}/>
{/if}
{:else}
{#if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4}

View File

@@ -1,4 +1,4 @@
<button
<button
on:click
class="{selected ? 'bg-borderc' : 'bg-gray-700'} border border-gray-600 text-white rounded-md shadow-sm hover:bg-borderc focus:outline-none focus:ring-2 focus:ring-borderc transition-colors duration-200{className ? (" " + className) : ""}"
class:px-4 = {size == "md"}

View File

@@ -29,6 +29,8 @@
tags = tags.replace(/[^a-zA-Z,]/g, '').toLocaleLowerCase()
}} />
{#if char.license !== 'CC BY-NC-SA 4.0' && char.license !== 'CC BY-SA 4.0'}
<span class="text-neutral-200 mt-4">License</span>
<span class="text-gray-400 text-sm">You can choose license for the downloaders to limit the usages of your card.</span>
<SelectInput bind:value={license}>
@@ -37,6 +39,8 @@
<OptionInput value={ccl}>{ccl} ({CCLicenseData[ccl][1]})</OptionInput>
{/each}
</SelectInput>
{/if}
<div class="flex items-center flex-wrap mt-4">
<button class="bg-bgcolor p-2 rounded-lg" class:ring-1={!privateMode} on:click={() => {privateMode = false}}>🌏 Public</button>
<!-- <button class="bg-bgcolor p-2 rounded-lg ml-2" class:ring-1={privateMode} on:click={() => {privateMode = true}}>🔒 Private</button> -->
@@ -59,7 +63,8 @@
shareRisuHub(char, {
privateMode: privateMode,
nsfw: nsfwMode,
tag: tags
tag: tags,
license: license
})
close()
}
@@ -80,9 +85,8 @@
import TextAreaInput from "../GUI/TextAreaInput.svelte";
import Button from "../GUI/Button.svelte";
import SelectInput from "../GUI/SelectInput.svelte";
import { CCLicenseData } from "src/ts/copyright/license";
import { key } from "localforage";
import OptionInput from "../GUI/OptionInput.svelte";
import { CCLicenseData } from "src/ts/copyright/license";
import OptionInput from "../GUI/OptionInput.svelte";
export let close = () => {}
export let char:character
let tags=""

View File

@@ -451,7 +451,8 @@ async function createBaseV2(char:character) {
utilityBot: char.utilityBot,
sdData: char.sdData,
additionalAssets: char.additionalAssets,
backgroundHTML: char.backgroundHTML
backgroundHTML: char.backgroundHTML,
license: char.license
}
}
}
@@ -527,9 +528,10 @@ export async function shareRisuHub(char:character, arg:{
nsfw: boolean,
privateMode:boolean
tag:string
license: string
}) {
char = cloneDeep(char)
char.license = arg.license
let tagList = arg.tag.split(',')
if(arg.nsfw){
@@ -584,7 +586,7 @@ export async function shareRisuHub(char:character, arg:{
card: card,
img: Buffer.from(img).toString('base64'),
resources: resources,
token: get(DataBase)?.account?.token
token: get(DataBase)?.account?.token,
})
})
@@ -709,7 +711,8 @@ type CharacterCardV2 = {
utilityBot?: boolean,
sdData?:[string,string][],
additionalAssets?:[string,string,string][],
backgroundHTML?:string
backgroundHTML?:string,
license?:string
}
}
}

View File

@@ -364,6 +364,7 @@ export interface character{
backgroundHTML?:string
reloadKeys?:number
backgroundCSS?:string
license?:string
}