Commit Graph

474 Commits

Author SHA1 Message Date
Ploum 4a3ec61f1f 2.2 - February 13th 2023
- cache folder is now configurable through $OFFPUNK_CACHE_PATH environment variable (by prx)
- offpunk: adding an URL to a list now update the view mode if url already present
- netcache: solve an infinite gemini loop with code 6X (see also bug #31)
- ansicat: added support for <video> HTML-element
- ansicat: if chafa fails to load an image, fallback to timg if available
- offpunk: add list autocompletion to "tour"
- offpunk: removed "blackbox", which has not been used nor maintained
- offpunk: "gus" was broken, it is functionnal again
- opnk/offpunk: more informative prompt in less
- ansicat: added support for HTML description elements <dt> and <dd> (by Bert Livens)
- opnk: added "--mode" command-line argument (bug #39)
- offpunk: support for "preformatted" theming (bug #38)
- opnk/netcache: added "--cache-validity" command-line argument (bug #37)
- ansicat: consider files as XML, not SVG, if they don’t have .svg extension
- offpunk: fix "view link" crashing with link to empty files
2024-02-12 22:25:46 +01:00
Ploum 9bec3b48dd fix view link crashing with empty files 2024-02-11 12:14:52 +01:00
Ploum eea914018c remove old blackbox call 2024-01-29 15:26:13 +01:00
Ploum cf459e5295 offpunk: "gus" was broken, it is functionnal again 2024-01-06 21:24:51 +01:00
Ploum c86a377d98 offpunk: removed "blackbox", which has not been used nor maintained 2024-01-06 21:21:08 +01:00
Ploum fa0793ef16 Migrating self.current_url to the modded URL
- adding an URL to a list now update the view mode if url already present
- self.current_url now contains the modded URL
2024-01-06 00:27:51 +01:00
Ploum 9d1fb1a3d4 add list autocompletion to tour 2023-12-25 00:14:04 +01:00
Ploum 1bbd317c1d v2.1 - December 15th 2023
Two years ago, I started to modify AV-98 in order to browser Gemini
offline.
https://ploum.net/2021-12-06-offline-av98.html
https://ploum.net/2021-12-17-offline-gemini.html

It is interesting to reflect on those last two years and look at what
this little experiment has become. A tool I use daily. In fact, on of my
main tools with Neovim and Neomutt. Also a community. People
contributing. Sending patches, bug reports or even thank you notes. A
few people hanging out on the offpunk:matrix.org room. I’m really
grateful for that and for all the people who make the Gemini-sphere
alive.

This 2.1 release is also a more relaxed release. The 2.0 release was
well received, widely packaged and has very few bugs (comparing to 1.0).

So nothing ground breaking but, besides a few bug fixed (including the
infamous gemini redirection bug), some little nice-to-have features.
Like highlighting "new links" in Gemini and RSS pages. I was unsure if
it would work, turns out that it is the best thing ever invented to read
Gemini Antenna or long RSS feeds.

Also added: "copy title" and "copy link", allowing you to quickly
reference a page in a personnal note or an email.

And, one day, I realized that I often wanted to know where a given link
was pointing to (a bit like hovering your mouse on a link in a
traditional browser). So I added a "view XX" where XX is the number of
the link.

What is really interesting with this feature is how I wrote it: I
realized I had a need, opened the offpunk.py, wrote a few lines of code
to test it and… that was it. No correction to do. It was good at the
very first try. Which is a testament to the fact that the 2.0
refactorisation was actually a good thing.

So, here is it, the 2.1 release. Enjoy!

Changelog since 2.0:
- freshly updated gemtext/rss links are highlighted ("new_link" theme option)
- offpunk : new "copy title" and "copy link" function
- offpunk : new "view XX" feature where XX is a number to view information about a link
- ansicat: added "--mode" option
- redirections are now reflected in links and the cache (bug #28)
- ansicat: avoid a crash when urllib.parse.urljoin fails
- offpunk: Fix a crash when gus is called without parameters (Von Hohenheiden)
- ansicat: fixed a crash when parsing wrong hidden_url in gemini (bug #32)
- offpunk: offpunk --version doesn’t create the cache anymore (bug #27)
- ansicat: fix a crash with HTML without title (bug #33)
- netcache: gemini socket code can crash when IPv6 is disabled (mailing-list)
2023-12-12 16:53:54 +01:00
Ploum f373144cca New view link feature
"view 12" will now gives you hindsight about link 12
2023-12-06 15:11:18 +01:00
Ploum 92516082c1 Access to xdg folders now refactored to be a function
Instead of creating three global variables, a xdg() function now returns
the DATA,CONFIG and CACHE folders.

This allows us to create the cache only when tentatively accessed
(this fixes bug #27)
2023-12-04 11:10:20 +01:00
Ploum aad1730cd8 New "copy link" and "copy title" features 2023-12-03 13:18:12 +01:00
Ploum 3164658352 Fixed a crash when parsing hidden_urls bug #32
GemtextRenderer is parsing the text for URLs not starting with "=>" and
adding them later to the list to avoid having to copy/paste with the
mouse. This is an hidden feature.

In this case, the url was not supposed to be one and included [] chars
which prevent urllib to know how to handle it.

The fix involved refactoring the looks_like_url functions out of offpunk
and add it to offutils so it can be used by ansicat to ensure a function
looks_like_url before giving it to urllib.
2023-12-02 00:11:34 +01:00
Ploum c3aff6755e follow redirects everywhere. Should fix #28$
«
2023-12-01 17:14:22 +01:00
vonhohenheiden@tutanota.com 3862183fee fix crash on calling 'gus' without query parameter
Apologies for the additional work and thanks for accepting the patch!
Please find it attached.
Best,
Von

Nov 26, 2023, 10:20 by sourcehut23@ploum.eu:

> On 23/11/26 08:04, vonhohenheiden@tutanota.com wrote:
> >This is a simple fix for a crash I observed when calling 'gus' without any parameters. The following stacktrace can be reproduced by ´python3 offpunk.py <http://offpunk.py> > gus [Enter]´
>
>
> Hi,
>
> Thanks for catching this. The patch looks good but cannot apply. It
> might be because the stacktrace is also considered as a patch by git am
> (that’s my only explanation).
>
> Do you mind sending it again without the stacktrace or as an attachment.
>
> A good practice in offpunk is also to add a line in the CHANGELOG (with
> your name at the end).  If not done, don’t worry, I will do it in a
> later commit.
>
> Thanks!
>
> Ploum
>
>>
>>
> >---
> >Traceback (most recent call last):
> >  File "offpunk/offpunk.py", line 1910, in <module>
> >    main()
> >  File "offpunk/offpunk.py", line 1905, in main
> >    gc.cmdloop()
> >  File "python3.11/cmd.py", line 138, in cmdloop
> >    stop = self.onecmd(line)
> >           ^^^^^^^^^^^^^^^^^
> >  File "python3.11/cmd.py", line 217, in onecmd
> >    return func(arg)
> >           ^^^^^^^^^
> >  File "offpunk/offpunk.py", line 949, in do_gus
> >    self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))
> >                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >TypeError: urlunparse() takes 1 positional argument but 6 were given
> >---
>
>>
>>
> >Proposed patch follows.
> >Thanks,
> >Von
>
>>
>>
> >Signed-off-by: vonhohenheiden <vonhohenheiden@tutanota.com>
> >---
> >offpunk.py <http://offpunk.py> | 3 +++
> >1 file changed, 3 insertions(+)
>
>>
>>
> >diff --git a/offpunk.py b/offpunk.py
> >index a76ac0a..6e82c72 100755
> >--- a/offpunk.py
> >+++ b/offpunk.py
> >@@ -945,6 +945,9 @@ Use 'ls -l' to see URLs."""
> > 
> >     def do_gus(self, line):
> >         """Submit a search query to the geminispace.info <http://geminispace.info> search engine."""
> >+        if not line:
> >+            print("What?")
> >+            return 
> >         self._go_to_url(urllib.parse.urlunparse("gemini","geminispace.info <http://geminispace.info>","/search","",line,""))
> > 
> >     def do_history(self, *args):
> >-- 
> >2.43.0
>
>>
>>
>
> --
> Ploum - Lionel Dricot
> Blog: https://www.ploum.net
> Livres: https://ploum.net/livres.html
>

>From 8ffc15145bad3a74c7771d488df3cb751c4b8039 Mon Sep 17 00:00:00 2001
From: vonhohenheiden <vonhohenheiden@tutanota.com>
Date: Sun, 26 Nov 2023 07:38:19 +0100
Subject: [PATCH] fix crash on calling 'gus' without parameters

Signed-off-by: vonhohenheiden <vonhohenheiden@tutanota.com>
2023-11-26 20:51:50 +01:00
Ploum 233f237e15 added new_link to help theme 2023-11-25 11:44:16 +01:00
Ploum 7e4bdd0601 Releasing 2.0 2023-11-16 12:00:00 +01:00
Ploum 63db80c7be introduced default_protocol option which default to gemini, solving #21 2023-11-12 15:01:58 +01:00
Ploum 24fe364f51 returns the good version number 2023-11-08 18:18:33 +01:00
Ploum ac78e85d04 Fixes bug #26
- make python-requests optional again
- reimplement --disable-http which had no effect
2023-11-08 16:37:13 +01:00
Ploum f05adf1b59 solve a crash with tour when argument and no url 2023-10-19 13:34:26 +02:00
Ploum f6cb7723e1 experimental: new plaintext renderer. Also used to view source 2023-10-07 23:30:09 +02:00
Lionel Dricot eeae7e3ad7 put blocked URLs in its own file to make contributions easier 2023-09-26 22:21:19 +02:00
Austreelis 39c5f17a39 Fix None prompt until manually changed
The GeminiClient's constructor expected set_prompt to return the prompt,
while the function directly mutated it without returning anything.

This manifested as having "None" as prompt instead of the default "ON>", until
entering the offline command.

This patch both fixes the constructor by not setting self.prompt to the
result of GeminiClient.set_prompt, *and* make that function return the
prompt as well. Each of those is a separated hunk, feel free to only
apply whichever feels best (though applying both should warrant any
future mistake of the sort).

Signed-off-by: Austreelis <dev@austreelis.net>
2023-09-23 11:00:35 +02:00
Lionel Dricot 8c752d7b44 fixed an an/or logical confusion that would cause non-displayable documents to be marked as to be refetched even when not necessary 2023-09-19 14:24:18 +02:00
Lionel Dricot a2678bfdf5 prompt color is now part of the theme too 2023-09-14 21:35:23 +02:00
Lionel Dricot 47317ca113 --sync now taking list names as arguments 2023-09-07 16:38:48 +02:00
Lionel Dricot 4c47f28f3f Releasing 2.0-beta1 - September 05th 2023
This is an an experimental release. Bug reports and feedbacks are welcome on the offpunk-devel list.
- WARNING: pyproject.toml has not been updated and is currently non-functional. Help needed!
- IMPORTANT: Licence has been changed to AGPL for ideological reasons
- IMPORTANT: Contact adress has been changed to offpunk2 on the same domain (because of spam)
- IMPORTANT: code has been splitted into 7 differents files. Installation/packaging should be adapted.
Major features:
- New command-line tool: "netcache"
- New command-line tool: "ansicat"
- New command-line tool: "opnk"
- "theme" command allows customization of the colours
- "--config-file" allows to start offpunk with custom config (#16)
Improvments:
- Reading position is saved for the whole session
- Rendering is cached for the session, allowing faster browsing of a page already visited
- "redirect" supports domains starting with "*" to also block all subdomins
- "--images-mode" allow to choose at startup which images should be dowloaded (none,readable,full)
- Support for multi-format rendering (such as RSS feeds with html elements)
- The cache is now automatically upgraded if needed (see .version in your cache)
Other changes from 1.X:
- Images of html files are now downloaded with the html (slower sync but better reading experience)
- URL do not default anymore to "gemini://" if not protocol are indicated. (ongoing discussion in #21)
- "accept_bad_ssl_certificates" now more agressive for http and really accepts them all
- Gopher-only: we don’t support naming a page after the name of the incoming link
- Gemini-only: support for client generated certificates has been removed
- "file" is now marked as a dependency (thank Guillaume Loret)
2023-09-05 14:03:15 +02:00
Lionel Dricot be71ba8c75 - version was crashing since the refactoring
- History is now created if it doesn’t exist
2023-09-04 20:59:32 +02:00
Lionel Dricot 1a2cff83af themes are now applied instantly 2023-09-02 12:41:55 +02:00
Lionel Dricot 2fa2fbc718 support blocking subdomains with * 2023-08-31 21:35:08 +02:00
Lionel Dricot 446c940820 error proofing fetch-later 2023-08-31 20:39:13 +02:00
Lionel Dricot 4c328e32aa don’t add history to itself 2023-08-31 15:49:20 +02:00
Lionel Dricot 0c2b24dd89 Themes and reload
- added background colours to theme
- theme for blockquote and preformatted in gemtext (untested)
- cleanup cache on reload
2023-08-31 10:53:24 +02:00
Lionel Dricot 699fed78b9 Introducing themes
You can now customize the colors of offpunk by using the command
"theme".

See "help theme" or use the autocomplete.
2023-08-31 00:40:35 +02:00
Lionel Dricot 5c5fcb3f9e new full_links_only mode to fetch all links from links saved in mode=full 2023-08-30 11:54:24 +02:00
Lionel Dricot d8bba70fe2 cleanup of the cache should always be full 2023-08-28 14:54:24 +02:00
Lionel Dricot 95c790f69d fix bug #20 due to a stupid line added without testing 2023-08-25 14:14:06 +02:00
Lionel Dricot 7c17b4f15d fixes bug #18 2023-08-24 15:31:08 +02:00
Lionel Dricot 392c42ae48 "--images-mode" allow to choose at startup which images should be dowloaded (none,readable,full)
It default to downloading "readable" images.
download_images_first option will also be deprecated
2023-08-24 15:14:49 +02:00
Lionel Dricot 8beae920a7 removing code of the client-side certificate (untested and unused for years) 2023-08-19 10:17:37 +02:00
Lionel Dricot 238d4352a9 missed an import in opnk 2023-08-18 12:45:28 +02:00
Lionel Dricot fe06f17b16 better handling of changing width with opnk 2023-08-17 15:38:47 +02:00
Lionel Dricot 38fcc89193 fixed do_cat and do_shell 2023-08-17 14:16:40 +02:00
Lionel Dricot e14c9dcd09 now blocking subdomains too 2023-08-17 13:42:59 +02:00
Lionel Dricot 462d257c36 implemented grep and better restoring of last mode 2023-08-17 13:42:57 +02:00
Lionel Dricot 99a3730618 restore redirect code and accept_bad_ssl 2023-08-17 13:41:41 +02:00
Lionel Dricot c149cb17f4 added --config-file (bug #16) 2023-08-17 13:41:41 +02:00
Lionel Dricot 147e628bc2 fixes reload of local ressources 2023-08-17 13:41:41 +02:00
Lionel Dricot af18214c41 except when reloading, we use the cache if younger than 60 seconds 2023-08-17 13:41:41 +02:00
Lionel Dricot 091e41ecf9 fix root function 2023-08-17 13:41:41 +02:00