mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge remote-tracking branch 'origin/master' into m42
# Conflicts: # src/public/app/services/app_context.js
This commit is contained in:
commit
aff12950f0
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@ -2,5 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -101,12 +101,6 @@ class AppContext extends Component {
|
||||
return $(el).closest(".component").prop('component');
|
||||
}
|
||||
|
||||
async protectedSessionStartedEvent() {
|
||||
await treeCache.loadInitialTree();
|
||||
|
||||
this.triggerEvent('treeCacheReloaded');
|
||||
}
|
||||
|
||||
async openInNewWindow(notePath) {
|
||||
if (utils.isElectron()) {
|
||||
const {ipcRenderer} = utils.dynamicRequire('electron');
|
||||
|
@ -1,13 +1,10 @@
|
||||
import treeService from './tree.js';
|
||||
import utils from './utils.js';
|
||||
import server from './server.js';
|
||||
import protectedSessionHolder from './protected_session_holder.js';
|
||||
import toastService from "./toast.js";
|
||||
import ws from "./ws.js";
|
||||
import appContext from "./app_context.js";
|
||||
|
||||
const $enterProtectedSessionButton = $("#enter-protected-session-button");
|
||||
const $leaveProtectedSessionButton = $("#leave-protected-session-button");
|
||||
import treeCache from "./tree_cache.js";
|
||||
|
||||
let protectedSessionDeferred = null;
|
||||
|
||||
@ -45,6 +42,10 @@ async function setupProtectedSession(password) {
|
||||
protectedSessionHolder.setProtectedSessionId(response.protectedSessionId);
|
||||
protectedSessionHolder.touchProtectedSession();
|
||||
|
||||
await treeCache.loadInitialTree();
|
||||
|
||||
await appContext.triggerEvent('treeCacheReloaded');
|
||||
|
||||
appContext.triggerEvent('protectedSessionStarted');
|
||||
|
||||
if (protectedSessionDeferred !== null) {
|
||||
@ -54,9 +55,6 @@ async function setupProtectedSession(password) {
|
||||
protectedSessionDeferred = null;
|
||||
}
|
||||
|
||||
$enterProtectedSessionButton.hide();
|
||||
$leaveProtectedSessionButton.show();
|
||||
|
||||
toastService.showMessage("Protected session has been started.");
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,16 @@ function touchProtectedSession() {
|
||||
}
|
||||
}
|
||||
|
||||
function touchProtectedSessionIfNecessary(note) {
|
||||
if (note && note.isProtected && isProtectedSessionAvailable()) {
|
||||
touchProtectedSession();
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
setProtectedSessionId,
|
||||
resetProtectedSession,
|
||||
isProtectedSessionAvailable,
|
||||
touchProtectedSession
|
||||
touchProtectedSession,
|
||||
touchProtectedSessionIfNecessary
|
||||
};
|
@ -69,10 +69,7 @@ class TabContext extends Component {
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
if (this.note.isProtected && protectedSessionHolder.isProtectedSessionAvailable()) {
|
||||
// FIXME: there are probably more places where this should be done
|
||||
protectedSessionHolder.touchProtectedSession();
|
||||
}
|
||||
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
||||
|
||||
if (triggerSwitchEvent) {
|
||||
this.triggerEvent('tabNoteSwitched', {
|
||||
|
@ -57,7 +57,10 @@ class BasicWidget extends Component {
|
||||
for (const key in this.attrs) {
|
||||
if (key === 'style') {
|
||||
if (this.attrs[key]) {
|
||||
$widget.attr(key, $widget.attr('style') + ';' + this.attrs[key]);
|
||||
let style = $widget.attr('style');
|
||||
style = style ? `${style}; ${this.attrs[key]}` : this.attrs[key];
|
||||
|
||||
$widget.attr(key, style);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -61,6 +61,8 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
const dto = note.dto;
|
||||
dto.content = this.getTypeWidget().getContent();
|
||||
|
||||
protectedSessionHolder.touchProtectedSessionIfNecessary(note);
|
||||
|
||||
await server.put('notes/' + noteId, dto, this.componentId);
|
||||
});
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
||||
this.spacedUpdate = new SpacedUpdate(async () => {
|
||||
const title = this.$noteTitle.val();
|
||||
|
||||
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
||||
|
||||
await server.put(`notes/${this.noteId}/change-title`, {title});
|
||||
});
|
||||
}
|
||||
|
@ -5,12 +5,12 @@ const TPL = `
|
||||
<div class="btn-group btn-group-xs">
|
||||
<button type="button"
|
||||
class="btn btn-sm icon-button bx bx-check-shield protect-button"
|
||||
title="Protected note can be viewed and edited only after entering password">
|
||||
title="Set this note as protected which means it will possible to view and edit this note only after entering password">
|
||||
</button>
|
||||
|
||||
<button type="button"
|
||||
class="btn btn-sm icon-button bx bx-shield-x unprotect-button"
|
||||
title="Not protected note can be viewed without entering password">
|
||||
title="Set this note as unprotected which will make it viewable and editable without entering password">
|
||||
</button>
|
||||
</div>`;``;
|
||||
|
||||
|
@ -27,7 +27,7 @@ async function loginSync(req) {
|
||||
|
||||
// login token is valid for 5 minutes
|
||||
if (Math.abs(timestamp.getTime() - now.getTime()) > 5 * 60 * 1000) {
|
||||
return [400, { message: 'Auth request time is out of sync' }];
|
||||
return [400, { message: 'Auth request time is out of sync, please check that both client and server have correct time.' }];
|
||||
}
|
||||
|
||||
const syncVersion = req.body.syncVersion;
|
||||
|
Loading…
x
Reference in New Issue
Block a user