From 4c9d52422b96c70ed3afff773e3bb3ab7ea1668e Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 26 Apr 2024 22:46:13 +0300 Subject: [PATCH] [chore] ESLint and JSDoc --- src/endpoints/content-manager.js | 9 +++++++-- src/users.js | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/endpoints/content-manager.js b/src/endpoints/content-manager.js index 46aeb7fb..e6ce885c 100644 --- a/src/endpoints/content-manager.js +++ b/src/endpoints/content-manager.js @@ -402,7 +402,7 @@ async function downloadAICCCharacter(id) { return { buffer: buffer, fileName: fileName, - fileType: contentType + fileType: contentType, }; } catch (error) { console.error('Error downloading character:', error); @@ -410,8 +410,13 @@ async function downloadAICCCharacter(id) { } } +/** + * Parses an aicharactercards URL to extract the path. + * @param {string} url URL to parse + * @returns {string | null} AICC path + */ function parseAICC(url) { - const pattern = /^https?:\/\/aicharactercards\.com\/character-cards\/([^\/]+)\/([^\/]+)\/?$|([^\/]+)\/([^\/]+)$/; + const pattern = /^https?:\/\/aicharactercards\.com\/character-cards\/([^/]+)\/([^/]+)\/?$|([^/]+)\/([^/]+)$/; const match = url.match(pattern); if (match) { // Match group 1 & 2 for full URL, 3 & 4 for relative path diff --git a/src/users.js b/src/users.js index b1686396..cf64c41f 100644 --- a/src/users.js +++ b/src/users.js @@ -299,7 +299,7 @@ async function migrateUserData() { fs.cpSync( migration.old, path.join(backupDirectory, path.basename(migration.old)), - { recursive: true, force: true } + { recursive: true, force: true }, ); fs.rmSync(migration.old, { recursive: true, force: true }); } else { @@ -309,7 +309,7 @@ async function migrateUserData() { fs.cpSync( migration.old, path.join(backupDirectory, path.basename(migration.old)), - { recursive: true, force: true } + { recursive: true, force: true }, ); fs.rmSync(migration.old, { recursive: true, force: true }); }