Added support for RedGifs and Reddit albums. Improved command line logger. Added rate limiters for reddit and host URLs.
This commit is contained in:
@@ -6,6 +6,7 @@ const yaml = require('js-yaml');
|
||||
const interpolate = require('../interpolate');
|
||||
// const textToStream = require('./textToStream');
|
||||
const save = require('./save');
|
||||
const logger = require('../logger')(__filename);
|
||||
|
||||
async function writeToIndex(posts, profilePaths, user, args) {
|
||||
const filepath = interpolate(config.library.index.file, null, null, null, null, user, false);
|
||||
@@ -44,8 +45,14 @@ async function writeToIndex(posts, profilePaths, user, args) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// return save(filepath, textToStream(yaml.safeDump(data)));
|
||||
return save(filepath, Buffer.from(yaml.safeDump(data), 'utf8'));
|
||||
try {
|
||||
const yamlIndex = yaml.safeDump(data);
|
||||
|
||||
return save(filepath, Buffer.from(yamlIndex, 'utf8'));
|
||||
} catch (error) {
|
||||
logger.error(`Could not save index for ${user.username}: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = writeToIndex;
|
||||
|
||||
Reference in New Issue
Block a user