minifluxworker

command module
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: EUPL-1.2 Imports: 17 Imported by: 0

README

minifluxWorker

version Go Report Card Go version Godoc ref

builds.sr.ht status Docker Pulls amd64 Docker Image Size

Filters Miniflux entries based on enhanced rules.

Usage

minifluxWorker reads rules from a configuration file and marks entries as read based on them.

The following options are supported:

USAGE
   minifluxWorker [OPTION]

OPTIONS
  --config <path>
        Path to config file (default "config.json")
  --dry-run
        Do not change anything
  --help
        Print this help
  --interactive
        Confirm entries to mark by hand
  --version
        Show version
Configuration

The sample config looks like this:

A config file consists of some top-level headers and a list of rules where every key is required.

The server config consists of the following keys: The general part consists of a server configuration and the log level:

  • server (object): The server config
    • url (string): The servers URL
    • token-command (list of strings): A command and optional arguments that return a token as obtained via Settings > API Keys when run
  • loglevel (string, one of "DEBUG", "INFO", "WARN", "ERROR" or "FATAL): The log level

The log level has to be must be set to "DEBUG" (useful to learn what minifluxWorker is attempting to do), "INFO" (useful to monitor), "WARN" (useful to mitigate problems), "ERROR" (problems occurred) or "FATAL" (problems fatal enough to crash the application).

"server": {
	"url": "https://hosting.miniflux.app",
	"token-command": ["cat", "./token.secret"]
},
"loglevel": "INFO",

A rule consists of the following keys:

  • name (string): A name for the rule, can be chosen freely
  • condition (object): What trigger the rule should act on
    • type (string, one of "time", "title", "fulltext" or "duplicate"): What kind of rule is enforced
    • keys (list of strings, integer durations and one of "m", "h", "d" or "w" for rules based on time, else keywords or sentences of choice): The specific values the rule considers. For type duplicate the scopes where duplicates should be marked read has to be supplied. Type title supports Golangs regex syntax (escaped into JSON).
  • scope (object): On what the rule should be enforced
    • type (string, one of "all", "category" or "feed"):
    • operator (string, one of "with" or "without"): Inverts the rule: Either only the scope or everything without the scope is evaluated
    • keys (list of strings): A freely chosen keyword or sentence to match the feeds/categories name(s)
  • include_starred (boolean): Disregards all starred entries if false

All in a valid configuration file looks like this:

{
	"server": {
		"url": "https://hosting.miniflux.app",
		"token-command": ["cat", "./token.secret"]
	},
	"loglevel": "INFO",
	"rules": [
		{
			"name": "All entries except category 'Knowledge' after two weeks",
			"condition": {
				"type": "time",
				"keys": ["2w"]
			},
			"scope": {
				"type": "category",
				"operator": "without",
				"keys": ["Knowledge", "Popular blog"]
			},
			"include_starred": true
		},
		{
			"name": "Unstarred entries with 'boring topic' in it's title",
			"condition": {
				"type": "title",
				"keys": ["boring topic", "Weekly report \\d{2}"]
			},
			"scope": {
				"type": "all"
			},
			"include_starred": false
		},
		{
			"name": "Sort out duplicates of the personal blog from aggregator",
			"condition": {
				"type": "duplicate",
				"keys": ["aggregator"]
			},
			"scope": {
				"type": "feed",
				"operator": "with",
				"keys": ["aggregator", "personal blog"]
			},
			"include_starred": false
		}
	]
}
Scheduling

minifluxWorker will act as soon as started. For scheduling a cronjob or a systemd timer can be used.

Docker

The config file must be mounted to run via Docker:

docker run --rm -v $(pwd)/config.json:/app/config.json:ro <your-name>/minifluxworker

Build

go build .
Docker
docker build -t <your-name>/minifluxworker .

The build architecture can be supplied optionally too:

docker build -t <your-name>/minifluxworker --build-arg arch=arm64 .

Contributing

Please write your commit messages as Conventional Commits.

License

This project is licensed under the European Union Public License v1.2. Please see License for more information.

Alternatives

As the use case is not uncommon the following projects provide similar functionality:

Documentation

Overview

MinifluxWorker marks miniflux entries as read. The entries to filter out are defined by rules that are configured in a JSON file.

Usage:

minifluxWorker [flags]

The flags are:

-config <file>
	The path to a config file to load.
	Optional argument, ./config.json is used as default.
-dry-run
	Entries won't be marked as read after gathering them, a summary is printed instead.
-help
	Print's the usage as help text.
-interactive
	Asks for confirmation via STDIN for every entry.
-version
	Show version

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL