builderscon 2019 day1 Mastodon
Fediverse互換一人用マイクロブログ
fediverseの中心となる機能
リモートフォロー
これによりフォローしたいユーザのサーバに合わせる必要が無くなり、好きなサーバを選べるようになる。
リモートフォローを実現するに必要な機能
他のサーバにフォロールクエストを送る
他のサーバの通知を受ける。
ユーザの場所を発見する。
発見する
RFC6415 Web HostMetadata
/.well-known/host-meta
pawoo.netnana@hibiki:~/codes/miku$ curl https://pawoo.net/.well-known/host-meta -iHTTP/2 200date: Fri, 30 Aug 2019 07:58:10 GMTcontent-type: application/xrd+xml; charset=utf-8server: Mastodonx-frame-options: DENYx-content-type-options: nosniffx-xss-protection: 1; mode=blockvary: Accept,Accept-Encodingcache-control: max-age=259200, publicetag: W/"434046f05de513c3897eeea835de69c3"x-request-id: 802bad5f-e28f-45fb-bec6-24218153ff12x-runtime: 0.002250strict-transport-security: max-age=31536000
<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"> <Link rel="lrdd" type="application/xrd+xml" template="https://pawoo.net/.well-known/webfinger?resource={uri}"/></XRD>kugayama$ curl https://pawoo.net/.well-known/webfinger?resource=kugayama@pawoo.net | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 1048 0 1048 0 0 6128 0 --:--:-- --:--:-- --:--:-- 6164{ "subject": "acct:kugayama@pawoo.net", "aliases": [ "https://pawoo.net/@kugayama", "https://pawoo.net/users/kugayama" ], "links": [ { "rel": "http://webfinger.net/rel/profile-page", "type": "text/html", "href": "https://pawoo.net/@kugayama" }, { "rel": "http://schemas.google.com/g/2010#updates-from", "type": "application/atom+xml", "href": "https://pawoo.net/users/kugayama.atom" }, { "rel": "self", "type": "application/activity+json", "href": "https://pawoo.net/users/kugayama" }, { "rel": "salmon", "href": "https://pawoo.net/api/salmon/184909" }, { "rel": "magic-public-key", "href": "data:application/magic-public-key,RSA.4-u85ceNiNS8yv01EE-k1dsa1n6PTbGg1JWCGF43Sp9uZouoC9l5UsrJ2YblflWF64PcpwxB1bdSEC3p-nL7xUnHtb-dBUpy3SGnP2mESvUmF8bRxY-mT-EGsMr-kKjzIzwAv7IcINV91GAmbMw9yQZ9vNM8Bj1U-UhqzpNE1rgmA51PTCalTrNEVXgqnCu70IoUIOAnWdIbx9ZeCScFRwLukLKryl5Sxa27h05PbYod8EVw2MCE-keEzJpKX5Wro5W-KvSKG4TuPT3oSS43cVEuDDGHjihI3TJ4IiYQrwQLTBVfhqDxWojpTtZsOvjwwXZwsolAVJNlpibK17xrtQ==.AQAB" }, { "rel": "http://ostatus.org/schema/1.0/subscribe", "template": "https://pawoo.net/authorize_follow?acct={uri}" } ]}ActivityPub
HTTP Signetures
署名してフォローリクエストを送ることによってなりすましを防ぐ。
アクター(アカウント)の公開鍵でリクエストを署名する。
note$ curl https://pawoo.net/@kugayama/101504538432479555.json | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 1240 0 1240 0 0 1540 0 --:--:-- --:--:-- --:--:-- 1540{ "@context": [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1", { "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", "sensitive": "as:sensitive", "movedTo": "as:movedTo", "Hashtag": "as:Hashtag", "ostatus": "http://ostatus.org#", "atomUri": "ostatus:atomUri", "inReplyToAtomUri": "ostatus:inReplyToAtomUri", "conversation": "ostatus:conversation", "toot": "http://joinmastodon.org/ns#", "Emoji": "toot:Emoji", "focalPoint": { "@container": "@list", "@id": "toot:focalPoint" }, "featured": "toot:featured", "schema": "http://schema.org#", "PropertyValue": "schema:PropertyValue", "value": "schema:value" } ], "id": "https://pawoo.net/users/kugayama/statuses/101504538432479555", "type": "Note", "summary": null, "content": "<p>ついったー</p>", "inReplyTo": null, "published": "2019-01-30T08:19:00Z", "url": "https://pawoo.net/@kugayama/101504538432479555", "attributedTo": "https://pawoo.net/users/kugayama", "to": [ "https://www.w3.org/ns/activitystreams#Public" ], "cc": [ "https://pawoo.net/users/kugayama/followers" ], "sensitive": false, "atomUri": "https://pawoo.net/users/kugayama/statuses/101504538432479555", "inReplyToAtomUri": null, "conversation": "tag:pawoo.net,2019-01-30:objectId=111959643:objectType=Conversation", "attachment": [], "tag": []}Note
ActivityStreams2
@context jsonのschmea的なもの。 curl https://pawoo.net/users/kugayama.json | jq . relay
何?
連合リレーに使われてる。
こういうやつ
outbox
過去のツイートの一覧の類。
inbox
フォロー数が増えると大変
shared inbox
サーバ単位に集約することができる。
どれぐらい大変か?
わかってしまえばそんなに。
preferredUsername が無いとマストドンが握り潰したりするとかそういうので大変だった。マストドン以外のアプリとの通信
マストドンで行けるようなやつはだいたい行けるのでは とかいう噂。