Преглед изворни кода

added addProof option

Former-commit-id: b8922b271422966f6de169188fab4728e00f8c0e
Gildas пре 6 година
родитељ
комит
453f1fc439
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      lib/single-file/single-file-core.js

+ 5 - 1
lib/single-file/single-file-core.js

@@ -490,12 +490,16 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 				filename = "Unnamed page";
 			}
 			const matchTitle = this.baseURI.match(/([^/]*)\/?(\.html?.*)$/) || this.baseURI.match(/\/\/([^/]*)\/?$/);
-			return {
+			const pageData = {
 				stats: this.stats.data,
 				title: this.options.title || (this.baseURI && matchTitle ? matchTitle[1] : (url.hostname ? url.hostname : "")),
 				filename,
 				content
 			};
+			if (this.options.addProof) {
+				pageData.hash = await util.digest("SHA-256", content);
+			}
+			return pageData;
 		}
 
 		preProcessPage() {