[feat] realm url sharing
This commit is contained in:
@@ -201,7 +201,8 @@
|
||||
<div class=" mt-2 w-full border-t-2 border-t-bgcolor"></div>
|
||||
<button class="w-full hover:bg-selected p-4" on:click|stopPropagation={async () => {
|
||||
menuOpen = false
|
||||
const id = await alertInput('Input URL or ID')
|
||||
const input = await alertInput('Input URL or ID')
|
||||
const id = input.split("?").at(-1)
|
||||
downloadRisuHub(id)
|
||||
|
||||
}}>Import Character from URL or ID</button>
|
||||
|
||||
@@ -125,7 +125,19 @@ async function importCharacterProcess(f:{
|
||||
}
|
||||
}
|
||||
|
||||
export async function characterHubImport() {
|
||||
export async function characterURLImport() {
|
||||
const realmPath = (new URLSearchParams(location.search)).get('realm')
|
||||
try {
|
||||
if(realmPath){
|
||||
const url = new URL(location.href);
|
||||
url.searchParams.delete('realm');
|
||||
window.history.pushState(null, '', url.toString());
|
||||
downloadRisuHub(realmPath)
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
const charPath = (new URLSearchParams(location.search)).get('charahub')
|
||||
try {
|
||||
if(charPath){
|
||||
|
||||
@@ -14,7 +14,7 @@ import { loadPlugins } from "../plugins/plugins";
|
||||
import { alertConfirm, alertError } from "../alert";
|
||||
import { checkDriverInit, syncDrive } from "../drive/drive";
|
||||
import { hasher } from "../parser";
|
||||
import { characterHubImport, hubURL } from "../characterCards";
|
||||
import { characterURLImport, hubURL } from "../characterCards";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { defaultJailbreak, defaultMainPrompt, oldJailbreak, oldMainPrompt } from "./defaultPrompts";
|
||||
import { loadRisuAccountData } from "../drive/accounter";
|
||||
@@ -408,7 +408,7 @@ export async function loadData() {
|
||||
}
|
||||
checkOldDomain()
|
||||
if(get(DataBase).didFirstSetup){
|
||||
characterHubImport()
|
||||
characterURLImport()
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user