mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
Compare commits
9 Commits
v0.49.0-be
...
v0.49.1-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad8d35efe9 | ||
|
|
0217b1c85d | ||
|
|
c0aa14f586 | ||
|
|
b54cfab4ff | ||
|
|
a08985e7a6 | ||
|
|
a789025025 | ||
|
|
3f307b117e | ||
|
|
a232035d47 | ||
|
|
9d38e9342d |
@@ -2,7 +2,7 @@
|
|||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"productName": "Trilium Notes",
|
"productName": "Trilium Notes",
|
||||||
"description": "Trilium Notes",
|
"description": "Trilium Notes",
|
||||||
"version": "0.49.0-beta",
|
"version": "0.49.1-beta",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"main": "electron.js",
|
"main": "electron.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -103,18 +103,20 @@ export default class BacklinksWidget extends NoteContextAwareWidget {
|
|||||||
async refreshWithNote(note) {
|
async refreshWithNote(note) {
|
||||||
this.clearItems();
|
this.clearItems();
|
||||||
|
|
||||||
const targetRelationCount = note.getTargetRelations().length;
|
// can't use froca since that would count only relations from loaded notes
|
||||||
if (targetRelationCount === 0) {
|
const resp = await server.get(`notes/${this.noteId}/backlink-count`);
|
||||||
|
|
||||||
|
if (!resp || !resp.count) {
|
||||||
this.$ticker.hide();
|
this.$ticker.hide();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
this.$ticker.show();
|
this.$ticker.show();
|
||||||
this.$count.text(
|
this.$count.text(
|
||||||
`${targetRelationCount} backlink`
|
`${resp.count} backlink`
|
||||||
+ (targetRelationCount === 1 ? '' : 's')
|
+ (resp.count === 1 ? '' : 's')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
clearItems() {
|
clearItems() {
|
||||||
this.$items.empty().hide();
|
this.$items.empty().hide();
|
||||||
@@ -136,18 +138,22 @@ export default class BacklinksWidget extends NoteContextAwareWidget {
|
|||||||
await froca.getNotes(backlinks.map(bl => bl.noteId)); // prefetch all
|
await froca.getNotes(backlinks.map(bl => bl.noteId)); // prefetch all
|
||||||
|
|
||||||
for (const backlink of backlinks) {
|
for (const backlink of backlinks) {
|
||||||
this.$items.append(await linkService.createNoteLink(backlink.noteId, {
|
const $item = $("<div>");
|
||||||
|
|
||||||
|
$item.append(await linkService.createNoteLink(backlink.noteId, {
|
||||||
showNoteIcon: true,
|
showNoteIcon: true,
|
||||||
showNotePath: true,
|
showNotePath: true,
|
||||||
showTooltip: false
|
showTooltip: false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (backlink.relationName) {
|
if (backlink.relationName) {
|
||||||
this.$items.append($("<p>").text("relation: " + backlink.relationName));
|
$item.append($("<p>").text("relation: " + backlink.relationName));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.$items.append(...backlink.excerpts);
|
$item.append(...backlink.excerpts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$items.append($item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const TPL = `
|
|||||||
|
|
||||||
export default class SharedInfoWidget extends NoteContextAwareWidget {
|
export default class SharedInfoWidget extends NoteContextAwareWidget {
|
||||||
isEnabled() {
|
isEnabled() {
|
||||||
return super.isEnabled() && this.note.hasAncestor('share');
|
return super.isEnabled() && this.noteId !== 'share' && this.note.hasAncestor('share');
|
||||||
}
|
}
|
||||||
|
|
||||||
doRender() {
|
doRender() {
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import server from "../services/server.js";
|
|||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
export default class SharedSwitchWidget extends SwitchWidget {
|
export default class SharedSwitchWidget extends SwitchWidget {
|
||||||
|
isEnabled() {
|
||||||
|
return super.isEnabled() && this.noteId !== 'root' && this.noteId !== 'share';
|
||||||
|
}
|
||||||
|
|
||||||
doRender() {
|
doRender() {
|
||||||
super.doRender();
|
super.doRender();
|
||||||
|
|
||||||
|
|||||||
@@ -14,21 +14,11 @@ const TPL = `
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.trilium-api-docs-button {
|
|
||||||
/*display: none;*/
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-detail-code-editor {
|
.note-detail-code-editor {
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<button class="btn bx bx-help-circle trilium-api-docs-button icon-button floating-button"
|
|
||||||
title="Open Trilium API docs"></button>
|
|
||||||
|
|
||||||
<div class="note-detail-code-editor"></div>
|
<div class="note-detail-code-editor"></div>
|
||||||
|
|
||||||
<div style="display: flex; justify-content: space-evenly;">
|
<div style="display: flex; justify-content: space-evenly;">
|
||||||
@@ -37,6 +27,13 @@ const TPL = `
|
|||||||
Execute <kbd data-command="runActiveNote"></kbd>
|
Execute <kbd data-command="runActiveNote"></kbd>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button class="no-print trilium-api-docs-button btn btn-sm"
|
||||||
|
title="Open Trilium API docs">
|
||||||
|
<span class="bx bx-help-circle"></span>
|
||||||
|
|
||||||
|
API docs
|
||||||
|
</button>
|
||||||
|
|
||||||
<button class="no-print save-to-note-button btn btn-sm">
|
<button class="no-print save-to-note-button btn btn-sm">
|
||||||
|
|
||||||
<span class="bx bx-save"></span>
|
<span class="bx bx-save"></span>
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ pre {
|
|||||||
word-wrap: anywhere;
|
word-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iframe.pdf-view {
|
||||||
|
width: 100%;
|
||||||
|
height: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
#menuButton {
|
#menuButton {
|
||||||
display: none;
|
display: none;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@@ -302,6 +302,21 @@ function uploadModifiedFile(req) {
|
|||||||
note.setContent(fileContent);
|
note.setContent(fileContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBacklinkCount(req) {
|
||||||
|
const {noteId} = req.params;
|
||||||
|
|
||||||
|
const note = becca.getNote(noteId);
|
||||||
|
|
||||||
|
if (!note) {
|
||||||
|
return [404, "Not found"];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return {
|
||||||
|
count: note.getTargetRelations().length
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getNote,
|
getNote,
|
||||||
updateNote,
|
updateNote,
|
||||||
@@ -316,5 +331,6 @@ module.exports = {
|
|||||||
duplicateSubtree,
|
duplicateSubtree,
|
||||||
eraseDeletedNotesNow,
|
eraseDeletedNotesNow,
|
||||||
getDeleteNotesPreview,
|
getDeleteNotesPreview,
|
||||||
uploadModifiedFile
|
uploadModifiedFile,
|
||||||
|
getBacklinkCount
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ function register(app) {
|
|||||||
apiRoute(DELETE, '/api/notes/:noteId/revisions/:noteRevisionId', noteRevisionsApiRoute.eraseNoteRevision);
|
apiRoute(DELETE, '/api/notes/:noteId/revisions/:noteRevisionId', noteRevisionsApiRoute.eraseNoteRevision);
|
||||||
route(GET, '/api/notes/:noteId/revisions/:noteRevisionId/download', [auth.checkApiAuthOrElectron], noteRevisionsApiRoute.downloadNoteRevision);
|
route(GET, '/api/notes/:noteId/revisions/:noteRevisionId/download', [auth.checkApiAuthOrElectron], noteRevisionsApiRoute.downloadNoteRevision);
|
||||||
apiRoute(PUT, '/api/notes/:noteId/restore-revision/:noteRevisionId', noteRevisionsApiRoute.restoreNoteRevision);
|
apiRoute(PUT, '/api/notes/:noteId/restore-revision/:noteRevisionId', noteRevisionsApiRoute.restoreNoteRevision);
|
||||||
|
apiRoute(GET, '/api/notes/:noteId/backlink-count', notesApiRoute.getBacklinkCount);
|
||||||
apiRoute(POST, '/api/notes/relation-map', notesApiRoute.getRelationMap);
|
apiRoute(POST, '/api/notes/relation-map', notesApiRoute.getRelationMap);
|
||||||
apiRoute(POST, '/api/notes/erase-deleted-notes-now', notesApiRoute.eraseDeletedNotesNow);
|
apiRoute(POST, '/api/notes/erase-deleted-notes-now', notesApiRoute.eraseDeletedNotesNow);
|
||||||
apiRoute(PUT, '/api/notes/:noteId/change-title', notesApiRoute.changeTitle);
|
apiRoute(PUT, '/api/notes/:noteId/change-title', notesApiRoute.changeTitle);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
module.exports = { buildDate:"2021-12-23T23:03:21+01:00", buildRevision: "f0217cae5eb4bdac12efe1d15bf26dc128e7f854" };
|
module.exports = { buildDate:"2021-12-24T23:05:10+01:00", buildRevision: "0217b1c85de9a2824e7f07d07a357064c5803383" };
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ async function createMainWindow() {
|
|||||||
height: mainWindowState.height,
|
height: mainWindowState.height,
|
||||||
title: 'Trilium Notes',
|
title: 'Trilium Notes',
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
enableRemoteModule: true,
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
spellcheck: spellcheckEnabled
|
spellcheck: spellcheckEnabled
|
||||||
|
|||||||
@@ -76,8 +76,13 @@ function getContent(note) {
|
|||||||
content = `<img src="api/images/${note.noteId}/${note.title}?${note.utcDateModified}">`;
|
content = `<img src="api/images/${note.noteId}/${note.title}?${note.utcDateModified}">`;
|
||||||
}
|
}
|
||||||
else if (note.type === 'file') {
|
else if (note.type === 'file') {
|
||||||
|
if (note.mime === 'application/pdf') {
|
||||||
|
content = `<iframe class="pdf-view" src="api/notes/${note.noteId}/view"></iframe>`
|
||||||
|
}
|
||||||
|
else {
|
||||||
content = `<button type="button" onclick="location.href='api/notes/${note.noteId}/download'">Download file</button>`;
|
content = `<button type="button" onclick="location.href='api/notes/${note.noteId}/download'">Download file</button>`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (note.type === 'book') {
|
else if (note.type === 'book') {
|
||||||
content = getChildrenList(note);
|
content = getChildrenList(note);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,26 @@ function register(router) {
|
|||||||
|
|
||||||
res.send(note.getContent());
|
res.send(note.getContent());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get('/share/api/notes/:noteId/view', (req, res, next) => {
|
||||||
|
const {noteId} = req.params;
|
||||||
|
const note = shaca.getNote(noteId);
|
||||||
|
|
||||||
|
if (!note) {
|
||||||
|
return res.status(404).send(`Not found`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const utils = require("../services/utils");
|
||||||
|
|
||||||
|
const filename = utils.formatDownloadTitle(note.title, note.type, note.mime);
|
||||||
|
|
||||||
|
// res.setHeader('Content-Disposition', utils.getContentDisposition(filename));
|
||||||
|
|
||||||
|
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
|
res.setHeader('Content-Type', note.mime);
|
||||||
|
|
||||||
|
res.send(note.getContent());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
<%- include('dialogs/delete_notes.ejs') %>
|
<%- include('dialogs/delete_notes.ejs') %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
global = globalThis; /* fixes https://github.com/webpack/webpack/issues/10035 */
|
||||||
|
|
||||||
window.baseApiUrl = 'api/';
|
window.baseApiUrl = 'api/';
|
||||||
window.device = "desktop";
|
window.device = "desktop";
|
||||||
window.glob = {
|
window.glob = {
|
||||||
|
|||||||
@@ -105,6 +105,8 @@
|
|||||||
<%- include('dialogs/confirm.ejs') %>
|
<%- include('dialogs/confirm.ejs') %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
global = globalThis; /* fixes https://github.com/webpack/webpack/issues/10035 */
|
||||||
|
|
||||||
window.baseApiUrl = 'api/';
|
window.baseApiUrl = 'api/';
|
||||||
window.device = "mobile";
|
window.device = "mobile";
|
||||||
window.glob = {
|
window.glob = {
|
||||||
|
|||||||
@@ -189,6 +189,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
global = globalThis; /* fixes https://github.com/webpack/webpack/issues/10035 */
|
||||||
|
|
||||||
window.glob = {
|
window.glob = {
|
||||||
sourceId: ''
|
sourceId: ''
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ module.exports = {
|
|||||||
filename: 'desktop.js'
|
filename: 'desktop.js'
|
||||||
},
|
},
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
target: 'electron-main'
|
target: 'electron-renderer'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ module.exports = {
|
|||||||
filename: 'mobile.js'
|
filename: 'mobile.js'
|
||||||
},
|
},
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
target: 'electron-main'
|
target: 'electron-renderer'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ module.exports = {
|
|||||||
filename: 'setup.js'
|
filename: 'setup.js'
|
||||||
},
|
},
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
target: 'electron-main'
|
target: 'electron-renderer'
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user