nb
nb copied to clipboard
nb br not working
web not working in my platform can you please point the change for termux
nb br + nb br -g both are not working
nb browse
depends on ncat
, which is available as part of the ncat
or nmap
package in most package managers, and pandoc
, so make sure both ncat
and pandoc
are installed. Here's the list of recommended packages for nb
from Ubuntu, which might be available under the same names for Termux:
bash-completion
bat
curl
ncat
pandoc
ripgrep
tig
w3m
We can determine what's missing depending on the observed behavior. When only pandoc
is available, the current note is rendered and [[wiki-style links]] go to unrendered, original files. If only ncat
is available, files in plain text formats are rendered with the original markup unconverted. If neither ncat
nor pandoc
is available, nb browse
falls back to the default behavior of nb show
.
Let me know if this helps.
I think my problem relates to this so I post it here. Feel free to correct if I am wrong.
nb browse
was showing notebooks and folders before I install stock nmap
and pandoc
on both Ubuntu 18.04 and 21.04. After trying to install the two packages, nb browse
returns blank output in the terminal.
I have both nmap
and pandoc
installed (as well as all the other recommended dependencies) and have checked that they respond with reasonable output when run independently of nb
. (e.g. ncat --help
, w3m google.com
).
However, nb browse
isn't working for me. I just get a blank page. nb b -g
also doesn't work, and shows this output:
> nb b -g
Listening: http://localhost:6789
it immediately returns, without opening any gui, and the return-code is 1
Edit: Also, if I attempt to go to that address, it times out.
@voxelv Thanks for the information. Can you try the following two commands and let me know if there is any output? Each command should print the web page markup to the terminal. The first command uses the server and the second one bypasses the server.
nb browse --print
nb browse --print-container
nb browse --print
seems to hang (cursor is blinking, but no output).
nb browse --print-container
shows a big html output with <title>nb browse home:</title>
@voxelv Thanks. Can you try running the following command, then opening http://localhost:6789/ in a GUI web browser? The command should stay open listening for a request and then exit after serving the page to the browser:
ncat --exec "nb browse --respond" --listen "localhost" "6789"
That command exits pretty quickly (1 to 2 seconds after running), with exit code 2
. Trying to go to that address times out.
I'm a software dev, but not as familiar with Javascript/HTML/webservers. I'd be happy to help debug if there's anything I can do.
I will mention that nb browse
works fine on my Arch box, so it might be a Windows vs. ncat
issue. I installed
"Latest stable release self-installer: nmap-7.94-setup.exe"
from Nmap.
Solved long time ago, it was some issue with path..
Thanks
On Sat, Jan 20, 2024, 2:35 PM voxelv @.***> wrote:
nb browse --print seems to hang (cursor is blinking, but no output).
nb browse --print-container shows a big html output with
nb browse home: — Reply to this email directly, view it on GitHub https://github.com/xwmx/nb/issues/112#issuecomment-1901783453, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDYUFQT4M6UO7LNH6YWBPDYPNQSJAVCNFSM44JQV3R2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJQGE3TQMZUGUZQ . You are receiving this because you authored the thread.Message ID: @.***>
@eshad What is the issue with path? How can I fix it? ncat
is installed with Nmap:
> which ncat
/c/Program Files (x86)/Nmap/ncat
@voxelv The issue that @eshad encountered was different.
@voxelv It looks like the error has something to do with ncat
and Windows. I would have to run commands and experiment in order to determine what’s not working. There are alternatives to ncat
that could be used in nb
for handling the connection, including socat
, nc
, accept
in Bash 5.2+. I haven’t gotten any of them to work cross platform yet. For example, nc
on macOS doesn’t include the -e
/ —exec
option, and I haven’t gotten workarounds to work yet. I’ll have to look into this more.
@voxelv I was able to implement the server in both nc
/ netcat
as well as pure Bash 5.2 accept
. 😄 This is available in the latest version in the repository. If you are able to run the latest repo version, please try it and let me know if it works. It should skip ncat
on Windows and automatically use the Bash 5.2 accept
implementation. You can also force it to use accept
by calling nb
with accept
or bash
assigned to the $NB_BROWSE_SERVER_TOOL
variable, e.g.:
NB_BROWSE_SERVER_TOOL="accept" nb b -s
I got the latest nb script and ran nb b -s
and got this result:
$ nb b -s
home
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[1] 20240117114707.md · "First note"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
❯ nb · nb add · nb <url> · nb edit <id> · nb show <id> · nb open <id> · nb browse · nb todos · nb tasks · nb search <query> · nb notebooks add <name> · nb settings · nb help
! Install `ncat`, `nc` / `netcat`, or Bash 5.2+ for full browsing and linking:
https://nmap.org/ncat/
https://en.wikipedia.org/wiki/Netcat
slippy@SAL-11ZW2L3 MINGW64 ~
$ bash --version
GNU bash, version 5.2.26(1)-release (x86_64-pc-msys)
...
I forgot to use that variable, so once I ran NB_BROWSE_SERVER_TOOL="accept" nb b -s
I got the following:
$ NB_BROWSE_SERVER_TOOL="accept" nb b -s
/usr/bin/nb: line 21724: ACCEPT_FD: unbound variable
/usr/bin/nb: line 21726: ACCEPT_FD: ambiguous redirect
/usr/bin/nb: line 21724: ACCEPT_FD: unbound variable
/usr/bin/nb: line 21726: ACCEPT_FD: ambiguous redirect
Listening: http://localhost:6789
/usr/bin/nb: line 21724: ACCEPT_FD: unbound variable
/usr/bin/nb: line 21726: ACCEPT_FD: ambiguous redirect
Press any key to exit.../usr/bin/nb: line 21724: ACCEPT_FD: unbound variable
/usr/bin/nb: line 21726: ACCEPT_FD: ambiguous redirect
/usr/bin/nb: line 21724: ACCEPT_FD: unbound variable
/usr/bin/nb: line 21726: ACCEPT_FD: ambiguous redirect
/usr/bin/nb: line 21724: ACCEPT_FD: unbound variable
/usr/bin/nb: line 21726: ACCEPT_FD: ambiguous redirect
/usr/bin/nb: line 21724: ACCEPT_FD: unbound variable
...
with those last two lines repeating spamming
Edit: And going to that address in firefox resulted in:
Unable to connect
Firefox can’t establish a connection to the server at localhost:6789
@voxelv Thanks. It looks like accept
is loading but the $ACCEPT_FD
file descriptor is not getting set, which might have something to do with Windows.
I'll probably revert this to using ncat
on Windows even though that doesn't currently work, either. ncat
is the best tool for this so far on other platforms since it handles concurrent requests, which is required for the Ace editor to load fully since it requests multiple JavaScript files.
Two other implementations that we could try are with socat
or with python
.
By the way I was using the termux terminal and issue was solved haha. Thanks you all guys...