From d6c3c6f26ebda61bfbbc82df41ba7c79a31b28df Mon Sep 17 00:00:00 2001 From: Cohee Date: Thu, 6 Jul 2023 20:36:02 +0300 Subject: [PATCH] Chub cope --- server.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index ab0ca8651..caa2ee1ea 100644 --- a/server.js +++ b/server.js @@ -4091,6 +4091,7 @@ async function downloadChubLorebook(id) { }); if (!result.ok) { + console.log(await result.text()); throw new Error('Failed to download lorebook'); } @@ -4133,7 +4134,14 @@ function parseChubUrl(str) { return null; } - const domainIndex = splitStr.indexOf('chub.ai'); + let domainIndex = -1; + + splitStr.forEach((part, index) => { + if (part === 'www.chub.ai' || part === 'chub.ai') { + domainIndex = index; + } + }) + const lastTwo = domainIndex !== -1 ? splitStr.slice(domainIndex + 1) : splitStr; const firstPart = lastTwo[0].toLowerCase();