No longer redownload profile image and description when indexed, unless --redownload-profile is specified.
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user