This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/server/calendar.js

26 lines
696 B
JavaScript
Raw Normal View History

2021-09-07 10:11:15 -07:00
require('../src/dotenv')();
2021-08-18 05:39:08 -07:00
const Pageres = require('pageres');
const fs = require('fs');
const Suml = require('suml');
2021-08-18 11:19:24 -07:00
const shoot = async (url, filename) => {
2021-08-18 05:39:08 -07:00
const pr = new Pageres({
delay: 3,
2021-08-18 11:19:24 -07:00
scale: 2,
2021-08-18 05:39:08 -07:00
});
2021-08-18 11:19:24 -07:00
pr.src(process.env.BASE_URL + url, ['1500x300']);
2021-08-18 05:39:08 -07:00
for (let buffer of await pr.run()) {
2021-09-14 08:45:20 -07:00
const dir = `${__dirname}/../static/img-local/calendar`;
fs.mkdirSync(dir, {recursive: true})
const target = `${dir}/${filename}.png`;
2021-08-18 05:39:08 -07:00
console.log(target);
fs.writeFileSync(target, buffer);
}
2021-08-18 11:19:24 -07:00
}
(async () => {
2021-09-14 08:45:20 -07:00
await shoot('/calendar-wide', `overview`);
await shoot('/calendar-wide?labels=true', `labels`);
2021-08-18 05:39:08 -07:00
})();