mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Move privacy to optional permissions
This commit is contained in:
parent
dc1dc2f17c
commit
defc45c6e4
7 changed files with 30 additions and 24 deletions
4
dist/manifest_chromium.json
vendored
4
dist/manifest_chromium.json
vendored
|
|
@ -162,7 +162,6 @@
|
|||
"nativeMessaging",
|
||||
"notifications",
|
||||
"offscreen",
|
||||
"privacy",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webNavigation",
|
||||
|
|
@ -170,6 +169,9 @@
|
|||
"webRequestAuthProvider",
|
||||
"webRequestBlocking"
|
||||
],
|
||||
"optional_permissions": [
|
||||
"privacy"
|
||||
],
|
||||
"content_security_policy": {
|
||||
"extension_pages": "script-src 'self'"
|
||||
},
|
||||
|
|
|
|||
4
dist/manifest_firefox.json
vendored
4
dist/manifest_firefox.json
vendored
|
|
@ -166,7 +166,6 @@
|
|||
"cookies",
|
||||
"nativeMessaging",
|
||||
"notifications",
|
||||
"privacy",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webNavigation",
|
||||
|
|
@ -176,6 +175,9 @@
|
|||
"http://*/*",
|
||||
"https://api.github.com/"
|
||||
],
|
||||
"optional_permissions": [
|
||||
"privacy"
|
||||
],
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "keepassxc-browser@keepassxc.org",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ const defaultSettings = {
|
|||
debugLogging: false,
|
||||
defaultGroup: '',
|
||||
defaultPasskeyGroup: '',
|
||||
defaultPasswordManager: false,
|
||||
defaultGroupAlwaysAsk: false,
|
||||
downloadFaviconAfterSave: false,
|
||||
passkeys: false,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ HTMLElement.prototype.hide = function() {
|
|||
|
||||
// Disables the browser's internal password manager and let the extension take the control
|
||||
const updateDefaultPasswordManager = async function() {
|
||||
const permissionResponse = await browser.permissions.request({ permissions: [ 'privacy' ] });
|
||||
if (!permissionResponse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const passwordSavingEnabled = await browser.privacy.services.passwordSavingEnabled.get({});
|
||||
if ((passwordSavingEnabled?.levelOfControl === 'controlled_by_this_extension'
|
||||
|| passwordSavingEnabled?.levelOfControl === 'controllable_by_this_extension')
|
||||
|
|
@ -18,4 +23,6 @@ const updateDefaultPasswordManager = async function() {
|
|||
value: !passwordSavingEnabled.value,
|
||||
});
|
||||
}
|
||||
|
||||
return passwordSavingEnabled.value;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@
|
|||
"nativeMessaging",
|
||||
"notifications",
|
||||
"offscreen",
|
||||
"privacy",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webNavigation",
|
||||
|
|
@ -170,6 +169,9 @@
|
|||
"webRequestAuthProvider",
|
||||
"webRequestBlocking"
|
||||
],
|
||||
"optional_permissions": [
|
||||
"privacy"
|
||||
],
|
||||
"content_security_policy": {
|
||||
"extension_pages": "script-src 'self'"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ const $ = function(elem) {
|
|||
const initPage = async function() {
|
||||
const changeCheckboxValue = async function(e) {
|
||||
const name = e.currentTarget.name;
|
||||
const isChecked = e.currentTarget.checked;
|
||||
let isChecked = e.currentTarget.checked;
|
||||
|
||||
if (name === 'defaultPasswordManager') {
|
||||
await updateDefaultPasswordManager();
|
||||
return;
|
||||
const isDefaultPasswordManagerSet = await updateDefaultPasswordManager();
|
||||
isChecked = isDefaultPasswordManagerSet;
|
||||
e.target.checked = isDefaultPasswordManagerSet;
|
||||
}
|
||||
|
||||
options.settings[name] = isChecked;
|
||||
|
|
@ -23,14 +24,7 @@ const initPage = async function() {
|
|||
// Switch/checkboxes
|
||||
const checkboxes = document.querySelectorAll('#tab-getting-started input[type=checkbox]');
|
||||
for (const checkbox of checkboxes) {
|
||||
if (checkbox.name === 'defaultPasswordManager') {
|
||||
const passwordSavingEnabled = await browser.privacy.services.passwordSavingEnabled.get({});
|
||||
checkbox.checked = (passwordSavingEnabled?.levelOfControl === 'controlled_by_this_extension'
|
||||
&& !passwordSavingEnabled.value) || false;
|
||||
} else {
|
||||
checkbox.checked = options.settings[checkbox.name];
|
||||
}
|
||||
|
||||
checkbox.checked = options.settings[checkbox.name];
|
||||
checkbox.addEventListener('click', changeCheckboxValue);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,13 @@ options.initGeneralSettings = async function() {
|
|||
const isChecked = e.currentTarget.checked;
|
||||
options.settings[name] = isChecked;
|
||||
|
||||
// Default password manager setting relies on optional permission, and must be checked before saving options
|
||||
if (name === 'defaultPasswordManager') {
|
||||
const isDefaultPasswordManagerSet = await updateDefaultPasswordManager();
|
||||
options.settings[name] = isDefaultPasswordManagerSet;
|
||||
e.target.checked = isDefaultPasswordManagerSet;
|
||||
}
|
||||
|
||||
const updated = await options.saveSettings();
|
||||
if (name === 'autoFillAndSend') {
|
||||
browser.runtime.sendMessage({ action: 'init_http_auth' });
|
||||
|
|
@ -78,8 +85,6 @@ options.initGeneralSettings = async function() {
|
|||
$('#passkeysFallback').disabled = !isChecked;
|
||||
} else if (name === 'useMonochromeToolbarIcon') {
|
||||
browser.runtime.sendMessage({ action: 'update_popup' });
|
||||
} else if (name === 'defaultPasswordManager') {
|
||||
await updateDefaultPasswordManager();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -92,14 +97,7 @@ options.initGeneralSettings = async function() {
|
|||
|
||||
const generalSettingsCheckboxes = document.querySelectorAll('#tab-general-settings input[type=checkbox]');
|
||||
for (const checkbox of generalSettingsCheckboxes) {
|
||||
if (checkbox.name === 'defaultPasswordManager') {
|
||||
const passwordSavingEnabled = await browser.privacy.services.passwordSavingEnabled.get({});
|
||||
checkbox.checked = (passwordSavingEnabled?.levelOfControl === 'controlled_by_this_extension'
|
||||
&& !passwordSavingEnabled.value) || false;
|
||||
} else {
|
||||
checkbox.checked = options.settings[checkbox.name];
|
||||
}
|
||||
|
||||
checkbox.checked = options.settings[checkbox.name];
|
||||
if (checkbox.name === 'defaultGroupAlwaysAsk' && checkbox.checked) {
|
||||
$('#defaultGroup').disabled = true;
|
||||
$('#defaultGroupButton').disabled = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue