1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Implemented Sync extension settings with Firefox Sync or own server (experimental)

This commit is contained in:
nobody
2020-06-08 11:38:52 +02:00
parent f87c77f325
commit f7b85adc24
9 changed files with 26 additions and 25 deletions

View File

@@ -38,7 +38,7 @@ main._initializeSettings = function () {
[Setting.DOMAINS_MANIPULATE_DOM]: {}
};
chrome.storage.local.get(settingDefaults, function (items) {
chrome.storage.sync.get(settingDefaults, function (items) {
if (items === null) {
items = settingDefaults; // Restore setting defaults.
@@ -57,7 +57,7 @@ main._initializeSettings = function () {
});
}
chrome.storage.local.set(items);
chrome.storage.sync.set(items);
});
};
@@ -70,7 +70,7 @@ main._showReleaseNotes = function (details) {
if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) {
chrome.storage.local.set({
chrome.storage.sync.set({
[Setting.LAST_MAPPING_UPDATE]: lastMappingUpdate
}, function() {
@@ -82,7 +82,7 @@ main._showReleaseNotes = function (details) {
if (details.temporary !== true) {
chrome.storage.local.get([Setting.HIDE_RELEASE_NOTES], function (items) {
chrome.storage.sync.get([Setting.HIDE_RELEASE_NOTES], function (items) {
if (items.hideReleaseNotes !== true) {
@@ -100,13 +100,13 @@ main._showReleaseNotes = function (details) {
let oldValue = "";
// If add-on update true, check last update of mappings.js
chrome.storage.local.get([Setting.LAST_MAPPING_UPDATE, Setting.HIDE_RELEASE_NOTES], function (items) {
chrome.storage.sync.get([Setting.LAST_MAPPING_UPDATE, Setting.HIDE_RELEASE_NOTES], function (items) {
oldValue = items.lastMappingUpdate;
if (oldValue !== newValue) {
// Updated mappings.js
chrome.storage.local.set({
chrome.storage.sync.set({
[Setting.LAST_MAPPING_UPDATE]: newValue
}, function() {
if (!items.hideReleaseNotes) {