renamed encryption module to protected_session

This commit is contained in:
azivner 2017-11-14 22:36:36 -05:00
parent b28df3f093
commit 4aa70d3574
6 changed files with 11 additions and 11 deletions

View file

@ -65,10 +65,10 @@ const contextMenu = (function() {
noteEditor.createNote(node, node.key, 'into');
}
else if (ui.cmd === "encryptSubTree") {
encryption.encryptSubTree(node.key);
protected_session.encryptSubTree(node.key);
}
else if (ui.cmd === "decryptSubTree") {
encryption.decryptSubTree(node.key);
protected_session.decryptSubTree(node.key);
}
else if (ui.cmd === "cut") {
cut(node);

View file

@ -90,7 +90,7 @@ settings.addModule((function() {
alert("Password has been changed. Trilium will be reloaded after you press OK.");
// encryption password changed so current encryption session is invalid and needs to be cleared
encryption.resetProtectedSession();
protected_session.resetProtectedSession();
}
else {
showError(result.message);
@ -120,7 +120,7 @@ settings.addModule((function() {
const encryptionTimeout = encryptionTimeoutEl.val();
settings.saveSettings(settingName, encryptionTimeout).then(() => {
encryption.setEncryptionSessionTimeout(encryptionTimeout);
protected_session.setEncryptionSessionTimeout(encryptionTimeout);
});
return false;

View file

@ -116,7 +116,7 @@ function initAjax() {
$.ajaxSetup({
headers: {
'x-browser-id': browserId,
'x-protected-session-id': encryption ? encryption.getProtectedSessionId() : null
'x-protected-session-id': protected_session ? protected_session.getProtectedSessionId() : null
}
});
}

View file

@ -122,7 +122,7 @@ const noteEditor = (function() {
async function createNote(node, parentKey, target, isProtected) {
// if isProtected isn't available (user didn't enter password yet), then note is created as unencrypted
// but this is quite weird since user doesn't see where the note is being created so it shouldn't occur often
if (!isProtected || !encryption.isProtectedSessionAvailable()) {
if (!isProtected || !protected_session.isProtectedSessionAvailable()) {
isProtected = false;
}
@ -194,7 +194,7 @@ const noteEditor = (function() {
noteTitleEl.focus().select();
}
await encryption.ensureProtectedSession(currentNote.detail.is_protected, false);
await protected_session.ensureProtectedSession(currentNote.detail.is_protected, false);
noteDetailWrapperEl.show();

View file

@ -1,6 +1,6 @@
"use strict";
const encryption = (function() {
const protected_session = (function() {
const dialogEl = $("#protected-session-password-dialog");
const passwordFormEl = $("#protected-session-password-form");
const passwordEl = $("#protected-session-password");

View file

@ -68,7 +68,7 @@
<div class="hide-toggle" style="grid-area: title;">
<div style="display: flex; align-items: center;">
<a onclick="encryption.protectNoteAndSendToServer()"
<a onclick="protected_session.protectNoteAndSendToServer()"
title="Encrypt the note so that password will be required to view the note"
class="icon-action"
id="protect-button"
@ -76,7 +76,7 @@
<img src="images/icons/lock.png" alt="Encrypt note"/>
</a>
<a onclick="encryption.unprotectNoteAndSendToServer()"
<a onclick="protected_session.unprotectNoteAndSendToServer()"
title="Decrypt note permamently so that password will not be required to access this note in the future"
class="icon-action"
id="unprotect-button"
@ -280,7 +280,7 @@
<!-- Note detail -->
<script src="javascripts/note_editor.js"></script>
<script src="javascripts/encryption.js"></script>
<script src="javascripts/protected_session.js"></script>
<!-- dialogs -->
<script src="javascripts/dialogs/recent_notes.js"></script>