Skip to content

Commit b3199a4

Browse files
poozaclaude
andcommitted
feat: X-Mulukhiya-Purpose: media_update をサポート
クライアント(capsicum)からの ALT 編集リクエスト用。 nginx が Purpose ヘッダの有無でルーティングするため、 クライアントは media_update を指定して PUT を送る。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8b1a2c2 commit b3199a4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/lib/mulukhiya/controller/mastodon_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class MastodonController < Controller
5858
verify_token_integrity!
5959
purpose = request.env['HTTP_X_MULUKHIYA_PURPOSE']
6060
body = case purpose
61-
when nil, ''
61+
when nil, '', 'media_update'
6262
{media_attributes: params[:media_attributes]}.compact
6363
when 'tag'
6464
{status: params[:status], media_attributes: params[:media_attributes]}.compact

docs/api.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,12 @@ SNS における「発言の責任」の観点から、本文の自由な編集
166166

167167
| X-Mulukhiya-Purpose | 許可されるパラメータ | 用途 |
168168
| --- | --- | --- |
169-
| (なし / 空) | `media_attributes` のみ | メディア説明(ALT)の編集 |
169+
| (なし / 空) | `media_attributes` のみ | メディア説明(ALT)の編集(直接アクセス時) |
170+
| `media_update` | `media_attributes` のみ | メディア説明(ALT)の編集(クライアントから) |
170171
| `tag` | `status`, `media_attributes` | ハッシュタグの付け替え(モロヘイヤ内部用) |
171172

172-
- Purpose ヘッダなし: クライアントからの通常リクエスト。`media_attributes` 以外は除去される
173+
- Purpose ヘッダなし: 直接アクセス時。`media_attributes` 以外は除去される
174+
- Purpose が `media_update`: クライアント(capsicum 等)からの ALT 編集リクエスト。nginx が Purpose ヘッダの有無でルーティングするため、クライアントはこの値を指定する
173175
- Purpose が `tag`: モロヘイヤ自身がハッシュタグを書き換える際に使用(将来の #3877 対応)
174176
- 不明な Purpose: 422 Unprocessable Entity を返す
175177

0 commit comments

Comments
 (0)