Przeglądaj źródła

pass sessionId from content script when auto-save is active

Gildas 7 lat temu
rodzic
commit
84cfd2635b

+ 1 - 0
extension/core/content/content-autosave.js

@@ -37,6 +37,7 @@ this.singlefile.autosave = this.singlefile.autosave || (async () => {
 	async function autoSavePage() {
 		const [autoSaveEnabled, options] = await Promise.all([browser.runtime.sendMessage({ isAutoSaveEnabled: true }), browser.runtime.sendMessage({ getConfig: true })]);
 		if (autoSaveEnabled) {
+			options.sessionId = 0;
 			if (options.autoSaveDelay && !autoSaveTimeout) {
 				autoSaveTimeout = setTimeout(() => {
 					autoSavePage();

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

@@ -33,7 +33,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		return class {
 			constructor(options) {
 				this.options = options;
-				options.sessionId = sessionId;
+				options.sessionId = options.sessionId || sessionId;
 				sessionId++;
 				this.SELECTED_CONTENT_ATTRIBUTE_NAME = SELECTED_CONTENT_ATTRIBUTE_NAME;
 				this.SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME = SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME;