feat: add forked
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { BookIcon, FlagIcon, ImageIcon, PaperclipIcon, SmileIcon, TrashIcon } from "lucide-svelte";
|
||||
import { language } from "src/lang";
|
||||
import { alertConfirm, alertInput, alertNormal } from "src/ts/alert";
|
||||
import { hubURL, type hubType, downloadRisuHub } from "src/ts/characterCards";
|
||||
import { hubURL, type hubType, downloadRisuHub, getRealmInfo } from "src/ts/characterCards";
|
||||
import { parseMarkdownSafe } from "src/ts/parser";
|
||||
import { DataBase } from "src/ts/storage/database";
|
||||
import RealmLicense from "./RealmLicense.svelte";
|
||||
@@ -24,6 +24,13 @@
|
||||
{#if openedData.authorname}
|
||||
<span class="text-borderc">Made by {openedData.authorname}</span>
|
||||
{/if}
|
||||
{#if openedData.original}
|
||||
<button class="text-blue-400 text-start" on:click={() => {
|
||||
const original = openedData.original
|
||||
openedData = null
|
||||
getRealmInfo(original)
|
||||
}}>Forked</button>
|
||||
{/if}
|
||||
<div class="flex justify-start gap-4 mt-4">
|
||||
<img class="h-36 w-36 rounded-md object-top object-cover" alt={openedData.name} src={`${hubURL}/resource/` + openedData.img}>
|
||||
<MultiLangDisplay value={openedData.desc} markdown={true} />
|
||||
|
||||
@@ -242,12 +242,7 @@ async function importCharacterProcess(f:{
|
||||
return db.characters.length - 1
|
||||
}
|
||||
|
||||
export const showRealmInfoStore:Writable<null|hubType> = writable(null)
|
||||
|
||||
export async function characterURLImport() {
|
||||
const realmPath = (new URLSearchParams(location.search)).get('realm')
|
||||
try {
|
||||
if(realmPath){
|
||||
export const getRealmInfo = async (realmPath:string) => {
|
||||
const url = new URL(location.href);
|
||||
url.searchParams.delete('realm');
|
||||
window.history.pushState(null, '', url.toString());
|
||||
@@ -259,6 +254,15 @@ export async function characterURLImport() {
|
||||
}
|
||||
showRealmInfoStore.set(await res.json())
|
||||
}
|
||||
|
||||
export const showRealmInfoStore:Writable<null|hubType> = writable(null)
|
||||
|
||||
export async function characterURLImport() {
|
||||
const realmPath = (new URLSearchParams(location.search)).get('realm')
|
||||
try {
|
||||
if(realmPath){
|
||||
getRealmInfo(realmPath)
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
@@ -1221,6 +1225,8 @@ export type hubType = {
|
||||
hot:number
|
||||
license:string
|
||||
authorname?:string
|
||||
original?:string
|
||||
type:string
|
||||
}
|
||||
|
||||
export async function getRisuHub(arg:{
|
||||
|
||||
Reference in New Issue
Block a user