Giter Club home page Giter Club logo

tp-note's People

Contributors

0323pin avatar getreu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tp-note's Issues

cannot find value `app_args` in this scope

Building either 1.22.2 and/or 1.22.3 yields the following error:

error[E0425]: cannot find value `app_args` in this scope
  --> tpnote/src/file_editor.rs:42:18
   |
42 |                 &app_args.editor
   |                  ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `app_args` in this scope
  --> tpnote/src/file_editor.rs:51:27
   |
51 |         (None, false) => &app_args.editor,
   |                           ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `app_args` in this scope
  --> tpnote/src/file_editor.rs:52:23
   |
52 |         (_, true) => &app_args.editor_console,
   |                       ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `app_args` in this scope
  --> tpnote/src/viewer/web_browser.rs:52:14
   |
52 |             &app_args.browser
   |              ^^^^^^^^ not found in this scope

error[E0425]: cannot find value `app_args` in this scope
  --> tpnote/src/viewer/web_browser.rs:63:10
   |
63 |         &app_args.browser
   |          ^^^^^^^^ not found in this scope

warning: unused import: `crate::config::CFG`
 --> tpnote/src/file_editor.rs:3:5
  |
3 | use crate::config::CFG;
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `crate::config::CFG`
 --> tpnote/src/viewer/web_browser.rs:2:5
  |
2 | use crate::config::CFG;
  |     ^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0425`.
warning: `tpnote` (bin "tpnote") generated 2 warnings
error: could not compile `tpnote` (bin "tpnote") due to 5 previous errors; 2 warnings emitted
*** Error code 101

Stop.

OS: NetBSD-10.99.9 dev version
Rust: 1.72.0

Viewer: relax security check for foreign paths

So far, the viewer only serves files that are located in the notes directory or in one of its subdirectories. As by default, annotation notes are always stored in the same directory than the to be annotated file, this security feature did not manifest as a restriction.

But, as #5 shows, some people prefer to store their notes in a separate directory, which can be easily realized either by
modifying the tmpl_annotate_* templates or by a wrapper script invoking tp-note (see #5).

In order to better support this use case, the viewer's above security feature could be relaxed a bit: it could allow not only to follow links below the note's directory, but also allow following links that start one node above.

It should be mentioned in this context, that tp-note comes with 2 other complementary security features:

  1. the viewer only serves files, that are explicitly referenced as links in the note file
  2. the viewer serves only files, whose file extension is part of the registered (see configuration file) file extensions and mime types

Conclusion

Relaxing the above described restriction seems tenable.

PS

It turns out, that at least Firefox resolves http://localhost:42829/../image.jpg to http://localhost:42829/image.jpg.

Proofread documentation

The files

  • ./README.md
  • ./docs/source/tpnote--manpage.md
  • ./docs/source/tpnote--manual.md
  • and - if possible - the Rustdoc documentation in ./src/*.rs

need proofreading by an English native speaker.

add default paths to common iOS text-editors

Please consider the following defaults for Linux and Windows

  • Linux default paths:

    tp-note/src/config.rs

    Lines 161 to 176 in adc8279

    const EDITOR_ARGS: &[&[&str]] = &[
    &[&"typora"],
    &[&"code", &"-w"],
    &[&"atom", &"-w"],
    &[&"retext"],
    &[&"geany"],
    &[&"gedit", &"-w"],
    &[&"mousepad"],
    &[&"leafpad"],
    &[&"nvim-qt", &"--nofork"],
    &[&"gvim", &"--nofork"],
    &[&"nano"],
    &[&"nvim"],
    &[&"vim"],
    &[&"vi"],
    ];

    tp-note/src/config.rs

    Lines 192 to 208 in adc8279

    const VIEWER_ARGS: &[&[&str]] = &[
    &[&"typora"],
    &[&"code", &"-w"],
    &[&"atom", &"-w"],
    &[&"retext"],
    &[&"geany", &"-r"],
    &[&"gedit", &"-w"],
    &[&"mousepad"],
    &[&"leafpad"],
    &[&"nvim-qt", &"--nofork", &"-R"],
    &[&"gvim", &"--nofork", &"-R"],
    &[&"nvim", &"-R"],
    &[&"nano"],
    &[&"nvim", &"-R"],
    &[&"vim", &"-R"],
    &[&"vi", &"-R"],
    ];
  • Windows default paths:

    tp-note/src/config.rs

    Lines 178 to 186 in adc8279

    const EDITOR_ARGS: &[&[&str]] = &[
    &[&"C:\\Program Files\\Typora\\Typora.exe"],
    &[
    "C:\\Program Files\\Notepad++\\notepad++.exe",
    "-nosession",
    "-multiInst",
    ],
    &[&"C:\\Windows\\notepad.exe"],
    ];

    tp-note/src/config.rs

    Lines 210 to 219 in adc8279

    const VIEWER_ARGS: &[&[&str]] = &[
    &[&"C:\\Program Files\\Typora\\Typora.exe"],
    &[
    "C:\\Program Files\\Notepad++\\notepad++.exe",
    "-nosession",
    "-multiInst",
    "-ro",
    ],
    &[&"C:\\Windows\\notepad.exe"],
    ];

The same is needed for iOS. Please enumerate the best iOS text-editors (and Markdown editors) and their paths. The order should be from best/uncommon to standard. The last should be some Unicode-editor, that comes with the OS. Only free products. OSS preferred.
Make sure that the editor does not fork (so that filename synchronization also occurs when the user closes his text-editor).

manpage tpnote.1.gz

Hi,

I've finished packaging tp-note for NetBSD yesterday and would like to merge the package into our repositories.

Is it possible to add the man page (tpnote.1.gz) to the GitLab repository, so we don't need to fetch sources from different locations.
I see the tpnote.1.gz for v1.16.4 hosted at https://blog.getreu.net/projects/tp-note/
But, on the GitLab I can only find https://gitlab.com/getreu/tp-note/-/raw/master/docs/source/tpnote--manpage.md

Yes, it can be converted using pandoc but, that means adding an external build dependency to the package.
So, would you be willing to consider hosting tpnote.1.gz within the repository as well?

As for the package itself, it builds and runs just fine on NetBSD. I've been test using it for some hours and I couldn't find any issues.
Thank you for providing the software.

shorter binary name

When Tp-Note is unsed on the console, one has to write the binary name tp-note a lot. Here, the - is especially annoying, because it inhibits autocomplete.

Tp-Note should have a shorter binary name, maybe tpnote or tpn?
Are there any widely used tpn applications out there?

default note storage location?

Hi folks, is there a flag that I can set which changes the location to which notes are saved? ie. I would like to change the default setting which saves the note in the directory where the file that I am annotating is located.

Make Tp-Note (also) a library

Use case

Expose Tp-Note's core functionality for simple embedding in text editors or text editor plugins.

Todo

Requires effortful refactoring, e.g.:

  • Refactor lazy static configuration variables into some configuration object on the heap.
  • Use the builder pattern for configuration objects.
  • Start by exposing the note module in note.rs.

tp-note failes to compile with: error[E0034]: multiple applicable items in scope

Compilation error:

error[E0034]: multiple applicable items in scope
   --> /home/getreu/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.19.4/src/order.rs:315:15
    |
315 |         if ct == R::BITS {
    |                     ^^^^ multiple `BITS` found
    |
note: candidate #1 is defined in the trait `BitMemory`
   --> /home/getreu/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.19.4/src/mem.rs:29:2
    |
29  |     const BITS: u8 = mem::size_of::<Self>() as u8 * 8;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `IsNumber`
   --> /home/getreu/.cargo/registry/src/github.com-1ecc6299db9ec823/funty-1.2.0/src/lib.rs:144:2
    |
144 |     const BITS: u32;
    |     ^^^^^^^^^^^^^^^^
help: disambiguate the associated constant for candidate #1
    |
315 |         if ct == BitMemory::BITS {
    |                  ^^^^^^^^^^^^^^^
help: disambiguate the associated constant for candidate #2
    |
315 |         if ct == IsNumber::BITS {
    |                  ^^^^^^^^^^^^^^

   Compiling rand_core v0.6.2
   Compiling directories v2.0.2
error: aborting due to 43 previous errors

This is a downstream issue, described here:
0.19 bitvec break by 1.2 funty, causes nom 6.1 to fail to compile · Issue #3 · myrrlyn/funty

The workaround "Downgrade funty to 1.1.0" works for me. The following prevents cargo install from upgrading
downstream dependencies:

cargo install --locked tp-note

I keep this issue open until funty is fixed. Nothing can be done in tp-note.

problem running on mac os x 11.4

Hi folks, downloading the mac binary and running ./tp-note yields

*** ERROR: Unable to load, parse or write the configuration file:

Bad TOML data: missing field debug_arg_default at line 1 column 1

Note: this error may occur after upgrading Tp-Note due
to some incompatible configuration file changes.

For now, Tp-Note backs up the existing configuration
file and next time it starts, it will create a new one
with default values.
*** ERROR: Can not backup and delete the erroneous configuration file:

Configuration file not found.

Rerunning doesn't fix it. There is no config file in ~/.config/tp-note/

I tried to trick it by doing a

touch ~/.config/tp-note/tp-note.toml

and then rerunning, but unfortunately no dice.

v1.19.5 fails to build on NetBSD

Hi,
Updating our tp-note package from v1.19.4 to 1.19.5 and hitting a build failure.
Any hints on what could be causing this? I see that the versions of the crates glib-sys, glib and glib-macros are the same on v1.19.4 and v1.19.5, so that is not the issue.

The following warnings were emitted during compilation:

warning: `"/usr/pkgsrc/wip/tp-note/work/.tools/bin/pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.48"` did not exit successfully: exit status: 1

error: failed to run custom build command for `glib-sys v0.15.10`

Caused by:
  process didn't exit successfully: `/usr/pkgsrc/wip/tp-note/work/tp-note-v1.19.5-692304815256290b31ae0dcb1679ebad0dd39b9f/target/release/build/glib-sys-6373f97bac89f54f/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-netbsd
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_netbsd
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-netbsd
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_netbsd
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-netbsd
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_netbsd
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-netbsd
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_netbsd
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=`"/usr/pkgsrc/wip/tp-note/work/.tools/bin/pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.48"` did not exit successfully: exit status: 1
  error: could not find system library 'glib-2.0' required by the 'glib-sys' crate

  --- stdout


  --- stderr
  Package libpcre was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libpcre.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'libpcre', required by 'glib-2.0', not found
  Package 'libpcre', required by 'glib-2.0', not found

warning: build failed, waiting for other jobs to finish...
*** Error code 101

Stop.

For info,

/usr/pkg/lib > ls | grep libpcre
.rw-r--r-- root wheel  366 KB Mon Nov 21 01:08:42 2022 libpcre.a
.rwxr-xr-x root wheel  941 B  Mon Nov 21 01:08:38 2022 libpcre.la
lrwxr-xr-x root wheel   17 B  Mon Nov 21 01:08:38 2022 libpcre.so ⇒ libpcre.so.1.2.13
lrwxr-xr-x root wheel   17 B  Mon Nov 21 01:08:38 2022 libpcre.so.1 ⇒ libpcre.so.1.2.13
.rwxr-xr-x root wheel  270 KB Mon Nov 21 01:08:37 2022 libpcre.so.1.2.13
.rw-r--r-- root wheel  345 KB Mon Nov 21 01:08:42 2022 libpcre16.a
.rwxr-xr-x root wheel  955 B  Mon Nov 21 01:08:38 2022 libpcre16.la
lrwxr-xr-x root wheel   19 B  Mon Nov 21 01:08:38 2022 libpcre16.so ⇒ libpcre16.so.0.2.13
lrwxr-xr-x root wheel   19 B  Mon Nov 21 01:08:38 2022 libpcre16.so.0 ⇒ libpcre16.so.0.2.13
.rwxr-xr-x root wheel  246 KB Mon Nov 21 01:08:38 2022 libpcre16.so.0.2.13
.rw-r--r-- root wheel  467 KB Mon Nov 21 01:44:07 2022 libpcre2-16.a
.rwxr-xr-x root wheel  970 B  Mon Nov 21 01:44:05 2022 libpcre2-16.la
lrwxr-xr-x root wheel   21 B  Mon Nov 21 01:44:04 2022 libpcre2-16.so ⇒ libpcre2-16.so.0.11.0
lrwxr-xr-x root wheel   21 B  Mon Nov 21 01:44:04 2022 libpcre2-16.so.0 ⇒ libpcre2-16.so.0.11.0
.rwxr-xr-x root wheel  346 KB Mon Nov 21 01:44:04 2022 libpcre2-16.so.0.11.0
.rw-r--r-- root wheel  458 KB Mon Nov 21 01:44:07 2022 libpcre2-32.a
.rwxr-xr-x root wheel  970 B  Mon Nov 21 01:44:05 2022 libpcre2-32.la
lrwxr-xr-x root wheel   21 B  Mon Nov 21 01:44:05 2022 libpcre2-32.so ⇒ libpcre2-32.so.0.11.0
lrwxr-xr-x root wheel   21 B  Mon Nov 21 01:44:05 2022 libpcre2-32.so.0 ⇒ libpcre2-32.so.0.11.0
.rwxr-xr-x root wheel  334 KB Mon Nov 21 01:44:05 2022 libpcre2-32.so.0.11.0
.rw-r--r-- root wheel  507 KB Mon Nov 21 01:44:07 2022 libpcre2-8.a
.rwxr-xr-x root wheel  963 B  Mon Nov 21 01:44:04 2022 libpcre2-8.la
lrwxr-xr-x root wheel   20 B  Mon Nov 21 01:44:04 2022 libpcre2-8.so ⇒ libpcre2-8.so.0.11.0
lrwxr-xr-x root wheel   20 B  Mon Nov 21 01:44:04 2022 libpcre2-8.so.0 ⇒ libpcre2-8.so.0.11.0
.rwxr-xr-x root wheel  382 KB Mon Nov 21 01:44:04 2022 libpcre2-8.so.0.11.0
.rw-r--r-- root wheel  5.4 KB Mon Nov 21 01:44:08 2022 libpcre2-posix.a
.rwxr-xr-x root wheel  1.0 KB Mon Nov 21 01:44:07 2022 libpcre2-posix.la
lrwxr-xr-x root wheel   23 B  Mon Nov 21 01:44:07 2022 libpcre2-posix.so ⇒ libpcre2-posix.so.3.0.2
lrwxr-xr-x root wheel   23 B  Mon Nov 21 01:44:06 2022 libpcre2-posix.so.3 ⇒ libpcre2-posix.so.3.0.2
.rwxr-xr-x root wheel   12 KB Mon Nov 21 01:44:06 2022 libpcre2-posix.so.3.0.2
.rw-r--r-- root wheel   51 KB Mon Nov 21 01:08:43 2022 libpcrecpp.a
.rwxr-xr-x root wheel 1008 B  Mon Nov 21 01:08:42 2022 libpcrecpp.la
lrwxr-xr-x root wheel   19 B  Mon Nov 21 01:08:42 2022 libpcrecpp.so ⇒ libpcrecpp.so.0.0.2
lrwxr-xr-x root wheel   19 B  Mon Nov 21 01:08:42 2022 libpcrecpp.so.0 ⇒ libpcrecpp.so.0.0.2
.rwxr-xr-x root wheel   46 KB Mon Nov 21 01:08:42 2022 libpcrecpp.so.0.0.2
.rw-r--r-- root wheel  5.6 KB Mon Nov 21 01:08:43 2022 libpcreposix.a
.rwxr-xr-x root wheel 1022 B  Mon Nov 21 01:08:40 2022 libpcreposix.la
lrwxr-xr-x root wheel   21 B  Mon Nov 21 01:08:40 2022 libpcreposix.so ⇒ libpcreposix.so.0.0.7
lrwxr-xr-x root wheel   21 B  Mon Nov 21 01:08:40 2022 libpcreposix.so.0 ⇒ libpcreposix.so.0.0.7
.rwxr-xr-x root wheel   12 KB Mon Nov 21 01:08:40 2022 libpcreposix.so.0.0.7
> pkgin list | grep glib2
glib2-2.72.4         Some useful routines for C programming (glib2)
glib2-tools-2.72.4   GLib2/gobject python-dependent tools

OS: NetBSD 9.99.107 (GENERIC) #0: Sat Nov 26 00:25:36 UTC 2022 amd64
Rust: 1.65.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.