An Offline-First browser for the smolnet
Lionel Dricot 329a1ad58a introducing --features for #3 | 2 gadi atpakaļ | |
---|---|---|
debian | 2 gadi atpakaļ | |
doc | 2 gadi atpakaļ | |
.gitignore | 5 gadi atpakaļ | |
CHANGELOG | 2 gadi atpakaļ | |
LICENSE | 2 gadi atpakaļ | |
README.md | 2 gadi atpakaļ | |
offpunk.py | 2 gadi atpakaļ | |
requirements.txt | 2 gadi atpakaļ | |
screenshot_offpunk1.png | 2 gadi atpakaļ | |
screenshot_offpunk2.png | 2 gadi atpakaļ | |
setup.py | 2 gadi atpakaļ | |
ubuntu_dependencies.txt | 2 gadi atpakaļ |
A command-line and offline-first smolnet browser/feed reader for Gemini, Gopher, Spartan and Web by Ploum.
The goal of Offpunk is to be able to synchronise your content once (a day, a week, a month) and then browse/organise it while staying disconnected.
Official repository : https://notabug.org/ploum/offpunk/
Offpunk is a fork of the original AV-98 by Solderpunk and was originally called AV-98-offline as an experimental branch.
Offpunk is a single python file. Installation is optional, you can simply download and run "./offpunk.py" or "python3 offpunk.py" in a terminal.
You use the go
command to visit a URL, e.g. go gemini.circumlunar.space
. (gemini:// is assumed is no protocol is specified. Supported protocols are gemini, gopher, http, https, mailto, spartan and file).
Links in pages are assigned numerical indices. Just type an index to follow that link. If page is too long to fit on your screen, the content is displayed in the less pager (by default). Type q
to quit and go back to Offpunk prompt. Type view
or v
to display it again. (view full
or v full
allows to see the full html page instead of the article view. v feed
try to display the linked RSS feed and v feeds
displays a list of available feeds. This only applies to html pages)
Use add
to add a capsule to your bookmarks and bookmarks
or bm
to show your bookmarks (you can create multiple bookmarks lists, edit and remove them. See the list
manual with help list
).
Use offline
to only browse cached content and online
to go back online. While offline, the reload
command will force a re-fetch during the next synchronisation.
Use the help
command to learn about additional commands. Some abreviations are available. See abbrevs
.
When launched with the "--sync" option, offpunk will run non-interactively and fetch content from your bookmarks, lists and ressources tentatively accessed while offline. New content found in your subscriptions (see help subscribe
) will be automatically added to your tour (use tour ls
to see your current tour, tour
without argument to access the next item and tour X
where X is a link number to add the content of a link to your tour).
With "--sync", one could specify a "--cache validity" in seconds. This option will not refresh content if a cache exists and is less than the specified amount of seconds old.
For example, running
offpunk --sync --cache-validity 43200
will refresh your bookmarks if those are at least 12h old. If cache-validity is not set or set to 0, any cache is considered good and only content never cached before will be fetched. --assume-yes
will automatically accept SSL certificates with errors instead of refusing them.
Offpunk can also be configured as a browser by other tool. If you want to use offpunk directly with a given URL, simply type:
offpunk URL
To have offpunk fetch the URL at next sync and close immediately, run:
offpunk --fetch-later URL
Known issues in the code:
I would happily mentor anyone willing to implement those:
See how I browse Web/Gemini offline => gemini://rawtext.club/~ploum/2021-12-17-offline-gemini.gmi
Announces about Offpunk will be made on Ploum’s Gemlog => gemini://rawtext.club/~ploum/
go gemini://rawtext.club/~ploum/
subscribe
Offpunk has no "strict dependencies", i.e. it should run and work without anything else beyond the Python standard library and the "less" pager. However, it will "opportunistically import" a few other libraries if they are available to offer an improved experience or some other features. Python libraries requests, bs4 and readability are required for http/html support. Images are displayed if chafa or timg are presents (python-pil is needed for chafa version before 1.10). When displaying only a picture (not inline), rendering will be pixel perfect in compatible terminals (such as Kitty) if chafa is at least version 1.8 or if timg is used.
To avoid using unstable or too recent libraries, the rule of thumb is that a library should be packaged in Debian/Ubuntu. Keep in mind that Offpunk is mainly tested will all libraries installed. If you encounter a crash without one optional dependencies, please report it. Patches and contributions to remove dependencies or support alternatives are highly appreciated.
Run command version
in offpunk to see if you are missing some dependencies.
Mandatory or highly recommended (packagers should probably make those mandatory):
Dependencies to enable web browsing (packagers should put those in an offpunk-web meta-package)
Nice to have (packagers should probaly make those optional):
go
to the URL copied in the clipboard without having to paste it (both X and traditional clipboards are supported). Also needed to use the copy
command. (apt-get install xsel)help
to get the list of command or a specific help about a command.view full
.subscribe
and rendered as gemlogs. They can be explored with view feed
and view feeds
.tour
and mark
(as per VF-1). Unlike AV-98, tour is saved on disk accross sessions.handler
)openssl
binary is availableYou can use an RC file to automatically run any sequence of valid Offpunk
commands upon start up. This can be used to make settings controlled with the
set
or handler
commanders persistent. You can also put a go
command in
your RC file to visit a "homepage" automatically on startup, or to pre-prepare
a tour
of your favourite Gemini sites or offline
to go offline by default.
The RC file should be called offpunkrc
and goes in $XDG_CONFIG_DIR/offpunk (or .config/offpunk or .offpunk if xdg not available)
The offline content is stored in ~/.cache/offpunk/ as plain .gmi/.html files. The structure of the Gemini-space is tentatively recreated. One key element of the design is to avoid any database. The cache can thus be modified by hand, content can be removed, used or added by software other than offpunk.
There’s no feature to automatically trim the cache. It is believed that gemini content being lightweight, one would have to seriously browse a lot before cache size is an issue. If cache becomes too big, simply rm -rf the folders of the capsules taking too much space.