Compare commits

...

35 Commits

Author SHA1 Message Date
zadam
cdb17ae937 release 0.30.7 2019-03-30 20:13:53 +01:00
zadam
c240fb9896 migration for inconsistent isProtected status across notes and note_contents 2019-03-30 20:09:38 +01:00
zadam
4b41eddf44 fix creating note directly as protected 2019-03-30 19:24:53 +01:00
zadam
b51ac112a2 fix loading of protected session in electron, #469 2019-03-30 18:00:08 +01:00
zadam
c2e3a3fe04 release 0.30.6 2019-03-28 23:17:24 +01:00
zadam
b2052a6ccd release 0.30.6 2019-03-28 23:01:52 +01:00
zadam
a07479cd5a release 0.30.6 2019-03-28 22:49:34 +01:00
zadam
3820384f51 release 0.30.6 2019-03-28 22:35:43 +01:00
zadam
0610576e5a 0.30.6 2019-03-28 22:35:36 +01:00
zadam
efac7701eb release 0.30.6 2019-03-28 22:31:59 +01:00
zadam
27cee1cf33 fix closing of context menu on FF66, closes #468
(cherry picked from commit 3c56d29fca)
2019-03-28 20:57:11 +01:00
zadam
b4c6d9f800 using now session cookies to store protectedSessionId 2019-03-13 21:53:09 +01:00
zadam
24c8b39d8e release 0.30.5 2019-03-12 22:21:35 +01:00
zadam
0144dc12df current note as in note loaded into right pane is now called "active note" in frontend API 2019-03-12 21:52:19 +01:00
zadam
65684550a8 updated API docs 2019-03-12 21:42:27 +01:00
zadam
6d09931a39 add getCurrentNote() frontend API, #444 2019-03-12 21:39:35 +01:00
zadam
37d2a7939c fix background/border on quick help dialog, closes #440 2019-03-09 18:57:21 +01:00
zadam
a432ad7483 fix isProtected consistency for images and files + related consistency check 2019-03-08 22:25:12 +01:00
zadam
ae17e4dc60 release 0.30.4 2019-03-07 22:40:05 +01:00
zadam
02eddc347a fix export of protected notes to tar archive, fixes #432 2019-03-07 22:00:23 +01:00
zadam
ee58bf3d5c fix bundle execution error handling 2019-03-07 20:51:55 +01:00
zadam
ecbaffa5f3 return focus back to note detail after quitting add link dialog 2019-03-07 20:45:32 +01:00
zadam
fe86c09f22 make sure date label is always created with YYYY-MM-DD and not the rest of date time 2019-03-05 20:49:39 +01:00
zadam
c8e01d6cce pretty print JSON into note content 2019-03-05 20:44:50 +01:00
zadam
7c404f03db unused param 2019-03-04 22:18:27 +01:00
zadam
ed1cf6aad5 fix passing of startNote and originEntity to backend script API 2019-03-04 21:17:34 +01:00
zadam
9703fd61e2 protected note's shield background now looks better on the dark themes 2019-03-04 20:53:57 +01:00
zadam
16790e388b recent changes should show titles of protected notes correctly when in protected session 2019-03-04 20:44:20 +01:00
zadam
b48474998b release 0.30.3-beta 2019-03-03 20:47:50 +01:00
zadam
95d8f07458 debugging info for image shrinking 2019-03-03 20:41:03 +01:00
zadam
e628c30c89 fix OPML export to include correct OPML version 2019-03-03 19:43:30 +01:00
zadam
52a8aae74f moved test enex files to separate repo 2019-03-03 19:40:47 +01:00
zadam
54b5898582 detect mime types from the filename instead of relying on upload mime type 2019-03-03 00:25:31 +01:00
zadam
64974d75d5 added sync fill for note_contents 2019-03-02 19:59:32 +01:00
zadam
bd118027fb note content is also part of hash check 2019-03-02 12:40:46 +01:00
38 changed files with 2719 additions and 8032 deletions

View File

@@ -0,0 +1,2 @@
INSERT OR REPLACE INTO sync (entityName, entityId, sourceId, syncDate)
SELECT 'note_contents', noteContentId, '', '2019-03-02T18:07:29.182Z' FROM note_contents;

View File

@@ -0,0 +1,6 @@
UPDATE notes SET title = 'Recovered protected note', isProtected = 0 WHERE noteId IN (
SELECT noteId FROM notes JOIN note_contents USING(noteId)
WHERE notes.isProtected = 1
AND note_contents.isProtected = 0
AND notes.isDeleted = 0
)

View File

@@ -350,7 +350,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line30">line 30</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line32">line 32</a>
</li></ul></dd> </li></ul></dd>
@@ -535,7 +535,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line304">line 304</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line308">line 308</a>
</li></ul></dd> </li></ul></dd>
@@ -700,7 +700,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line173">line 173</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line177">line 177</a>
</li></ul></dd> </li></ul></dd>
@@ -876,7 +876,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line315">line 315</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line319">line 319</a>
</li></ul></dd> </li></ul></dd>
@@ -980,7 +980,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line602">line 602</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line606">line 606</a>
</li></ul></dd> </li></ul></dd>
@@ -1080,7 +1080,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line630">line 630</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line634">line 634</a>
</li></ul></dd> </li></ul></dd>
@@ -1184,7 +1184,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line616">line 616</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line620">line 620</a>
</li></ul></dd> </li></ul></dd>
@@ -1288,7 +1288,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line80">line 80</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line82">line 82</a>
</li></ul></dd> </li></ul></dd>
@@ -1388,7 +1388,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line491">line 491</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line495">line 495</a>
</li></ul></dd> </li></ul></dd>
@@ -1619,7 +1619,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line514">line 514</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line518">line 518</a>
</li></ul></dd> </li></ul></dd>
@@ -1815,7 +1815,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line552">line 552</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line556">line 556</a>
</li></ul></dd> </li></ul></dd>
@@ -2011,7 +2011,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line561">line 561</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line565">line 565</a>
</li></ul></dd> </li></ul></dd>
@@ -2111,7 +2111,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line87">line 87</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line89">line 89</a>
</li></ul></dd> </li></ul></dd>
@@ -2260,7 +2260,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line402">line 402</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line406">line 406</a>
</li></ul></dd> </li></ul></dd>
@@ -2425,7 +2425,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line198">line 198</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line202">line 202</a>
</li></ul></dd> </li></ul></dd>
@@ -2590,7 +2590,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line190">line 190</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line194">line 194</a>
</li></ul></dd> </li></ul></dd>
@@ -2743,7 +2743,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line414">line 414</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line418">line 418</a>
</li></ul></dd> </li></ul></dd>
@@ -2851,7 +2851,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line577">line 577</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line581">line 581</a>
</li></ul></dd> </li></ul></dd>
@@ -2955,7 +2955,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line595">line 595</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line599">line 599</a>
</li></ul></dd> </li></ul></dd>
@@ -3055,7 +3055,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line63">line 63</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line65">line 65</a>
</li></ul></dd> </li></ul></dd>
@@ -3155,7 +3155,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line158">line 158</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line162">line 162</a>
</li></ul></dd> </li></ul></dd>
@@ -3259,7 +3259,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line642">line 642</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line646">line 646</a>
</li></ul></dd> </li></ul></dd>
@@ -3412,7 +3412,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line408">line 408</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line412">line 412</a>
</li></ul></dd> </li></ul></dd>
@@ -3577,7 +3577,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line214">line 214</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line218">line 218</a>
</li></ul></dd> </li></ul></dd>
@@ -3742,7 +3742,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line206">line 206</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line210">line 210</a>
</li></ul></dd> </li></ul></dd>
@@ -3895,7 +3895,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line426">line 426</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line430">line 430</a>
</li></ul></dd> </li></ul></dd>
@@ -4051,7 +4051,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line420">line 420</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line424">line 424</a>
</li></ul></dd> </li></ul></dd>
@@ -4159,7 +4159,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line568">line 568</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line572">line 572</a>
</li></ul></dd> </li></ul></dd>
@@ -4259,7 +4259,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line139">line 139</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line143">line 143</a>
</li></ul></dd> </li></ul></dd>
@@ -4367,7 +4367,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line586">line 586</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line590">line 590</a>
</li></ul></dd> </li></ul></dd>
@@ -4467,7 +4467,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line165">line 165</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line169">line 169</a>
</li></ul></dd> </li></ul></dd>
@@ -4643,7 +4643,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line295">line 295</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line299">line 299</a>
</li></ul></dd> </li></ul></dd>
@@ -4747,7 +4747,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line609">line 609</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line613">line 613</a>
</li></ul></dd> </li></ul></dd>
@@ -4900,7 +4900,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line390">line 390</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line394">line 394</a>
</li></ul></dd> </li></ul></dd>
@@ -5053,7 +5053,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line396">line 396</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line400">line 400</a>
</li></ul></dd> </li></ul></dd>
@@ -5162,7 +5162,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line222">line 222</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line226">line 226</a>
</li></ul></dd> </li></ul></dd>
@@ -5244,7 +5244,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line129">line 129</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line131">line 131</a>
</li></ul></dd> </li></ul></dd>
@@ -5348,7 +5348,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line121">line 121</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line123">line 123</a>
</li></ul></dd> </li></ul></dd>
@@ -5452,7 +5452,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line116">line 116</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line118">line 118</a>
</li></ul></dd> </li></ul></dd>
@@ -5556,7 +5556,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line111">line 111</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line113">line 113</a>
</li></ul></dd> </li></ul></dd>
@@ -5660,7 +5660,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line134">line 134</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line136">line 136</a>
</li></ul></dd> </li></ul></dd>
@@ -5764,7 +5764,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line227">line 227</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line231">line 231</a>
</li></ul></dd> </li></ul></dd>
@@ -5991,7 +5991,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line373">line 373</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line377">line 377</a>
</li></ul></dd> </li></ul></dd>
@@ -6187,7 +6187,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line477">line 477</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line481">line 481</a>
</li></ul></dd> </li></ul></dd>
@@ -6383,7 +6383,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line486">line 486</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line490">line 490</a>
</li></ul></dd> </li></ul></dd>
@@ -6610,7 +6610,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line347">line 347</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line351">line 351</a>
</li></ul></dd> </li></ul></dd>
@@ -6710,7 +6710,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line94">line 94</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line96">line 96</a>
</li></ul></dd> </li></ul></dd>
@@ -6810,7 +6810,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line106">line 106</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line108">line 108</a>
</li></ul></dd> </li></ul></dd>
@@ -7006,7 +7006,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line459">line 459</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line463">line 463</a>
</li></ul></dd> </li></ul></dd>
@@ -7202,7 +7202,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line468">line 468</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line472">line 472</a>
</li></ul></dd> </li></ul></dd>
@@ -7460,7 +7460,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line330">line 330</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line334">line 334</a>
</li></ul></dd> </li></ul></dd>
@@ -7687,7 +7687,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line440">line 440</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line444">line 444</a>
</li></ul></dd> </li></ul></dd>
@@ -7914,7 +7914,7 @@ Cache is note instance scoped.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line450">line 450</a> <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line454">line 454</a>
</li></ul></dd> </li></ul></dd>

View File

@@ -41,6 +41,8 @@ const LABEL_DEFINITION = 'label-definition';
const RELATION = 'relation'; const RELATION = 'relation';
const RELATION_DEFINITION = 'relation-definition'; const RELATION_DEFINITION = 'relation-definition';
const STRING_MIME_TYPES = ["application/x-javascript"];
/** /**
* This represents a Note which is a central object in the Trilium Notes project. * This represents a Note which is a central object in the Trilium Notes project.
* *
@@ -132,7 +134,7 @@ class Note extends Entity {
/** @returns {Promise} */ /** @returns {Promise} */
async setJsonContent(content) { async setJsonContent(content) {
await this.setContent(JSON.stringify(content)); await this.setContent(JSON.stringify(content, null, '\t'));
} }
/** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */ /** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
@@ -160,7 +162,9 @@ class Note extends Entity {
/** @returns {boolean} true if the note has string content (not binary) */ /** @returns {boolean} true if the note has string content (not binary) */
isStringNote() { isStringNote() {
return ["text", "code", "relation-map", "search"].includes(this.type) || this.mime.startsWith('text/'); return ["text", "code", "relation-map", "search"].includes(this.type)
|| this.mime.startsWith('text/')
|| STRING_MIME_TYPES.includes(this.mime);
} }
/** @returns {string} JS script environment - either "frontend" or "backend" */ /** @returns {string} JS script environment - either "frontend" or "backend" */
@@ -709,6 +713,7 @@ class Note extends Entity {
delete pojo.isContentAvailable; delete pojo.isContentAvailable;
delete pojo.__attributeCache; delete pojo.__attributeCache;
delete pojo.titleCipherText; delete pojo.titleCipherText;
delete pojo.noteContent;
} }
} }

View File

@@ -1244,7 +1244,7 @@
<h4 class="name" id="getCodeMimeTypes"><span class="type-signature"></span>getCodeMimeTypes<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4> <h4 class="name" id="getActiveNote"><span class="type-signature"></span>getActiveNote<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="NoteFull.html">NoteFull</a>}</span></h4>
@@ -1292,7 +1292,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line236">line 236</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line211">line 211</a>
</li></ul></dd> </li></ul></dd>
@@ -1319,7 +1319,7 @@
<div class="param-desc"> <div class="param-desc">
list of currently used code mime types active note (loaded into right pane)
</div> </div>
@@ -1330,7 +1330,7 @@
</dt> </dt>
<dd> <dd>
<span class="param-type">array</span> <span class="param-type"><a href="NoteFull.html">NoteFull</a></span>
</dd> </dd>
@@ -1348,7 +1348,7 @@
<h4 class="name" id="getCurrentNoteContent"><span class="type-signature"></span>getCurrentNoteContent<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> <h4 class="name" id="getActiveNoteContent"><span class="type-signature"></span>getActiveNoteContent<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
@@ -1423,7 +1423,7 @@
<div class="param-desc"> <div class="param-desc">
content of currently loaded note in the editor (HTML, code etc.) content of active note (loaded into right pane)
</div> </div>
@@ -1452,6 +1452,110 @@
<h4 class="name" id="getCodeMimeTypes"><span class="type-signature"></span>getCodeMimeTypes<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line242">line 242</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
list of currently used code mime types
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
<h4 class="name" id="getDefaultCodeMimeTypes"><span class="type-signature"></span>getDefaultCodeMimeTypes<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4> <h4 class="name" id="getDefaultCodeMimeTypes"><span class="type-signature"></span>getDefaultCodeMimeTypes<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4>
@@ -1500,7 +1604,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line230">line 230</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line236">line 236</a>
</li></ul></dd> </li></ul></dd>
@@ -1860,7 +1964,7 @@ otherwise (by e.g. createNoteLink())
<h4 class="name" id="isNoteStillLoaded"><span class="type-signature"></span>isNoteStillLoaded<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4> <h4 class="name" id="isNoteStillActive"><span class="type-signature"></span>isNoteStillActive<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
@@ -1915,7 +2019,7 @@ note.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line216">line 216</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line222">line 222</a>
</li></ul></dd> </li></ul></dd>
@@ -2068,7 +2172,7 @@ note.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line224">line 224</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line230">line 230</a>
</li></ul></dd> </li></ul></dd>
@@ -2255,7 +2359,7 @@ note.
<h4 class="name" id="protectCurrentNote"><span class="type-signature"></span>protectCurrentNote<span class="signature">()</span><span class="type-signature"></span></h4> <h4 class="name" id="protectActiveNote"><span class="type-signature"></span>protectActiveNote<span class="signature">()</span><span class="type-signature"></span></h4>
@@ -2303,7 +2407,7 @@ note.
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line253">line 253</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line259">line 259</a>
</li></ul></dd> </li></ul></dd>
@@ -2719,7 +2823,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line242">line 242</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line248">line 248</a>
</li></ul></dd> </li></ul></dd>
@@ -2850,7 +2954,7 @@ Internally this serializes the anonymous function into string and sends it to ba
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line248">line 248</a> <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line254">line 254</a>
</li></ul></dd> </li></ul></dd>

View File

@@ -228,9 +228,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
/** /**
* @method * @method
* @returns {string} content of currently loaded note in the editor (HTML, code etc.) * @returns {string} content of active note (loaded into right pane)
*/ */
this.getCurrentNoteContent = noteDetailService.getCurrentNoteContent; this.getActiveNoteContent = noteDetailService.getCurrentNoteContent;
/**
* @method
* @returns {NoteFull} active note (loaded into right pane)
*/
this.getActiveNote = noteDetailService.getCurrentNote;
/** /**
* This method checks whether user navigated away from the note from which the scripts has been started. * This method checks whether user navigated away from the note from which the scripts has been started.
@@ -241,7 +247,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
* @method * @method
* @return {boolean} returns true if the original note is still loaded, false if user switched to another * @return {boolean} returns true if the original note is still loaded, false if user switched to another
*/ */
this.isNoteStillLoaded = () => { this.isNoteStillActive = () => {
return this.originEntity.noteId === noteDetailService.getCurrentNoteId(); return this.originEntity.noteId === noteDetailService.getCurrentNoteId();
}; };
@@ -278,7 +284,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
/** /**
* @method * @method
*/ */
this.protectCurrentNote = protectedSessionService.protectNoteAndSendToServer; this.protectActiveNote = protectedSessionService.protectNoteAndSendToServer;
} }
export default FrontendScriptApi;</code></pre> export default FrontendScriptApi;</code></pre>

4779
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.30.2-beta", "version": "0.30.7",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {
@@ -37,7 +37,7 @@
"express-session": "1.15.6", "express-session": "1.15.6",
"file-type": "10.8.0", "file-type": "10.8.0",
"fs-extra": "7.0.1", "fs-extra": "7.0.1",
"get-port": "4.1.0", "get-port": "4.2.0",
"helmet": "3.15.1", "helmet": "3.15.1",
"html": "1.0.0", "html": "1.0.0",
"image-type": "3.0.0", "image-type": "3.0.0",
@@ -62,7 +62,7 @@
"session-file-store": "1.2.0", "session-file-store": "1.2.0",
"simple-node-logger": "18.12.22", "simple-node-logger": "18.12.22",
"sqlite": "3.0.2", "sqlite": "3.0.2",
"tar-stream": "2.0.0", "tar-stream": "2.0.1",
"turndown": "5.0.3", "turndown": "5.0.3",
"unescape": "1.0.1", "unescape": "1.0.1",
"ws": "6.1.4", "ws": "6.1.4",

View File

@@ -106,7 +106,7 @@ class Note extends Entity {
/** @returns {Promise} */ /** @returns {Promise} */
async setJsonContent(content) { async setJsonContent(content) {
await this.setContent(JSON.stringify(content)); await this.setContent(JSON.stringify(content, null, '\t'));
} }
/** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */ /** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */

View File

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fafafa" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shield"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-opacity="0.03" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shield"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg>

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 296 B

View File

@@ -17,7 +17,8 @@ import link from './services/link.js';
import messagingService from './services/messaging.js'; import messagingService from './services/messaging.js';
import noteDetailService from './services/note_detail.js'; import noteDetailService from './services/note_detail.js';
import noteType from './services/note_type.js'; import noteType from './services/note_type.js';
import protected_session from './services/protected_session.js'; import protectedSessionService from './services/protected_session.js';
import protectedSessionHolder from './services/protected_session_holder.js';
import searchNotesService from './services/search_notes.js'; import searchNotesService from './services/search_notes.js';
import FrontendScriptApi from './services/frontend_script_api.js'; import FrontendScriptApi from './services/frontend_script_api.js';
import ScriptContext from './services/script_context.js'; import ScriptContext from './services/script_context.js';
@@ -52,6 +53,8 @@ window.glob.getCurrentNote = noteDetailService.getCurrentNote;
window.glob.requireLibrary = libraryLoader.requireLibrary; window.glob.requireLibrary = libraryLoader.requireLibrary;
window.glob.ESLINT = libraryLoader.ESLINT; window.glob.ESLINT = libraryLoader.ESLINT;
protectedSessionHolder.setProtectedSessionId(null);
window.onerror = function (msg, url, lineNo, columnNo, error) { window.onerror = function (msg, url, lineNo, columnNo, error) {
const string = msg.toLowerCase(); const string = msg.toLowerCase();

View File

@@ -137,6 +137,10 @@ function linkTypeChanged() {
$linkTypes.change(linkTypeChanged); $linkTypes.change(linkTypeChanged);
// return back focus to note text detail after quitting add link
// the problem is that cursor position is reset
$dialog.on("hidden.bs.modal", () => noteDetailText.focus());
export default { export default {
showDialog showDialog
}; };

View File

@@ -79,7 +79,7 @@ $form.submit(() => {
function exportBranch(branchId, type, format, version) { function exportBranch(branchId, type, format, version) {
exportId = utils.randomString(10); exportId = utils.randomString(10);
const url = utils.getHost() + `/api/notes/${branchId}/export/${type}/${format}/${version}/${exportId}?protectedSessionId=` + encodeURIComponent(protectedSessionHolder.getProtectedSessionId()); const url = utils.getHost() + `/api/notes/${branchId}/export/${type}/${format}/${version}/${exportId}`;
utils.download(url); utils.download(url);
} }

View File

@@ -17,7 +17,7 @@ async function executeBundle(bundle, originEntity) {
}.call(apiContext)); }.call(apiContext));
} }
catch (e) { catch (e) {
infoService.showAndLogError(`Execution of script "${bundle.note.title}" (${bundle.note.noteId}) failed with error: ${e.message}`); infoService.showAndLogError(`Execution of ${bundle.noteId} failed with error: ${e.message}`);
} }
} }

View File

@@ -1,5 +1,7 @@
const $contextMenuContainer = $("#context-menu-container"); const $contextMenuContainer = $("#context-menu-container");
let dateContextMenuOpenedMs = 0;
function initContextMenu(event, itemContainer, selectContextMenuItem) { function initContextMenu(event, itemContainer, selectContextMenuItem) {
event.stopPropagation(); event.stopPropagation();
@@ -55,6 +57,8 @@ function initContextMenu(event, itemContainer, selectContextMenuItem) {
top = event.pageY - 10; top = event.pageY - 10;
} }
dateContextMenuOpenedMs = Date.now();
$contextMenuContainer.css({ $contextMenuContainer.css({
display: "block", display: "block",
top: top, top: top,
@@ -62,8 +66,18 @@ function initContextMenu(event, itemContainer, selectContextMenuItem) {
}).addClass("show"); }).addClass("show");
} }
$(document).click(() => $contextMenuContainer.hide()); $(document).click(() => hideContextMenu());
function hideContextMenu() {
// this date checking comes from change in FF66 - https://github.com/zadam/trilium/issues/468
// "contextmenu" event also triggers "click" event which depending on the timing can close just opened context menu
// we might filter out right clicks, but then it's better if even right clicks close the context menu
if (Date.now() - dateContextMenuOpenedMs > 300) {
$contextMenuContainer.hide();
}
}
export default { export default {
initContextMenu initContextMenu,
hideContextMenu
} }

View File

@@ -200,9 +200,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
/** /**
* @method * @method
* @returns {string} content of currently loaded note in the editor (HTML, code etc.) * @returns {string} content of active note (loaded into right pane)
*/ */
this.getCurrentNoteContent = noteDetailService.getCurrentNoteContent; this.getActiveNoteContent = noteDetailService.getCurrentNoteContent;
/**
* @method
* @returns {NoteFull} active note (loaded into right pane)
*/
this.getActiveNote = noteDetailService.getCurrentNote;
/** /**
* This method checks whether user navigated away from the note from which the scripts has been started. * This method checks whether user navigated away from the note from which the scripts has been started.
@@ -213,7 +219,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
* @method * @method
* @return {boolean} returns true if the original note is still loaded, false if user switched to another * @return {boolean} returns true if the original note is still loaded, false if user switched to another
*/ */
this.isNoteStillLoaded = () => { this.isNoteStillActive = () => {
return this.originEntity.noteId === noteDetailService.getCurrentNoteId(); return this.originEntity.noteId === noteDetailService.getCurrentNoteId();
}; };
@@ -250,7 +256,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
/** /**
* @method * @method
*/ */
this.protectCurrentNote = protectedSessionService.protectNoteAndSendToServer; this.protectActiveNote = protectedSessionService.protectNoteAndSendToServer;
} }
export default FrontendScriptApi; export default FrontendScriptApi;

View File

@@ -117,7 +117,10 @@ async function saveNote() {
} }
note.title = $noteTitle.val(); note.title = $noteTitle.val();
note.noteContent.content = getCurrentNoteContent(note);
if (note.noteContent != null) { // might be null for file/image
note.noteContent.content = getCurrentNoteContent(note);
}
// it's important to set the flag back to false immediatelly after retrieving title and content // it's important to set the flag back to false immediatelly after retrieving title and content
// otherwise we might overwrite another change (especially async code) // otherwise we might overwrite another change (especially async code)

View File

@@ -51,8 +51,7 @@ $openButton.click(() => {
function getFileUrl() { function getFileUrl() {
// electron needs absolute URL so we extract current host, port, protocol // electron needs absolute URL so we extract current host, port, protocol
return utils.getHost() + "/api/notes/" + noteDetailService.getCurrentNoteId() return utils.getHost() + "/api/notes/" + noteDetailService.getCurrentNoteId();
+ "/download?protectedSessionId=" + encodeURIComponent(protectedSessionHolder.getProtectedSessionId());
} }
export default { export default {

View File

@@ -62,8 +62,7 @@ $copyToClipboardButton.click(() => {
function getFileUrl() { function getFileUrl() {
// electron needs absolute URL so we extract current host, port, protocol // electron needs absolute URL so we extract current host, port, protocol
return utils.getHost() + "/api/notes/" + noteDetailService.getCurrentNoteId() return utils.getHost() + "/api/notes/" + noteDetailService.getCurrentNoteId() + "/download";
+ "/download?protectedSessionId=" + encodeURIComponent(protectedSessionHolder.getProtectedSessionId());
} }
export default { export default {

View File

@@ -1,9 +1,10 @@
import utils from "./utils.js"; import utils from "./utils.js";
import optionsInitService from './options_init.js'; import optionsInitService from './options_init.js';
const PROTECTED_SESSION_ID_KEY = 'protectedSessionId';
let lastProtectedSessionOperationDate = null; let lastProtectedSessionOperationDate = null;
let protectedSessionTimeout = null; let protectedSessionTimeout = null;
let protectedSessionId = null;
optionsInitService.optionsReady.then(options => protectedSessionTimeout = options.protectedSessionTimeout); optionsInitService.optionsReady.then(options => protectedSessionTimeout = options.protectedSessionTimeout);
@@ -18,15 +19,16 @@ function setProtectedSessionTimeout(encSessTimeout) {
} }
function getProtectedSessionId() { function getProtectedSessionId() {
return protectedSessionId; return utils.getCookie(PROTECTED_SESSION_ID_KEY);
} }
function setProtectedSessionId(id) { function setProtectedSessionId(id) {
protectedSessionId = id; // using session cookie so that it disappears after browser/tab is closed
utils.setSessionCookie(PROTECTED_SESSION_ID_KEY, id);
} }
function resetProtectedSession() { function resetProtectedSession() {
protectedSessionId = null; utils.setSessionCookie(PROTECTED_SESSION_ID_KEY, null);
// most secure solution - guarantees nothing remained in memory // most secure solution - guarantees nothing remained in memory
// since this expires because user doesn't use the app, it shouldn't be disruptive // since this expires because user doesn't use the app, it shouldn't be disruptive
@@ -34,12 +36,12 @@ function resetProtectedSession() {
} }
function isProtectedSessionAvailable() { function isProtectedSessionAvailable() {
return protectedSessionId !== null; return !!utils.getCookie(PROTECTED_SESSION_ID_KEY);
} }
function touchProtectedSession() { function touchProtectedSession() {
if (isProtectedSessionAvailable()) { if (isProtectedSessionAvailable()) {
lastProtectedSessionOperationDate = new Date(); setProtectedSessionId(utils.getCookie(PROTECTED_SESSION_ID_KEY));
} }
} }

View File

@@ -14,6 +14,8 @@ function getHeaders() {
// so hypothetical protectedSessionId becomes protectedsessionid on the backend // so hypothetical protectedSessionId becomes protectedsessionid on the backend
// also avoiding using underscores instead of dashes since nginx filters them out by default // also avoiding using underscores instead of dashes since nginx filters them out by default
return { return {
// protectedSessionId is normally carried in cookie, but for electron AJAX requests we bypass
// HTTP so no cookies and we need to pass it here explicitly
'trilium-protected-session-id': protectedSessionId, 'trilium-protected-session-id': protectedSessionId,
'trilium-source-id': glob.sourceId 'trilium-source-id': glob.sourceId
}; };

View File

@@ -417,6 +417,9 @@ function initFancyTree(tree) {
const node = data.node; const node = data.node;
const noteId = node.data.noteId; const noteId = node.data.noteId;
// click event won't propagate so let's close context menu manually
contextMenuWidget.hideContextMenu();
setCurrentNotePathToHash(node); setCurrentNotePathToHash(node);
noteDetailService.switchToNote(noteId); noteDetailService.switchToNote(noteId);

View File

@@ -164,11 +164,23 @@ function isDesktop() {
|| (!window.device && !/Mobi/.test(navigator.userAgent)); || (!window.device && !/Mobi/.test(navigator.userAgent));
} }
// cookie code below works for simple use cases only - ASCII only
// not setting path so that cookies do not leak into other websites if multiplexed with reverse proxy
function setCookie(name, value) { function setCookie(name, value) {
const date = new Date(Date.now() + 10 * 365 * 24 * 60 * 60 * 1000); const date = new Date(Date.now() + 10 * 365 * 24 * 60 * 60 * 1000);
const expires = "; expires=" + date.toUTCString(); const expires = "; expires=" + date.toUTCString();
document.cookie = name + "=" + (value || "") + expires + "; path=/"; document.cookie = name + "=" + (value || "") + expires + ";";
}
function setSessionCookie(name, value) {
document.cookie = name + "=" + (value || "") + ";";
}
function getCookie(name) {
const valueMatch = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
return valueMatch ? valueMatch[2] : null;
} }
function getNoteTypeClass(type) { function getNoteTypeClass(type) {
@@ -213,6 +225,8 @@ export default {
isMobile, isMobile,
isDesktop, isDesktop,
setCookie, setCookie,
setSessionCookie,
getCookie,
getNoteTypeClass, getNoteTypeClass,
getMimeTypeClass getMimeTypeClass
}; };

View File

@@ -911,3 +911,8 @@ a.external:after, a[href^="http://"]:after, a[href^="https://"]:after {
content: "\2197"; content: "\2197";
vertical-align: top; vertical-align: top;
} }
.card {
background-color: inherit !important;
border-color: var(--main-border-color) !important;
}

View File

@@ -17,9 +17,13 @@ async function getRecentChanges() {
dateModifiedTo DESC dateModifiedTo DESC
LIMIT 1000`); LIMIT 1000`);
if (!protectedSessionService.isProtectedSessionAvailable()) { for (const change of recentChanges) {
for (const change of recentChanges) { if (change.current_isProtected) {
if (change.current_isProtected) { if (protectedSessionService.isProtectedSessionAvailable()) {
change.title = protectedSessionService.decryptNoteTitle(change.noteId, change.title);
change.current_title = protectedSessionService.decryptNoteTitle(change.noteId, change.current_title);
}
else {
change.title = change.current_title = "[Protected]"; change.title = change.current_title = "[Protected]";
} }
} }

View File

@@ -4,8 +4,8 @@ const build = require('./build');
const packageJson = require('../../package'); const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir'); const {TRILIUM_DATA_DIR} = require('./data_dir');
const APP_DB_VERSION = 125; const APP_DB_VERSION = 127;
const SYNC_VERSION = 5; const SYNC_VERSION = 6;
module.exports = { module.exports = {
appVersion: packageJson.version, appVersion: packageJson.version,

View File

@@ -1 +1 @@
module.exports = { buildDate:"2019-02-28T22:33:33+01:00", buildRevision: "b5283d58bb937dacd8a890a40e09657c6d489364" }; module.exports = { buildDate:"2019-03-30T20:13:53+01:00", buildRevision: "c240fb98967d11ea3925c2c39b44138bb8e46f58" };

View File

@@ -357,6 +357,13 @@ async function findLogicIssues() {
logFix(`Removed link ${linkId} because target note ${targetNoteId} is also deleted.`); logFix(`Removed link ${linkId} because target note ${targetNoteId} is also deleted.`);
}); });
await findIssues(`
SELECT noteId
FROM notes
JOIN note_contents USING(noteId)
WHERE notes.isDeleted = 0 AND notes.isProtected != note_contents.isProtected`,
({noteId}) => `Note ${noteId} has inconsistent isProtected in notes and note_contents tables`);
} }
async function runSyncRowChecks(entityName, key) { async function runSyncRowChecks(entityName, key) {

View File

@@ -8,6 +8,7 @@ const messagingService = require('./messaging');
const ApiToken = require('../entities/api_token'); const ApiToken = require('../entities/api_token');
const Branch = require('../entities/branch'); const Branch = require('../entities/branch');
const Note = require('../entities/note'); const Note = require('../entities/note');
const NoteContent = require('../entities/note_content');
const Attribute = require('../entities/attribute'); const Attribute = require('../entities/attribute');
const NoteRevision = require('../entities/note_revision'); const NoteRevision = require('../entities/note_revision');
const RecentNote = require('../entities/recent_note'); const RecentNote = require('../entities/recent_note');
@@ -33,6 +34,7 @@ async function getHashes() {
const hashes = { const hashes = {
notes: await getHash(Note), notes: await getHash(Note),
note_contents: await getHash(NoteContent),
branches: await getHash(Branch), branches: await getHash(Branch),
note_revisions: await getHash(NoteRevision), note_revisions: await getHash(NoteRevision),
recent_notes: await getHash(RecentNote), recent_notes: await getHash(RecentNote),

View File

@@ -116,7 +116,7 @@ async function getDateNote(dateStr) {
dateNote = await createNote(monthNote.noteId, noteTitle); dateNote = await createNote(monthNote.noteId, noteTitle);
} }
await attributeService.createLabel(dateNote.noteId, DATE_LABEL, dateStr); await attributeService.createLabel(dateNote.noteId, DATE_LABEL, dateStr.substr(0, 10));
} }
return dateNote; return dateNote;

View File

@@ -54,7 +54,7 @@ async function exportToOpml(exportContext, branch, version, res) {
res.setHeader('Content-Type', 'text/x-opml'); res.setHeader('Content-Type', 'text/x-opml');
res.write(`<?xml version="1.0" encoding="UTF-8"?> res.write(`<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0"> <opml version="${version}">
<head> <head>
<title>Trilium export</title> <title>Trilium export</title>
</head> </head>

View File

@@ -13,7 +13,7 @@ const imageType = require('image-type');
const sanitizeFilename = require('sanitize-filename'); const sanitizeFilename = require('sanitize-filename');
async function saveImage(buffer, originalName, parentNoteId, shrinkImageSwitch) { async function saveImage(buffer, originalName, parentNoteId, shrinkImageSwitch) {
const finalImageBuffer = shrinkImageSwitch ? await shrinkImage(buffer) : buffer; const finalImageBuffer = shrinkImageSwitch ? await shrinkImage(buffer, originalName) : buffer;
const imageFormat = imageType(finalImageBuffer); const imageFormat = imageType(finalImageBuffer);
@@ -41,14 +41,14 @@ async function saveImage(buffer, originalName, parentNoteId, shrinkImageSwitch)
}; };
} }
async function shrinkImage(buffer) { async function shrinkImage(buffer, originalName) {
const resizedImage = await resize(buffer); const resizedImage = await resize(buffer);
let finalImageBuffer; let finalImageBuffer;
try { try {
finalImageBuffer = await optimize(resizedImage); finalImageBuffer = await optimize(resizedImage);
} catch (e) { } catch (e) {
log.error(e.message + e.stack); log.error("Failed to optimize image '" + originalName + "\nStack: " + e.stack);
finalImageBuffer = resizedImage; finalImageBuffer = resizedImage;
} }
return finalImageBuffer; return finalImageBuffer;

View File

@@ -5,6 +5,7 @@ const imageService = require('../../services/image');
const protectedSessionService = require('../protected_session'); const protectedSessionService = require('../protected_session');
const commonmark = require('commonmark'); const commonmark = require('commonmark');
const path = require('path'); const path = require('path');
const mimeTypes = require('mime-types');
const CODE_MIME_TYPES = { const CODE_MIME_TYPES = {
'text/plain': true, 'text/plain': true,
@@ -47,21 +48,23 @@ const CODE_MIME_TYPES = {
}; };
async function importSingleFile(importContext, file, parentNote) { async function importSingleFile(importContext, file, parentNote) {
const mime = mimeTypes.lookup(file.originalname);
if (importContext.textImportedAsText) { if (importContext.textImportedAsText) {
if (file.mimetype === 'text/html') { if (mime === 'text/html') {
return await importHtml(importContext, file, parentNote); return await importHtml(importContext, file, parentNote);
} else if (['text/markdown', 'text/x-markdown'].includes(file.mimetype)) { } else if (['text/markdown', 'text/x-markdown'].includes(mime)) {
return await importMarkdown(importContext, file, parentNote); return await importMarkdown(importContext, file, parentNote);
} else if (file.mimetype === 'text/plain') { } else if (mime === 'text/plain') {
return await importPlainText(importContext, file, parentNote); return await importPlainText(importContext, file, parentNote);
} }
} }
if (importContext.codeImportedAsCode && file.mimetype in CODE_MIME_TYPES) { if (importContext.codeImportedAsCode && mime in CODE_MIME_TYPES) {
return await importCodeNote(importContext, file, parentNote); return await importCodeNote(importContext, file, parentNote);
} }
if (["image/jpeg", "image/gif", "image/png"].includes(file.mimetype)) { if (["image/jpeg", "image/gif", "image/png"].includes(mime)) {
return await importImage(file, parentNote, importContext); return await importImage(file, parentNote, importContext);
} }
@@ -84,7 +87,7 @@ async function importFile(importContext, file, parentNote) {
target: 'into', target: 'into',
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(), isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
type: 'file', type: 'file',
mime: file.mimetype, mime: mimeTypes.lookup(originalName),
attributes: [ attributes: [
{ type: "label", name: "originalFileName", value: originalName }, { type: "label", name: "originalFileName", value: originalName },
{ type: "label", name: "fileSize", value: size } { type: "label", name: "fileSize", value: size }
@@ -99,7 +102,8 @@ async function importFile(importContext, file, parentNote) {
async function importCodeNote(importContext, file, parentNote) { async function importCodeNote(importContext, file, parentNote) {
const title = getFileNameWithoutExtension(file.originalname); const title = getFileNameWithoutExtension(file.originalname);
const content = file.buffer.toString("UTF-8"); const content = file.buffer.toString("UTF-8");
const mime = CODE_MIME_TYPES[file.mimetype] === true ? file.mimetype : CODE_MIME_TYPES[file.mimetype]; const detectedMime = mimeTypes.lookup(file.originalname);
const mime = CODE_MIME_TYPES[detectedMime] === true ? detectedMime : CODE_MIME_TYPES[detectedMime];
const {note} = await noteService.createNote(parentNote.noteId, title, content, { const {note} = await noteService.createNote(parentNote.noteId, title, content, {
type: 'code', type: 'code',

View File

@@ -95,7 +95,8 @@ async function createNewNote(parentNoteId, noteData) {
note.noteContent = await new NoteContent({ note.noteContent = await new NoteContent({
noteId: note.noteId, noteId: note.noteId,
content: noteData.content content: noteData.content,
isProtected: noteData.isProtected
}).save(); }).save();
const branch = await new Branch({ const branch = await new Branch({
@@ -332,19 +333,21 @@ async function updateNote(noteId, noteUpdates) {
const noteTitleChanged = note.title !== noteUpdates.title; const noteTitleChanged = note.title !== noteUpdates.title;
noteUpdates.noteContent.content = await saveLinks(note, noteUpdates.noteContent.content);
note.title = noteUpdates.title; note.title = noteUpdates.title;
note.isProtected = noteUpdates.isProtected; note.isProtected = noteUpdates.isProtected;
await note.save(); await note.save();
if (note.type !== 'file' && note.type !== 'image') { const noteContent = await note.getNoteContent();
const noteContent = await note.getNoteContent();
if (!['file', 'image'].includes(note.type)) {
noteUpdates.noteContent.content = await saveLinks(note, noteUpdates.noteContent.content);
noteContent.content = noteUpdates.noteContent.content; noteContent.content = noteUpdates.noteContent.content;
noteContent.isProtected = noteUpdates.isProtected;
await noteContent.save();
} }
noteContent.isProtected = noteUpdates.isProtected;
await noteContent.save();
if (noteTitleChanged) { if (noteTitleChanged) {
await triggerNoteTitleChanged(note); await triggerNoteTitleChanged(note);
} }

View File

@@ -15,7 +15,8 @@ function setDataKey(decryptedDataKey) {
} }
function setProtectedSessionId(req) { function setProtectedSessionId(req) {
cls.namespace.set('protectedSessionId', req.headers['trilium-protected-session-id']); // cookies is the main storage but for electron header is used when bypassing HTTP
cls.namespace.set('protectedSessionId', req.headers['trilium-protected-session-id'] || req.cookies.protectedSessionId);
} }
function getProtectedSessionId() { function getProtectedSessionId() {
@@ -62,7 +63,9 @@ function decryptNoteContent(noteContent) {
} }
try { try {
noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content); if (noteContent.content != null) {
noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content.toString());
}
} }
catch (e) { catch (e) {
e.message = `Cannot decrypt note content for noteContentId=${noteContent.noteContentId}: ` + e.message; e.message = `Cannot decrypt note content for noteContentId=${noteContent.noteContentId}: ` + e.message;
@@ -83,12 +86,17 @@ function decryptNoteRevision(hist) {
return; return;
} }
if (hist.title) { try {
hist.title = dataEncryptionService.decryptString(dataKey, hist.title); if (hist.title) {
} hist.title = dataEncryptionService.decryptString(dataKey, hist.title);
}
if (hist.content) { if (hist.content) {
hist.content = dataEncryptionService.decryptString(dataKey, hist.content); hist.content = dataEncryptionService.decryptString(dataKey, hist.content);
}
}
catch (e) {
throw new Error(`Decryption failed for note ${hist.noteId}: ` + e.message + " " + e.stack);
} }
} }

View File

@@ -65,10 +65,10 @@ async function executeScript(script, params, startNoteId, currentNoteId, originE
const bundle = await getScriptBundle(currentNote); const bundle = await getScriptBundle(currentNote);
return await executeBundle(bundle, startNote, originEntity); return await executeBundle(bundle, { startNote, originEntity });
} }
async function execute(ctx, script, params = []) { async function execute(ctx, script) {
// scripts run as "server" sourceId so clients recognize the changes as "foreign" and update themselves // scripts run as "server" sourceId so clients recognize the changes as "foreign" and update themselves
cls.namespace.set('sourceId', sourceIdService.getCurrentSourceId()); cls.namespace.set('sourceId', sourceIdService.getCurrentSourceId());

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export2.dtd">
<en-export export-date="20181101T193909Z" application="Evernote/Windows" version="6.x">
<note><title>Note</title><content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note><div>this is a note in a notebook in a stack</div></en-note>]]></content><created>20181101T193703Z</created><updated>20181101T193712Z</updated><note-attributes><author>Adam Zivner</author><source>desktop.win</source><source-application>evernote.win32</source-application></note-attributes></note></en-export>

File diff suppressed because it is too large Load Diff