diff --git a/.env.example b/.env.example
index 6cff8b9..155ec8a 100644
--- a/.env.example
+++ b/.env.example
@@ -22,6 +22,7 @@ DISCOURSE_PUBLIC_URL='https://community.kosmos.org'
GITEA_PUBLIC_URL='https://gitea.kosmos.org'
MASTODON_PUBLIC_URL='https://kosmos.social'
MEDIAWIKI_PUBLIC_URL='https://wiki.kosmos.org'
+RS_STORAGE_URL='https://storage.kosmos.org'
EJABBERD_ADMIN_URL='https://xmpp.kosmos.org/admin'
EJABBERD_API_URL='https://xmpp.kosmos.org/api'
diff --git a/.env.test b/.env.test
index 0c94493..016655b 100644
--- a/.env.test
+++ b/.env.test
@@ -6,4 +6,6 @@ LNDHUB_API_URL='http://localhost:3026'
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
LNDHUB_PUBLIC_KEY='024cd3be18617f39cf645851e3ba63f51fc13f0bb09e3bb25e6fd4de556486d946'
+RS_STORAGE_URL='https://storage.kosmos.org'
+
WEBHOOKS_ALLOWED_IPS='10.1.1.23'
diff --git a/app/models/setting.rb b/app/models/setting.rb
index dff6425..b1364a5 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -104,4 +104,14 @@ class Setting < RailsSettings::Base
#
field :nostr_enabled, type: :boolean, default: true
+
+ #
+ # RemoteStorage
+ #
+
+ field :remotestorage_enabled, type: :boolean,
+ default: (ENV["RS_STORAGE_URL"].present?.to_s || false)
+
+ field :rs_storage_url, type: :string,
+ default: ENV["RS_STORAGE_URL"].presence
end
diff --git a/app/views/admin/settings/services/_remotestorage.html.erb b/app/views/admin/settings/services/_remotestorage.html.erb
new file mode 100644
index 0000000..fdfa3f4
--- /dev/null
+++ b/app/views/admin/settings/services/_remotestorage.html.erb
@@ -0,0 +1,17 @@
+
RemoteStorage
+
+ <%= render FormElements::FieldsetToggleComponent.new(
+ form: f,
+ attribute: :remotestorage_enabled,
+ enabled: Setting.remotestorage_enabled?,
+ title: "Enable RemoteStorage integration",
+ description: "RemoteStorage configuration present and features enabled"
+ ) %>
+ <% if Setting.remotestorage_enabled? %>
+ <%= render FormElements::FieldsetComponent.new(title: "Storage URL") do %>
+ <%= f.text_field :rs_storage_url,
+ value: Setting.rs_storage_url,
+ class: "w-full", disabled: true %>
+ <% end %>
+ <% end %>
+
diff --git a/app/views/shared/_admin_sidenav_settings_services.html.erb b/app/views/shared/_admin_sidenav_settings_services.html.erb
index c897b6d..142f6fc 100644
--- a/app/views/shared/_admin_sidenav_settings_services.html.erb
+++ b/app/views/shared/_admin_sidenav_settings_services.html.erb
@@ -47,3 +47,10 @@
icon: Setting.nostr_enabled? ? "check" : "x",
active: current_page?(admin_settings_services_path(params: { s: "nostr" })),
) %>
+<%= render SidenavLinkComponent.new(
+ level: 2,
+ name: "RemoteStorage",
+ path: admin_settings_services_path(params: { s: "remotestorage" }),
+ icon: Setting.remotestorage_enabled? ? "check" : "x",
+ active: current_page?(admin_settings_services_path(params: { s: "remotestorage" })),
+) %>
diff --git a/spec/features/admin/settings_spec.rb b/spec/features/admin/settings_spec.rb
index 7a394ba..a522d31 100644
--- a/spec/features/admin/settings_spec.rb
+++ b/spec/features/admin/settings_spec.rb
@@ -46,5 +46,26 @@ RSpec.describe 'Admin/global settings', type: :feature do
expect(page).to_not have_checked_field("setting[ejabberd_enabled]")
expect(page).to_not have_field("API URL", disabled: true)
end
+
+ scenario "View remoteStorage settings" do
+ visit admin_settings_services_path(params: { s: "remotestorage" })
+
+ expect(page).to have_content("Enable RemoteStorage integration")
+ expect(page).to have_field("Storage URL",
+ with: "https://storage.kosmos.org",
+ disabled: true)
+ end
+
+ scenario "Disable remoteStorage integration" do
+ visit admin_settings_services_path(params: { s: "remotestorage" })
+ expect(page).to have_checked_field("setting[remotestorage_enabled]")
+
+ uncheck "setting[remotestorage_enabled]"
+ click_button "Save"
+
+ expect(current_url).to eq(admin_settings_services_url(params: { s: "remotestorage" }))
+ expect(page).to_not have_checked_field("setting[remotestorage_enabled]")
+ expect(page).to_not have_field("Storage URL", disabled: true)
+ end
end
end