gPass

gPass Commit Details

Date:2017-04-17 20:39:53 (2 years 6 months ago)
Author:Grégory Soutadé
Branch:master
Commit:c3fab882f24e60bc3dcfb568887eb0cfcd268146
Parents: 74b1010881d281c22b9a2ba5c59c780cf2640742
Message:Add compat.js for getPref and setPref

Changes:
Cserver/resources/hmac.js → chrome_addon/compat.js
Cserver/ref/index.php → firefox_webextension/compat.js
Mchrome_addon/lib/misc.js (1 diff)
Mchrome_addon/manifest.json (2 diffs)
Mfirefox_webextension/manifest.json (1 diff)

File differences

chrome_addon/compat.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
Copyright (C) 2013-2017 Grégory Soutadé
This file is part of gPass.
gPass is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
gPass is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with gPass. If not, see <http://www.gnu.org/licenses/>.
*/
function getPref(key)
{
var promise = new Promise((resolve, reject) => {
chrome.storage.local.get(key, (items) => {
let err = chrome.runtime.lastError;
if (err) {
reject(err);
} else {
resolve(items);
}
});
})
.then(function (pref) {
if (!pref.hasOwnProperty(key))
return default_preferences[key];
return pref[key];
});
return promise;
}
function setPref(key, value)
{
chrome.storage.local.set({key:value}, function ok() {});
}
chrome_addon/lib/misc.js
175175
176176
177177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
return result;
}
function getPref(key)
{
return browser.storage.local.get(key)
.then(
function (pref) {
if (!pref.hasOwnProperty(key))
return default_preferences[key];
return pref[key];
}
,
function (err) {
console.log("Error getting preference " + err);
}
);
}
function setPref(key, value)
{
browser.storage.local.set({key:value});
}
chrome_addon/manifest.json
33
44
55
6
6
77
88
99
......
1212
1313
1414
15
15
1616
1717
1818
"name": "gPass",
"short_name": "gPass",
"version": "0.7",
"version": "0.8",
"description": "gPass : global password manager",
"icons" : {"16":"icons/gpass_icon_16.png", "32":"icons/gpass_icon_32.png", "64":"icons/gpass_icon_64.png", "128":"icons/gpass_icon_128.png"},
"author" : "Grégory Soutadé",
"content_scripts": [
{
"matches": ["https://*/*", "http://*/*"],
"js": ["lib/parseuri.js", "lib/misc.js", "lib/main.js"],
"js": ["lib/parseuri.js", "lib/misc.js", "compat.js", "lib/main.js"],
"run_at" : "document_idle",
"all_frames" : true
}
firefox_webextension/compat.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
Copyright (C) 2013-2017 Grégory Soutadé
This file is part of gPass.
gPass is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
gPass is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with gPass. If not, see <http://www.gnu.org/licenses/>.
*/
function getPref(key)
{
return browser.storage.local.get(key)
.then(
function (pref) {
if (!pref.hasOwnProperty(key))
return default_preferences[key];
return pref[key];
}
,
function (err) {
console.log("Error getting preference " + err);
}
);
}
function setPref(key, value)
{
browser.storage.local.set({key:value});
}
firefox_webextension/manifest.json
1212
1313
1414
15
15
1616
1717
1818
"content_scripts": [
{
"matches": ["https://*/*", "http://*/*"],
"js": ["lib/parseuri.js", "lib/misc.js", "lib/main.js"],
"js": ["lib/parseuri.js", "lib/misc.js", "compat.js", "lib/main.js"],
"run_at" : "document_idle",
"all_frames" : true
}

Archive Download the corresponding diff file