mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 18:05:55 +01:00
Compare commits
4 Commits
v0.8.0-bet
...
v0.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31d5ac05ff | ||
|
|
72d91d1571 | ||
|
|
f4b57f4c57 | ||
|
|
ee0833390a |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"description": "Trilium Notes",
|
"description": "Trilium Notes",
|
||||||
"version": "0.8.0-beta",
|
"version": "0.8.1",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"main": "electron.js",
|
"main": "electron.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ class Note extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isJavaScript() {
|
isJavaScript() {
|
||||||
return this.type === "code" && this.mime === "application/javascript";
|
return (this.type === "code" || this.type === "file")
|
||||||
|
&& (this.mime === "application/javascript" || this.mime === "application/x-javascript");
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAttributes() {
|
async getAttributes() {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function exportSubTree(noteId) {
|
function exportSubTree(noteId) {
|
||||||
const url = getHost() + "/api/export/" + noteId;
|
const url = getHost() + "/api/export/" + noteId + "?protectedSessionId="
|
||||||
|
+ encodeURIComponent(protected_session.getProtectedSessionId());
|
||||||
|
|
||||||
download(url);
|
download(url);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function validatorJavaScript(text, options) {
|
async function validatorJavaScript(text, options) {
|
||||||
|
if (noteEditor.getCurrentNote().detail.mime === 'application/json') {
|
||||||
|
// eslint doesn't seem to validate pure JSON well
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
await requireLibrary(ESLINT);
|
await requireLibrary(ESLINT);
|
||||||
|
|
||||||
if (text.length > 20000) {
|
if (text.length > 20000) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const wrap = require('express-promise-wrap').wrap;
|
|||||||
const tar = require('tar-stream');
|
const tar = require('tar-stream');
|
||||||
const sanitize = require("sanitize-filename");
|
const sanitize = require("sanitize-filename");
|
||||||
|
|
||||||
router.get('/:noteId/', auth.checkApiAuth, wrap(async (req, res, next) => {
|
router.get('/:noteId/', auth.checkApiAuthOrElectron, wrap(async (req, res, next) => {
|
||||||
const noteId = req.params.noteId;
|
const noteId = req.params.noteId;
|
||||||
|
|
||||||
const noteTreeId = await sql.getValue('SELECT noteTreeId FROM note_tree WHERE noteId = ?', [noteId]);
|
const noteTreeId = await sql.getValue('SELECT noteTreeId FROM note_tree WHERE noteId = ?', [noteId]);
|
||||||
|
|||||||
@@ -63,8 +63,10 @@ async function getSubTreeScripts(parentId, includedNoteIds, repository, isJavaSc
|
|||||||
SELECT notes.*
|
SELECT notes.*
|
||||||
FROM notes JOIN note_tree USING(noteId)
|
FROM notes JOIN note_tree USING(noteId)
|
||||||
WHERE note_tree.isDeleted = 0 AND notes.isDeleted = 0
|
WHERE note_tree.isDeleted = 0 AND notes.isDeleted = 0
|
||||||
AND note_tree.parentNoteId = ? AND notes.type = 'code'
|
AND note_tree.parentNoteId = ? AND (notes.type = 'code' OR notes.type = 'file')
|
||||||
AND (notes.mime = 'application/javascript' OR notes.mime = 'text/html')`, [parentId]);
|
AND (notes.mime = 'application/javascript'
|
||||||
|
OR notes.mime = 'application/x-javascript'
|
||||||
|
OR notes.mime = 'text/html')`, [parentId]);
|
||||||
|
|
||||||
let script = "\r\n";
|
let script = "\r\n";
|
||||||
|
|
||||||
@@ -77,7 +79,7 @@ async function getSubTreeScripts(parentId, includedNoteIds, repository, isJavaSc
|
|||||||
|
|
||||||
script += await getSubTreeScripts(child.noteId, includedNoteIds, repository);
|
script += await getSubTreeScripts(child.noteId, includedNoteIds, repository);
|
||||||
|
|
||||||
if (!isJavaScript && child.mime === 'application/javascript') {
|
if (!isJavaScript && child.isJavaScript()) {
|
||||||
child.content = '<script>' + child.content + '</script>';
|
child.content = '<script>' + child.content + '</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user