Commit Graph

243 Commits

Author SHA1 Message Date
88daabe091 Overhaul TOFU checking code.
Main motivation for this was to switch from keying the cache cert
database off hostname + address to hostname + port.  While making
the necessary changes I refactored to reduce code duplication and
make the overall flow of the TOFU checks more transparent.

The check of whether the "previous certificate" has expired has
been changed from using the most frequently seen previous cert to
the most recently seen, which makes a *lot* more sense and is
arguably a bug fix.

The address column of the DB is now used only for reporting, but
the column is not maintained well, or rather, the semantics are
currently "address cert was first received from", and we may want
something less static?
2024-01-17 20:58:59 +01:00
fc056ef680 Merge pull request 'Print <META> string before user input' (#44) from continue/AV-98:master into master
Reviewed-on: #44
2024-01-17 17:44:05 +00:00
Aleksey Ryndin
6d489e6ab3 Print <META> string before user input 2024-01-04 18:58:54 +03:00
4b06b23e2a Merge pull request 'Fix: ERROR: local variable 'certdir' referenced before assignment' (#43) from continue/AV-98:master into master
Reviewed-on: #43
2023-12-09 19:06:16 +00:00
Aleksey Ryndin
bf0db27d6f Merge branch 'master' of tildegit.org:continue/AV-98 2023-12-07 17:49:25 +03:00
Alexey Ryndin
3361c79c1e Fix: ERROR: local variable 'certdir' referenced before assignment 2023-12-06 13:57:56 +03:00
Alexey Ryndin
474787dab7 Merge branch 'master' of tildegit.org:solderpunk/AV-98 2023-12-06 11:58:46 +03:00
Aleksey Ryndin
fae71f5746 Merge branch 'master' of tildegit.org:solderpunk/AV-98 2023-12-06 09:08:42 +03:00
854369afad Add a 'user' command, analogous to 'root' but jumps to a pubnix user's capsule if the URL starts with ~username. 2023-11-26 12:36:49 +01:00
0e9953882c Don't treat filename collisions as fatal. 2023-11-26 12:17:42 +01:00
e96d373eec Fix bug with default response to Y/N prompts. 2023-11-26 12:12:19 +01:00
0e91b4f894 Rename the gus command to search, and the old search to filter. Add option to set search endpoint. 2023-11-25 16:16:54 +01:00
0268cd426b Further splitting up and renaming of files.
Now that everything lives in src/av98/ as per the latest Python
fashion, it's a problem to have a file named av98.py.  So split
it out into main.py (which just implements the argument parsing)
and client.py.  The old clientcerts.py has become certmanager.py
so that tab completion for client.py is quick and easy.
2023-11-25 16:12:46 +01:00
4b759aec70 Add --output command line option for use with --download. 2023-11-25 13:08:36 +01:00
48c8fd9543 Get on board with modern Python packaging conventions.
Remember when we used to make fun of Java people for sticking
everything in a `src/` directory?
2023-11-22 11:20:05 +01:00
188cacca1f Restore coloured debug output, like we had before the logging module was adopted. 2023-11-19 16:49:07 +01:00
b46b15905b Prepare to cut 1.1.0. 2023-11-19 16:26:48 +01:00
3abf44d18c Make the new --download option play nicely with --tls_cert and --tls_key. 2023-11-19 16:23:36 +01:00
203ffaea90 Replace VF-1's flight-themed sign off with AV-98 policing-themed sign off. 2023-11-19 15:25:29 +01:00
cbbc410976 Add curl/wget style --download option. 2023-11-19 15:24:26 +01:00
305f7f9f2c Make do_quit() silent, move the farewell message to main(). 2023-11-19 14:40:26 +01:00
4df88896a8 Ensure we drive a useable filename for saving items whose URL does not provide one. 2023-11-19 14:38:55 +01:00
c8c12cab86 Don't trigger a traceback in debug mode for 4x or 5x status codes. 2023-11-19 14:35:13 +01:00
a0eedac532 Include temporary buffer file name in debug output. 2023-11-19 14:34:29 +01:00
a459e49fa0 Extract titles from gemtext and use them as GeminiItem.name if that's missing. 2023-11-19 14:27:47 +01:00
0a9846b342 Correctly report downloaded file size in debug messages.
Previously, the return value of fp.write() was used, however for
text files this counts the number of characters written, not the
number of bytes, and for non-ASCII content these differ.
2023-11-19 12:29:48 +01:00
9970f21e47 Move a little more clutter from av98.py into util.py. 2023-11-19 10:41:08 +01:00
73ce79310d Reuse a consistent function for getting Y/N type user input. 2023-11-19 10:20:54 +01:00
03b90fcd5e Put config dir discovery/creation in own method, store computed filename of bookmarks. 2023-11-18 19:28:15 +01:00
62972c0228 Restore cert prompt functionality. 2023-11-18 19:27:42 +01:00
0393ae3ea3 Correctly track domains which a client cert has been sent to. 2023-11-18 17:15:17 +01:00
2a70985176 General tidy-up of entire av98.py file.
Most a matter of rearranging the order of methods to flow
sensibly, as well writing or updating docstrings, getting rid of
old unused return values, and fixing a few very minor defects.
2023-11-18 15:59:36 +01:00
247f01e3e7 Update bookmarks to reflect permanent redirects upon exiting. 2023-11-18 14:23:56 +01:00
de7e5dc254 Factor out client certificate management into its own class/file. 2023-11-18 14:22:32 +01:00
607223c25a Get real persnickety about nice option/blackbox alignment. 2023-11-17 20:08:48 +01:00
a9b34278a8 Don't hardcode black box spacing values. 2023-11-17 19:59:12 +01:00
4f354ab291 Nicely align setting names and values. 2023-11-17 19:56:47 +01:00
bd7c5c2110 Log network errors a little more carefully. 2023-11-17 19:44:06 +01:00
71f8a3dc86 Gracefully handle requests for file:// URLs which point at a directory. 2023-11-16 19:18:30 +01:00
0ce09f37a6 Gracefully handle requests for file:// URLs where the file does not exist. 2023-11-16 19:14:22 +01:00
681b11b8a4 Include local file and cached resource handling inside nice try/except error printing. 2023-11-16 19:13:20 +01:00
91ff51a0ef Fix subtle breakage on some certs, when ssl_dnsname_match throws a non-CertificateError exception. 2023-11-15 19:47:17 +01:00
50c43c75b4 Provider progress animation when downloading files > 100 KiB. 2023-11-15 19:46:01 +01:00
f78b6ff780 Move handling of permanent redirects inside of _fetch_over_network(). 2023-11-15 19:45:36 +01:00
9e2cce7ce0 Print full tracebacks from exceptions when debugging is enabled. 2023-11-15 19:38:45 +01:00
23b0597b6d Update email address and copyright years. 2023-11-15 19:38:13 +01:00
67729fb711 Count redirects in black box recorder. 2023-11-15 18:40:48 +01:00
480f2cc15f Rejig how do_bookmark() handles an argument to simplify go_to_gi(). 2023-11-15 18:29:52 +01:00
d2fe381c3e Change Cache to use a TemporaryDirectory for its storage to
ensure and simplify thorough cleanups upon shutdown.

Thanks to Ghost for making me aware of this possibility!
2023-11-15 18:21:11 +01:00
048b04bed2 Extensively refactor the way temporary files are used.
Instead of littering /tmp with one file per download plus one per
rendered gemtext file, just reuse the same two files over and
over.  If enabled, caching creates separate copies.

Pretty sure this solves Issue #35, but I'll test and close that
after also improving the use of cache files...
2023-11-15 18:06:33 +01:00