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

kalvn/shaarli2mastodon: This Shaarli plugin allows you to automatically publish ...

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

开源软件名称(OpenSource Name):

kalvn/shaarli2mastodon

开源软件地址(OpenSource Url):

https://github.com/kalvn/shaarli2mastodon

开源编程语言(OpenSource Language):

PHP 77.3%

开源软件介绍(OpenSource Introduction):

Shaarli2Mastodon

This plugin allows you to automatically publish links you post on your Mastodon timeline.

It is largely inspired by ArthurHoaro's shaarli2twitter and uses an adapted version of TootoPHP.

Requirements

  • PHP 5.3
  • PHP cURL extension
  • Shaarli >= v0.8.1 in public mode (which is the default mode)

Installation

1. Create the application in Mastodon

On your Mastodon instance, go to Preferences > Development > Your applications and create a new one.

You can use whatever you want as name and website but if you have no idea, I suggest shaarli2mastodon and https://github.com/kalvn/shaarli2mastodon.

In Scopes, chose only write permission and validate.

Your new application should appear in the list. Click on it and copy the app token (the third entry) to your clipboard (CTRL+C).

2. Install the plugin

You must download and copy the files under /plugins/shaarli2mastodon directory of your Shaarli installation. There are several ways to do so. Here, I'll be using Git.

Run the following command from within the /plugins directory:

$ git clone https://github.com/kalvn/shaarli2mastodon

Make sure these new files are readable by your web server (Apache, Nginx, etc.).

Then, on your Shaarli instance, go to Plugin administration page and activate the plugin.

3. Configure the plugin

Your parameters from step 1 will be used here. After plugin activation, you'll see 5 parameters.

  • MASTODON_INSTANCE: Your Mastodon instance, example: mastodon.xyz
  • MASTODON_APPTOKEN: Mastodon application token, example: rODeyYKXVXDq91ecGwTG6BI0yU5mLTSiPjFMv6uJ50I
  • MASTODON_TOOT_MAX_LENGTH: Defines the toots max length. By default it is 500 since it's the max length on most Mastodon instances.
  • MASTODON_TOOT_FORMAT: The format of your toots. Available placeholders:
    • ${url}: URL of link shared
    • ${permalink}: permalink of the share
    • ${title}: title of the share
    • ${description}: description of the share
    • ${tags}: tags of the share, prefixed with # to be valid Mastodon tags
    • ${cw}: content warning. Everything which is before this placeholder will appear before the content warning (visible). Everything which is after this placeholder will appear after the content warning (hidden - you must unfold to see it).

Tests

composer install
composer test
# or
./vendor/bin/phpunit tests



鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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