Compare commits

...

4 Commits

Author SHA1 Message Date
azivner
31d5ac05ff release 0.8.1 2018-03-01 23:08:53 -05:00
azivner
72d91d1571 don't use eslint on JSON notes, closes #70 2018-03-01 22:42:51 -05:00
azivner
f4b57f4c57 Allow attachments to be included in the scripts, closes #66 2018-03-01 22:30:06 -05:00
azivner
ee0833390a fix export in electron (auth problem) 2018-02-27 09:47:05 -05:00
6 changed files with 16 additions and 7 deletions

View File

@@ -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": {

View File

@@ -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() {

View File

@@ -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);
} }

View File

@@ -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) {

View File

@@ -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]);

View File

@@ -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>';
} }