2024-10-24 06:53:20 +02:00
|
|
|
|
```text
|
|
|
|
|
[[[ SYNOPSIS ]]]
|
|
|
|
|
|
2024-10-24 12:41:22 +02:00
|
|
|
|
gancioff [options] <configuration file path>
|
2024-10-24 06:53:20 +02:00
|
|
|
|
|
|
|
|
|
[[[ DESCRIPTION ]]]
|
|
|
|
|
|
2024-10-25 08:34:41 +02:00
|
|
|
|
This is GancioFF v0.2, a CLI PHP script that can be used to periodically
|
2024-10-24 12:23:19 +02:00
|
|
|
|
fetch the RSS feed from an instance of Gancio (https://gancio.org) and post
|
|
|
|
|
its new entries – the events – on the fediverse through a Mastodon account,
|
|
|
|
|
keeping track of already posted events’ GUIDs (Global Unique IDentifiers) in
|
|
|
|
|
order to post only the new ones on each run.
|
|
|
|
|
It can be useful, for example, when the admins of a Gancio instance chose not
|
|
|
|
|
to use its federation feature because it would be too heavy on its server: in
|
|
|
|
|
this case GancioFF is a quite light alternative, moving from the server
|
|
|
|
|
running Gancio to the one running Mastodon the burden of posting each event to
|
|
|
|
|
all the instances that host at least one follower, and of sending them the
|
|
|
|
|
image a Gancio user can and almost always do attach to each event, because
|
|
|
|
|
GancioFF will fetch it only once and attach it to the post for the event.
|
|
|
|
|
GancioFF is meant to be periodically run, every half an hour or so, by a cron
|
|
|
|
|
job, or systemd timer, or the likes (you can find a sample «gancioff.timer»
|
|
|
|
|
and a commented sample «gancioff.service» in the «systemd» directory).
|
2024-10-24 12:41:22 +02:00
|
|
|
|
In order to work, GancioFF needs a configuration file path to be passed to it
|
|
|
|
|
as an argument on the command line.
|
2024-10-24 06:53:20 +02:00
|
|
|
|
|
|
|
|
|
[[[ CONFIGURATION FILE ]]]
|
|
|
|
|
|
|
|
|
|
The configuration file needs to be like this:
|
|
|
|
|
|
|
|
|
|
--- Example configuration file ---
|
|
|
|
|
# Lines beginnig with a «#» and empty lines will be ignored
|
|
|
|
|
|
2024-10-24 12:23:19 +02:00
|
|
|
|
# «feed_url» is required to specify the URL to fetch the RSS feed from;
|
2024-10-24 06:53:20 +02:00
|
|
|
|
# for example:
|
|
|
|
|
feed_url = https://gancio.some.domain/feed/rss?show_recurrent=true
|
|
|
|
|
|
|
|
|
|
# «fedi_hostname» is required to specify the hostname of the Mastodon instance
|
2024-10-24 12:23:19 +02:00
|
|
|
|
# you want to post to; for example:
|
2024-10-24 06:53:20 +02:00
|
|
|
|
fedi_hostname = mastodon.another.domain
|
|
|
|
|
|
|
|
|
|
# «fedi_token» is required to specify an «app token» to access the account
|
|
|
|
|
# that you want to use on the instance defined by «fedi_hostname». On Mastodon
|
|
|
|
|
# default web frontend you can get such a token under «Preferences» ->
|
|
|
|
|
# «Development», by clicking on the «New application» button; the new
|
2024-10-24 22:51:09 +02:00
|
|
|
|
# application should have at least the «write:media» and «write:statuses»
|
|
|
|
|
# privileges; when you’ll be done setting it up, it will be listed under
|
|
|
|
|
# «Your applications», and by clicking on its name you’ll be able to copy
|
|
|
|
|
# «Your access token» and paste it here. For example:
|
2024-10-24 06:53:20 +02:00
|
|
|
|
fedi_token = w6oQ_Ot2LSAm_Q31hrvp0asfl22ip3O4ipYq1kV1ceY
|
|
|
|
|
|
2024-10-24 12:23:19 +02:00
|
|
|
|
# «state_file_absolute_path» is required to specify the absolute path of the
|
|
|
|
|
# state file where GancioFF will store the GUIDs of already posted events and
|
|
|
|
|
# the timestamps of the moments when it posted them (on each run, GancioFF
|
|
|
|
|
# will check for entries older than one year and discard them, in order to
|
|
|
|
|
# avoid the state file to grow too much). For example:
|
|
|
|
|
state_file_absolute_path = /var/local/cache/gancio.some.domain.feed.state
|
|
|
|
|
|
|
|
|
|
# «posts_language» is required to specify the ISO 639-1 code for the language
|
|
|
|
|
# of posts (see https://www.loc.gov/standards/iso639-2/php/code_list.php for
|
|
|
|
|
# a complete list); for example:
|
|
|
|
|
posts_language = it
|
|
|
|
|
|
|
|
|
|
# «posts_visibility» is optional and lets you override the default “public”
|
|
|
|
|
# visibility of posts; it can be set to «public» (posts will be visible in the
|
|
|
|
|
# «Local» and «Federated» timelines, and any user will be able to boost them),
|
|
|
|
|
# «unlisted» (posts will be visible only in the «Home» timeline of followers
|
|
|
|
|
# and on the profile of the Mastodon account in use, not in the «Local» or
|
|
|
|
|
# «Federated» timelines, but any user will still be able to boost them),
|
|
|
|
|
# «private» (AKA «followers only»: posts will be visible only by followers and
|
|
|
|
|
# won’t be boostable by anyone), and «direct» (since GancioFF posts won’t ever
|
|
|
|
|
# explicitly mention any account, posts with this visibility will be visible
|
2024-10-24 12:46:38 +02:00
|
|
|
|
# only from the Mastodon account in use). For example:
|
2024-10-24 12:23:19 +02:00
|
|
|
|
post_visibility = unlisted
|
|
|
|
|
|
2024-10-24 06:53:20 +02:00
|
|
|
|
# «max_post_length» is optional and lets you override the automatically
|
|
|
|
|
# detected maximum length that a post can have on the instance specified with
|
|
|
|
|
# «fedi_hostname»; it can be used for testing purposes or just to keep the
|
2024-10-24 12:23:19 +02:00
|
|
|
|
# posts shorter than they would be otherwise; for example:
|
2024-10-24 06:53:20 +02:00
|
|
|
|
max_post_length = 840
|
|
|
|
|
--- End of example configuration file ---
|
|
|
|
|
|
|
|
|
|
[[[ OPTIONS ]]]
|
|
|
|
|
|
|
|
|
|
-h / --help
|
2024-10-24 12:23:19 +02:00
|
|
|
|
Show this help text and exit.
|
|
|
|
|
-p / --do-post <y|n>
|
|
|
|
|
Setting this option to «n» («no») will make GancioFF skip posting. Note that
|
|
|
|
|
even in this case it will save into the state file the GUIDs of new events
|
2024-10-25 08:34:41 +02:00
|
|
|
|
it may find in the feed, so it won’t post them even on subsequent runs.
|
|
|
|
|
Also note that, in order to prevent you from flooding your instance’s local
|
|
|
|
|
timeline on GancioFF first run on a given feed (i.e. when the state file
|
|
|
|
|
specified in the configuration file doesn’t exist yet), if events in the feed
|
|
|
|
|
are more than 5 and «posts_visibility» is set to «public» GancioFF refuses to
|
|
|
|
|
post them unless you explicitly set this option to «n» («no») or «y» («yes»).
|
2024-10-24 12:23:19 +02:00
|
|
|
|
When the state file exists, this option defaults to «y» («yes»).
|
2024-10-24 06:53:20 +02:00
|
|
|
|
-v / --verbose
|
|
|
|
|
Show some more messages about what the script is doing.
|
|
|
|
|
--
|
|
|
|
|
Treat every possible subsequent argument as non-options. Useful only in the
|
|
|
|
|
very improbable case your config file is named «--help» or as another option.
|
|
|
|
|
|
|
|
|
|
[[[ EXIT VALUES ]]]
|
|
|
|
|
|
|
|
|
|
0: regular run
|
|
|
|
|
1: some error occurred
|
2024-10-24 12:23:19 +02:00
|
|
|
|
99: killed with signal (ctrl+c, etc.)
|
2024-10-24 06:53:20 +02:00
|
|
|
|
|
|
|
|
|
[[[ DISCLAIMER AND LICENSE ]]]
|
|
|
|
|
|
|
|
|
|
This program comes with ABSOLUTELY NO WARRANTY; for details see the source.
|
|
|
|
|
This is free software, and you are welcome to redistribute it under certain
|
|
|
|
|
conditions; see <http://www.gnu.org/licenses/> for details.
|
|
|
|
|
```
|