The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

news - a web front-end to a local news server

SYNOPSIS

news

DESCRIPTION

news connects to the local news server via NNTP on port 119 and offers a web interface for it.

There are a number of views available:

  • the list of newsgroups available ("server view");

  • the list of articles available in a particular newsgroup ("group view");

  • a list of articles with a particular tag in a newsgroup ("tag view");

  • an article ("article view");

  • a reply;

  • a new post.

When showing From fields, the value is stripped of things that look like email addresses in angled brackets such as <alex@gnu.org> or in double quotes such as "alex@gnu.org"; if an email address is followed by a real name in parenthesis such as alex@gnu.org (Alex Schroeder), the address and the parenthesis are stripped. If no full name is provided, "Anonymous" is used.

In the article view, email addresses in angled brackets such as <alex@gnu.org> or in double quotes such as "alex@gnu.org" are also stripped. Other things that might look like email addresses are not stripped.

Threading

Technically, articles only have references back in time. In order to show links to replies, the article view relies on a cache of the group view. If the group view isn't in the cache, replies cannot be shown.

Caching

All the NNTP requests are cached for 5min. The cache relies on Mojo::Cache. That cache only holds 100 items by default, so on a busy server, NNTP requests might get cached for less time. The cache isn't written to disk, so if you're a developer, you can restart the server to empty the cache instead of waiting for 5min.

Tags

When an article's subject contains a string in square brackets [like this], then this is treated as a tag. Click on the tag to see the tag view containing articles with the same tag, irrespective of threading.

Authentication

When posting or replying, the username and password provided by the user are passed along to the news server. If that allows the user to post, it works.

Environment variables

The news server is determined by Net::NNTP: If no host is passed then two environment variables are checked NNTPSERVER then NEWSHOST, then Net::Config is checked, and if a host is not found then news is used.

NEWS_INTRO_ID can be set to a message id for a "start here" message. By default, no such link is shown. This must be a message-id and cannot be a message number (that would require a group, too).

NEWS_MODE can be set to "NOAUTH" in order to hide username and password on the post form in case your newsserver isn't public and requires no authorisation; if set to "NOPOST" then posting links are hidden.

NEWS_GROUPS can be set to a comma-separated list of patterns in the WILDMAT format. The details are in RFC 3977. Usually it means: names separated by commas, prefixed by ! if negated and * used as a wildcard. Support for this varies. The sn server only accepts a single pattern, no negation. You might have to experiment.

Systemd

To install as a service, use a news.service file like the following:

    [Unit]
    Description=News (a web front-end)
    After=network-online.target
    Wants=network-online.target
    [Install]
    WantedBy=multi-user.target
    [Service]
    Type=simple
    DynamicUser=true
    Restart=always
    MemoryHigh=80M
    MemoryMax=100M
    Environment="NNTPSERVER=localhost"
    Environment="NEWS_INTRO_ID=<u4d0i0$n72d$1@sibirocobombus.campaignwiki>"
    ExecStart=/home/alex/perl5/perlbrew/perls/perl-5.32.0/bin/perl /home/alex/perl5/perlbrew/perls/perl-5.32.0/bin/news daemon

Cookies

The web app stores name, username and password in an encrypted cookie which expires one week after posting an article.

Caching

The web app caches all the data it gets from the news server in a cache, using Mojo::Cache. By default, this cache is small (100 items). Each cached item is cached with a timestamp and cache hits are only used if they aren't older than 5min.

Superseding

The web app allows superseding. It's up to the newsserver to allow or deny this. There's currently no way for the user to supply their own cancel secret.

EXAMPLES

A remote news server.

    NNTPSERVER=cosmic.voyage news daemon

The remote news server but only the campaignwiki.* groups, with the pattern in quotes to prevent shell expansion:

    NNTPSERVER=campaignwiki.org "NEWS_GROUPS=campaignwiki.*" news daemon

The remote news server with all the groups except any *.test groups, with the pattern in quotes to prevent shell expansion. The sn server can't parse this pattern, unfortunately.

    NNTPSERVER=campaignwiki.org "NEWS_GROUPS=*,!*.test" news daemon

The local news server requires no authorisation.

    NNTPSERVER=localhost NEWS_MODE=NOAUTH news daemon

The news server requires authorisation and we want to point visitors to a first post. We assume that NNTPSERVER or NEWSHOST is already set.

    NEWS_INTRO_ID='<u4d0i0$n72d$1@sibirocobombus.campaignwiki>' news daemon

As a developer, run it under morbo so that we can make changes to the script. Provide the path to the script. This time with regular authorisation.

    PERL5LIB=lib NNTPSERVER=localhost morbo script/news

SEE ALSO

The Tildeverse also runs news. https://news.tildeverse.org/

RFC 3977: Network News Transfer Protocol (NNTP).

RFC 3987: Internationalized Resource Identifiers (IRIs)

RFC 4643: Network News Transfer Protocol (NNTP) Extension for Authentication.

RFC 5536: Netnews Article Format.

RFC 5537: Netnews Architecture and Protocols.

RFC 8315: Cancel-Locks in Netnews Articles

LICENSE

GNU Affero General Public License