No longer redownload profile image and description when indexed, unless --redownload-profile is specified.

This commit is contained in:
2024-09-11 05:16:56 +02:00
parent fcb85f57c8
commit e087e47069
8 changed files with 37 additions and 22 deletions
+23
View File
@@ -0,0 +1,23 @@
'use strict';
const config = require('config');
const fs = require('fs-extra');
const yaml = require('js-yaml');
const interpolate = require('../interpolate.js');
async function getIndex(user) {
const indexFilePath = interpolate(config.library.index.file, user, null, null, false);
try {
const indexFile = await fs.readFile(indexFilePath, 'utf8');
return yaml.safeLoad(indexFile);
} catch (error) {
console.log('\x1b[33m%s\x1b[0m', `Could not load index file for '${user.name}' at '${indexFilePath}': ${error}`);
return { profile: { image: null, description: null }, posts: [] };
}
}
module.exports = getIndex;