-
Notifications
You must be signed in to change notification settings - Fork 1
MastodonController
Tatsuya Koishi edited this page Jun 21, 2020
·
58 revisions
- POST /api/v1/statuses
- POST /api/v1/statuses/:id/favourite
- POST /api/v1/statuses/:id/reblog
- POST /api/v1/statuses/:id/bookmark
- POST /api/v1/media
- POST /api/v2/media
- GET /api/v2/search
今のところなし。
Mastodon公式 に載っている手順通りにnginxを設定し、同一ホストにモロヘイヤを設置する想定。
location ~ ^/api/v[0-9]+/(statuses|media|search)$ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Proxy "";
proxy_pass_header Server;
proxy_buffering off;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
tcp_nodelay on;
if ($http_x_mulukhiya != '') {
proxy_pass http://localhost:3000;
}
if ($http_x_mulukhiya = '') {
proxy_pass http://localhost:3008;
}
}
location ~ ^/api/v[0-9]+/statuses/[0-9]+/(favourite|reblog|bookmark)$ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Proxy "";
proxy_pass_header Server;
proxy_buffering off;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
tcp_nodelay on;
if ($http_x_mulukhiya != '') {
proxy_pass http://localhost:3000;
}
if ($http_x_mulukhiya = '') {
proxy_pass http://localhost:3008;
}
}
location ^~ /mulukhiya {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:3008;
}
location ^~ /auth/twitter {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:3008;
}
environment: production
mastodon:
url: https://mstdn.example.com/
status:
max_length: 600
search:
limit: 100
handler:
image_resize:
pixel: 1920
agent:
test:
token: hogehoge
info:
token: fugafuga
slack:
hooks:
- https://hooks.slack.com/services/xxxxx
- https://discordapp.com/api/webhooks/xxxxx/slack
amazon:
associate_tag: hoge
access_key: fuga
secret_key: piyo
affiliate: true
spotify:
client_id: hoge
client_secret: fuga
google:
api:
key: xxxxx
twitter:
consumer:
key: xxxxx
secret: xxxxx
status:
tags:
- タグ1
- タグ2
user_config:
redis:
dsn: redis://localhost:6379/1
postgres:
dsn: postgres://postgres@localhost:5432/mastodon
sidekiq:
redis:
dsn: redis://localhost:6379/2
auth:
password: your_password
tagging:
default_tags:
- デフォルトタグ1
- デフォルトタグ2
dictionaries:
- url: https://mstdn.example.com/dictionaries/dic1
fields:
- cure_name
- human_name
- cv
- url: https://mstdn.example.com/dictionaries/dic2
fields:
- field1
- field2
- url: https://mstdn.example.com/dictionaries/dic3
type: relative
- url: https://mstdn.example.com/dictionaries/dic4
type: mecab
crypt:
salt: your_salt
password: your_password
アップロード関連のハンドラを利用する場合は、
app/javascript/mastodon/utils/resize_image.js
の既存コードを全て削除し、
代わりに以下のコードを貼り付け。
(「実質何もしない」様に書き換えている)
export default inputFile => new Promise((resolve, reject) => {
resolve(inputFile);
});
修正後はいつもの様に、 RAILS_ENV=production bundle exec rails assets:precompile
を実行。
これを行うことにより、アップロードした全てのファイルにImageMagickやffmpegを通せる様になる。