Show error when using open/save in insecure context

This commit is contained in:
Brian Adams 2023-01-23 16:31:05 -06:00
parent f3818a8474
commit 13b92dddf0
1 changed files with 17 additions and 0 deletions

View File

@ -56,6 +56,10 @@ Vue.createApp({
},
async open() {
if (!this.checkSecureContext()) {
return;
}
let fileHandle;
try {
@ -86,6 +90,10 @@ Vue.createApp({
},
async save() {
if (!this.checkSecureContext()) {
return;
}
try {
let fileHandle = await window.showSaveFilePicker();
let writeStream = await fileHandle.createWritable();
@ -100,6 +108,15 @@ Vue.createApp({
}
},
checkSecureContext() {
if (window.isSecureContext) {
return true;
} else {
alert('This feature is only available in a secure context (https)');
return false;
}
},
menu(menuItem, ...props) {
switch(menuItem) {
case 'php_info':