[feat] private characters

This commit is contained in:
kwaroran
2023-07-29 11:51:31 +09:00
parent ff93cf22e4
commit 243e2b913f
6 changed files with 66 additions and 34 deletions

View File

@@ -184,7 +184,7 @@ function convertOldTavernAndJSON(charaData:OldTavernChar, imgp:string|undefined
scenario:charaData.scenario ?? '',
firstMsgIndex: -1,
replaceGlobalNote: "",
triggerscript: []
triggerscript: [],
}
}
@@ -345,7 +345,8 @@ async function importSpecv2(card:CharacterCardV2, img?:Uint8Array, mode?:'hub'|'
replaceGlobalNote: data.post_history_instructions ?? '',
backgroundHTML: data?.extensions?.risuai?.backgroundHTML,
license: data?.extensions?.risuai?.license,
triggerscript: data?.extensions?.risuai?.triggerscript ?? []
triggerscript: data?.extensions?.risuai?.triggerscript ?? [],
private: data?.extensions?.risuai?.private ?? false
}
db.characters.push(char)
@@ -557,7 +558,7 @@ export async function shareRisuHub(char:character, arg:{
img: Buffer.from(img).toString('base64'),
resources: resources,
token: get(DataBase)?.account?.token,
apiver: 2
apiver: 3
})
})
@@ -623,7 +624,7 @@ export async function downloadRisuHub(id:string) {
method: "POST",
body: JSON.stringify({
id: id,
apiver: 2
apiver: 3
})
})
if(res.status !== 200){
@@ -689,6 +690,7 @@ type CharacterCardV2 = {
backgroundHTML?:string,
license?:string,
triggerscript?:triggerscript[]
private?:boolean
}
}
}

View File

@@ -1,8 +1,9 @@
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"],
"CC BY 4.0": ["by", "Requires Attribution", "CC BY 4.0"],
"CC BY-NC 4.0": ["by-nc", "Requires Attribution and Non Commercial", "CC BY-NC 4.0"],
"CC BY-NC-SA 4.0": ["by-nc-sa", "Requires Attribution, Non Commercial and Share Alike", "CC BY-NC-SA 4.0"],
"CC BY-SA 4.0": ["by-sa", "Requires Attribution and Share Alike", "CC BY-SA 4.0"],
"CC BY-ND 4.0": ["by-nd", "Requires Attribution and No Derivatives", "CC BY-ND 4.0"],
"CC BY-NC-ND 4.0": ["by-nc-nd", "Requires Attribution, Non Commercial and No Derivatives", "CC BY-NC-ND 4.0"],
"private": ["by-nc-nd", "Requires Attribution, Non Commercial and No Derivatives + Private Prompts", "CC BY-NC-ND 4.0 + Private"],
}

View File

@@ -375,6 +375,7 @@ export interface character{
reloadKeys?:number
backgroundCSS?:string
license?:string
private?:boolean
}