Changed range toggles to links for home and actor pages.

This commit is contained in:
2020-05-07 03:20:51 +02:00
parent 2b2fb9e3e7
commit 525995615a
10 changed files with 116 additions and 104 deletions

View File

@@ -264,19 +264,15 @@ async function storeImageFile(media, hashDir, hashSubDir, filename, filedir, fil
const lazydir = path.join(media.role, 'lazy', hashDir, hashSubDir);
const lazypath = path.join(lazydir, filename);
const image = sharp(media.file.path);
const [info, stat] = await Promise.all([
image.metadata(),
fsPromises.stat(media.file.path),
]);
await Promise.all([
fsPromises.mkdir(path.join(config.media.path, filedir), { recursive: true }),
fsPromises.mkdir(path.join(config.media.path, thumbdir), { recursive: true }),
fsPromises.mkdir(path.join(config.media.path, lazydir), { recursive: true }),
]);
const image = sharp(media.file.path);
const info = await image.metadata();
// generate thumbnail and lazy
await Promise.all([
image
@@ -321,7 +317,6 @@ async function storeImageFile(media, hashDir, hashSubDir, filename, filedir, fil
...media.meta,
width: info.width,
height: info.height,
size: stat.size,
},
};
}
@@ -382,8 +377,12 @@ async function fetchSource(source, baseMedia) {
const tempFileTarget = fs.createWriteStream(tempFilePath);
const hashStream = new PassThrough();
let size = 0;
hashStream.on('data', chunk => hasher.write(chunk));
hashStream.on('data', (chunk) => {
size += chunk.length;
hasher.write(chunk);
});
const res = await http.get(source.src, {
...(source.referer && { referer: source.referer }),
@@ -417,6 +416,7 @@ async function fetchSource(source, baseMedia) {
extension,
type,
subtype,
size,
},
};
} catch (error) {