[feat] realm url sharing

This commit is contained in:
kwaroran
2023-07-16 22:31:18 +09:00
parent d919121870
commit bc57c232cd
3 changed files with 17 additions and 4 deletions

View File

@@ -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){

View File

@@ -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 {