mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 00:06:30 +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",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.8.0-beta",
|
||||
"version": "0.8.1",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"repository": {
|
||||
|
||||
@@ -24,7 +24,8 @@ class Note extends Entity {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
function exportSubTree(noteId) {
|
||||
const url = getHost() + "/api/export/" + noteId;
|
||||
const url = getHost() + "/api/export/" + noteId + "?protectedSessionId="
|
||||
+ encodeURIComponent(protected_session.getProtectedSessionId());
|
||||
|
||||
download(url);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (text.length > 20000) {
|
||||
|
||||
@@ -10,7 +10,7 @@ const wrap = require('express-promise-wrap').wrap;
|
||||
const tar = require('tar-stream');
|
||||
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 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.*
|
||||
FROM notes JOIN note_tree USING(noteId)
|
||||
WHERE note_tree.isDeleted = 0 AND notes.isDeleted = 0
|
||||
AND note_tree.parentNoteId = ? AND notes.type = 'code'
|
||||
AND (notes.mime = 'application/javascript' OR notes.mime = 'text/html')`, [parentId]);
|
||||
AND note_tree.parentNoteId = ? AND (notes.type = 'code' OR notes.type = 'file')
|
||||
AND (notes.mime = 'application/javascript'
|
||||
OR notes.mime = 'application/x-javascript'
|
||||
OR notes.mime = 'text/html')`, [parentId]);
|
||||
|
||||
let script = "\r\n";
|
||||
|
||||
@@ -77,7 +79,7 @@ async function getSubTreeScripts(parentId, includedNoteIds, repository, isJavaSc
|
||||
|
||||
script += await getSubTreeScripts(child.noteId, includedNoteIds, repository);
|
||||
|
||||
if (!isJavaScript && child.mime === 'application/javascript') {
|
||||
if (!isJavaScript && child.isJavaScript()) {
|
||||
child.content = '<script>' + child.content + '</script>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user