Mark settings as readonly, allow params for editable ones
This commit is contained in:
parent
fa56d6b772
commit
8da297811b
@ -1,5 +1,4 @@
|
||||
class Admin::Settings::RegistrationsController < Admin::SettingsController
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
@ -10,11 +9,4 @@ class Admin::Settings::RegistrationsController < Admin::SettingsController
|
||||
success: "Settings saved"
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def setting_params
|
||||
params.require(:setting).permit(:reserved_usernames)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,5 +1,4 @@
|
||||
class Admin::Settings::ServicesController < Admin::SettingsController
|
||||
|
||||
def index
|
||||
@service = params[:s]
|
||||
|
||||
@ -17,19 +16,4 @@ class Admin::Settings::ServicesController < Admin::SettingsController
|
||||
success: "Settings saved"
|
||||
}
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.require(:setting).permit(
|
||||
:discourse_enabled,
|
||||
:ejabberd_enabled,
|
||||
:gitea_enabled,
|
||||
:lndhub_enabled,
|
||||
:lndhub_admin_enabled,
|
||||
:lndhub_keysend_enabled,
|
||||
:mastodon_enabled,
|
||||
:mediawiki_enabled,
|
||||
:nostr_enabled,
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -30,7 +30,11 @@ class Admin::SettingsController < Admin::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_current_section
|
||||
@current_section = :settings
|
||||
end
|
||||
def set_current_section
|
||||
@current_section = :settings
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.require(:setting).permit(Setting.editable_keys.map(&:to_sym))
|
||||
end
|
||||
end
|
||||
|
@ -14,7 +14,7 @@ class Setting < RailsSettings::Base
|
||||
# Discourse
|
||||
#
|
||||
|
||||
field :discourse_public_url, type: :string,
|
||||
field :discourse_public_url, type: :string, readonly: true,
|
||||
default: ENV["DISCOURSE_PUBLIC_URL"].presence
|
||||
|
||||
field :discourse_enabled, type: :boolean,
|
||||
@ -27,17 +27,20 @@ class Setting < RailsSettings::Base
|
||||
field :ejabberd_enabled, type: :boolean,
|
||||
default: (ENV["EJABBERD_API_URL"].present?.to_s || false)
|
||||
|
||||
field :ejabberd_api_url, type: :string,
|
||||
field :ejabberd_api_url, type: :string, readonly: true,
|
||||
default: ENV["EJABBERD_API_URL"].presence
|
||||
|
||||
field :ejabberd_admin_url, type: :string,
|
||||
field :ejabberd_admin_url, type: :string, readonly: true,
|
||||
default: ENV["EJABBERD_ADMIN_URL"].presence
|
||||
|
||||
field :ejabberd_buddy_roster, type: :string,
|
||||
default: "Buddies"
|
||||
|
||||
#
|
||||
# Gitea
|
||||
#
|
||||
|
||||
field :gitea_public_url, type: :string,
|
||||
field :gitea_public_url, type: :string, readonly: true,
|
||||
default: ENV["GITEA_PUBLIC_URL"].presence
|
||||
|
||||
field :gitea_enabled, type: :boolean,
|
||||
@ -47,7 +50,7 @@ class Setting < RailsSettings::Base
|
||||
# Lightning Network
|
||||
#
|
||||
|
||||
field :lndhub_api_url, type: :string,
|
||||
field :lndhub_api_url, type: :string, readonly: true,
|
||||
default: ENV["LNDHUB_API_URL"].presence
|
||||
|
||||
field :lndhub_enabled, type: :boolean,
|
||||
@ -56,7 +59,7 @@ class Setting < RailsSettings::Base
|
||||
field :lndhub_admin_enabled, type: :boolean,
|
||||
default: (ENV["LNDHUB_ADMIN_UI"] || false)
|
||||
|
||||
field :lndhub_public_key, type: :string,
|
||||
field :lndhub_public_key, type: :string, readonly: true,
|
||||
default: (ENV["LNDHUB_PUBLIC_KEY"] || "")
|
||||
|
||||
field :lndhub_keysend_enabled, type: :boolean,
|
||||
@ -66,7 +69,7 @@ class Setting < RailsSettings::Base
|
||||
# Mastodon
|
||||
#
|
||||
|
||||
field :mastodon_public_url, type: :string,
|
||||
field :mastodon_public_url, type: :string, readonly: true,
|
||||
default: ENV["MASTODON_PUBLIC_URL"].presence
|
||||
|
||||
field :mastodon_enabled, type: :boolean,
|
||||
@ -76,7 +79,7 @@ class Setting < RailsSettings::Base
|
||||
# MediaWiki
|
||||
#
|
||||
|
||||
field :mediawiki_public_url, type: :string,
|
||||
field :mediawiki_public_url, type: :string, readonly: true,
|
||||
default: ENV["MEDIAWIKI_PUBLIC_URL"].presence
|
||||
|
||||
field :mediawiki_enabled, type: :boolean,
|
||||
|
Loading…
x
Reference in New Issue
Block a user