Add: NodeInfoにupstream情報を追加 (#440)

This commit is contained in:
KMY(雪あすか) 2024-01-09 18:05:08 +09:00 committed by GitHub
parent 7694c62bc6
commit f624cdfa98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -43,6 +43,10 @@ class NodeInfo::Serializer < ActiveModel::Serializer
nodeName: Setting.site_title,
nodeDescription: Setting.site_short_description,
features: capabilities_for_nodeinfo,
upstream: {
name: 'Mastodon',
version: Mastodon::Version.to_s_of_mastodon,
},
}
end

View file

@ -46,8 +46,19 @@ module Mastodon
components.join
end
def to_s_of_mastodon
components = [to_a.join('.')]
components << "-#{prerelease}" if prerelease.present?
components << "+#{build_metadata_of_mastodon}" if build_metadata_of_mastodon.present?
components.join
end
def build_metadata
['kmyblue', to_s_of_kmyblue, ENV.fetch('MASTODON_VERSION_METADATA', nil)].compact.join('.')
['kmyblue', to_s_of_kmyblue, build_metadata_of_mastodon].compact.join('.')
end
def build_metadata_of_mastodon
ENV.fetch('MASTODON_VERSION_METADATA', nil)
end
def to_a