Mastodon の API を叩くには以下の手順を踏む必要がある:
- OAuth2 クライアントを登録する
- アクセストークンを取得する
- アクセストークンを
Authorizationヘッダに指定して API にアクセスする
Mastodon の Apps API に登録情報を送ってクライアントを払い出してもらう(一度だけやれば OK).
| # Reason for choosing cherrypy | |
| # https://blog.appdynamics.com/engineering/a-performance-analysis-of-python-wsgi-servers-part-2/ | |
| # | |
| # Flask application based on Quickstart | |
| # http://flask.pocoo.org/docs/0.12/quickstart/ | |
| # | |
| # CherryPy documentation for this | |
| # http://docs.cherrypy.org/en/latest/deploy.html#wsgi-servers | |
| # http://docs.cherrypy.org/en/latest/advanced.html#host-a-foreign-wsgi-application-in-cherrypy | |
| # Install: pip install cherrypy |
| /** | |
| * リアクションtootスクリプト | |
| * | |
| * メンションを発見したら直ちにリプライ | |
| * | |
| * アクセストークンとインスタンスのAPI URLはプロジェクトのプロパティに設定しておく。 | |
| * ソースコードとトークンおよびインスタンスを切り離すことにより、スクリプトの再利用性が高まった。 | |
| * | |
| * リアクションtootスクリプト © @hidao80 クリエイティブ・コモンズ・ライセンス(表示4.0 国際)https://creativecommons.org/licenses/by/4.0/ | |
| */ |
| function onload() | |
| cooutside(params) | |
| startLuaCoroutine(self, "normalcoroutine") --this is calling the regular way people do coroutines | |
| end | |
| --This is the usual way people do coroutines, does not allow params to be passed through | |
| function normalcoroutine() --no params can be passed | |
| waitTime(1) | |
| print("1") | |
| waitFrames(60) |
| article div.main { | |
| display: flex; | |
| } | |
| article div.body { | |
| margin-left: 0.5rem; | |
| margin-right: auto; | |
| } | |
| article div.text p, article div.text span, article div.text br { | |
| content: attr(text); | |
| } |