Use alternate method of determining URLs, consolidate logs format
This commit is contained in:
parent
668d1f0fb9
commit
112e8f224c
|
@ -148,6 +148,7 @@ import {
|
||||||
getBase64Async,
|
getBase64Async,
|
||||||
humanFileSize,
|
humanFileSize,
|
||||||
Stopwatch,
|
Stopwatch,
|
||||||
|
isValidUrl,
|
||||||
} from './scripts/utils.js';
|
} from './scripts/utils.js';
|
||||||
|
|
||||||
import { ModuleWorkerWrapper, doDailyExtensionUpdatesCheck, extension_settings, getContext, loadExtensionSettings, renderExtensionTemplate, runGenerationInterceptors, saveMetadataDebounced } from './scripts/extensions.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();
|
const url = input.trim();
|
||||||
var request;
|
var request;
|
||||||
|
|
||||||
if (url.includes("https")) {
|
if (isValidUrl(url)) {
|
||||||
console.debug('Custom content import started for URL: ', url);
|
console.debug('Custom content import started for URL: ', url);
|
||||||
request = await fetch('/api/content/importURL', {
|
request = await fetch('/api/content/importURL', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
@ -422,18 +422,17 @@ router.post('/importUUID', jsonParser, async (request, response) => {
|
||||||
const uuid = request.body.url;
|
const uuid = request.body.url;
|
||||||
let result;
|
let result;
|
||||||
|
|
||||||
const isJannny = uuid.includes("_character")
|
const isJannny = uuid.includes('_character');
|
||||||
const isPygmalion = (!isJannny && uuid.length == 36)
|
const isPygmalion = (!isJannny && uuid.length == 36);
|
||||||
const uuidType = uuid.includes("lorebook") ? "lorebook" : "character";
|
const uuidType = uuid.includes('lorebook') ? 'lorebook' : 'character';
|
||||||
|
|
||||||
if (isPygmalion) {
|
if (isPygmalion) {
|
||||||
console.debug("We have a Pyg character")
|
console.log('Downloading Pygmalion character:', uuid);
|
||||||
result = await downloadPygmalionCharacter(uuid);
|
result = await downloadPygmalionCharacter(uuid);
|
||||||
} else if (isJannny) {
|
} else if (isJannny) {
|
||||||
console.debug("We have a Janny character")
|
console.log('Downloading Janitor character:', uuid.split('_')[0]);
|
||||||
result = await downloadJannyCharacter(uuid.split("_")[0]);
|
result = await downloadJannyCharacter(uuid.split('_')[0]);
|
||||||
} else {
|
} else {
|
||||||
console.debug("We have something from Chub?")
|
|
||||||
if (uuidType === 'character') {
|
if (uuidType === 'character') {
|
||||||
console.log('Downloading chub character:', uuid);
|
console.log('Downloading chub character:', uuid);
|
||||||
result = await downloadChubCharacter(uuid);
|
result = await downloadChubCharacter(uuid);
|
||||||
|
|
Loading…
Reference in New Issue