add permission check to formRead
This commit is contained in:
parent
90a5d79570
commit
91682dd633
@ -28,7 +28,22 @@ function getOptionsFullMutable() {
|
|||||||
|
|
||||||
async function formRead(options) {
|
async function formRead(options) {
|
||||||
options.general.enable = $('#enable').prop('checked');
|
options.general.enable = $('#enable').prop('checked');
|
||||||
options.general.enableClipboardPopups = $('#enable-clipboard-popups').prop('checked');
|
const enableClipboardPopups = $('#enable-clipboard-popups').prop('checked');
|
||||||
|
if (enableClipboardPopups) {
|
||||||
|
options.general.enableClipboardPopups = await new Promise((resolve, _reject) => {
|
||||||
|
chrome.permissions.request(
|
||||||
|
{permissions: ['clipboardRead']},
|
||||||
|
(granted) => {
|
||||||
|
if (!granted) {
|
||||||
|
$('#enable-clipboard-popups').prop('checked', false);
|
||||||
|
}
|
||||||
|
resolve(granted);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
options.general.enableClipboardPopups = false;
|
||||||
|
}
|
||||||
options.general.showGuide = $('#show-usage-guide').prop('checked');
|
options.general.showGuide = $('#show-usage-guide').prop('checked');
|
||||||
options.general.compactTags = $('#compact-tags').prop('checked');
|
options.general.compactTags = $('#compact-tags').prop('checked');
|
||||||
options.general.compactGlossaries = $('#compact-glossaries').prop('checked');
|
options.general.compactGlossaries = $('#compact-glossaries').prop('checked');
|
||||||
|
Loading…
Reference in New Issue
Block a user