offpunk/README.md

133 lines
10 KiB
Markdown
Raw Permalink Normal View History

2021-12-30 15:03:08 +00:00
# OFFPUNK
2019-06-22 12:54:45 +00:00
2022-03-05 15:36:39 +00:00
A command-line and offline-first smolnet browser/feed reader for Gemini, Gopher, Spartan and Web by [Ploum](https://ploum.net).
2021-12-17 13:11:46 +00:00
2022-02-10 22:41:10 +00:00
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.
2021-12-17 15:07:34 +00:00
Official project page (repository/mailing lists) : https://sr.ht/~lioploum/offpunk/
2022-04-09 17:07:30 +00:00
2022-10-12 11:17:29 +00:00
![Screenshot HTML page with picture](screenshot_offpunk1.png)
![Screenshot Gemini page](screenshot_offpunk2.png)
2022-02-23 10:17:21 +00:00
2021-12-30 23:54:25 +00:00
Offpunk is a fork of the original [AV-98](https://tildegit.org/solderpunk/AV-98) by Solderpunk and was originally called AV-98-offline as an experimental branch.
2021-12-10 10:27:48 +00:00
2022-01-01 21:36:06 +00:00
## How to use
2023-11-12 14:51:48 +00:00
Offpunk is a set of python files. Installation is optional, you can simply git clone the project and run "./offpunk.py" or "python3 offpunk.py" in a terminal.
2021-12-06 16:12:45 +00:00
2023-11-12 14:51:48 +00:00
You use the `go` command to visit a URL, e.g. `go gemini.circumlunar.space`. (gemini:// is assumed if no protocol is specified. Supported protocols are gemini, gopher, finger, http, https, mailto, spartan and file. Default protocol is configurable).
2021-12-10 10:27:48 +00:00
2023-11-12 14:51:48 +00:00
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. 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. `v source` allows you to see the source code of a page and `v normal` to go back to normal view)
2023-11-12 14:51:48 +00:00
Use `add` to add a page 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`).
2021-12-30 15:03:08 +00:00
2021-12-30 15:18:35 +00:00
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.
2021-12-30 15:03:08 +00:00
2021-12-30 23:54:25 +00:00
Use the `help` command to learn about additional commands. Some abreviations are available. See `abbrevs`.
2021-12-30 15:03:08 +00:00
2022-01-24 16:15:54 +00:00
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).
2021-12-30 15:03:08 +00:00
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`
2021-12-30 15:03:08 +00:00
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.
2021-12-30 15:03:08 +00:00
2023-11-12 14:51:48 +00:00
Sync can be applied to only a subset of list.
`offpunk --sync bookmarks tour to_fetch --cache-validity 3600`
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`
2021-12-30 15:18:35 +00:00
## More
2021-12-30 15:03:08 +00:00
2022-12-10 20:46:52 +00:00
Important news and releases will be announced on the offpunk-devel mailing list
=> https://lists.sr.ht/~lioploum/offpunk-devel
2021-12-30 15:23:33 +00:00
2022-12-10 20:46:52 +00:00
Questions can be asked on the users mailing list:
=> https://lists.sr.ht/~lioploum/offpunk-users
2020-06-07 17:55:49 +00:00
## Dependencies
2023-11-12 14:51:48 +00:00
Offpunk has few "strict dependencies", i.e. it should run and work without anything
2022-02-18 22:50:08 +00:00
else beyond the Python standard library and the "less" pager. However, it will "opportunistically
2020-06-07 17:55:49 +00:00
import" a few other libraries if they are available to offer an improved
2023-11-12 14:51:48 +00:00
experience or some other features such as HTTP/HTML or image support.
2020-06-07 17:55:49 +00:00
2022-03-25 12:37:23 +00:00
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.
2022-01-10 10:19:29 +00:00
2023-11-12 14:51:48 +00:00
* [List of existing Offpunk packages (Repology)](https://repology.org/project/offpunk/versions)
2022-12-10 20:46:52 +00:00
* PIP: [requirements file to install dependencies with pip](requirements.txt)
* Ubuntu/Debian: [command to install dependencies on Ubuntu/Debian without pip](ubuntu_dependencies.txt)
* Please contribute packages for other systems, theres a [mailing-list dedicated to packaging](https://lists.sr.ht/~lioploum/offpunk-packagers).
2022-02-16 08:21:50 +00:00
Run command `version` in offpunk to see if you are missing some dependencies.
Mandatory or highly recommended (packagers should probably make those mandatory):
2022-04-02 20:08:51 +00:00
* [less](http://www.greenwoodsoftware.com/less/): mandatory but is probably already on your system
2022-12-10 20:46:52 +00:00
* [file](https://www.darwinsys.com/file/) is used to get the MIME type of cached objects. Should already be on your system.
2022-02-20 22:22:25 +00:00
* [xdg-utils](https://www.freedesktop.org/wiki/Software/xdg-utils/) provides xdg-open which is highly recommended to open files without a renderer or a handler. It is also used for mailto: command.
2022-12-10 20:46:52 +00:00
* The [cryptography library](https://pypi.org/project/cryptography/) will provide a better and slightly more secure experience when using the default TOFU certificate validation mode and is recommended (apt-get install python3-cryptography).
2022-03-29 11:28:20 +00:00
2022-12-10 20:46:52 +00:00
Dependencies to enable web browsing (packagers may put those in an offpunk-web meta-package but it is recommended to have it for a better offpunk experience)
2022-01-10 10:19:29 +00:00
* [Python-requests](http://python-requests.org) is needed to handle http/https requests natively (apt-get install python3-requests). Without it, http links will be opened in an external browser
2022-01-18 10:39:01 +00:00
* [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup) and [Readability](https://github.com/buriy/python-readability) are both needed to render HTML. Without them, HTML will not be rendered or be sent to an external parser like Lynx. (apt-get install python3-bs4 python3-readability or pip3 install readability-lxml)
2022-02-06 13:08:25 +00:00
* [Python-feedparser](https://github.com/kurtmckee/feedparser) will allow parsing of RSS/Atom feeds and thus subscriptions to them. (apt-get install python3-feedparser)
2022-02-10 16:19:20 +00:00
* [Chafa](https://hpjansson.org/chafa/) allows to display pictures in your console. Install it and browse to an HTML page with picture to see the magic.
2023-11-12 14:51:48 +00:00
Gopher dependencies:
* [Python-chardet](https://github.com/chardet/chardet) is used to detect the character encoding on Gopher (and may be used more in the future)
Older dependencies which are only needed on older systems (where chafa < 1.10)
* [Timg](https://github.com/hzeller/timg) is a slower alternative to chafa for inline images. Might be deprecated in the future.
* [Python-pil](http://python-pillow.github.io/) is required to only display the first frame of animated gif with chafa if chafa version is lower than 1.10. Might be deprecated in the future.
2022-03-29 11:28:20 +00:00
2022-12-10 20:46:52 +00:00
Nice to have (packagers should may make those optional):
2022-03-29 11:28:20 +00:00
* [Xsel](http://www.vergenet.net/~conrad/software/xsel/) allows to `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)
2022-02-18 22:50:08 +00:00
* [Python-setproctitle](https://github.com/dvarrazzo/py-setproctitle) will change the process name from "python" to "offpunk". Useful to kill it without killing every python service.
2020-06-07 17:55:49 +00:00
## Features
2023-11-12 14:51:48 +00:00
* Browse https/gemini/gopher without leaving your keyboard and without distractions
* Customize your experience with the `theme` command.
2022-01-30 18:23:50 +00:00
* Built-in documentation: type `help` to get the list of command or a specific help about a command.
2022-01-03 13:48:58 +00:00
* Offline mode to browse cached content without a connection. Requested elements are automatically fetched during the next synchronization and are added to your tour.
* HTML pages are prettified to focus on content. Read without being disturbed or see the full page with `view full`.
* RSS/Atom feeds are automatically discovered by `subscribe` and rendered as gemlogs. They can be explored with `view feed` and `view feeds`.
2022-01-24 16:15:54 +00:00
* Support "subscriptions" to a page. New content seen in subscribed pages are automatically added to your next tour.
* Complex bookmarks management through multiple lists, built-in edition, subscribing/freezing lists and archiving content.
2022-01-24 16:15:54 +00:00
* Advanced navigation tools like `tour` and `mark` (as per VF-1). Unlike AV-98, tour is saved on disk accross sessions.
2022-01-19 14:21:28 +00:00
* Ability to specify external handler programs for different MIME types (use `handler`)
2022-08-04 10:07:41 +00:00
* Enhanced privacy with `redirect` which allows to block a http domain or to redirect all request to a privacy friendly frontent (such as nitter for twitter).
2022-02-04 15:10:49 +00:00
* Non-interactive cache-building with configurable depth through the --sync command. The cache can easily be used by other software.
2023-11-12 14:51:48 +00:00
* `netcache`, a standalone CLI tool to retrieve the cached version of a network ressource.
* `ansicat`, a standalone CLI tool to render HTML/Gemtext/image in a terminal.
* `opnk`, a standalone CLI tool to open any kind of ressources (local or network) and display it in your terminal or, if not possible, fallback to `xdg-open`.
2020-06-07 17:55:49 +00:00
2020-12-24 12:27:18 +00:00
## RC files
2021-12-30 15:18:35 +00:00
You can use an RC file to automatically run any sequence of valid Offpunk
2020-12-24 12:27:18 +00:00
commands upon start up. This can be used to make settings controlled with the
2023-11-12 14:51:48 +00:00
`set`, `handler` or `themes` commands persistent. You can also put a `go` command in
2020-12-24 12:27:18 +00:00
your RC file to visit a "homepage" automatically on startup, or to pre-prepare
2021-12-30 15:18:35 +00:00
a `tour` of your favourite Gemini sites or `offline` to go offline by default.
2020-12-24 12:27:18 +00:00
2022-12-10 20:46:52 +00:00
The RC file should be called `offpunkrc` and goes in $XDG_CONFIG_DIR/offpunk (or .config/offpunk or .offpunk if xdg not available). In that file, simply write one command per line, just like you would type them in offpunk.
2022-01-01 21:36:06 +00:00
## Cache design
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.
2022-01-01 21:36:06 +00:00
2023-11-12 14:51:48 +00:00
The cache can be accessed/built with the `netcache` tool. See `netcache -h` for more informations.
Theres no feature to automatically trim the cache. But any part of the cache can safely be removed manually as there are no databases or complex synchronisation.
2022-12-10 20:46:52 +00:00