@@ -252,30 +254,28 @@
});
}
- let fileSelectElm = document.getElementById('licenseFile');
let licenseTextElm = document.getElementById('licenseTextElement')
- let loadFromFile = async () => {
- try {
- let licenseFileTxt = await readContentFromFile(fileSelectElm, 'text');
+ let fileSelectElm = document.getElementById('licenseFile');
+ fileSelectElm.addEventListener('click', (e) => {
+ e.preventDefault();
+ browseFileContents('text').then(licenseFileTxt => {
if (licenseFileTxt) {
- licenseFileTxt = (licenseFileTxt || '').toString().trim()
+ licenseFileTxt = (licenseFileTxt || '').toString().trim().substring(0, 10 * 1024)
licenseTextElm.value = licenseFileTxt;
- licenseTextElm.focus();
- licenseTextElm.select();
-
if (licenseFileTxt.indexOf('BEGIN LICENSE') >= 0) {
document.getElementById('licenseForm').submit();
+ } else {
+ licenseTextElm.focus();
+ licenseTextElm.select();
}
}
- } catch (err) {
+ }).catch(err => {
+ console.error(err);
if (err.code === 'NoFileSelected') {
return
}
showToast('Failed to read license key file\n' + err.message, 'check-circle');
- return
- }
- }
-
- fileSelectElm.addEventListener('change', loadFromFile);
+ })
+ });
});
\ No newline at end of file
diff --git a/views/config/oauth.hbs b/views/config/oauth.hbs
index 28b15278..a5091777 100644
--- a/views/config/oauth.hbs
+++ b/views/config/oauth.hbs
@@ -106,15 +106,15 @@
{{#if activeGmailService}}