Some more cleanup

This commit is contained in:
Dakedres 2024-04-11 09:54:06 -06:00
parent bc5e0e63dc
commit 76a10c6ba8

7
lib.js
View File

@ -397,7 +397,6 @@ export const downloadImage = async (url, basename, source, view) => {
const download = () => write(path, response.body)
.then(annotate( `Downloaded ${pathname}`))
// TODO: See if the image is downloaded before even trying to download it
view.batch.add(FS.access(path).catch(download))
return pathname
} else {
@ -512,7 +511,7 @@ export const writeView = (sources, feeds, view) => {
writeStylesheet(Path.join(import.meta.dirname, 'assets/style.css'), view)
}
export const createPages = (list, { pageSize }) => {
export const createPages = (list, view) => {
let posts = []
let pages = []
let lastPageLink = 'about:blank'
@ -522,9 +521,9 @@ export const createPages = (list, { pageSize }) => {
for(let i = list.posts.length - 1; i >= 0; i--) {
posts.push(list.posts[i])
if(i % pageSize == 0) {
if(i % view.pageSize == 0) {
let title = getPageTitle(list, pages.length)
let filename = i < pageSize ? getFinalPageFilename(list) : getPageFilename(list, pages.length)
let filename = i < view.pageSize ? getFinalPageFilename(list) : getPageFilename(list, pages.length)
let page = {
filename,
title,