Fix monitor add issue (#153)

* Fix monitor add issue
This commit is contained in:
quickiwiki 2025-08-01 15:00:04 +05:00 committed by GitHub
parent 699daf8a81
commit 784667aa08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 6 deletions

View File

@ -132,12 +132,18 @@ export function setSetting(name, value) {
// No days means only for this browser session
export function writeSetting(name, value) {
"use strict";
if (settings[name] === value) return;
settings[name] = value;
if (window.chrome && window.chrome.storage) {
window.chrome.storage.sync.set(settings);
} else {
localStorage.setItem(name, value);
if (settings[name] !== value) {
settings[name] = value;
}
try {
if (window.chrome?.storage) {
window.chrome.storage.sync.set({ [name]: value });
} else {
localStorage.setItem(name, value);
}
} catch (e) {
console.log("Failed to write setting: " + name + " = " + value);
}
}