Commit Graph

18 Commits (e07b1557c70d6cbeb74a8190a8c33748bc43c9ef)

Author SHA1 Message Date
alex e55471e48c
ngui,nd: screenlock feature implementation
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
the screenlock use case is a way to restrict access to the touchscreen,
for example from children. it is in no way a security measure against
theft or prolonged physical access.

however, nd daemon will refuse to connect to a wifi, switch sysupdates
channel, set a new nodename or init lnd wallet during active screenlock

screenlock pin code can be enabled and disabled from the settings screen.
upon loss of the code, the only way to disable screenlock is to set
slock field to null in the nd daemon conf file.
8 months ago
alex a080e1ac79
nd,ui: add a new facility to be able to change node name
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
the "nodename" encompasses lnd alias and OS hostname.
while the former may be seen by lightning node peers as a node name, the
latter is how the device is seen on a local network such as WiFi.

upon receiving a comm message set_nodename, nd sets both lightning node
alias and hostname to that new name while applying restrictions such as
RFC 1123 for hostnames.

the lightning alias is written to lnd config file, regenerated and
persistent, after which the lnd daemon is restarted to pick up the
changes. network host name is changed by writing the name to
/etc/hostname and issuing "hostname <newname>" shell command.

while persisting operations are atomic, the whole sequence isn't.
in the latter case an inconsistency can be eliminated by sending a
set_nodename msg again.

the nd daemon also includes the OS hostname in the settings message when
sending it to ngui.
9 months ago
alex 0a74bf2c3a
nd/conf: add lnd config (de)serializer and use it conf gen
ci/woodpecker/push/woodpecker Pipeline was successful Details
the change is based on the previously added ini parser.
this makes lnd config gen more robust and allows to presist config
modifications in the future, such as changing node alias.
10 months ago
alex b57ebacd4a
nd,ngui: add lightning setup process, phone pairing and reset
ci/woodpecker/pr/woodpecker Pipeline failed Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
the daemon can now identify which state lnd is in and report to the GUI
which displays different elements on the lighting tab, based on the
reported lnd state:

- startup in progress: displays spinner
- no lightning wallet: displays a "setup" button and guides the user
  through a simple workflow
- reset an operational node

this means, the UI has now minimal but functional elements for any user
equipped with a smart phone to set up the lightning node without SSHing
in or using command line in general.
1 year ago
alex 9f9e4aa171
nd: ignore RpcInWarmup bitcoind RPC error
ci/woodpecker/push/woodpecker Pipeline was successful Details
the daemon now pretends the report is sent over to ngui on such errors.
this is a stop-gap to avoid writing errors on tty. see linked issue.

part of #30
1 year ago
alex e618fee65c
comm: rename bitcoin report to onchain
ci/woodpecker/push/woodpecker Pipeline was successful Details
the "bitcoin" name is overloaded: everything's about bitcoin here.
a less confusing name is onchain to emphasize the difference w.r.t.
lightning or any other future L2 networks.
1 year ago
alex 29f6975601
nd,ngui: remove memleaks and deadlocks mostly from v0.4.0
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
the offending memleak printed out at program exit was introduced in
116fb3b5, specifically line 140 in src/bitcoindrpc.zig using incorrect
allocator.

while there, improved a bit overall memory handling by making sure
heap-alloc'ed messages are always deinit'ed.

another source of trouble was logging from within a sighandler: the
logger uses a thread mutex which may deadlock when the handler is
invoked by the OS.
1 year ago
alex 280bea40df
nd/conf: link to sysupdates repo in doc comments
it is important the constants in Config.zig match those in sysupdates.
somehow should've made it into 664c75a9 but never did.
1 year ago
alex c82848d186
nd,ngui: let users switch sysupdates channel from the UI
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
at the moment, there are two channels: edge and stable.

this builds up on few previous commits, most notably the persistent
configuration storage.
1 year ago
alex 664c75a9c9
nd: add a persistent configuration support
the config will be used by the daemon to store user choices across
reboots.

closes #6
1 year ago
alex 116fb3b59c
nd,ngui: display on-chain balance in bitcoin tab
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
a previous commit added some lightning tab implementation which
including balance details but only for lightning channels.

this commit queries lnd for a wallet balance and displays it on the
bitcoin tab since "wallet" funds are on-chain and it doesn't feel like
it belongs to the lightning tab in the UI.

while there, also improved some daemon backend code style, alightning
with the lightning implementation structures.
1 year ago
alex 52a8c1fb1a
nd: add lnd lightning report sent to UI every min
similarly to 2642a554, this adds an lnd HTTP client able to make some
queries like getinfo. the daemon then uses the client to compose a
lightning status report and sends it over to ngui through comms,
periodically.

there's also a client playground built on demand with
"zig build lndhc".
1 year ago
alex 328df67c5d
zig: upgrade from 0.10.x to 0.11.0
ci/woodpecker/push/woodpecker Pipeline was successful Details
while there's lots of changes and new features in zig v0.11.0, the most
important for this project at the moment is the HTTP client.
the client is most likely what will connect to lnd lightning node to
fetch stats and info for the UI to then visualize it on "lightning" tab,
similar to the bitcoind RPC client.

see all zig 0.11 release notes here:
https://ziglang.org/download/0.11.0/release-notes.html
1 year ago
alex 2642a55477
nd: add bitcoin core report sent to UI every min
this adds a very simple bitcoind RPC client able to make a few queries
like the blockchain and network status. the daemon uses the client
to get the bitcoind status and sends a report through comms periodically.

there's also a little playground program which simply dumps a query
result to stderr. built on demand with "zig build btcrpc".
1 year ago
alex 63eb27bf18
nd,ngui: make program termination reliable on SIGTERM
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
most troubles were due to blocking nature of child process pipe
descriptions which made comm.read loops hang in various places
under certain conditions.

this commit moves all read/writes in separate threads to be able to
always watch for sig TERM and INT, and ensures child process pipes
are closed early allowing comm.read loops to terminate.
1 year ago
alex 78df4ad7ee
nd: poweroff with progress report to ngui
the daemon now sends info about the system shutdown progress: a list of
important services which may require up to several minutes to stop such
as lnd lightning daemon and bitcoin core.

see next commit for how this info is displayed and used by the GUI.
1 year ago
alex fd49235f9e
ui: implement a screen timeout after a period of user inactivity
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
passed 60 sec of no touch screen activity, daemon turns off backlight
and gui places a black "topdrop", opposite of backdrop. simply touching
the screen reactivates it immediately.

there seem to be no way to turn screen power off, so backlight plus
black topdrop is the next best.

there's no user settings to change 60 sec timeout at the moment because it
is unclear whether it's worth adding UI elements. can always do so later.

the implementation also provides means to reactivate the screen in
an event of an alert from the daemon in the future.

closes #3
2 years ago
alex bfc71fec92 start: initial minimal implementation
3 tabs: bitcoin, lightning and settings.
only settings is populated, with wifi info and shutdown.

see build.zig for how everything ties up together.
2 years ago