single-file-core 1.3.24 → 1.3.26

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
@@ -588,12 +588,14 @@ class Processor {
588
588
  this.stats.add("discarded", "HTML bytes", size - contentSize);
589
589
  }
590
590
  const filename = await util.formatFilename(content, this.doc, this.options);
591
+ const mimeType = util.getMimeType(this.options);
591
592
  const matchTitle = this.baseURI.match(/([^/]*)\/?(\.html?.*)$/) || this.baseURI.match(/\/\/([^/]*)\/?$/);
592
593
  const additionalData = this.processorHelper.getAdditionalPageData(this.doc, content, this.resources);
593
594
  const pageData = Object.assign({
594
595
  stats: this.stats.data,
595
596
  title: this.options.title || (this.baseURI && matchTitle ? matchTitle[1] : url.hostname ? url.hostname : ""),
596
597
  filename,
598
+ mimeType,
597
599
  content
598
600
  }, additionalData);
599
601
  if (this.options.addProof) {
package/core/infobar.js CHANGED
@@ -205,6 +205,7 @@ function appendInfobar(doc, options, useShadowRoot) {
205
205
  } else {
206
206
  const scriptElement = doc.createElement("script");
207
207
  let scriptContent = refreshInfobarInfo.toString();
208
+ scriptContent += ";const SINGLE_FILE_SIGNATURE = " + JSON.stringify(SINGLE_FILE_SIGNATURE) + ";";
208
209
  scriptContent += extractInfobarData.toString();
209
210
  scriptContent += "(" + initInfobar.toString() + ")(document)";
210
211
  scriptElement.textContent = scriptContent;
package/core/util.js CHANGED
@@ -154,6 +154,9 @@ function getInstance(utilOptions) {
154
154
  formatFilename(content, doc, options) {
155
155
  return modules.templateFormatter.formatFilename(content, doc, options);
156
156
  },
157
+ getMimeType(options) {
158
+ return !options.compressContent || options.selfExtractingArchive ? "text/html" : "application/zip";
159
+ },
157
160
  async evalTemplate(template, options, content, doc, dontReplaceSlash) {
158
161
  return modules.templateFormatter.evalTemplate(template, options, content, doc, dontReplaceSlash);
159
162
  },
@@ -349,7 +349,7 @@ function getUsedFontWeight(fontInfo, fontStyle, fontWeights) {
349
349
  }
350
350
  }
351
351
  if (!foundWeight) {
352
- foundWeight = fontWeights.find(weights => weights[0] <= fontWeight && weights[1] >= fontWeight);
352
+ foundWeight = fontWeights.find(weights => weights[0] <= fontWeight && weights[weights.length - 1] >= fontWeight);
353
353
  }
354
354
  } else {
355
355
  foundWeight = fontWeights[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.3.24",
3
+ "version": "1.3.26",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",