• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

dahlia/mediawiki-rc-mastodon-bot: Relay RecentChanges from a MediaWiki site to a ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

dahlia/mediawiki-rc-mastodon-bot

开源软件地址(OpenSource Url):

https://github.com/dahlia/mediawiki-rc-mastodon-bot

开源编程语言(OpenSource Language):

TypeScript 90.9%

开源软件介绍(OpenSource Introduction):

mediawiki-rc-mastodon-bot

This small program continuously relays RecentChanges from a MediaWiki site to a Mastodon account. Each toot will contain up to 4 items with their screenshots. The following toot is an example:

Example

Prerequisites

  1. You need a MediaWiki site. It doesn't have to be owned by you, but you should be allowed to redistribute their page titles, permalinks, and their screenshots to public social media.

    Base URL will be used. Note that MediaWiki base URLs usually do not include paths like wiki/ and w/.

  2. Create a Mastodon account. I recommend botsin.space, a Mastodon server specialized for bots, but you can use any other Mastodon server too, except automatical tooting is allowed according to the rules of your server.

  3. Create a Mastodon application from PreferencesDevelopmentNew Application. It requires 3 access scopes:

    • read:statuses
    • write:media
    • write:statuses

    Application name and Redirect URI do not matter as they are unused.

    Your access key will be used.

  4. Optionally, you may need a Browserless account, if you can't or don't want to run a headless web browser on your own node (e.g., Deno Deploy). Don't worry! Browserless offers some prepaid balance for free.

    API Key will be used.

Download

Official executable binaries for Linux, macOS, and Windows are available in the releases page.

Usage

Here's a command to run with minimum options:

mediawiki-rc-mastodon-bot \
  https://your-mediawiki-site.wiki/ \
  https://your-mastodon-server.social/ \
  --mastodon-access-token=YOUR_MASTODON_ACCESS_KEY \
  --limit=16

If you want to use Browserless instead of your local web browser for capturing screenshots, use --browser-ws-endpoint option:

mediawiki-rc-mastodon-bot \
  https://your-mediawiki-site.wiki/ \
  https://your-mastodon-server.social/ \
  -a YOUR_MASTODON_ACCESS_KEY -C -l 16 \
  --browser-ws-endpoint wss://chrome.browserless.io?token=BROWSERLESS_API_KEY

For further options, use -h/--help option.

Continuous operation

This program does not provide daemon mode or long-running mode, but checks recent changes only once for a invoke. For continous operation, automate periodical execution using cron or some shell scripting, e.g.:

while true; do
  mediawiki-rc-mastodon-bot \
    https://your-mediawiki-site.wiki/ \
    https://your-mastodon-server.social/ \
    --mastodon-access-token=YOUR_MASTODON_ACCESS_KEY \
    --continue
  sleep 1800 # Every 30 minutes
done

Note that -C/--continue option is used together. With this option, only RecentChanges after the last fetched change are published to Mastodon.

Build

As this program is written in TypeScript & Deno, you need Deno first.

You could run your own modified version from the local source tree using run.sh script. It's basically a drop-in-replacement of official executable binaries.

To build executable binaries, use build.sh script. Output files will be placed under dist/ directory. The directory will be created if not exists.

License

Distributed under AGPL 3.0 or later.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Gargron/mastodon-java-api-example: Example Android app that uses Mastodon API vi ...发布时间:2022-08-18
下一篇:
unblinking/encryptodon: 发布时间:2022-08-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap