Added support for fetching content directly from host. Improved pattern interpolation. Refactored content modules.

This commit is contained in:
2019-11-01 04:22:36 +01:00
parent d773920da8
commit eee3ba0abc
26 changed files with 572 additions and 440 deletions

View File

@@ -25,10 +25,17 @@ async function saveProfileImage(user, args) {
return null;
}
const filepath = interpolate(config.library.profile.image, user, null, {
const filepath = interpolate(
config.library.profile.image,
{
// pass profile image as item to interpolate extension variable
url: image,
});
url: image,
},
null,
null,
null,
user,
);
try {
const stream = await fetchItem(image, 0, { permalink: `https://reddit.com/user/${user.name}` });
@@ -54,7 +61,7 @@ async function saveProfileDescription(user, args) {
if (config.library.profile.description && !user.fallback && !user.deleted) {
if (user.profile && user.profile.description) {
const filepath = interpolate(config.library.profile.description, user);
const filepath = interpolate(config.library.profile.description, null, null, null, null, user);
const stream = textToStream(user.profile.description);
try {

View File

@@ -8,7 +8,7 @@ const textToStream = require('./textToStream');
const save = require('./save');
async function writeToIndex(posts, profilePaths, user, args) {
const filepath = interpolate(config.library.index.file, user, null, false);
const filepath = interpolate(config.library.index.file, null, null, null, null, user, false);
const now = new Date();
const newAndUpdatedEntries = posts.concat(user.indexed.updated, args.indexIgnored ? user.indexed.ignored : []).map((post) => {