[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> }}>{n}</Button>
{/each} {/each}
{:else if $alertStore.type === 'error' || $alertStore.type === 'normal' || $alertStore.type === 'markdown'} {: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({ alertStore.set({
type: 'none', type: 'none',
msg: '' msg: ''

View File

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

View File

@@ -29,6 +29,8 @@
tags = tags.replace(/[^a-zA-Z,]/g, '').toLocaleLowerCase() 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-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> <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}> <SelectInput bind:value={license}>
@@ -37,6 +39,8 @@
<OptionInput value={ccl}>{ccl} ({CCLicenseData[ccl][1]})</OptionInput> <OptionInput value={ccl}>{ccl} ({CCLicenseData[ccl][1]})</OptionInput>
{/each} {/each}
</SelectInput> </SelectInput>
{/if}
<div class="flex items-center flex-wrap mt-4"> <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" 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> --> <!-- <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, { shareRisuHub(char, {
privateMode: privateMode, privateMode: privateMode,
nsfw: nsfwMode, nsfw: nsfwMode,
tag: tags tag: tags,
license: license
}) })
close() close()
} }
@@ -80,9 +85,8 @@
import TextAreaInput from "../GUI/TextAreaInput.svelte"; import TextAreaInput from "../GUI/TextAreaInput.svelte";
import Button from "../GUI/Button.svelte"; import Button from "../GUI/Button.svelte";
import SelectInput from "../GUI/SelectInput.svelte"; import SelectInput from "../GUI/SelectInput.svelte";
import { CCLicenseData } from "src/ts/copyright/license"; import { CCLicenseData } from "src/ts/copyright/license";
import { key } from "localforage"; import OptionInput from "../GUI/OptionInput.svelte";
import OptionInput from "../GUI/OptionInput.svelte";
export let close = () => {} export let close = () => {}
export let char:character export let char:character
let tags="" let tags=""

View File

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

View File

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