Closed Yakabuff closed 1 year ago
Did a bit of investigating:
In single-file-cli-api.js
async function capturePage(options) {
try {
let filename;
const pageData = await backend.getPageData(options);
if (options.includeInfobar) {
await includeInfobarScript(pageData);
}
In back-end/pupeteer.js:
exports.getPageData = async (options, page) => {
return await getPageData(context || browser, page, options);
async function getPageData(context, page, options) {
...
return await page.evaluate(async options => {
return await singlefile.getPageData(options);
}, options);
In singlefile.js in single-file-core:
async function getPageData(options = {}, initOptions, doc = globalThis.document, win = globalThis) {
...
const processor = new SingleFile(options);
return await processor.getPageData();
In Processor#getPageData in single-file-core/single-file-core.js:
async getPageData() {
const commentNode = this.doc.createComment("\n " + (this.options.useLegacyCommentHeader ? util.COMMENT_HEADER_LEGACY : util.COMMENT_HEADER) +
" \n url: " + infobarURL +
(this.options.removeSavedDate ? " " : " \n saved date: " + infobarSaveDate) +
(infobarContent ? " \n info: " + infobarContent : "") + "\n");
From a cursory glance, it looks as though we can just add a removeSavedDate
flag in args.js and a default value in const DEFAULT_OPTIONS
without changing any internal logic as we are only passing around this option object?
@gildas-lormeau That seems to work. Adding a removeSavedDate option field in args.js disables the saved date:
portion in the html. Should I make a PR?
https://github.com/gildas-lormeau/SingleFile/issues/1058
Is there a flag to disable the saved date header in the .html from CLI like what was implemented the issue above? It's causing the snapshots to have different hashes despite having the exact same content.