# Feather default configuration file.
# You can overwrite any of these values by either:
# - creating a config.toml file containing your user configuration. You can choose to load the configuration file from somewhere else by setting the CONFIG_PATH environment variable.
# - setting environment variables for the values you want to overwrite (the environment variable name for each value can be found in the comments below).

[server]
# (Required) Server API to use. Either "googlereader" for the Google Reader API (FreshRSS, Miniflux, etc.) or "ttrss" for the TinyTiny-RSS API.
# The Google Reader API do not support nested categories.
api = "googlereader"
# (Required) URL of your server's Google Reader API endpoint
# Can be set through the environment variable SERVER_URL.
url = "https://rss.example.com/"
# (Required) Username/email-adress used to connect to the server
# Can be set through the environment variable SERVER_USER.
user = "username"
# (Required) Password/API password used to connect to the server
# Can be set through the environment variable SERVER_PASSWORD.
password = "password"
# How many articles to retrieve at most from the server in a single request. Lower values will make synchronization slower, higher values might make the server complain.
# If you are missing articles after a sync, it might be because this value is too high.
# If you are using the Google Reader API: servers should be okay with up to 1000.
# If you are using the ttrss API: servers should be okay with up to 200.
# Set to 0 to let Feather choose (200 for ttrss, 1000 for googlereader).
# Can be set through the environment variable SERVER_ARTICLES_PER_REQUEST.
articles_per_request = 0
# Set to true to only sync unread articles; Feather will not retrieve any read article from the server.
# If set to false, Feather will download ALL articles from the server, read and unread, on each synchronization. This might be a lot of data depending on how many read articles your server keeps. If you only want to keep recent read articles, look at the keep_read_articles_for settings below.
# Can be set through the environment variable SERVER_ONLY_SYNC_UNREAD_ARTICLES.
only_sync_unread_articles = true
# How long in seconds to keep read articles in the local storage before deleting them.
# Once an article is removed, Feather can no longer:
# - mark it as unread when its article file is restored from the trash;
# - generate articles files for read articles if html.write_read_articles = true.
# If only_sync_unread_articles = false, this does nothing (since Feather always retrieve all read articles from the server).
# Can be set through the environment variable SERVER_KEEP_READ_ARTICLES_FOR.
keep_read_articles_for = 259200

[directories]
# Data directory: path where the internal Feather data will be stored.
# Can be set through the environment variable DIRECTORIES_DATA.
data = "data"
# Reader directory: path where the user-facing files (category directories, article files) will be stored.
# Can be set through the environment variable DIRECTORIES_READER.
reader = "reader"

[html]
# If set to true, Feather will also generate articles files for read articles.
# The the mark-as-unread behavior will change depending on this value:
# - if false, marking an article as unread requires its file to be recreated/restored from the trash;
# - if true, marking an article as unread requires deleting its article file (same as mark-as-read).
# Can be set through the environment variable HTML_WRITE_READ_ARTICLES.
write_read_articles = false
# Template used for generating article HTML files. All templates are Jinja2 templates.
# Available fields:
# - id: article id (int | str)
# - unread: if the article is unread (bool) - only makes sense if server.only_sync_unread_articles is false
# - title: article title (str)
# - published: article publication date and time (str)
# - updated: article publication date and time (str)
# - author: article author (str)
# - summary: article summary (HTML) (str)
# - content: article content (HTML) (str)
# - feed_title: feed title (str)
# - feed_url: feed URL (str)
# - feed_icon_url: feed icon URL (str)
# - feed_order: feed display order, starting from 1 (0 if unknown, only available for ttrss) (int)
# - article_url: article URL (str)
# - comments_url: article comments URL (str)
# - language: article language (str)
# - image_url: article main image (str)
# - category: feed category (Category)
# Can be set through the environment variable HTML_TEMPLATE.
article_template = '''
<!doctype html>
<html lang="{{ language }}">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    {% if feed_icon_url %}
        <link rel="icon" href="{{ feed_icon_url }}" />
    {% endif %}
    <title>{{ title }} - {{ feed_title }}</title>
</head>
<body style="background-color:black; color:white; font-family:sans-serif; overflow-x:hidden;">
    <style>
        a {color:palevioletred; text-decoration:none;}
        .feather-content img {display:block; margin-left:50%; transform:translateX(-50%); max-width:100vw;}
    </style>
    <article style="max-width:min(60rem,100%); margin:auto;">
        <p style="display:flex; flex-direction:row; justify-content:space-between;">
            <span>{{ published }}</span>
            <span>
                {% if feed_url %}
                    <a href="{{ feed_url }}">
                {% endif %}
                        {% if feed_icon_url %}
                            <img style="height:1em; vertical-align:middle;" src="{{ feed_icon_url }}">
                        {% endif %}
                        {{ feed_title }}
                {% if feed_url %}
                    </a>
                {% endif %}
            </span>
        </p>
        <h1><a href="{{ article_url }}">{{ title }}</a></h1>
        <h3>{{ author }}</h3>
        {% if content %}
            <div class="feather-content">{{ content | safe }}</div>
        {% else %}
            <div class="feather-content">
                {% if image_url %}
                    <img src="{{ image_url }}">
                {% endif %}
                {{ summary | safe }}
            </div>
        {% endif %}
    </article>
</body>
</html>
'''
# Filename template for generated HTML files.
# The available fields are the same as for template.
# Can be set through the environment variable HTML_FILENAME_TEMPLATE.
filename_template = "[{{ feed_title }}]\t{{ title }} ({{ published }}).html"
# Category directory name template for generated HTML files.
# Fields available:
# - id: category id (str | int)
# - title: category name (str)
# - parents: list of parent categories (list[Category])
# - order: category display order, starting from 1 (0 if unknown, only available for ttrss) (int)
# If empty, no directory will be created.
# Can be set through the environment variable HTML_CATEGORY_TEMPLATE.
category_template = "{% if order %}{{ '%02d' % order }} {% endif %}{{ title }}"
# Set to true to automatically remove category directories when they do not contain any article.
# Can be set through the environment variable HTML_HIDE_EMPTY_CATEGORIES.
hide_empty_categories = true
# Maximum allowed filename length (in bytes assuming UTF-8 encoding) before truncating. Depending on your filesystem filename's limits it may be possible to increase the value, ask Wikipedia for details.
# Can be set through the environment variable HTML_MAX_FILENAME_LENGTH.
max_filename_length = 250
# Table mapping characters to what they will be replaced with in filenames. Useful to remove/replace characters that are not allowed in filename by your filesystem. The default should be fine for most Unix filesystems.
filename_replacement = { "/" = "⧸", "\u0000" = "" }

[datetime]
# Which timezone to use when writing date and time.
# Can be set through the environment variable DATETIME_TIMEZONE.
timezone = "Etc/UTC"
# How date and time are formatted. See https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior for the supported codes.
# This will be used in filenames so it's a good idea to use something sortable...
# Can be set through the environment variable DATETIME_FORMAT.
format = "%Y-%m-%d %H:%M"

[daemon]
# When running in daemon mode, Feather will download changes from the server (new articles, articles read state) at least every <sync_down_every> seconds.
# Can be set through the environment variable DAEMON_SYNC_DOWN_EVERY.
sync_down_every = 1800
# When running in daemon mode, Feather will upload local changes to the server (read articles) at least every <sync_up_every> seconds.
# Can be set through the environment variable DAEMON_SYNC_UP_EVERY.
sync_up_every = 300
# If true, enable the file watcher.
# When enabled, Feather will watch for file changes in the reader directory; when a change is detected, the time before the next up and down synchronization is reduced to <sync_up_every_when_used> and <sync_down_every_when_used>, thus increasing synchronization frequency while Feather is in use.
# Can be set through the environment variable DAEMON_WATCH_FILES.
watch_files = true
# If the file watcher is enabled and activity is detected, Feather will wait <sync_down_every_when_used> instead of <sync_down_every> seconds before the next down synchronization.
# Can be set through the environment variable DAEMON_SYNC_DOWN_EVERY_WHEN_USED.
sync_down_every_when_used = 300
# If the file watcher is enabled and activity is detected, Feather will wait <sync_up_every_when_used> instead of <sync_up_every> seconds before the next up synchronization.
# Can be set through the environment variable DAEMON_SYNC_UP_EVERY_WHEN_USED.
sync_up_every_when_used = 3

