Change update check source to kmyblue origin

This commit is contained in:
KMY 2023-09-20 18:42:08 +09:00
parent ee6186a197
commit 7696216cbd
7 changed files with 19 additions and 4 deletions

View file

@ -46,6 +46,7 @@ class Form::AdminSettings
receive_other_servers_emoji_reaction
streaming_other_servers_emoji_reaction
enable_emoji_reaction
check_lts_version_only
).freeze
INTEGER_KEYS = %i(
@ -72,6 +73,7 @@ class Form::AdminSettings
receive_other_servers_emoji_reaction
streaming_other_servers_emoji_reaction
enable_emoji_reaction
check_lts_version_only
).freeze
UPLOAD_KEYS = %i(

View file

@ -27,11 +27,18 @@ class SoftwareUpdateCheckService < BaseService
end
def api_url
ENV.fetch('UPDATE_CHECK_URL', 'https://api.joinmastodon.org/update-check')
ENV.fetch('UPDATE_CHECK_URL', 'https://kmy.blue/update-check')
end
def version
@version ||= Mastodon::Version.to_s.split('+')[0]
return @version if @version.present?
if ENV.fetch('UPDATE_CHECK_SOURCE', 'kmyblue') == 'kmyblue'
@version = "#{Mastodon::Version.kmyblue_major}.#{Mastodon::Version.kmyblue_minor}"
@version += '-lts' if Setting.check_lts_version_only
else
@version = Mastodon::Version.to_s.split('+')[0]
end
end
def process_update_notices!(update_notices)

View file

@ -55,6 +55,9 @@
.fields-group
= f.input :authorized_fetch, as: :boolean, wrapper: :with_label, label: t('admin.settings.security.authorized_fetch'), warning_hint: authorized_fetch_overridden? ? t('admin.settings.security.authorized_fetch_overridden_hint') : nil, hint: t('admin.settings.security.authorized_fetch_hint'), disabled: authorized_fetch_overridden?, recommended: authorized_fetch_overridden? ? :overridden : nil
.fields-group
= f.input :check_lts_version_only, as: :boolean, wrapper: :with_label, kmyblue: true, hint: false
%h4= t('admin.settings.discovery.follow_recommendations')
.fields-group

View file

@ -315,6 +315,7 @@ en:
activity_api_enabled: Publish aggregate statistics about user activity in the API
backups_retention_period: User archive retention period
bootstrap_timeline_accounts: Always recommend these accounts to new users
check_lts_version_only: Check kmyblue LTS version only when update check
closed_registrations_message: Custom message when sign-ups are not available
content_cache_retention_period: Content cache retention period
custom_css: Custom CSS

View file

@ -330,6 +330,7 @@ ja:
activity_api_enabled: APIでユーザーアクティビティに関する集計統計を公開する
backups_retention_period: ユーザーアーカイブの保持期間
bootstrap_timeline_accounts: おすすめユーザーに常に表示するアカウント
check_lts_version_only: 更新チェックの時、LTSバージョンのみ確認する
closed_registrations_message: アカウント作成を停止している時のカスタムメッセージ
content_cache_retention_period: コンテンツキャッシュの保持期間
custom_css: カスタムCSS

View file

@ -41,6 +41,7 @@ defaults: &defaults
receive_other_servers_emoji_reaction: false
streaming_other_servers_emoji_reaction: false
enable_emoji_reaction: true
check_lts_version_only: true
development:
<<: *defaults

View file

@ -6,7 +6,7 @@ RSpec.describe SoftwareUpdateCheckService, type: :service do
subject { described_class.new }
shared_examples 'when the feature is enabled' do
let(:full_update_check_url) { "#{update_check_url}?version=#{Mastodon::Version.to_s.split('+')[0]}" }
let(:full_update_check_url) { "#{update_check_url}?version=#{Mastodon::Version.kmyblue_major}.#{Mastodon::Version.kmyblue_minor}-lts" }
let(:devops_role) { Fabricate(:user_role, name: 'DevOps', permissions: UserRole::FLAGS[:view_devops]) }
let(:owner_user) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')) }
@ -139,7 +139,7 @@ RSpec.describe SoftwareUpdateCheckService, type: :service do
end
context 'when using the default update checking API' do
let(:update_check_url) { 'https://api.joinmastodon.org/update-check' }
let(:update_check_url) { 'https://kmy.blue/update-check' }
it_behaves_like 'when the feature is enabled'
end