From 7945daf9f2b2c25e70ed497cdec0f30dfd380580 Mon Sep 17 00:00:00 2001 From: qishibo Date: Sat, 27 Feb 2021 17:27:57 +0800 Subject: [PATCH] mas file permission tips --- src/i18n/langs/cn.js | 1 + src/i18n/langs/de.js | 1 + src/i18n/langs/en.js | 1 + src/i18n/langs/fr.js | 1 + src/i18n/langs/pt.js | 1 + src/i18n/langs/ru.js | 1 + src/i18n/langs/tr.js | 1 + src/i18n/langs/tw.js | 1 + src/i18n/langs/ua.js | 1 + src/redisClient.js | 23 ++++++++++++++++------- 10 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/i18n/langs/cn.js b/src/i18n/langs/cn.js index 11fb5a1..53aa51a 100644 --- a/src/i18n/langs/cn.js +++ b/src/i18n/langs/cn.js @@ -108,6 +108,7 @@ const cn = { delete_all: '全部删除', clear_cache: '清除缓存', mark_color: '标记颜色', + key_no_permission: '文件读取权限已过期,请手动重新选择密钥文件', }, }; diff --git a/src/i18n/langs/de.js b/src/i18n/langs/de.js index 784bb05..b29725f 100644 --- a/src/i18n/langs/de.js +++ b/src/i18n/langs/de.js @@ -108,6 +108,7 @@ const de = { delete_all: 'Alle löschen', clear_cache: 'Cache leeren', mark_color: 'Farbe markieren', + key_no_permission: 'Die Berechtigung zum Lesen von Dateien ist abgelaufen. Wählen Sie die Schlüsseldatei erneut manuell aus', }, }; diff --git a/src/i18n/langs/en.js b/src/i18n/langs/en.js index a51bfbe..7642890 100644 --- a/src/i18n/langs/en.js +++ b/src/i18n/langs/en.js @@ -108,6 +108,7 @@ const en = { delete_all: 'Delete All', clear_cache: 'Clear Cache', mark_color: 'Mark Color', + key_no_permission: 'File read permission has expired, please reselect the key file manually', }, }; diff --git a/src/i18n/langs/fr.js b/src/i18n/langs/fr.js index 0b73781..943fab5 100644 --- a/src/i18n/langs/fr.js +++ b/src/i18n/langs/fr.js @@ -108,6 +108,7 @@ const fr = { delete_all: 'Supprimer tout', clear_cache: 'Vider le cache', mark_color: 'Couleur de la marque', + key_no_permission: 'L\'autorisation de lecture de fichier a expiré, veuillez resélectionner le fichier de clé manuellement', }, }; diff --git a/src/i18n/langs/pt.js b/src/i18n/langs/pt.js index 1529d42..66625a0 100644 --- a/src/i18n/langs/pt.js +++ b/src/i18n/langs/pt.js @@ -108,6 +108,7 @@ const pt = { delete_all: 'Apagar Tudo', clear_cache: 'Limpar cache', mark_color: 'Cor da marca', + key_no_permission: 'A permissão de leitura do arquivo expirou, selecione novamente o arquivo de chave manualmente', }, }; diff --git a/src/i18n/langs/ru.js b/src/i18n/langs/ru.js index 07493ab..cbe3b51 100644 --- a/src/i18n/langs/ru.js +++ b/src/i18n/langs/ru.js @@ -108,6 +108,7 @@ const ru = { delete_all: 'Удалить все', clear_cache: 'Oчистить кэш', mark_color: 'Цвет отметки', + key_no_permission: 'Срок действия разрешения на чтение файла истек, пожалуйста, повторно выберите ключевой файл вручную', }, }; diff --git a/src/i18n/langs/tr.js b/src/i18n/langs/tr.js index cf3a77e..ebb0087 100644 --- a/src/i18n/langs/tr.js +++ b/src/i18n/langs/tr.js @@ -108,6 +108,7 @@ const tr = { delete_all: 'Hepsini sil', clear_cache: 'önbelleği temizle', mark_color: 'Mark rengi', + key_no_permission: 'Dosya okuma izninin süresi doldu, lütfen anahtar dosyasını manuel olarak yeniden seçin', }, }; diff --git a/src/i18n/langs/tw.js b/src/i18n/langs/tw.js index 089b70b..6910fd4 100644 --- a/src/i18n/langs/tw.js +++ b/src/i18n/langs/tw.js @@ -108,6 +108,7 @@ const tw = { delete_all: '全部删除', clear_cache: '清除緩存', mark_color: '標記顏色', + key_no_permission: '文件讀取權限已過期,請手動重新選擇密鑰文件', }, }; diff --git a/src/i18n/langs/ua.js b/src/i18n/langs/ua.js index 84117cb..c8e5d53 100644 --- a/src/i18n/langs/ua.js +++ b/src/i18n/langs/ua.js @@ -108,6 +108,7 @@ const ua = { delete_all: 'Видалити все', clear_cache: 'Oчистити кеш', mark_color: 'Позначити колір', + key_no_permission: 'Термін дії дозволу на читання файлу закінчився, будь-ласка, виберіть файл ключа вручну', }, }; diff --git a/src/redisClient.js b/src/redisClient.js index c38c6c8..d13abb1 100644 --- a/src/redisClient.js +++ b/src/redisClient.js @@ -227,15 +227,24 @@ export default { return undefined; } - // mac app store version, read through bookmark - if (bookmark) { - const bookmarkClose = remote.app.startAccessingSecurityScopedResource(bookmark); + try { + // mac app store version, read through bookmark + if (bookmark) { + const bookmarkClose = remote.app.startAccessingSecurityScopedResource(bookmark); + } + + const content = fs.readFileSync(file); + (typeof bookmarkClose == 'function') && bookmarkClose(); + + return content; } + catch (e) { + // force alert + alert(vue.$t('message.key_no_permission') + `\n[${e.message}]`); + vue.$bus.$emit('closeConnection'); - const content = fs.readFileSync(file); - (typeof bookmarkClose == 'function') && bookmarkClose(); - - return content; + return undefined; + } }, };