Commit Graph

782 Commits

Author SHA1 Message Date
Lionel Dricot 8b97acc5e0 relative import back to offpunk 2023-09-16 10:53:15 +02:00
Lionel Dricot 963ac3d7a3 merging refactor 2023-09-16 10:32:26 +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 7a606b71cf some ugly code to filter XMLparsedAsHTMLWarning from BS4 2023-09-12 18:06:42 +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
Austreelis 6e215c0512 Use relative imports when importing offpunk's own modules
This should allow running offpunk locally from any
directory.
2023-09-09 22:43:45 +02:00
Austreelis 370e7e4dc5 Add scripts to run tools locally
This adds a script for each executable, and a __main__.py for offpunk
itself.  This intends to "fix" (albeit unperfectly, see below) how
46f61bf forbade locally running executables without first installing
offpunk in your site packages (or hacking on PYTHONPATH).

Of those, most are "glue script", files in the top-level directory
and outside offpunk's module, which are purely there to allow running
the `netcache`, `ansicat` and `opnk` without any other setup than a
working python and a `git clone`.  Notably, they will not be included in
the source distribution (sdist) archive built by flit.

Sadly the `offpunk` executable doesn't get the same treatment, because
having both an `offpunk.py` script and an `offpunk` python package
is ambiguous, and flit disallows that, avoiding to package anything.
So instead it now has a pretty bare __main__.py, which really works the
same way as the "glue scripts", except this one does get packaged.
This means everything but `offpunk` may be run like `./netcache.py`,
making this setup a bit inconsistent (which may or may not be an issue).
Running `python -m <tool>` works for everything though, so there *is* a
consistent way to run them all, and in the darkness, bind them.
2023-09-08 17:21:11 +02:00
Austreelis bc43e3150b Put everything in a common offpunk package
This moves around and renames a bunch of code, as an effort toward
fixing the flit build process.  Simply put, all source code has been
moved in an `offpunk` directory, and renamed in ways that (hopefully)
make sense.  The `pyproject.toml` file has been updated, too.

This changes how to import code from offpunk modules: old top-level
modules are now under `offpunk` (`import netcache` ->
`from offpunk import netcache`), and "off" prefixes have been stripped
(`from offutils import run` -> `from offpunk.utils import run`).

Note file mode x (execute) was removed on all touched files (if it was
set before), meaning they cannot be executed exactly like before this
change.  Running scripts directly (`./offpunk/netcache.py`) is broken
because python doesn't populate parent modules of top-level modules.
Running `python -m offpunk.netcache` is broken because running inner
python modules as top-level this way *does* populate parent modules
(assuming my understanding is correct, but it may very well not be), but
it can somehow trigger undefined behavior (!?).  Running
`python -m offpunk` still works though.

Signed-off-by: Austreelis <dev@austreelis.net>
2023-09-08 17:21:07 +02:00
Austreelis 5f3d8d69be Update license classifier in pyproject.toml
The previous one wasn't listed on
[pypy's list](https://pypi.org/pypi?%3Aaction=list_classifiers), which
made flit 3.9.0 refuse to build offpunk (I didn't investigate this
much).
2023-09-08 15:29:58 +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 53b310507f allows offpunk to run with older cryptography package 2023-09-05 11:52:30 +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 b1effe57b6 not trying to display absent images 2023-09-04 10:29:14 +02:00
Lionel Dricot e14009f2a4 ansicat working again alone 2023-09-03 23:20:54 +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 28d22c4d11 do not try to open files if they dont exist 2023-08-31 20:45:52 +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 b001ade107 correctly close background ansi codes 2023-08-31 14:59:18 +02:00
Lionel Dricot 514e853b6b create cache dir if it doesn’t exists. Thanks mart-e for reporting the bug. 2023-08-31 11:01:52 +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 1e002f3456 early support for themes in ansicat 2023-08-30 17:02:54 +02:00
Lionel Dricot 97b02a666f do not use cache for local files 2023-08-30 14:06:07 +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
Étienne Mollier 7ad75380a6 Homogenize shebang
Before the change, ansicat, netcache and opnk assume that the
interpreter location is always /bin/python.  While some distributions
do provide python at this location, even as a python3 interpreter,
some others such as Debian do not provide a plain python interpreter
anymore, at least not by default.  There exist packages to provide the
version 2 or the version 3 of the interpreter at that location, but
the three possible configurations (v2, v3 or none) are left at the
discretion of the administrator, so in practice can't really be
predicted in advance.

This change applies the same shebang as offpunk.py and the cache
migration script.  Use of /usr/bin/env has also the side effect of
easing use of python3 interpreters installed at weird locations.

Signed-off-by: Étienne Mollier <emollier@debian.org>
2023-08-30 09:22:08 +02:00
Lionel Dricot 5d9df83ea0 cache_migration doesn’t need to be executable 2023-08-29 12:21:43 +02:00
Lionel Dricot c356a4607c automatic handle of cache migration 2023-08-29 11:47:51 +02:00
Lionel Dricot 68451fbc0a tentative of upgrading pyproject 2023-08-28 23:52:59 +02:00
Lionel Dricot 751c4eb2b2 removing unecessary Debian reference from manpages 2023-08-28 23:18:07 +02:00
Lionel Dricot d8bba70fe2 cleanup of the cache should always be full 2023-08-28 14:54:24 +02:00
Lionel Dricot 11adf1aca9 changelog update 2023-08-27 23:25:01 +02:00
Étienne Mollier 5d675f4ceb offpunk.1: cross reference other manual pages.
Signed-off-by: Étienne Mollier <emollier@debian.org>
2023-08-27 22:47:02 +02:00
Étienne Mollier 7a22ea3c8a Provide manuals for new commands.
This patch add stubs of documentation for ansicat(1), netcache(1),
migrate-offpunk-cache(1) and opnk(1) in prevision of offpunk 2.0
release.  The migration script manual notably resolves issue #15.

Signed-off-by: Étienne Mollier <emollier@debian.org>
2023-08-27 22:46:49 +02:00
Lionel Dricot a1ce45403f I broke the feed renderer. Now it works 2023-08-27 13:46:33 +02:00
Lionel Dricot d7fe66b204 support for multiformat rendering (trying view full for RSS) 2023-08-27 13:11:34 +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 3f6a9df107 fixes bug #19 2023-08-23 15:04:19 +02:00
Lionel Dricot 8c4f4eee65 compute size of lists 2023-08-22 15:43:17 +02:00
Lionel Dricot 10b3a84be5 Solve the infamous application/javascript bug
Lot of html pages are now recognized as application/javascript. We now
force the HtmlRenderer for application/javascript.

Contact address has also be changed to offpunk2 everywhere
2023-08-22 14:59:20 +02:00
Lionel Dricot f4818c966e adding file as a dependancy 2023-08-21 01:08:13 +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