2

什么是 Mastodon(长毛象),应该怎么玩

 1 year ago
source link: https://limboy.me/posts/mastodon/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

什么是 Mastodon(长毛象),应该怎么玩

2023-01-15

Mastodon 是一款开源软件,当该软件运行在服务器上时,就形成了一个 Mastodon 实例,如 mastodon.social。Mastodon 使用起来有点像 Twitter:

mastodon-page.jpg

独立部署的好处是数据保存在自己的服务器上,同时可以定制言论规则,比如哪些类型的帖子不能发,还可以执行一些自定义操作,如只能邀请才能加入。近期有越来越多的 Twitter 用户开始使用 Mastodon 也是因为 Elon Musk 的一系列操作,让大家对 Twitter 的未来越来越悲观。

跟 Twitter 一样,Mastodon 也提供了 REST API,这样就可以通过第三方 App 来使用 Mastodon 了。

如果只是 Twitter 的开源实现,那吸引力还是不够的,真正把 Mastodon 跟 Twitter 区别开来的是它的去中心化特性:运行在美国服务器上的 Mastodon 实例可以跟运行在日本服务器上的 Mastodon 实例互相通信。

mastodon-communication.png

Mastodon 实例间的通信使用的是 ActivityPub 协议,这个协议把常见的 Social Activity 封装为不同的数据格式。比如 Alice 向 Bob 发送一条内容,可以这么描述(做了些简化):

{"@context": "https://www.w3.org/ns/activitystreams",
 "type": "Create",
 "id": "https://social.example/alice/posts/a29a6843",
 "to": ["https://chatty.example/bob/"],
 "actor": "https://social.example/alice/",
 "object": {"type": "Note",
            "id": "https://social.example/alice/posts/49e2d03d",
            "content": "Hello World"}}

就像一封邮件,actor 是发送者,to 是接收者,object 是 post 内容。假如 Mastodon Server A(以下简称 MSA)上的用户 Alice,想要 follow Mastodon Server B(以下简称 MSB)上的用户 Bob,可以这么做:

mastodon-follow.png

这里涉及到了另一个协议:WebFinger,在聊这个协议之前,先说说 handle 这个概念,在 Twitter 上我们想要 @ 一个用户时,只需 @someone 就行了,因为这个用户只存在于 Twitter 的服务器上。但如果在 MSA 上想要 @ MSB 上的一个用户的话,仅仅 @someone 就不够了,需要 @[email protected] 才能完整表达,这个 @[email protected] 就是 handle(就像 email address 一样)。

接下来的问题就是,我知道了 @[email protected],如何把 follow 这个行为发送过去呢?这就需要知道 bobmsb.com 上的 inbox URL,而获取的方法就是使用 WebFinger 协议。只需要请求这个 URL

https://msb.com/.well-known/webfinger?resource=acct:[email protected]

就能拿到 bob 在 msb.com 上的一些信息,就像这样:

{
	"subject": "acct:[email protected]",
	"links": [
		{
			"rel": "self",
			"type": "application/activity+json",
			"href": "https://msb.com/users/bob"
		}
	]
}

这个 https://msb.com/users/bob 就是 bob 的 profile URL。但这还不够,毕竟我们要往 bob 的 inbox 去发送数据,还需要知道 bob 的 inbox URL。这个也很简单,只要在 profile URL 后面加上 .json 就行了。比如要获取 Gargron 这个用户在 mastodon.social 上的 inbox URL,可以请求 https://mastodon.social/users/Gargron.json,结果中就会有这个 inbox URL

mastodon-inbox-url.png

然后把 Follow 这个行为,封装成 ActivityPub 中定义的数据格式发送到 inbox URL 就行了,对方的服务器就知道 Alice follow 了 Bob,Bob 的 Follower 列表里会增加 [email protected] 这一项

mastodon-followers.png

Bob 如果发布一条 post,该 post 的内容就会被发送到 Alice 所在的服务器 MSA。

mastodon-post-1.png
mastodon-post-2.png

此时 Alice 如果浏览自己的 Home Timeline,就能看到 Bob 发的这个 post。这样,借助 WebFinger 和 ActivityPub 协议,Mastodon 实例之间就能实现关注、点赞等常见社交行为。而社交行为并非只有 Twitter 这种形式,Instagram、YouTube 等 App 也可以有社交行为,那么是否可以基于 ActivityPub 去构建此类 App 呢?当然可以,比如 Pixelfed 就是一个类似 Instagram 的服务,Peertube 则是类似 Youtube 的实现。

因为这些实例都实现了 ActivityPub 协议,所以它们之间可以互相通信,这些实例组合在一起,就形成了 Fediverse(联邦宇宙,Federation + Universe)。

mastodon-fediverse.jpg

正是这种去中心化、多实例的特性,让 Mastodon 有了三个 Timeline:Home / Local / Federated。

  • Home: 关注的用户发布的内容,跟 Twitter Feed 类似,但只是按时间顺序排序。
  • Local:当前 Mastodon 实例的用户发布的内容。
  • Federated: 当前 Mastodon 实例的用户关注的用户(包含其他 Mastodon 实例)发布/转推的内容。

也正是这三条 Timeline,让 Mastodon 有了自己的玩法。想要体验 Mastodon,第一件事就是注册账号。有那么多的 Mastodon 实例,怎么选呢?如果把 Fediverse 比作 Reddit 的话,每一个 Mastodon 实例就像一个个 subreddit,subreddit 都会有一个特定的主题,比如 Linux、Draw、Web Dev 等等,如果某个 Mastodon 实例的主题是你感兴趣的,就可以考虑加入(当然前提是该实例开放注册)。比如:

  • m.webtoo.ls 专注于 Web Open Souce Tools 的开发,不到 50 个人,注册入口关闭。
  • toot.thoughtworks ThoughtWorks Infra 部门,100 多人,注册入口关闭。
  • vis.social 可视化相关,近 1000 人,注册入口关闭。
  • linuxrocks.online 讨论 linux 相关问题,500多人,注册入口开放。

a tip:尽量避免找人数多,主题又过于 General 的 Mastodon 实例,这就像在玩另一个版本的 Twitter,不能体验到 Mastodon 的精髓。

这三条 Timeline 中,Local Timeline 是一个能够找到新朋友,发现新内容的好去处(前提是该 Mastodon 实例人不要太多,不要太 General),就像浏览 subreddit 一样。


如何找到我可以加入的 Mastodon 实例?
可以使用 instances.social 或浏览 Mastodon 官方的 servers 列表

如何 follow fediverse 里的用户?
每个 fediverse 用户都会有一个 handle(类似 email address),如 @[email protected],搜索这个 handle 就能找到对应的用户。比如我在 mas.to 实例,而梁欢在 alive.bar 实例,在 mas.to 里搜索 @[email protected] 就能找到他,并关注。

mastodon-cross-follow.jpg

可以加入多个 Mastodon 实例吗?
当然可以,就像你可以 join 多个 subreddit 一样。比如在游戏相关的 Mastodon 实例可以发表游戏相关的内容,在科幻小说的 Mastodon 实例里可以聊阿西莫夫。

如何找到我在 Twitter 关注的人他们在 Fediverse 的账号?
可以试试 Fedifindermovetodon

除了 Mastodon 自带的 UI 外,有推荐的第三方 App 么?
web 端的话推荐 elk, 由 nuxt 团队开发,品质有保障。iOS 的话 Tweetbot 团队的 Ivory 目前正在内测,可以期待下。Mastodon 官方也有一个推荐列表,可以一并看下。

我有一个 Twitter 账号,应该迁移到 Mastodon 吗?
可以先找到一个 Mastodon 实例体验下,Follow 些用户慢慢玩起来。Twitter 虽然有它自己的问题,但毕竟有那么多的活跃用户和潜在的感兴趣内容,这些独特的价值短时间内还是很难被取代的。

可以把 Tweet 内容同步到 Mastodon 吗?
如果同时在使用 Twitter 和 Mastodon,同样的内容两边都发一遍还是会有点麻烦,可以试试 moa.party 这个服务,绑定 Twitter 和 Mastodon 账号后,就可以自动同步了(没有试过,不保证效果)。

我应该建一个自己的 Mastodon 实例吗?
如果你在一个组织或团队,且内容是可以公开的,可以考虑建一个,这样可以方便了解大家都在做什么,也能产生互动,内容沉淀和传播上也会比「群」要好。比如 ThoughtWorks Infra 就建了一个 Mastodon 实例:toot.thoughtworks.com

这篇文章阐述了为什么你应该为自己的 Organization 建一个 Mastodon。

Mastodon 和 Twitter 在产品层面有哪些差异?

  • Mastodon 没有广告。
  • Mastodon 默认可以发表 500 个字(管理员可以自行设置)。
  • Tweet 在 Mastodon 叫 Toot,Retweet 在 Mastodon 叫 Boost。
  • Mastodon 可以编辑 Toot!(3.5 版本加的这个功能)
  • Mastodon 的 Timeline 没有算法「干扰」。
  • Mastodon 没有 Quote Tweet 功能。
  • Mastodon 没有 Full Text Search 功能,但可以搜 hashtag,如 #book
  • Mastodon 里的 Favorite 不会像 Twitter 的 Like 一样推送给 Follower。
  • Mastodon 的 Toot 可见范围有 4 个 Level,Tweet 只有 Everyone 和 Circle 两个 Level。
    • direct: 只有提及的用户才能看到这条消息,就像 Twitter 的 Direct Message。
    • followers-only: 只有关注你的用户才能看到这条消息。
    • unlisted: 不会出现在 Local 或 Federated Timeline,但是关注你的用户或点击你主页依旧能看到。
    • public: 完全公开。

Mastodon 还有哪些非常规操作?
可以用来作为评论系统。在 Mastodon 上发布文章链接,得到 toot id,然后通过 API 请求该 toot 的 replies,将它们展示到评论区。这位同学就是这么实践的。


Refs:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK