[feat] added license

This commit is contained in:
kwaroran
2023-07-19 22:01:23 +09:00
parent dfc27df7c7
commit 07f6117a01
13 changed files with 269 additions and 106 deletions

View File

@@ -3,7 +3,7 @@ import { sleep } from "./util"
import { language } from "../lang"
interface alertData{
type: 'error'| 'normal'|'none'|'ask'|'wait'|'selectChar'|'input'|'toast'|'wait2'|'markdown'|'select'|'login'
type: 'error'| 'normal'|'none'|'ask'|'wait'|'selectChar'|'input'|'toast'|'wait2'|'markdown'|'select'|'login'|'tos'
msg: string
}
@@ -78,6 +78,15 @@ export function alertToast(msg:string){
})
}
export function alertWait(msg:string){
alertStore.set({
'type': 'wait',
'msg': msg
})
}
export async function alertSelectChar(){
alertStore.set({
'type': 'selectChar',
@@ -111,6 +120,32 @@ export async function alertConfirm(msg:string){
return get(alertStore).msg === 'yes'
}
export async function alertTOS(){
// if(localStorage.getItem('tos') === 'true'){
// return true
// }
alertStore.set({
'type': 'tos',
'msg': 'tos'
})
while(true){
if (get(alertStore).type === 'none'){
break
}
await sleep(10)
}
if(get(alertStore).msg === 'yes'){
localStorage.setItem('tos', 'true')
return true
}
return false
}
export async function alertInput(msg:string){
alertStore.set({

View File

@@ -1,5 +1,5 @@
import { get } from "svelte/store"
import { alertConfirm, alertError, alertMd, alertNormal, alertSelect, alertStore } from "./alert"
import { alertConfirm, alertError, alertMd, alertNormal, alertSelect, alertStore, alertTOS } from "./alert"
import { DataBase, defaultSdDataFunc, type character, setDatabase, type customscript, type loreSettings, type loreBook } from "./storage/database"
import { checkNullish, selectMultipleFile, selectSingleFile, sleep } from "./util"
import { language } from "src/lang"
@@ -604,13 +604,14 @@ export async function shareRisuHub(char:character, arg:{
export type hubType = {
name:string
desc: string
download: number,
download: string,
id: string,
img: string
tags: string[],
viewScreen: "none" | "emotion" | "imggen"
hasLore:boolean
creator?:string
license:string
}
export async function getRisuHub(arg?:{
@@ -636,6 +637,9 @@ export async function getRisuHub(arg?:{
export async function downloadRisuHub(id:string) {
try {
if(!(await alertTOS())){
return
}
alertStore.set({
type: "wait",
msg: "Downloading..."

View File

@@ -0,0 +1,24 @@
import tippy from 'tippy.js'
import 'tippy.js/dist/tippy.css';
export const CCLicenseData = {
"CC BY 4.0": ["by", "Requires Attribution"],
"CC BY-NC 4.0": ["by-nc", "Requires Attribution and Non Commercial"],
"CC BY-NC-SA 4.0": ["by-nc-sa", "Requires Attribution, Non Commercial and Share Alike"],
"CC BY-SA 4.0": ["by-sa", "Requires Attribution and Share Alike"],
"CC BY-ND 4.0": ["by-nd", "Requires Attribution and No Derivatives"],
"CC BY-NC-ND 4.0": ["by-nc-nd", "Requires Attribution, Non Commercial and No Derivatives"],
}
export function tooltip(node:HTMLElement, tip:string) {
const instance = tippy(node, {
content: tip,
animation: 'fade',
arrow: true,
})
return {
destroy() {
instance.destroy()
}
};
}