Commit Graph

216 Commits

Author SHA1 Message Date
Ploum 2faf460f0f close #39: implement --mode in opnk 2024-01-31 16:30:49 +01:00
Bert Livens 1cd331170c Added support for <dd> and <dt> tags to ansicat to render websites like https://fsl.software/ better.
Signed-off-by: Bert Livens <bert@bertlivens.be>
2024-01-29 16:51:21 +01:00
Ploum 79a3f9875f More informative prompt in LESS 2024-01-29 15:15:00 +01:00
Ploum 0a9fb62582 check that the cache_path ends with / 2024-01-23 21:21:15 +01:00
Ploum 01de6fe6ae changelog update 2024-01-23 14:12:22 +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 6d7c45188f fallback to timg if chafa fails to load an image 2023-12-22 18:50:03 +01:00
Bert Livens 426161e35d Added initial support for html <video> elements, including for their poster tag.
Signed-off-by: Bert Livens <bert@bertlivens.be>
2023-12-19 22:24:35 +01:00
Ploum 1ed8ba749e solve an infinite loop with certificate 6X 2023-12-18 10:11:17 +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 52a3ef643a IPv6 might crash if disabled on the OS level
In his message "Bug in some gemini capsule", user Y C had crashes when
connecting to IPv6 enabled capsule while IPv6 was disabled at OS level.

This raised a crash when creating the socket in netcache gemini code.
For whatever reason, the socket creation was not in the "try/catch"
section.

This should fix the issue.
2023-12-11 23:45:19 +01:00
Ploum e3e81fe344 tentatively fix #33 2023-12-10 22:54:37 +01:00
Ploum f9e33914aa typo in changelog 2023-12-06 15:21:26 +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 6e09f0264b New theme option: new_link
In gemtext and RSS rendering, if a link point to a page which is
considered as "new" (it has been cached less than 60 seconds after the
page itself), we display it differently (by default in bold white).

This feature allows to quickcly see new links in RSS pages or aggregator
such as antenna.
2023-11-21 22:04:09 +01:00
Ploum b03cbd9c64 ansicat : added --mode option 2023-11-19 22:07:15 +01:00
Ploum 7e4bdd0601 Releasing 2.0 2023-11-16 12:00:00 +01:00
Ploum c9e5310a07 preparing changelog for 2.0 2023-11-12 15:13:27 +01:00
Ploum 63db80c7be introduced default_protocol option which default to gemini, solving #21 2023-11-12 15:01:58 +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 8d082cb2df migration to hatchling and 2.0-beta2 release 2023-11-08 11:37:29 +01:00
Ploum 856b89ff45 fixes a crash when parsing invalid RSS dates 2023-11-03 23:01:46 +01:00
Ploum bf17b21b30 fixes hang/crash when meeting ; itemtype in gopher 2023-11-01 23:45:47 +01:00
Ploum 979b80c5bd fixes a crash with data:image/svg+xml links 2023-10-20 00:02:35 +02:00
Ploum 924eed3775 fixes a crash with some invalid URLs 2023-10-14 17:22:47 +02:00
Ploum 010288a6fb fixes input in Gemini 2023-10-12 15:23:59 +02:00
Ploum 2b234cdc43 initial tentative to support podcast RSS/atom feeds 2023-10-09 13:26:12 +02:00
Ploum d50bc5a8e2 force closing html title elements 2023-10-07 23:45:01 +02:00
Ploum f6cb7723e1 experimental: new plaintext renderer. Also used to view source 2023-10-07 23:30:09 +02:00
Ploum 4892b9e450 fixes a crash reported by Xavier Maillard for RSS feeds without link elemnet 2023-10-01 14:04:17 +02:00
Lionel Dricot eeae7e3ad7 put blocked URLs in its own file to make contributions easier 2023-09-26 22:21:19 +02:00
Lionel Dricot f8d185eac9 ignoring encoding errors in ansicat 2023-09-23 10:42:45 +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 f33a4cb1e9 use chafa by default if version >= 1.10 2023-09-15 21:54:51 +02:00
Lionel Dricot a2678bfdf5 prompt color is now part of the theme too 2023-09-14 21:35:23 +02:00
Lionel Dricot ea82e81d75 Improve handling of base64 images
Also makes images links absolute in the rendering
2023-09-13 21:49:52 +02:00
Lionel Dricot 0666aaaa7a fixes opening mailto links 2023-09-11 17:26:57 +02:00
Lionel Dricot dc238309dd fixes gophermap being badly rendered as gemtext 2023-09-11 10:47:38 +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 e14009f2a4 ansicat working again alone 2023-09-03 23:20:54 +02:00
Lionel Dricot 2fa2fbc718 support blocking subdomains with * 2023-08-31 21:35:08 +02:00