Add force unlocked option to official Mastodon App

This commit is contained in:
noellabo 2023-02-27 05:22:08 +09:00
parent 5ebd24c801
commit 751874241b
10 changed files with 31 additions and 2 deletions

View file

@ -132,4 +132,17 @@ class Api::BaseController < ApplicationController
def disallow_unauthenticated_api_access?
authorized_fetch_mode?
end
def application
doorkeeper_token&.application
end
def mastodon_for_ios?
application&.name == 'Mastodon for iOS'
end
def mastodon_for_android?
application&.name == 'Mastodon for Android'
end
end

View file

@ -6,7 +6,10 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController
before_action :require_user!
def show
@account = current_account
@account = current_account.tap do |account|
account.locked = false if account.user.setting_unlocked_for_official_app && (mastodon_for_ios? || mastodon_for_android?)
end
render json: @account, serializer: REST::CredentialAccountSerializer
end

View file

@ -94,7 +94,9 @@ class Api::V1::AccountsController < Api::BaseController
private
def set_account
@account = Account.find(params[:id])
@account = Account.find(params[:id]).tap do |account|
account.locked = false if account == current_account && current_user.setting_unlocked_for_official_app && (mastodon_for_ios? || mastodon_for_android?)
end
end
def relationships(**options)

View file

@ -125,6 +125,7 @@ class Settings::PreferencesController < Settings::BaseController
:setting_hide_link_preview,
:setting_hide_photo_preview,
:setting_hide_video_preview,
:setting_unlocked_for_official_app,
setting_prohibited_visibilities: [],
notification_emails: %i(follow follow_request reblog favourite emoji_reaction status_reference mention digest report pending_account trending_tag),
interactions: %i(must_be_follower must_be_following must_be_following_dm must_be_dm_to_send_email must_be_following_reference)

View file

@ -102,6 +102,7 @@ class UserSettingsDecorator
hide_video_preview
enable_wide_emoji
enable_wide_emoji_reaction
unlocked_for_official_app
).freeze
STRING_KEYS = %w(

View file

@ -148,6 +148,7 @@ class User < ApplicationRecord
:prohibited_visibilities, :prohibited_words,
:disable_relative_time, :hide_direct_from_timeline, :hide_personal_from_timeline, :hide_personal_from_account, :hide_privacy_meta,
:hide_link_preview, :hide_photo_preview, :hide_video_preview,
:unlocked_for_official_app,
to: :settings, prefix: :setting, allow_nil: false

View file

@ -137,6 +137,9 @@
.fields-group
= f.input :setting_hide_privacy_meta, as: :boolean, wrapper: :with_label, fedibird_features: true
.fields-group
= f.input :setting_unlocked_for_official_app, as: :boolean, wrapper: :with_label, fedibird_features: true
%h4= t 'preferences.public_timelines'
.fields-group

View file

@ -135,6 +135,7 @@ en:
setting_theme_instance_ticker_type-2: Type-2 (Favicon + BG White)
setting_theme_instance_ticker_type-3: Type-3 (Favicon + BG Black)
setting_theme_public: Your public pages will reflect the theme currently in use
setting_unlocked_for_official_app: Force the official Mastodon app to recognize the account follow approval-only as disabled, making the default visibility public
setting_use_blurhash: Gradients are based on the colors of the hidden visuals but obfuscate any details
setting_use_pending_items: Hide timeline updates behind a click instead of automatically scrolling the feed
username: Your username will be unique on %{domain}
@ -344,6 +345,7 @@ en:
setting_theme_public: Reflecting the theme on the public page
setting_trends: Show today's trends
setting_unfollow_modal: Show confirmation dialog before unfollowing someone
setting_unlocked_for_official_app: Disable follow approval-only for against the official Mastodon App
setting_unsubscribe_modal: Show confirmation dialog before unsubscribing someone
setting_use_blurhash: Show colorful gradients for hidden media
setting_use_pending_items: Slow mode

View file

@ -131,6 +131,7 @@ ja:
setting_theme_instance_ticker_type-2: Type-2 (Favicon + 白背景)
setting_theme_instance_ticker_type-3: Type-3 (Favicon + 黒背景)
setting_theme_public: あなたの公開ページに現在使用中のテーマを反映します
setting_unlocked_for_official_app: Mastodon公式アプリに対し、アカウントのフォロー承認制を強制的に無効と認識させることで、デフォルトの可視性を公開にします。
setting_use_blurhash: ぼかしはメディアの色を元に生成されますが、細部は見えにくくなっています
setting_use_pending_items: 新着があってもタイムラインを自動的にスクロールしないようにします
username: あなたのユーザー名は %{domain} の中で重複していない必要があります
@ -340,6 +341,7 @@ ja:
setting_theme_public: 公開ページにテーマを反映する
setting_trends: 本日のトレンドタグを表示する
setting_unfollow_modal: フォローを解除する前に確認ダイアログを表示する
setting_unlocked_for_official_app: Mastodon公式アプリに対し、フォロー承認制を無効にする
setting_unsubscribe_modal: 購読を解除する前に確認ダイアログを表示する
setting_use_blurhash: 非表示のメディアを色付きのぼかしで表示する
setting_use_pending_items: 手動更新モード

View file

@ -75,6 +75,7 @@ defaults: &defaults
picker_emoji_size: 22,
enable_wide_emoji: true
enable_wide_emoji_reaction: true
unlocked_for_official_app: false
notification_emails:
follow: false
reblog: false