single-file-core 1.5.103 → 1.5.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/index.js
CHANGED
|
@@ -181,6 +181,10 @@ class Runner {
|
|
|
181
181
|
this.options.rootDocument = root;
|
|
182
182
|
this.options.updatedResources = this.options.updatedResources || {};
|
|
183
183
|
this.options.fontTests = new Map();
|
|
184
|
+
if (root && !this.options.saveFilenameTemplateData && (this.options.openEditor || /{digest-sha-\d/.test(this.options.filenameTemplate))) {
|
|
185
|
+
this.options.saveFilenameTemplateData = true;
|
|
186
|
+
this.options.omitReferrerInTemplateData = !/{url-referrer/.test(this.options.filenameTemplate);
|
|
187
|
+
}
|
|
184
188
|
this.batchRequest = new BatchRequest();
|
|
185
189
|
this.processor = new Processor(options, processorHelper, this.batchRequest);
|
|
186
190
|
if (rootDocDefined) {
|
|
@@ -668,7 +672,7 @@ class Processor {
|
|
|
668
672
|
optionsElement.textContent = JSON.stringify({
|
|
669
673
|
saveUrl: this.options.url,
|
|
670
674
|
saveDate: this.options.saveDate.getTime(),
|
|
671
|
-
visitDate: this.options.visitDate.getTime(),
|
|
675
|
+
visitDate: (this.options.visitDate || this.options.saveDate).getTime(),
|
|
672
676
|
filenameTemplate: this.options.filenameTemplate,
|
|
673
677
|
filenameReplacedCharacters: this.options.filenameReplacedCharacters,
|
|
674
678
|
filenameReplacementCharacter: this.options.filenameReplacementCharacter,
|
|
@@ -680,7 +684,7 @@ class Processor {
|
|
|
680
684
|
selfExtractingArchive: this.options.selfExtractingArchive,
|
|
681
685
|
disableCompression: this.options.disableCompression,
|
|
682
686
|
extractDataFromPage: this.options.extractDataFromPage,
|
|
683
|
-
referrer: this.options.referrer,
|
|
687
|
+
referrer: this.options.omitReferrerInTemplateData ? undefined : this.options.referrer,
|
|
684
688
|
title: this.options.title,
|
|
685
689
|
info: this.options.info
|
|
686
690
|
});
|
package/package.json
CHANGED
package/test/fixtures/README.md
CHANGED
|
@@ -9,6 +9,9 @@ Frozen sample archives used by the test suites of the projects consuming
|
|
|
9
9
|
stylesheet and an image: the manifest has an `aliases` map and the
|
|
10
10
|
`pages/N/` copies are symlink entries
|
|
11
11
|
- `single-page.zip.html` — regular single-page self-extracting archive
|
|
12
|
+
- `classic-digest.html` — hand-written classic (uncompressed) saved page with
|
|
13
|
+
embedded filename template data and a `{digest-sha-256}` filename template,
|
|
14
|
+
used to verify the editor recomputes the filename digest when saving
|
|
12
15
|
|
|
13
16
|
The fixtures are intentionally frozen. When the archive format evolves, add
|
|
14
17
|
new fixtures (see `generate-fixtures.sh`) instead of regenerating these ones,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<!DOCTYPE html><html><!--
|
|
2
|
+
Page saved with SingleFile
|
|
3
|
+
url: https://example.com/digest
|
|
4
|
+
saved date: Thu Aug 27 2026 00:00:00 GMT+0000
|
|
5
|
+
--><head><meta charset="utf-8"><title>Digest fixture</title></head><body><script type="application/json" data-single-file-options>{"saveUrl": "https://example.com/digest", "saveDate": 1787000000000, "visitDate": 1787000000000, "filenameTemplate": "{page-title}_{digest-sha-256}.html", "filenameReplacedCharacters": ["~", "+", "?", "%", "*", ":", "|", "\"", "<", ">", "\\\\", "\u0000-\u001f", "\u007f"], "filenameReplacementCharacter": "_", "filenameReplacementCharacters": ["\uff5e", "\uff0b", "\uff1f", "\uff05", "\uff0a", "\uff1a", "\uff5c", "\uff02", "\uff1c", "\uff1e", "\uff3c"], "filenameMaxLengthUnit": "bytes", "filenameMaxLength": 192, "replaceEmojisInFilename": false, "compressContent": false, "referrer": "", "title": "Digest fixture", "info": {}}</script><h1>Delta</h1></body></html>
|