Skip to content
Merged

5.9.0 #4163

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a473e5c
docs: 5.8.0をリリース済みに更新
pooza Mar 15, 2026
122b67f
docs: 同期手順に Sentry 確認ステップを追加
pooza Mar 16, 2026
900c5ff
bundle update
pooza Mar 16, 2026
0a51a57
docs: Sentry同期手順を具体化し、4.xメンテナンスタイミングを追記
pooza Mar 16, 2026
8e92f7e
style: Layout/EndAlignment設定追加とインデントスタイル統一
pooza Mar 16, 2026
aebe736
feat: GroupTagHandler — PieFed community-hashtag-map 連携 (#4164)
pooza Mar 18, 2026
52ffdaf
docs: 5.9.0に#4164 GroupTagHandlerのステージング検証状況を追記
pooza Mar 18, 2026
b484ce1
feat: カスタムAPI一覧画面のエンドポイントURLをクリック可能なリンクに (#4144)
pooza Mar 19, 2026
aeba075
Merge remote-tracking branch 'origin/main' into develop
pooza Mar 19, 2026
8641842
fix: GroupTagHandler の Redis#exists? を key? に修正 (#4164)
pooza Mar 19, 2026
26249d1
docs: #4164 GroupTagHandler ステージング検証完了を反映
pooza Mar 19, 2026
f78f3a2
feat: PieFed対応をginseng-piefedに切り出し (#4146)
pooza Mar 19, 2026
f626407
docs: #4146, #4164 完了を反映
pooza Mar 19, 2026
de0efe6
refactor: カスタムAPI機能をモロヘイヤから除去 (#4144)
pooza Mar 19, 2026
62697b5
chore(deps): Bump json from 2.19.1 to 2.19.2
dependabot[bot] Mar 19, 2026
048d72a
chore: バージョンを5.9.0にバンプ
pooza Mar 19, 2026
74fc8ea
chore(deps): Bump json from 2.19.1 to 2.19.2 (#4166)
pooza Mar 19, 2026
00d06ad
fix: ginseng-piefed 0.1.1に更新(Service#logger未定義を修正)
pooza Mar 19, 2026
88a7e9d
fix: CIでGroupTagHandlerの外部HTTPリクエストを抑制
pooza Mar 19, 2026
b0219df
docs: カスタムAPI設計書・CLAUDE.mdからカスタムフィードの記述を除去
pooza Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: chmod -R o-w "$(gem environment gemdir)"
- name: Create CI config
run: |
printf "controller: ${{ matrix.controller }}\ncrypt:\n password: ci_dummy_password\n${{ matrix.controller }}:\n url: https://ci.example.com\n" > config/local.yaml
printf "controller: ${{ matrix.controller }}\ncrypt:\n password: ci_dummy_password\n${{ matrix.controller }}:\n url: https://ci.example.com\nhandler:\n group_tag:\n sources: []\n" > config/local.yaml
- name: bundle install
run: |
gem install bundler
Expand Down
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Layout/ArrayAlignment:
EnforcedStyle: with_fixed_indentation
Layout/EmptyLineAfterGuardClause:
Enabled: false
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
Layout/EndOfLine:
EnforcedStyle: lf
Layout/FirstArgumentIndentation:
Expand Down Expand Up @@ -125,6 +127,8 @@ Sequel:
- app/migration/**/*.rb
Sequel/ConcurrentIndex:
Enabled: false
Sequel/IrreversibleMigration:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/ConditionalAssignment:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ gem 'dry-validation'
gem 'faye-websocket', github: 'pooza/faye-websocket-ruby'
gem 'ginseng-core', github: 'pooza/ginseng-core', branch: 'main', require: 'ginseng'
gem 'ginseng-fediverse', github: 'pooza/ginseng-fediverse', branch: 'main', require: 'ginseng/fediverse'
gem 'ginseng-piefed', github: 'pooza/ginseng-piefed', branch: 'main', require: 'ginseng/piefed'
gem 'ginseng-postgres', github: 'pooza/ginseng-postgres', branch: 'main'
gem 'ginseng-redis', github: 'pooza/ginseng-redis', branch: 'main', require: 'ginseng/redis'
gem 'ginseng-web', github: 'pooza/ginseng-web', branch: 'main', require: 'ginseng/web'
Expand Down
22 changes: 15 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ GIT
specs:
ginseng-fediverse (1.8.21)

GIT
remote: https://github.com/pooza/ginseng-piefed.git
revision: 56208ffd262652788eb0a3d2ff8e34df410d0b0f
branch: main
specs:
ginseng-piefed (0.1.1)

GIT
remote: https://github.com/pooza/ginseng-postgres.git
revision: 92a453b5cd3b061f3fc389af4e9d75ef1f8f0aa7
Expand Down Expand Up @@ -208,7 +215,7 @@ GEM
multi_xml (>= 0.5.2)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
json (2.19.1)
json (2.19.2)
json-schema (6.2.0)
addressable (~> 2.8)
bigdecimal (>= 3.1, < 5)
Expand All @@ -232,7 +239,7 @@ GEM
mime-types (3.7.0)
logger
mime-types-data (~> 3.2025, >= 3.2025.0507)
mime-types-data (3.2026.0303)
mime-types-data (3.2026.0317)
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (6.0.2)
Expand Down Expand Up @@ -322,7 +329,7 @@ GEM
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rainbow (3.1.1)
rake (13.3.1)
redis-client (0.27.0)
redis-client (0.28.0)
connection_pool
regexp_parser (2.11.3)
rest-client (2.0.2)
Expand Down Expand Up @@ -379,12 +386,12 @@ GEM
sassc (2.4.0)
ffi (~> 1.9)
securerandom (0.4.1)
sentry-ruby (6.4.1)
sentry-ruby (6.5.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
logger
sentry-sidekiq (6.4.1)
sentry-ruby (~> 6.4.1)
sentry-sidekiq (6.5.0)
sentry-ruby (~> 6.5.0)
sidekiq (>= 5.0)
sequel (5.102.0)
bigdecimal
Expand Down Expand Up @@ -434,7 +441,7 @@ GEM
uri (1.1.1)
useragent (0.16.11)
version_gem (1.1.9)
webmock (3.26.1)
webmock (3.26.2)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -459,6 +466,7 @@ DEPENDENCIES
faye-websocket!
ginseng-core!
ginseng-fediverse!
ginseng-piefed!
ginseng-postgres!
ginseng-redis!
ginseng-web!
Expand Down
12 changes: 0 additions & 12 deletions app/lib/mulukhiya/controller/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -546,18 +546,6 @@ class APIController < Controller
return @renderer.to_s
end

CustomAPI.all do |api|
get api.path do
@renderer = api.create_renderer(params)
return @renderer.to_s
rescue => e
e.log
@renderer.status = e.status
@renderer.message = {error: e.message}
return @renderer.to_s
end
end

def token
return params[:token].decrypt
rescue
Expand Down
18 changes: 9 additions & 9 deletions app/lib/mulukhiya/controller/mastodon_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ class MastodonController < Controller
put '/api/:version/statuses/:id' do
verify_token_integrity!
purpose = request.env['HTTP_X_MULUKHIYA_PURPOSE']
body = case purpose
when nil, '', 'media_update'
source = sns.fetch_status_source(params[:id], {headers: @headers})
{status: source['text'], media_attributes: params[:media_attributes]}.compact
when 'tag'
{status: params[:status], media_attributes: params[:media_attributes]}.compact
else
raise Ginseng::ValidateError, "unknown purpose: #{purpose}"
end
case purpose
when nil, '', 'media_update'
source = sns.fetch_status_source(params[:id], {headers: @headers})
body = {status: source['text'], media_attributes: params[:media_attributes]}.compact
when 'tag'
body = {status: params[:status], media_attributes: params[:media_attributes]}.compact
else
raise Ginseng::ValidateError, "unknown purpose: #{purpose}"
end
raise Ginseng::ValidateError, 'media_attributes is required' if body.empty?
reporter.response = sns.update_status(params[:id], body, {headers: @headers})
@renderer.message = reporter.response.parsed_response
Expand Down
114 changes: 0 additions & 114 deletions app/lib/mulukhiya/custom_api.rb

This file was deleted.

4 changes: 1 addition & 3 deletions app/lib/mulukhiya/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ def self.task_prefixes

def self.pre_start_tasks
tasks = ['config:lint']
if config['/ruby/bundler/install']
tasks.push('mulukhiya:api:bundler', 'mulukhiya:feed:bundler')
end
tasks.push('mulukhiya:feed:bundler') if config['/ruby/bundler/install']
return tasks
end

Expand Down
2 changes: 1 addition & 1 deletion app/lib/mulukhiya/handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def schema
end

EXCLUDED_EDITABLE_HANDLERS = [
'dictionary_tag', 'remote_tag', 'removal_rule_tag', 'user_tag'
'dictionary_tag', 'group_tag', 'remote_tag', 'removal_rule_tag', 'user_tag'
].freeze

def editable_schema
Expand Down
96 changes: 96 additions & 0 deletions app/lib/mulukhiya/handler/group_tag_handler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
module Mulukhiya
class GroupTagHandler < TagHandler
CACHE_KEY = 'group_tag:communities'.freeze

def disable?
return true unless sources.present?
return super
end

def addition_tags
tags = TagContainer.new
map = community_map
parser.accts.each do |acct|
entry = map[acct.to_s] || map[acct.to_s.delete_prefix('@')]
tags.concat(entry[:hashtags]) if entry
tags.push(db_display_name(acct)) if mastodon?
end
return tags
end

private

def community_map
update_cache unless cache_valid?
return @community_map ||= load_cache
end

def update_cache
communities = []
sources.each do |url|
response = @http.get(url)
data = response.parsed_response
communities.concat(data['communities'] || [])
rescue => e
e.log(url:)
end
@community_map = build_map(communities)
redis.setex(CACHE_KEY, cache_ttl, communities.to_json)
end

def load_cache
raw = redis[CACHE_KEY]
return {} unless raw
return build_map(JSON.parse(raw))
rescue => e
e.log
return {}
end

def build_map(communities)
map = {}
communities.each do |entry|
acct = entry['acct'].to_s
map[acct] = {hashtags: entry['hashtags'] || []}
end
return map
end

def cache_valid?
return redis.key?(CACHE_KEY)
end

def cache_ttl
return handler_config(:cache_ttl) || 3600
end

def sources
return handler_config(:sources) || []
end

def db_display_name(acct)
account = account_class.get(acct: acct)
return nil unless account
return nil unless account.actor_type == 'Group'
return account.display_name
rescue
return nil
end

def mastodon?
return controller_class == MastodonController
rescue
return false
end

def redis
@redis ||= Redis.new
return @redis
end

def initialize(params = {})
super
@http = HTTP.new
end
end
end
2 changes: 1 addition & 1 deletion app/lib/mulukhiya/model/account_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def webhook

def piefed
return nil unless [:url, :user, :password].all? {|k| user_config["/piefed/#{k}"]}
@piefed ||= PiefedClipper.new(
@piefed ||= Ginseng::Piefed::Service.new(
url: user_config['/piefed/url'],
user: user_config['/piefed/user'],
password: user_config['/piefed/password'],
Expand Down
Loading
Loading