Improved missing gfycat handling. Added 'preview' marker to index.

This commit is contained in:
2018-07-02 23:15:06 +02:00
parent dfee2c2ae2
commit 5dce74588b
3 changed files with 41 additions and 32 deletions

View File

@@ -10,16 +10,24 @@ async function writeToIndex(posts, profilePaths, user) {
const filename = interpolate(config.library.index.file, user, null, false);
const now = new Date();
const newAndUpdatedEntries = posts.concat(user.indexed.updated).map(post => ({
id: post.id,
subreddit: post.subreddit,
permalink: post.permalink,
url: post.url,
hostId: post.host.id,
date: post.datetime,
indexed: now,
title: post.title,
}));
const newAndUpdatedEntries = posts.concat(user.indexed.updated).map((post) => {
const entryPost = {
id: post.id,
subreddit: post.subreddit,
permalink: post.permalink,
url: post.url,
hostId: post.host.id,
date: post.datetime,
indexed: now,
title: post.title,
};
if (post.previewFallback) {
entryPost.preview = true;
}
return entryPost;
});
const data = {
profile: {