1
0
Эх сурвалжийг харах

fixed infobar displaying issue

Gildas 7 жил өмнө
parent
commit
e2fa2c6fad

+ 7 - 2
extension/core/bg/config.js

@@ -62,8 +62,8 @@ singlefile.config = (() => {
 
 	let pendingUpgradePromise = upgrade();
 	browser.runtime.onMessage.addListener(request => {
-		if (request.getConfig) {
-			return getConfig();
+		if (request.getOptions) {
+			return getOptions();
 		}
 	});
 
@@ -177,6 +177,11 @@ singlefile.config = (() => {
 		}
 	}
 
+	async function getOptions() {
+		const [config, tabsData] = await Promise.all([getConfig(), singlefile.tabsData.get()]);
+		return config.profiles[tabsData.profileName || DEFAULT_PROFILE_NAME];
+	}
+
 	async function getConfig() {
 		await pendingUpgradePromise;
 		return await browser.storage.local.get(["profiles", "defaultProfile"]);

+ 2 - 2
extension/ui/content/infobar.js

@@ -44,8 +44,8 @@ this.singlefile.infobar = this.singlefile.infobar || (() => {
 		if (singleFileComment) {
 			const info = singleFileComment.textContent.split("\n");
 			const [, , url, saveDate, ...infoData] = info;
-			const config = await browser.runtime.sendMessage({ getConfig: true });
-			if (config.displayInfobar) {
+			const options = await browser.runtime.sendMessage({ getOptions: true });
+			if (options.displayInfobar) {
 				initInfobar(url, saveDate, infoData);
 			}
 		}