[feat] added license
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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..."
|
||||
|
||||
24
src/ts/copyright/license.ts
Normal file
24
src/ts/copyright/license.ts
Normal 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()
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user