vault backup: 2025-08-03 11:01:42
This commit is contained in:
1 parent
52c61d3ad8
commit
dc7b44d2ea
39 files changed
+679
-648
No files matched your search
+51
-130
@@ -502,7 +502,7 @@ var en_default = {
|
||||
close_password_protection: "Unlock password protection",
|
||||
open_password_protection: "Lock password protection",
|
||||
password_protection_opened: "Password protection is locked!",
|
||||
password_protection_closed: "Password protection is unlocked!",
|
||||
password_protection_closed: "Password verification passed.",
|
||||
notice_set_password: "Please set the password in the settings page for the Password Protection Plugin first!",
|
||||
setting_folder_name: "Protected folder or file",
|
||||
setting_folder_desc: "With relative path, the '/' is the root path of the vault",
|
||||
@@ -524,8 +524,6 @@ var en_default = {
|
||||
password_is_right: "Password is correct.",
|
||||
auto_lock_interval_name: "Auto-lock",
|
||||
auto_lock_interval_desc: "The number of minutes to wait before auto-locking since the protected file was opened.",
|
||||
forbid_close_verify_modal_name: "Disable closing the password verify box if the password isn't correct",
|
||||
forbid_close_verify_modal_desc: "This will allow more privacy, but if you forgot your password, you may not be able to view your notes.",
|
||||
before_open_protection: "Turn on the above switch to enable password protection, and disable the below options.",
|
||||
setting_pwd_hint_question_name: "Password prompt",
|
||||
setting_pwd_hint_question_desc: "Please type a question to help you remember your password.",
|
||||
@@ -545,7 +543,7 @@ var es_default = {
|
||||
close_password_protection: "Activar protecci\xF3n con contrase\xF1a",
|
||||
open_password_protection: "Desactivar protecci\xF3n con contrase\xF1a",
|
||||
password_protection_opened: "\xA1Protecci\xF3n con contrase\xF1a est\xE1 bloqueada!",
|
||||
password_protection_closed: "\xA1Protecci\xF3n con contrase\xF1a est\xE1 desbloqueada!",
|
||||
password_protection_closed: "Verificaci\xF3n de contrase\xF1a aprobada!",
|
||||
notice_set_password: "\xA1Introduzca la contrase\xF1a en preferencias para el complemento Protecci\xF3n con Contrase\xF1a primero!",
|
||||
setting_folder_name: "Carpeta o archivo protegido",
|
||||
setting_folder_desc: "Ruta relativa, usa '/' para la ruta ra\xEDz de la b\xF3veda",
|
||||
@@ -567,8 +565,6 @@ var es_default = {
|
||||
password_is_right: "Contrase\xF1a correcta.",
|
||||
auto_lock_interval_name: "Bloqueo Autom\xE1tico",
|
||||
auto_lock_interval_desc: "El n\xFAmero de minutos para esperar antes de bloquear autom\xE1tico desde que se abri\xF3 la nota protegido.",
|
||||
forbid_close_verify_modal_name: "Desactivar el cierre de la casilla de verificaci\xF3n de contrase\xF1a si la contrase\xF1a no es correcta",
|
||||
forbid_close_verify_modal_desc: "Esto te permitir\xE1 mas privacidad, pero si olvidas la contrase\xF1a, es posible que no puedas ver las notas.",
|
||||
before_open_protection: "Activar el interruptor de arriba para activar protecci\xF3n con contrase\xF1a y desactivar las opciones de abajo.",
|
||||
setting_pwd_hint_question_name: "Mensaje para recordar",
|
||||
setting_pwd_hint_question_desc: "Escribe una frase para ayudarte recordar la contrase\xF1a.",
|
||||
@@ -584,11 +580,10 @@ var es_default = {
|
||||
var zh_cn_default = {
|
||||
ok: "\u786E\u5B9A",
|
||||
cancel: "\u53D6\u6D88",
|
||||
open: "\u6253\u5F00\u5BC6\u7801\u4FDD\u62A4",
|
||||
close_password_protection: "\u5173\u95ED\u5BC6\u7801\u4FDD\u62A4",
|
||||
open_password_protection: "\u6253\u5F00\u5BC6\u7801\u4FDD\u62A4",
|
||||
password_protection_opened: "\u5BC6\u7801\u4FDD\u62A4\u5DF2\u6253\u5F00",
|
||||
password_protection_closed: "\u5BC6\u7801\u4FDD\u62A4\u5DF2\u5173\u95ED",
|
||||
open: "\u5F00\u542F\u5BC6\u7801\u4FDD\u62A4",
|
||||
open_password_protection: "\u5F00\u542F\u5BC6\u7801\u4FDD\u62A4",
|
||||
password_protection_opened: "\u5BC6\u7801\u4FDD\u62A4\u5DF2\u5F00\u542F",
|
||||
password_protection_closed: "\u5BC6\u7801\u9A8C\u8BC1\u901A\u8FC7",
|
||||
notice_set_password: "\u8BF7\u5148\u53BB\u5BC6\u7801\u4FDD\u62A4\u63D2\u4EF6\u7684\u8BBE\u7F6E\u9875\u8BBE\u7F6E\u5BC6\u7801",
|
||||
setting_folder_name: "\u9700\u8981\u4FDD\u62A4\u7684\u6587\u4EF6\u5939\u6216\u6587\u4EF6",
|
||||
setting_folder_desc: "\u8F93\u5165\u76F8\u5BF9\u8DEF\u5F84, '/' \u4EE3\u8868\u7B14\u8BB0\u5E93\u7684\u6839\u8DEF\u5F84",
|
||||
@@ -605,13 +600,11 @@ var zh_cn_default = {
|
||||
verify_password: "\u9A8C\u8BC1\u5BC6\u7801",
|
||||
enter_password: "\u8F93\u5165\u4F60\u7684\u5BC6\u7801",
|
||||
enter_password_to_verify: "\u8BF7\u8F93\u5165\u5BC6\u7801\u9A8C\u8BC1",
|
||||
password_is_empty: "\u5BC6\u7801\u4E0D\u80FD\u662F\u7A7A\u7684",
|
||||
password_is_empty: "\u5BC6\u7801\u4E0D\u80FD\u662F\u7A7A\u7684\u3002",
|
||||
password_not_match: "\u5BC6\u7801\u4E0D\u5339\u914D\u3002",
|
||||
password_is_right: "\u5BC6\u7801\u6B63\u786E",
|
||||
auto_lock_interval_name: "\u81EA\u52A8\u6253\u5F00\u5BC6\u7801\u4FDD\u62A4\u7684\u95F4\u9694\u65F6\u95F4",
|
||||
auto_lock_interval_desc: "\u4ECE\u4E0A\u6B21\u5173\u95ED\u5BC6\u7801\u4FDD\u62A4\u6216\u4E0A\u6B21\u6253\u5F00\u4E00\u4E2A\u53D7\u4FDD\u62A4\u7684\u6587\u4EF6\u5F00\u59CB\u8BA1\u7B97\uFF0C0 \u4EE3\u8868\u4E0D\u81EA\u52A8\u6253\u5F00\u5BC6\u7801\u4FDD\u62A4, \u5355\u4F4D\uFF1A\u5206\u949F",
|
||||
forbid_close_verify_modal_name: "\u7981\u6B62\u5173\u95ED\u5BC6\u7801\u9A8C\u8BC1\u6846 (\u5F53\u5BC6\u7801\u4E0D\u6B63\u786E)",
|
||||
forbid_close_verify_modal_desc: "\u8FD9\u5C06\u4FDD\u62A4\u66F4\u591A\u9690\u79C1\uFF0C\u4F46\u662F\u5982\u679C\u4F60\u5FD8\u8BB0\u4E86\u5BC6\u7801\uFF0C\u4F60\u53EF\u80FD\u5C06\u65E0\u6CD5\u8FDB\u5165Obsidian.",
|
||||
auto_lock_interval_name: "\u81EA\u52A8\u5F00\u542F\u5BC6\u7801\u4FDD\u62A4\u7684\u95F4\u9694\u65F6\u95F4",
|
||||
auto_lock_interval_desc: "\u4ECE\u4E0A\u6B21\u5173\u95ED\u5BC6\u7801\u4FDD\u62A4\u6216\u4E0A\u6B21\u6253\u5F00\u4E00\u4E2A\u53D7\u4FDD\u62A4\u7684\u6587\u4EF6\u5F00\u59CB\u8BA1\u7B97\uFF0C0 \u4EE3\u8868\u4E0D\u81EA\u52A8\u5F00\u542F\u5BC6\u7801\u4FDD\u62A4, \u5355\u4F4D\uFF1A\u5206\u949F",
|
||||
before_open_protection: "\u6253\u5F00\u4E0A\u9762\u7684\u5BC6\u7801\u4FDD\u62A4\u5F00\u5173\u540E\uFF0C\u4E0B\u9762\u7684\u8BBE\u7F6E\u5C06\u4E0D\u53EF\u4FEE\u6539.",
|
||||
setting_pwd_hint_question_name: "\u5BC6\u7801\u63D0\u793A\u95EE\u9898",
|
||||
setting_pwd_hint_question_desc: "\u5F53\u4F60\u5FD8\u8BB0\u5BC6\u7801\u65F6\uFF0C\u53EF\u4EE5\u901A\u8FC7\u8FD9\u4E2A\u95EE\u9898\u6765\u63D0\u793A\u4F60\u7684\u5BC6\u7801.",
|
||||
@@ -627,11 +620,10 @@ var zh_cn_default = {
|
||||
var zh_tw_default = {
|
||||
ok: "\u78BA\u8A8D",
|
||||
cancel: "\u53D6\u6D88",
|
||||
open: "\u6253\u958B\u5BC6\u78BC\u4FDD\u8B77",
|
||||
close_password_protection: "\u95DC\u9589\u5BC6\u78BC\u4FDD\u8B77",
|
||||
open_password_protection: "\u6253\u958B\u5BC6\u78BC\u4FDD\u8B77",
|
||||
password_protection_opened: "\u5BC6\u78BC\u4FDD\u8B77\u5DF2\u6253\u958B",
|
||||
password_protection_closed: "\u5BC6\u78BC\u4FDD\u8B77\u5DF2\u95DC\u9589",
|
||||
open: "\u958B\u555F\u5BC6\u78BC\u4FDD\u8B77",
|
||||
open_password_protection: "\u958B\u555F\u5BC6\u78BC\u4FDD\u8B77",
|
||||
password_protection_opened: "\u5BC6\u78BC\u4FDD\u8B77\u5DF2\u958B\u555F",
|
||||
password_protection_closed: "\u5BC6\u78BC\u9A57\u8B49\u901A\u904E",
|
||||
notice_set_password: "\u8ACB\u5148\u53BB\u5BC6\u78BC\u4FDD\u8B77\u63D2\u4EF6\u7684\u8A2D\u7F6E\u9801\u8A2D\u7F6E\u5BC6\u78BC",
|
||||
setting_folder_name: "\u9700\u8981\u4FDD\u8B77\u7684\u6587\u4EF6\u593E\u6216\u6587\u4EF6",
|
||||
setting_folder_desc: "\u8F38\u5165\u76F8\u5C0D\u8DEF\u5F91, '/' \u4EE3\u8868\u7B46\u8A18\u5EAB\u7684\u6839\u8DEF\u5F91",
|
||||
@@ -648,13 +640,11 @@ var zh_tw_default = {
|
||||
verify_password: "\u9A57\u8B49\u5BC6\u78BC",
|
||||
enter_password: "\u8F38\u5165\u4F60\u7684\u5BC6\u78BC",
|
||||
enter_password_to_verify: "\u8ACB\u8F38\u5165\u5BC6\u78BC\u9A57\u8B49",
|
||||
password_is_empty: "\u5BC6\u78BC\u4E0D\u80FD\u662F\u7A7A\u7684",
|
||||
password_is_empty: "\u5BC6\u78BC\u4E0D\u80FD\u662F\u7A7A\u7684\u3002",
|
||||
password_not_match: "\u5BC6\u78BC\u4E0D\u5339\u914D\u3002",
|
||||
password_is_right: "\u5BC6\u78BC\u6B63\u78BA",
|
||||
auto_lock_interval_name: "\u81EA\u52D5\u6253\u958B\u5BC6\u78BC\u4FDD\u8B77\u7684\u9593\u9694\u6642\u9593",
|
||||
auto_lock_interval_desc: "\u5F9E\u4E0A\u6B21\u95DC\u9589\u5BC6\u78BC\u4FDD\u8B77\u6216\u4E0A\u6B21\u6253\u958B\u4E00\u500B\u53D7\u4FDD\u8B77\u7684\u6587\u4EF6\u958B\u59CB\u8A08\u7B97\uFF0C0 \u8868\u793A\u4E0D\u81EA\u52D5\u6253\u958B\u5BC6\u78BC\u4FDD\u8B77\uFF0C\u55AE\u4F4D\uFF1A\u5206\u9418",
|
||||
forbid_close_verify_modal_name: "\u7981\u6B62\u95DC\u9589\u5BC6\u78BC\u9A57\u8B49\u6846 (\u5F53\u5BC6\u78BC\u4E0D\u6B63\u78BA)",
|
||||
forbid_close_verify_modal_desc: "\u9019\u5C07\u4FDD\u8B77\u66F4\u591A\u96B1\u79C1\uFF0C\u4F46\u662F\u5982\u679C\u4F60\u5FD8\u8A18\u4E86\u5BC6\u78BC\uFF0C\u4F60\u53EF\u80FD\u5C06\u7121\u6CD5\u9032\u5165Obsidian.",
|
||||
auto_lock_interval_name: "\u81EA\u52D5\u958B\u555F\u5BC6\u78BC\u4FDD\u8B77\u7684\u9593\u9694\u6642\u9593",
|
||||
auto_lock_interval_desc: "\u5F9E\u4E0A\u6B21\u95DC\u9589\u5BC6\u78BC\u4FDD\u8B77\u6216\u4E0A\u6B21\u6253\u958B\u4E00\u500B\u53D7\u4FDD\u8B77\u7684\u6587\u4EF6\u958B\u59CB\u8A08\u7B97\uFF0C0 \u8868\u793A\u4E0D\u81EA\u52D5\u958B\u555F\u5BC6\u78BC\u4FDD\u8B77\uFF0C\u55AE\u4F4D\uFF1A\u5206\u9418",
|
||||
before_open_protection: "\u6253\u958B\u4E0A\u9762\u7684\u5BC6\u78BC\u4FDD\u8B77\u958B\u95DC\u540E\uFF0C\u4E0B\u9762\u7684\u8A2D\u7F6E\u5C07\u4E0D\u53EF\u4FEE\u6539.",
|
||||
setting_pwd_hint_question_name: "\u5BC6\u78BC\u63D0\u793A\u554F\u984C",
|
||||
setting_pwd_hint_question_desc: "\u7576\u4F60\u5FD8\u8A18\u5BC6\u78BC\u6642\uFF0C\u53EF\u4EE5\u901A\u904E\u9019\u500B\u554F\u984C\u4F86\u63D0\u793A\u4F60\u7684\u5BC6\u78BC.",
|
||||
@@ -715,7 +705,6 @@ var DEFAULT_SETTINGS = {
|
||||
protectEnabled: false,
|
||||
password: "",
|
||||
lang: "auto",
|
||||
forbidClosePassVerifyModal: false,
|
||||
autoLockInterval: 0,
|
||||
pwdHintQuestion: "",
|
||||
isLastVerifyPasswordCorrect: false,
|
||||
@@ -727,8 +716,6 @@ var PasswordPlugin = class extends import_obsidian2.Plugin {
|
||||
this.isVerifyPasswordWaitting = false;
|
||||
this.isVerifyPasswordCorrect = false;
|
||||
this.lastUnlockOrOpenFileTime = null;
|
||||
this.startupFile = [];
|
||||
this.isLayoutReady = true;
|
||||
this.t = (x, vars) => {
|
||||
return this.i18n.t(x, vars);
|
||||
};
|
||||
@@ -748,32 +735,25 @@ var PasswordPlugin = class extends import_obsidian2.Plugin {
|
||||
this.settings.lang = lang;
|
||||
await this.saveSettings();
|
||||
});
|
||||
if (this.settings.protectEnabled) {
|
||||
this.passwordRibbonBtn = this.addRibbonIcon("unlock", this.t("close_password_protection"), (evt) => {
|
||||
this.switchPasswordProtection();
|
||||
});
|
||||
} else {
|
||||
this.passwordRibbonBtn = this.addRibbonIcon("lock", this.t("open_password_protection"), (evt) => {
|
||||
this.switchPasswordProtection();
|
||||
});
|
||||
}
|
||||
this.passwordRibbonBtn = this.addRibbonIcon("lock", this.t("open_password_protection"), (evt) => {
|
||||
this.openPasswordProtection();
|
||||
});
|
||||
this.addCommand({
|
||||
id: "Open password protection",
|
||||
name: this.t("open"),
|
||||
callback: () => {
|
||||
this.openPasswordProtection();
|
||||
this.enablePasswordProtection();
|
||||
}
|
||||
});
|
||||
this.addSettingTab(new PasswordSettingTab(this.app, this));
|
||||
this.app.workspace.onLayoutReady(() => {
|
||||
if (this.settings.protectEnabled && this.isIncludeRootPath()) {
|
||||
if (!this.isVerifyPasswordCorrect) {
|
||||
this.closeLeaves();
|
||||
let curTime = (0, import_obsidian2.moment)();
|
||||
if (curTime.diff(this.settings.timeOnUnload, "second") <= 2 && this.settings.isLastVerifyPasswordCorrect) {
|
||||
this.isVerifyPasswordCorrect = true;
|
||||
} else {
|
||||
this.verifyToClosePasswordProtection();
|
||||
this.verifyPasswordProtection();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -782,11 +762,7 @@ var PasswordPlugin = class extends import_obsidian2.Plugin {
|
||||
if (file != null) {
|
||||
this.autoLockCheck();
|
||||
if (this.settings.protectEnabled && !this.isVerifyPasswordCorrect && this.isProtectedFile(file)) {
|
||||
if (this.isLayoutReady && this.isVerifyPasswordWaitting) {
|
||||
this.startupFile.push(file);
|
||||
}
|
||||
this.closeLeave(file);
|
||||
this.closePasswordProtection(file);
|
||||
this.verifyPasswordProtection();
|
||||
}
|
||||
if (this.settings.protectEnabled && this.isVerifyPasswordCorrect) {
|
||||
this.lastUnlockOrOpenFileTime = (0, import_obsidian2.moment)();
|
||||
@@ -799,7 +775,7 @@ var PasswordPlugin = class extends import_obsidian2.Plugin {
|
||||
if (viewType == "search") {
|
||||
this.autoLockCheck();
|
||||
if (this.settings.protectEnabled && !this.isVerifyPasswordCorrect) {
|
||||
this.verifyToClosePasswordProtection();
|
||||
this.verifyPasswordProtection();
|
||||
}
|
||||
if (this.settings.protectEnabled && this.isVerifyPasswordCorrect) {
|
||||
this.lastUnlockOrOpenFileTime = (0, import_obsidian2.moment)();
|
||||
@@ -821,34 +797,7 @@ var PasswordPlugin = class extends import_obsidian2.Plugin {
|
||||
let curTime = (0, import_obsidian2.moment)();
|
||||
if (curTime.diff(this.lastUnlockOrOpenFileTime, "minute") >= this.settings.autoLockInterval) {
|
||||
this.isVerifyPasswordCorrect = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// open note
|
||||
async openLeave(file) {
|
||||
let leaf = this.app.workspace.getLeaf(false);
|
||||
if (leaf != null) {
|
||||
leaf.openFile(file);
|
||||
}
|
||||
}
|
||||
// close a note
|
||||
async closeLeave(file) {
|
||||
let leaves = [];
|
||||
this.app.workspace.iterateAllLeaves((leaf) => {
|
||||
leaves.push(leaf);
|
||||
});
|
||||
const emptyLeaf = async (leaf) => {
|
||||
leaf.setViewState({ type: "empty" });
|
||||
};
|
||||
for (const leaf of leaves) {
|
||||
if (leaf != null && leaf.view instanceof import_obsidian2.FileView) {
|
||||
if (leaf.view.file != null) {
|
||||
if (leaf.view.file.path == file.path) {
|
||||
await emptyLeaf(leaf);
|
||||
leaf.detach();
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.verifyPasswordProtection();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -871,19 +820,18 @@ var PasswordPlugin = class extends import_obsidian2.Plugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
// open or close password protection
|
||||
switchPasswordProtection() {
|
||||
if (this.settings.protectEnabled) {
|
||||
if (!this.isVerifyPasswordCorrect) {
|
||||
this.verifyToClosePasswordProtection();
|
||||
} else {
|
||||
this.openPasswordProtection();
|
||||
}
|
||||
// enable password protection
|
||||
enablePasswordProtection() {
|
||||
if (!this.settings.protectEnabled) {
|
||||
new import_obsidian2.Notice(this.t("notice_set_password"));
|
||||
} else {
|
||||
this.openPasswordProtection();
|
||||
if (this.isVerifyPasswordCorrect) {
|
||||
this.isVerifyPasswordCorrect = false;
|
||||
this.closeLeaves();
|
||||
}
|
||||
}
|
||||
}
|
||||
// open password protection
|
||||
// open or guide in password protection
|
||||
openPasswordProtection() {
|
||||
if (!this.settings.protectEnabled) {
|
||||
new import_obsidian2.Notice(this.t("notice_set_password"));
|
||||
@@ -891,50 +839,19 @@ var PasswordPlugin = class extends import_obsidian2.Plugin {
|
||||
if (this.isVerifyPasswordCorrect) {
|
||||
this.isVerifyPasswordCorrect = false;
|
||||
}
|
||||
this.closeLeaves();
|
||||
(0, import_obsidian2.setIcon)(this.passwordRibbonBtn, "unlock");
|
||||
this.passwordRibbonBtn.ariaLabel = this.t("close_password_protection");
|
||||
new import_obsidian2.Notice(this.t("password_protection_opened"));
|
||||
this.verifyPasswordProtection();
|
||||
}
|
||||
}
|
||||
// close password protection
|
||||
closePasswordProtection(file) {
|
||||
// verify password protection
|
||||
verifyPasswordProtection() {
|
||||
if (!this.isVerifyPasswordWaitting) {
|
||||
const setModal = new VerifyPasswordModal(this.app, this, () => {
|
||||
if (this.isVerifyPasswordCorrect) {
|
||||
this.openLeave(file);
|
||||
(0, import_obsidian2.setIcon)(this.passwordRibbonBtn, "lock");
|
||||
this.passwordRibbonBtn.ariaLabel = this.t("open_password_protection");
|
||||
new import_obsidian2.Notice(this.t("password_protection_closed"));
|
||||
}
|
||||
}).open();
|
||||
}
|
||||
}
|
||||
verifyToClosePasswordProtection() {
|
||||
if (!this.isVerifyPasswordWaitting) {
|
||||
const setModal = new VerifyPasswordModal(this.app, this, () => {
|
||||
if (this.isVerifyPasswordCorrect) {
|
||||
(0, import_obsidian2.setIcon)(this.passwordRibbonBtn, "lock");
|
||||
this.passwordRibbonBtn.ariaLabel = this.t("open_password_protection");
|
||||
new import_obsidian2.Notice(this.t("password_protection_closed"));
|
||||
if (this.isLayoutReady) {
|
||||
this.isLayoutReady = false;
|
||||
for (const file of this.startupFile) {
|
||||
if (file != null) {
|
||||
this.openLeave(file);
|
||||
}
|
||||
}
|
||||
this.startupFile = [];
|
||||
}
|
||||
}
|
||||
}).open();
|
||||
}
|
||||
}
|
||||
// close password protection
|
||||
disableProtection() {
|
||||
(0, import_obsidian2.setIcon)(this.passwordRibbonBtn, "lock");
|
||||
this.passwordRibbonBtn.ariaLabel = this.t("open_password_protection");
|
||||
}
|
||||
// check if the root folder need to be protected
|
||||
isIncludeRootPath() {
|
||||
if (this.settings.protectedPath == ROOT_PATH) {
|
||||
@@ -1024,8 +941,9 @@ var PasswordSettingTab = class extends import_obsidian2.PluginSettingTab {
|
||||
this.plugin.settings.protectEnabled = false;
|
||||
const setModal = new SetPasswordModal(this.app, this.plugin, () => {
|
||||
if (this.plugin.settings.protectEnabled) {
|
||||
this.plugin.isVerifyPasswordCorrect = false;
|
||||
this.plugin.saveSettings();
|
||||
this.plugin.openPasswordProtection();
|
||||
this.plugin.closeLeaves();
|
||||
}
|
||||
this.display();
|
||||
}).open();
|
||||
@@ -1035,7 +953,6 @@ var PasswordSettingTab = class extends import_obsidian2.PluginSettingTab {
|
||||
if (this.plugin.isVerifyPasswordCorrect) {
|
||||
this.plugin.settings.protectEnabled = false;
|
||||
this.plugin.saveSettings();
|
||||
this.plugin.disableProtection();
|
||||
}
|
||||
this.display();
|
||||
}).open();
|
||||
@@ -1044,11 +961,6 @@ var PasswordSettingTab = class extends import_obsidian2.PluginSettingTab {
|
||||
})
|
||||
);
|
||||
containerEl.createEl("h6", { text: this.plugin.t("before_open_protection") });
|
||||
new import_obsidian2.Setting(containerEl).setName(this.plugin.t("forbid_close_verify_modal_name")).setDesc(this.plugin.t("forbid_close_verify_modal_desc")).addToggle(
|
||||
(toggle) => toggle.setValue(this.plugin.settings.forbidClosePassVerifyModal).onChange((value) => {
|
||||
this.plugin.settings.forbidClosePassVerifyModal = value;
|
||||
})
|
||||
).setDisabled(this.plugin.settings.protectEnabled);
|
||||
new import_obsidian2.Setting(containerEl).setName(this.plugin.t("auto_lock_interval_name")).setDesc(this.plugin.t("auto_lock_interval_desc")).addText((text) => text.setPlaceholder("0").setValue(this.plugin.settings.autoLockInterval.toString()).onChange(async (value) => {
|
||||
value = value.replace(/[^0-9]/g, "");
|
||||
if (value) {
|
||||
@@ -1214,13 +1126,16 @@ var VerifyPasswordModal = class extends import_obsidian2.Modal {
|
||||
this.onSubmit = onSubmit;
|
||||
}
|
||||
onOpen() {
|
||||
if (this.plugin.settings.protectEnabled && this.plugin.settings.forbidClosePassVerifyModal) {
|
||||
if (this.plugin.settings.protectEnabled) {
|
||||
const { modalEl } = this;
|
||||
const closeButton = modalEl.getElementsByClassName("modal-close-button")[0];
|
||||
if (closeButton != null) {
|
||||
closeButton.setAttribute("style", "display: none;");
|
||||
}
|
||||
}
|
||||
Object.assign(this.app.workspace.containerEl.style, {
|
||||
filter: "blur(8px)"
|
||||
});
|
||||
const { contentEl } = this;
|
||||
contentEl.empty();
|
||||
contentEl.createEl("h2", { text: this.plugin.t("verify_password") });
|
||||
@@ -1229,7 +1144,6 @@ var VerifyPasswordModal = class extends import_obsidian2.Modal {
|
||||
const pwInputEl = inputPwContainerEl.createEl("input", { type: "password", value: "" });
|
||||
pwInputEl.placeholder = this.plugin.t("enter_password");
|
||||
pwInputEl.style.width = "70%";
|
||||
pwInputEl.focus();
|
||||
const messageEl = contentEl.createDiv();
|
||||
messageEl.style.marginBottom = "1em";
|
||||
messageEl.setText(this.plugin.t("enter_password_to_verify"));
|
||||
@@ -1240,7 +1154,7 @@ var VerifyPasswordModal = class extends import_obsidian2.Modal {
|
||||
});
|
||||
const pwConfirmChecker = () => {
|
||||
if (pwInputEl.value == "") {
|
||||
messageEl.style.color = "yellow";
|
||||
messageEl.style.color = "red";
|
||||
messageEl.setText(this.plugin.t("password_is_empty"));
|
||||
return false;
|
||||
}
|
||||
@@ -1283,17 +1197,24 @@ var VerifyPasswordModal = class extends import_obsidian2.Modal {
|
||||
pwChecker(null);
|
||||
}));
|
||||
}
|
||||
restoreBlur() {
|
||||
Object.assign(this.app.workspace.containerEl.style, {
|
||||
filter: "blur(0px)"
|
||||
});
|
||||
}
|
||||
onClose() {
|
||||
this.plugin.isVerifyPasswordWaitting = false;
|
||||
const { contentEl } = this;
|
||||
contentEl.empty();
|
||||
if (this.plugin.settings.protectEnabled && this.plugin.settings.forbidClosePassVerifyModal) {
|
||||
if (this.plugin.settings.protectEnabled) {
|
||||
if (!this.plugin.isVerifyPasswordCorrect) {
|
||||
const setModal = new VerifyPasswordModal(this.app, this.plugin, this.onSubmit).open();
|
||||
} else {
|
||||
this.restoreBlur();
|
||||
this.onSubmit();
|
||||
}
|
||||
} else {
|
||||
this.restoreBlur();
|
||||
this.onSubmit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user