diff --git a/README.md b/README.md index c77529a..1ba07fd 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,22 @@ -# Rivista +# Rivista XJP -Previously, XMPP Journal Publisher ("XJP") and XMPP PubSub To Atom ("XPTA"). +Rivista XJP ("XMPP Journal Publisher"); previously XMPP PubSub To Atom ("XPTA"). -Rivista is a software that parses XMPP Pubsub Nodes and sends them as Atom Syndication Format or OPML over HTTP. +Rivista is a software that parses XMPP Pubsub Nodes and sends them as Atom +Syndication Format or OPML over HTTP. -Rivista generates Atom syndication feeds ([RFC 4287](https://www.rfc-editor.org/rfc/rfc4287)) from XMPP PubSub nodes ([XEP-0060](http://xmpp.org/extensions/xep-0060.html)). +Rivista generates Atom syndication feeds +([RFC 4287](https://www.rfc-editor.org/rfc/rfc4287)) from XMPP PubSub nodes +([XEP-0060](http://xmpp.org/extensions/xep-0060.html)). -Rivista includes [XSLT ](https://www.w3.org/TR/xslt/) stylesheets that transform PubSub nodes into static XHTML journal sites. +Rivista includes [XSLT ](https://www.w3.org/TR/xslt/) stylesheets that transform +PubSub nodes into static XHTML journal sites. Rivista was inspired from Tigase and was motivated by Movim. ## Instances -* https://rivista.woodpeckersnest.eu/ +* https://rivista.woodpeckersnest.eu ## Preview @@ -23,60 +27,90 @@ Rivista was inspired from Tigase and was motivated by Movim. ## Motivation -Rivista is a syndication project which makes journals and publications that are hosted on XMPP PubSub nodes, available -from HTTP to both, XML news readers and even HTML browsers. +Rivista is a syndication project which makes journals and publications that are +hosted on XMPP PubSub nodes, available from HTTP to both, XML news readers and +even HTML browsers. -This means that instead of hosting a journal or publication site in the old fashion (i.e. HTML documents hosted on an HTTP server), one only has to have an HTTP server to operate Rivista, and the rest of the content is delivered from an XMPP server (i.e. PubSub nodes). +This means that instead of hosting a journal or publication site in the old +fashion (i.e. HTML documents hosted on an HTTP server), one only has to have an +HTTP server to operate Rivista, and the rest of the content is delivered from an +XMPP server (i.e. PubSub nodes). -The project also showcases the non-necessity of HTML, as it automatically generates valid XHTML pages by HTML browsers (client-side) from XSLT stylesheets. +The project also showcases the non-necessity of HTML, as it automatically +generates valid XHTML pages by HTML browsers (client-side) from XSLT +stylesheets. -Because Rivista reads XMPP PubSub nodes, it is possible to view a complete set of node items, and even a single node item, which means, that a considered and carefully earnest use of Rivista would save bandwidth and system overhead, which includes CPU, I/O and RAM usage. +Because Rivista reads XMPP PubSub nodes, it is possible to view a complete set +of node items, and even a single node item, which means, that a considered and +carefully earnest use of Rivista would save bandwidth and system overhead, which +includes CPU, I/O and RAM usage. ## Requirements * Python >= 3.5 +* beautifulsoup4 * fastapi * lxml +* markdown * slixmpp * tomllib (Python <= 3.10) * uvicorn ## Installation -### Debian-based Distro +It is possible to install Rivista using pip and pipx. -```shell -# apt install python3 python3-fastapi python3-feedgenerator python3-lxml python3-slixmpp python3-tomli uvicorn +#### pip inside venv + +``` +$ python3 -m venv .venv +$ source .venv/bin/activate ``` -### Download +##### Install -Extract the source package to a directory that you have permission to run software. +``` +$ pip install git+https://git.xmpp-it.net/sch/Rivista +``` -```shell -$ git clone https://git.xmpp-it.net/sch/Rivista -$ cd Rivista/ +#### pipx + +##### Install + +``` +$ pipx install git+https://git.xmpp-it.net/sch/Rivista +``` + +##### Update + +``` +$ pipx uninstall rivista +$ pipx install git+https://git.xmpp-it.net/sch/Rivista ``` ### Configure -Add account credentials to file `configuration.toml`. +Add account credentials to file `settings.toml`. + +Copy file`settings.toml` to `~/.config/rivista/`. + +Copy directories `css`, `graphics`, `img`, `script`, and `xsl` to +`~/.local/share/rivista/`. + +Copy directory `json` to `~/.cache/rivista/`. ### Start -Execute Rivista with one of the following commands: - -```shell -$ python -m uvicorn main:app --reload -$ python -m uvicorn pubsub_to_atom:app --reload -$ python -m uvicorn pubsub_to_atom:app --reload --host 127.0.0.1 --port 8000 -$ uvicorn pubsub_to_atom:app --host 127.0.0.1 --port 8000 -$ fastapi dev pubsub_to_atom.py +``` +$ rivista ``` ## Usage -It is possible to view a complete node and even a single item, which means, that it is possible to save bandwidth and it further means that a considered and carefully earnest use of this software would save system overhead, which includes CPU, I/O and RAM usage. +It is possible to view a complete node and even a single item, which means, that +it is possible to save bandwidth and it further means that a considered and +carefully earnest use of this software would save system overhead, which +includes CPU, I/O and RAM usage. ### Viewing PubSub @@ -145,18 +179,34 @@ Python code is licensed under the license AGPL-3.0 only. ## Acknowledgement -Thank you to Mr. Peter Saint-Andre ([stpeter](https://stpeter.im/journal/731.html)) for manifesting [Atom Over XMPP](https://www.ietf.org/archive/id/draft-saintandre-atompub-notify-07.html). +Thank you to Mr. Peter Saint-Andre ([stpeter](https://stpeter.im/journal/731.html)) +for manifesting [Atom Over XMPP](https://www.ietf.org/archive/id/draft-saintandre-atompub-notify-07.html). -Thank you to Mr. Wojtek and [Tigase](https://tigase.org/) for publicly exposing an implementation of PubSub as Syndication at [Sure.IM](https://sure.im/) as [feeds.tigase.im](http://feeds.tigase.im/atom?server=pubsub@sure.im&node=news). +Thank you to Mr. Wojtek and [Tigase](https://tigase.org/) for publicly exposing +an implementation of PubSub as Syndication at [Sure.IM](https://sure.im/) as +[feeds.tigase.im](http://feeds.tigase.im/atom?server=pubsub@sure.im&node=news). -Thank you to to Mr. Timothée Jaussoin ([edhelas](https://edhelas.movim.eu/)) who consistently and earnestly showcases the potential of PubSub as a publication platform with project [Movim](https://movim.eu/). +Thank you to to Mr. Timothée Jaussoin ([edhelas](https://edhelas.movim.eu/)) who +consistently and earnestly showcases the potential of PubSub as a publication +platform with project [Movim](https://movim.eu/). -A special thank you to the gentlemen "d3x" and "cchianel" from IRC channel #python on irc.libera.chat for initial references concerning code, servers and FastAPI. +A special thank you to the gentlemen "d3x" and "cchianel" from IRC channel +#python on irc.libera.chat for initial references concerning code, servers and +FastAPI. -And an important thank you to Mr. Simone Canaletti ([roughnecks](https://blog.woodpeckersnest.space/)) for testing and deploying Rivista into production. +And an important thank you to Mr. Simone Canaletti +([roughnecks](https://blog.woodpeckersnest.space)) for testing and deploying +Rivista into production. ## Similar Projects -* [AtomEntry](https://github.com/tigase/sureim/blob/master/site/src/main/java/tigase/sure/web/site/client/pubsub/AtomEntry.java) and [PubSubPublishViewImpl](https://github.com/tigase/sureim/blob/master/site/src/main/java/tigase/sure/web/site/client/pubsub/PubSubPublishViewImpl.java) - Convert XMPP Pubsub Nodes to Atom Syndication Format and convey them over HTTP. +* [AtomEntry](https://github.com/tigase/sureim/blob/master/site/src/main/java/tigase/sure/web/site/client/pubsub/AtomEntry.java) + and [PubSubPublishViewImpl](https://github.com/tigase/sureim/blob/master/site/src/main/java/tigase/sure/web/site/client/pubsub/PubSubPublishViewImpl.java) - + Convert XMPP Pubsub Nodes to Atom Syndication Format and convey them over HTTP. -* [AtomToPubsub](https://github.com/edhelas/atomtopubsub) - A little client that parses Atom + RSS feeds and send them on XMPP Pubsub Nodes. +* [AtomToPubsub](https://github.com/edhelas/atomtopubsub) - A little client that + parses Atom + RSS feeds and send them on XMPP Pubsub Nodes. + +# Home site +- https://schapps.woodpeckersnest.eu/rivista/ +- gemini://woodpeckersnest.space/~schapps/rivista.gmi diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..55e4fdb --- /dev/null +++ b/__init__.py @@ -0,0 +1,3 @@ +from rivista.version import __version__, __version_info__ + +print('Rivista XJP', __version__) diff --git a/__main__.py b/__main__.py new file mode 100644 index 0000000..d642253 --- /dev/null +++ b/__main__.py @@ -0,0 +1,14 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +#import importlib.resources + +from rivista.http.instance import HttpInstance +import uvicorn + +def main(): + http_instance = HttpInstance() + return http_instance.app + +app = main() +uvicorn.run(app, host='localhost', port=8000, reload=False) diff --git a/css/stylesheet.css b/assets/css/stylesheet.css similarity index 100% rename from css/stylesheet.css rename to assets/css/stylesheet.css diff --git a/graphic/akregator.svg b/assets/graphic/akregator.svg similarity index 100% rename from graphic/akregator.svg rename to assets/graphic/akregator.svg diff --git a/graphic/leechcraft.png b/assets/graphic/leechcraft.png similarity index 100% rename from graphic/leechcraft.png rename to assets/graphic/leechcraft.png diff --git a/assets/graphic/leechcraft.svg b/assets/graphic/leechcraft.svg new file mode 100644 index 0000000..cd103bd --- /dev/null +++ b/assets/graphic/leechcraft.svg @@ -0,0 +1,724 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/graphic/liferea.svg b/assets/graphic/liferea.svg similarity index 100% rename from graphic/liferea.svg rename to assets/graphic/liferea.svg diff --git a/graphic/raven.svg b/assets/graphic/raven.svg similarity index 100% rename from graphic/raven.svg rename to assets/graphic/raven.svg diff --git a/graphic/rssguard.png b/assets/graphic/rssguard.png similarity index 100% rename from graphic/rssguard.png rename to assets/graphic/rssguard.png diff --git a/graphic/rssowl.svg b/assets/graphic/rssowl.svg similarity index 100% rename from graphic/rssowl.svg rename to assets/graphic/rssowl.svg diff --git a/graphic/tickr.png b/assets/graphic/tickr.png similarity index 100% rename from graphic/tickr.png rename to assets/graphic/tickr.png diff --git a/graphic/xmpp.svg b/assets/graphic/xmpp.svg similarity index 100% rename from graphic/xmpp.svg rename to assets/graphic/xmpp.svg diff --git a/favicon.ico b/assets/img/favicon.ico similarity index 100% rename from favicon.ico rename to assets/img/favicon.ico diff --git a/data/README b/assets/json/README similarity index 100% rename from data/README rename to assets/json/README diff --git a/assets/script/iso8601_to_utc.js b/assets/script/iso8601_to_utc.js new file mode 100644 index 0000000..8f369b3 --- /dev/null +++ b/assets/script/iso8601_to_utc.js @@ -0,0 +1,8 @@ +// Convert ISO8601 To UTC + +window.onload = function(){ + for (element of document.querySelectorAll('#articles > ul > li > div > h4')) { + timestamp = new Date(element.textContent); + element.textContent = timestamp.toUTCString(); + } +} diff --git a/script/marked.min.js b/assets/script/marked.min.js similarity index 100% rename from script/marked.min.js rename to assets/script/marked.min.js diff --git a/assets/script/parse_markdown.js b/assets/script/parse_markdown.js new file mode 100644 index 0000000..b38c994 --- /dev/null +++ b/assets/script/parse_markdown.js @@ -0,0 +1,7 @@ +// Parse Markdown + +window.onload = function(){ + for (element of document.querySelectorAll('#articles > ul > li > div > p')) { + element.innerHTML = marked.parse(element.textContent); + } +} diff --git a/script/postprocess.js b/assets/script/postprocess.js similarity index 100% rename from script/postprocess.js rename to assets/script/postprocess.js diff --git a/configuration.toml b/assets/settings.toml similarity index 100% rename from configuration.toml rename to assets/settings.toml diff --git a/xsl/atom.xsl b/assets/xsl/atom.xsl similarity index 100% rename from xsl/atom.xsl rename to assets/xsl/atom.xsl diff --git a/xsl/atom_as_xhtml.xsl b/assets/xsl/atom_as_xhtml.xsl similarity index 100% rename from xsl/atom_as_xhtml.xsl rename to assets/xsl/atom_as_xhtml.xsl diff --git a/xsl/extract-filename.xsl b/assets/xsl/extract-filename.xsl similarity index 100% rename from xsl/extract-filename.xsl rename to assets/xsl/extract-filename.xsl diff --git a/xsl/metadata.xsl b/assets/xsl/metadata.xsl similarity index 100% rename from xsl/metadata.xsl rename to assets/xsl/metadata.xsl diff --git a/xsl/opml.xsl b/assets/xsl/opml.xsl similarity index 100% rename from xsl/opml.xsl rename to assets/xsl/opml.xsl diff --git a/xsl/opml_as_xhtml.xsl b/assets/xsl/opml_as_xhtml.xsl similarity index 100% rename from xsl/opml_as_xhtml.xsl rename to assets/xsl/opml_as_xhtml.xsl diff --git a/assets/xsl/stylesheet.xsl b/assets/xsl/stylesheet.xsl new file mode 100644 index 0000000..88c6987 --- /dev/null +++ b/assets/xsl/stylesheet.xsl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xsl/stylesheet_all_in_one_still_does_not_work_with_ff.xsl b/assets/xsl/stylesheet_all_in_one_still_does_not_work_with_ff.xsl new file mode 100644 index 0000000..eba91d4 --- /dev/null +++ b/assets/xsl/stylesheet_all_in_one_still_does_not_work_with_ff.xsl @@ -0,0 +1,501 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <xsl:choose> + <xsl:when test='atom:title and not(atom:title="")'> + <xsl:value-of select='atom:title'/> + </xsl:when> + <xsl:otherwise>StreamBurner</xsl:otherwise> + </xsl:choose> + + + + + + + + +