Commit bd802d2d authored by Sascha's avatar Sascha

Merge branch 'develop' into 'master'

Preparing v1.10.0

Closes #90

See merge request !106
parents 0252ca76 dfadd7a2
...@@ -109,7 +109,34 @@ ...@@ -109,7 +109,34 @@
url: "config.json" url: "config.json"
}; };
return $http(req); var onSuccess = function(orig_json_config) {
var new_config = orig_json_config.data;
var deferred = $q.defer();
var onStorageRetrieve = function(storage_item) {
try {
new_config = JSON.parse(storage_item.ConfigJson);
} catch (e) {
// pass
}
return deferred.resolve(new_config);
};
chrome.storage.managed.get('ConfigJson', onStorageRetrieve);
return deferred.promise;
};
var onError = function(error) {
//should not happen
console.log(error);
return $q.reject(error);
};
return $http(req)
.then(onSuccess, onError);
}; };
/** /**
...@@ -219,8 +246,8 @@ ...@@ -219,8 +246,8 @@
if (Object.keys(config).length === 0) { if (Object.keys(config).length === 0) {
var onSuccess = function(data) { var onSuccess = function(new_config) {
config = data.data; config = new_config;
return resolve(_get_config(key)); return resolve(_get_config(key));
}; };
......
{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "object",
"properties": {
"ConfigJson": {
"type": "string",
"title": "Config Json",
"description": "The config.json that you want to preconfigure"
}
}
}
\ No newline at end of file
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
"http://*/*", "http://*/*",
"https://*/*" "https://*/*"
], ],
"storage": {
"managed_schema": "managed_storage.json"
},
"icons": { "icons": {
"16": "data/img/icon-16.png", "16": "data/img/icon-16.png",
"32": "data/img/icon-32.png", "32": "data/img/icon-32.png",
......
...@@ -130,7 +130,20 @@ ...@@ -130,7 +130,20 @@
url: "config.json" url: "config.json"
}; };
return $http(req); var onSuccess = function(orig_json_config) {
var new_config = orig_json_config.data;
return $q.resolve(new_config);
};
var onError = function(error) {
//should not happen
console.log(error);
return $q.reject(error);
};
return $http(req)
.then(onSuccess, onError);
}; };
/** /**
...@@ -276,8 +289,8 @@ ...@@ -276,8 +289,8 @@
if (Object.keys(config).length === 0) { if (Object.keys(config).length === 0) {
var onSuccess = function(data) { var onSuccess = function(new_config) {
config = data.data; config = new_config;
return resolve(_get_config(key)); return resolve(_get_config(key));
}; };
......
...@@ -109,7 +109,34 @@ ...@@ -109,7 +109,34 @@
url: "config.json" url: "config.json"
}; };
return $http(req); var onSuccess = function(orig_json_config) {
var new_config = orig_json_config.data;
var deferred = $q.defer();
var onStorageRetrieve = function(storage_item) {
try {
new_config = JSON.parse(storage_item.ConfigJson);
} catch (e) {
// pass
}
return deferred.resolve(new_config);
};
browser.storage.managed.get('ConfigJson', onStorageRetrieve);
return deferred.promise;
};
var onError = function(error) {
//should not happen
console.log(error);
return $q.reject(error);
};
return $http(req)
.then(onSuccess, onError);
}; };
/** /**
...@@ -219,8 +246,8 @@ ...@@ -219,8 +246,8 @@
if (Object.keys(config).length === 0) { if (Object.keys(config).length === 0) {
var onSuccess = function(data) { var onSuccess = function(new_config) {
config = data.data; config = new_config;
return resolve(_get_config(key)); return resolve(_get_config(key));
}; };
......
{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "object",
"properties": {
"ConfigJson": {
"type": "string",
"title": "Config Json",
"description": "The config.json that you want to preconfigure"
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment