Use alternate method of determining URLs, consolidate logs format

This commit is contained in:
Cohee 2024-03-03 16:45:26 +02:00
parent 668d1f0fb9
commit 112e8f224c
2 changed files with 8 additions and 8 deletions

View File

@ -148,6 +148,7 @@ import {
getBase64Async,
humanFileSize,
Stopwatch,
isValidUrl,
} from './scripts/utils.js';
import { ModuleWorkerWrapper, doDailyExtensionUpdatesCheck, extension_settings, getContext, loadExtensionSettings, renderExtensionTemplate, runGenerationInterceptors, saveMetadataDebounced } from './scripts/extensions.js';
@ -9988,7 +9989,7 @@ jQuery(async function () {
const url = input.trim();
var request;
if (url.includes("https")) {
if (isValidUrl(url)) {
console.debug('Custom content import started for URL: ', url);
request = await fetch('/api/content/importURL', {
method: 'POST',

View File

@ -422,18 +422,17 @@ router.post('/importUUID', jsonParser, async (request, response) => {
const uuid = request.body.url;
let result;
const isJannny = uuid.includes("_character")
const isPygmalion = (!isJannny && uuid.length == 36)
const uuidType = uuid.includes("lorebook") ? "lorebook" : "character";
const isJannny = uuid.includes('_character');
const isPygmalion = (!isJannny && uuid.length == 36);
const uuidType = uuid.includes('lorebook') ? 'lorebook' : 'character';
if (isPygmalion) {
console.debug("We have a Pyg character")
console.log('Downloading Pygmalion character:', uuid);
result = await downloadPygmalionCharacter(uuid);
} else if (isJannny) {
console.debug("We have a Janny character")
result = await downloadJannyCharacter(uuid.split("_")[0]);
console.log('Downloading Janitor character:', uuid.split('_')[0]);
result = await downloadJannyCharacter(uuid.split('_')[0]);
} else {
console.debug("We have something from Chub?")
if (uuidType === 'character') {
console.log('Downloading chub character:', uuid);
result = await downloadChubCharacter(uuid);