history tracer plugin

108 views
Skip to first unread message

Matt Wilkie

unread,
Feb 21, 2020, 1:38:27 AM2/21/20
to leo-editor
Hi Vitalije,

I'd like to try your History Tracer plugin. Has anything significant changed since this thread?

-matt

vitalije

unread,
Feb 21, 2020, 4:31:38 AM2/21/20
to leo-editor
I use it all the time.
I am not sure how significant (if any) changes were made since then.
I've just checked and the version of leo-ver-serv on  my computer is the same as on the github.
So, I suggest that you install rust if you don't already have it. The best way is to install rustup first (https://rustup.rs/)

Then using rustup install the latest tool-chain for rust:
rustup toolchain install nightly

Then you can just run the following command:
cargo install leo-ver-serv

If you find that this doesn't work for you, or after starting leo-ver-serv you get some errors in the console, please file the issue on the github, or ask here for further help.

For the plugin to work correctly, leo-ver-serv should be running and full path to the outline should be in the list of known files that was given to leo-ver-serv on the start. This means if you create a new outline, or if you open some outline that is not listed in your recent Leo files, you'll probably have to restart leo-ver-serv.

This limitation can be lifted, however, leo-ver-serv has to create and open a sqlite3 database for any filename it receives request for. So, theoretically speaking, if an attacker can manage to send the requests to your leo-ver-serv, it would be possible to cause creation of too many files just by sending requests for nonexistent filenames. To prevent this kind of attack, leo-ver-serv will bind only on localhost and will refuse to handle requests for filenames that are not among known files.

While I am writing this, I have just realized that perhaps it would be enough just to check if the filename exists and is Leo file. In that case leo-ver-serv won't need list of known files at all.

I think I should put some more work on the web view displaying versions of Leo. The outline view lacks scrolling, so it is sometimes hard or impossible to see nodes close to the bottom of the outline.

Vitalije

Matt Wilkie

unread,
Feb 22, 2020, 1:51:23 AM2/22/20
to leo-editor
Thanks Vitalije!

installation went smoothly but the browser doesn't show anything and there are connection errors in the terminal. I opened an issue: https://github.com/leo-editor/leo-editor/issues/1502.

cheers,

-matt

vitalije

unread,
Feb 25, 2020, 4:58:53 AM2/25/20
to leo-e...@googlegroups.com
I am sorry for being late. I see you have found the solution for connection errors yourself.
Have you tried to reload page?

The limits of range inputs for choosing the version are set during the first display of Leo outline. If there are no posted snapshots the page can't show anything. After some edits and posted snapshots, you can switch to another Leo document in the browser, and then return again to the document you want to see, and ranges will adjust to include recent snapshots.

Perhaps it would be a good thing to adjust ranges whenever page regain focus. I'll look into this.

Vitalije

Matt Wilkie

unread,
Feb 25, 2020, 4:43:20 PM2/25/20
to leo-editor
Confirmed working now on Linux (yay!) but still not on Win10. I added some info to the issue. I have to leave now but will resume investigating later today.

Matt Wilkie

unread,
Feb 28, 2020, 8:36:44 PM2/28/20
to leo-editor
Still no joy on Windows. I may have a prototype for buttons to start/stop the server from within Leo though:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by Leo: http://leoeditor.com/leo_toc.html -->
<leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1" >
<leo_header file_format="2"/>
<vnodes>
<v t="mhw.20200222165550.1"><vh>History Tracer</vh>
<v t="mhw.20200228172833.1"><vh>@button start leo-ver-serv</vh></v>
<v t="mhw.20200228172603.1"><vh>@button stop leo-ver-serv</vh></v>
<v t="mhw.20200222171315.1"><vh>@int history-tracer-port=8088</vh></v>
</v>
</vnodes>
<tnodes>
<t tx="mhw.20200222165550.1">@
Some notes added while figuring out how to install and use Vitalije's History
Tracer plugin.

Ahhh, in reading history_tracer.py I see reference to port # to put in my
settings. Trying that...

Ok, that's fixed the urllib connection errors, and I see a .history file in same
folder as .leo. However there is still nothing showing in the browser window.

ok, so maybe there really is an issue on Windows.

</t>
<t tx="mhw.20200222171315.1"></t>
<t tx="mhw.20200228172603.1">bpm = g.app.backgroundProcessManager
bpm.kill(kind='leo-ver-serv')
</t>
<t tx="mhw.20200228172833.1">bpm = g.app.backgroundProcessManager
bpm.start_process(c,
    command='leo-ver-serv %userprofile%/.leo/.leorecentFiles.txt 8088',
    kind='leo-ver-serv',
    shell=True)
</t>
</tnodes>
</leo_file>


Working from these docs: https://leoeditor.com/scripting-miscellany.html#using-g-app-backgroundprocessmanager.  It looks like we should be able to read the port number automatically too using @data? (https://leoeditor.com/scripting-miscellany.html#call-g-execute-shell-commands-with-options)

-matt

Edward K. Ream

unread,
Feb 28, 2020, 9:32:58 PM2/28/20
to leo-editor
On Fri, Feb 28, 2020 at 7:36 PM Matt Wilkie <map...@gmail.com> wrote:
Still no joy on Windows. I may have a prototype for buttons to start/stop the server from within Leo though:

Thanks for all this work. I would like to use the history tracer plugin on Windows.

Edward

vitalije

unread,
Feb 29, 2020, 3:11:56 AM2/29/20
to leo-editor
Can you tell me more about your problem on Windows? Am I correct to assume that leo-ver-serv is running and accepting snapshots on both Windows and Linux?

You wrote that there is no activity in the browser. Have you tried reloading page? Does the input for selecting Leo file has expected entries or not? What is happening when you choose another Leo file in this field? Is there anything in the Web console of your browser? Which browser do you use?

I use Firefox on Windows and it works for me.

Vitalije

vitalije

unread,
Feb 29, 2020, 3:23:47 AM2/29/20
to leo-e...@googlegroups.com
There used to be a bug on Windows where sending the list of Leo files to the front end included '\n\r' but the front end was expecting just '\n'. I know that I have fixed this bug, but perhaps I didn't push the changes to the crates.io and cargo install command uses the old version without this fix. If that's the case, you might have to clone


and build it from the source. Just execute 'cargo build --release --bin leo-ver-serv` in the top project folder.

Vitalije

vitalije

unread,
Feb 29, 2020, 4:15:22 AM2/29/20
to leo-editor
I've just published the new version of leo-ver-serv on crates.io. The version 1.8 includes both the fix for the Windows and also has automatic refresh after more than 10s of inactivity.

If the page looses focus for more than 10s, it will refresh automatically once it regains focus.

Vitalije

Edward K. Ream

unread,
Feb 29, 2020, 8:19:08 AM2/29/20
to leo-editor
On Sat, Feb 29, 2020 at 3:15 AM vitalije <vita...@gmail.com> wrote:
I've just published the new version of leo-ver-serv on crates.io. The version 1.8 includes both the fix for the Windows and also has automatic refresh after more than 10s of inactivity.

Thanks, Vitalije.

Edward

Matt Wilkie

unread,
Mar 9, 2020, 1:35:22 AM3/9/20
to leo-editor
I've just published the new version of leo-ver-serv on crates.io. The version 1.8 includes both the fix for the Windows and also has automatic refresh after more than 10s of inactivity.

v1.8 confirmed working on my Win10 machine. Thanks!

-matt

vitalije

unread,
Mar 9, 2020, 2:07:42 PM3/9/20
to leo-editor
Thanks for the confirmation.
Vitalije
Reply all
Reply to author
Forward
0 new messages