chore: configure next-image-export-optimizer
This commit is contained in:
parent
3db46c8f65
commit
5ebda2c942
@ -1,6 +1,19 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
output: "export",
|
output: "export",
|
||||||
|
images: {
|
||||||
|
loader: "custom",
|
||||||
|
deviceSizes: [1080, 1200, 1920],
|
||||||
|
imageSizes: [128, 256, 384],
|
||||||
|
},
|
||||||
|
transpilePackages: ["next-image-export-optimizer"],
|
||||||
env: {
|
env: {
|
||||||
COMMIT_SHORT_SHA: process.env.COMMIT_SHORT_SHA || "HEAD",
|
COMMIT_SHORT_SHA: process.env.COMMIT_SHORT_SHA || "HEAD",
|
||||||
|
nextImageExportOptimizer_imageFolderPath: "public/images",
|
||||||
|
nextImageExportOptimizer_exportFolderPath: "out",
|
||||||
|
nextImageExportOptimizer_quality: "90",
|
||||||
|
nextImageExportOptimizer_storePicturesInWEBP: "true",
|
||||||
|
nextImageExportOptimizer_exportFolderName: "nextImageExportOptimizer",
|
||||||
|
nextImageExportOptimizer_generateAndUseBlurImages: "true",
|
||||||
|
nextImageExportOptimizer_remoteImageCacheTTL: "31536000",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
42
remoteOptimizedImages.js
Normal file
42
remoteOptimizedImages.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
const config = require("./config.json");
|
||||||
|
|
||||||
|
const minio = require("minio");
|
||||||
|
const xml2json = require("xml2json");
|
||||||
|
|
||||||
|
const minioEndpoint = process.env.MINIO_ENDPOINT;
|
||||||
|
const minioBucket = process.env.MINIO_BUCKET;
|
||||||
|
|
||||||
|
const mc = new minio.Client({
|
||||||
|
endPoint: minioEndpoint,
|
||||||
|
accessKey: process.env.MINIO_ACCESS_KEY,
|
||||||
|
secretKey: process.env.MINIO_SECRET_KEY,
|
||||||
|
});
|
||||||
|
|
||||||
|
const minioObjects = new Promise((resolve, reject) => {
|
||||||
|
const data = [];
|
||||||
|
|
||||||
|
const stream = mc.listObjectsV2(minioBucket, "photos", true, "");
|
||||||
|
|
||||||
|
stream.on("data", (obj) => data.push(obj.name));
|
||||||
|
stream.on("error", reject);
|
||||||
|
stream.on("end", () => {
|
||||||
|
resolve(data);
|
||||||
|
});
|
||||||
|
}).then((data) => {
|
||||||
|
return data.map((id) => `https://${minioEndpoint}/${minioBucket}/${id}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const getPeertubeFeeds = fetch(process.env.PEERTUBE_FEED_URL)
|
||||||
|
.then((res) => res.text())
|
||||||
|
.then((payload) => {
|
||||||
|
const peertubeFeedsJSON = xml2json.toJson(payload, { object: true });
|
||||||
|
const peertubeItems = peertubeFeedsJSON.rss.channel.item;
|
||||||
|
|
||||||
|
const videos = peertubeItems.map((item) => item["media:thumbnail"][0].url);
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = Promise.all([minioObjects, getPeertubeFeeds]).then((data) => {
|
||||||
|
return [...data[0], ...data[1], config.navbar.logo, config.profile.avatar];
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user