diff --git a/server/import_images/bulk_import_images_from_derpi.ts b/server/import_images/bulk_import_images_from_derpi.ts index 0feb979..5223a4b 100644 --- a/server/import_images/bulk_import_images_from_derpi.ts +++ b/server/import_images/bulk_import_images_from_derpi.ts @@ -7,11 +7,11 @@ const { COPYFILE_EXCL } = fs.constants; const imghash: any = require('imghash'); +import config from "../../config/config" - -const PATH_TO_IMAGES = path.join("..", "..", "..", 'import_from_derpi', 'images') -const PATH_TO_JSONS = path.join("..", "..", "..", 'import_from_derpi', 'jsons') -const PATH_TO_IMPORTED_IMAGES = path.join("..", "..", "..", 'public', 'images') +const PATH_TO_IMAGES = path.join(config.root_path, 'import_from_derpi', 'images') +const PATH_TO_JSONS = path.join(config.root_path, 'import_from_derpi', 'jsons') +const PATH_TO_IMPORTED_IMAGES = path.join(config.root_path, 'public', 'images') const IMAGES = fs.readdirSync(PATH_TO_IMAGES) const JSONS = fs.readdirSync(PATH_TO_JSONS).map(json_file_name => path.parse(json_file_name).name) diff --git a/server/routes/import_from_derpi.ts b/server/routes/import_from_derpi.ts index ddddb44..a64bb19 100644 --- a/server/routes/import_from_derpi.ts +++ b/server/routes/import_from_derpi.ts @@ -9,7 +9,7 @@ import sharp from 'sharp' import image_ops from './../helpers/image_ops' const imghash: any = require('imghash'); const PATH_TO_IMAGES = path.join(process.cwd(), 'public', 'images') -const PATH_TO_WEBP = path.join(process.cwd(),'webp_images') +const PATH_TO_WEBP = path.join(process.cwd(),'public','webp_images') async function parse_author(tags: any) { for (const tag of tags) { const idx = tag.indexOf("artist:")