diff --git a/Gemfile b/Gemfile index 9aa5bca..fe749cb 100644 --- a/Gemfile +++ b/Gemfile @@ -61,7 +61,7 @@ gem "sentry-rails" # Services gem 'discourse_api' gem "lnurl" -gem 'manifique' +gem 'manifique', '~> 1.1.0' gem 'nostr', '~> 0.6.0' group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index ead85a4..59cb7d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -245,7 +245,7 @@ GEM net-imap net-pop net-smtp - manifique (1.0.1) + manifique (1.1.0) faraday (~> 2.9.0) faraday-follow_redirects (= 0.3.0) nokogiri (~> 1.16.0) @@ -515,7 +515,7 @@ DEPENDENCIES listen (~> 3.2) lnurl lockbox - manifique + manifique (~> 1.1.0) net-ldap nostr (~> 0.6.0) pagy (~> 6.0, >= 6.0.2) diff --git a/app/controllers/services/remotestorage_controller.rb b/app/controllers/services/remotestorage_controller.rb index 15726d4..4a7801e 100644 --- a/app/controllers/services/remotestorage_controller.rb +++ b/app/controllers/services/remotestorage_controller.rb @@ -8,8 +8,7 @@ class Services::RemotestorageController < Services::BaseController # unless current_user.service_enabled?(:remotestorage) # redirect_to service_remotestorage_info_path # end - @rs_auths = current_user.remote_storage_authorizations - # TODO sort by app name + # @rs_apps_connected = current_user.remote_storage_authorizations.any? end private diff --git a/app/controllers/services/rs_auths_controller.rb b/app/controllers/services/rs_auths_controller.rb index e31f046..2cbcb6c 100644 --- a/app/controllers/services/rs_auths_controller.rb +++ b/app/controllers/services/rs_auths_controller.rb @@ -3,7 +3,12 @@ class Services::RsAuthsController < Services::BaseController before_action :require_feature_enabled before_action :require_service_available # before_action :require_service_enabled - before_action :find_rs_auth + before_action :find_rs_auth, only: [:destroy, :launch_app] + + def index + @rs_auths = current_user.remote_storage_authorizations + # TODO sort by app name? + end def destroy @auth.destroy! diff --git a/app/controllers/well_known_controller.rb b/app/controllers/well_known_controller.rb index b028562..72443be 100644 --- a/app/controllers/well_known_controller.rb +++ b/app/controllers/well_known_controller.rb @@ -4,7 +4,7 @@ class WellKnownController < ApplicationController def nostr http_status :unprocessable_entity and return if params[:name].blank? domain = request.headers["X-Forwarded-Host"].presence || Setting.primary_domain - relay_url = Setting.nostr_relay_url + relay_url = Setting.nostr_relay_url.presence if params[:name] == "_" # pubkey for the primary domain without a username (e.g. kosmos.org) diff --git a/app/views/contributions/projects/index.html.erb b/app/views/contributions/projects/index.html.erb index 3a299e1..253b860 100644 --- a/app/views/contributions/projects/index.html.erb +++ b/app/views/contributions/projects/index.html.erb @@ -43,7 +43,7 @@

We have run two 6-month trials so far, with the next trial period - starting sometime in Q2 2024. Watch your email for notifications about it! + starting sometime soon. Watch your email for notifications about it!

<% end %> diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 5f2e8a6..1bd8c27 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -41,15 +41,16 @@ <% end %> <% end %> - <% if Setting.discourse_enabled? %> + <% if Setting.remotestorage_enabled? && + Flipper.enabled?(:remotestorage, current_user) %>
- <%= link_to "#{Setting.discourse_public_url}/session/sso?return_path=/", + bg-[length:80%] bg-[center_top_-156px] bg-no-repeat + bg-[url(/img/logos/icon_remotestorage.svg)]"> + <%= link_to services_storage_path, class: "block h-full px-6 py-6 rounded-md" do %> -

Discourse

+

Storage

- Community forums and support/help site + Sync your data between apps and devices

<% end %>
@@ -67,16 +68,15 @@ <% end %> <% end %> - <% if Setting.remotestorage_enabled? && - Flipper.enabled?(:remotestorage, current_user) %> + <% if Setting.discourse_enabled? %>
- <%= link_to services_storage_path, + bg-[length:80%] bg-center bg-no-repeat + bg-[url(/img/logos/icon_discourse.svg)]"> + <%= link_to "#{Setting.discourse_public_url}/session/sso?return_path=/", class: "block h-full px-6 py-6 rounded-md" do %> -

Storage

+

Discourse

- Sync your data between apps and devices + Community forums and support/help site

<% end %>
diff --git a/app/views/services/remotestorage/show.html.erb b/app/views/services/remotestorage/show.html.erb index 58b7ed7..14fe8ea 100644 --- a/app/views/services/remotestorage/show.html.erb +++ b/app/views/services/remotestorage/show.html.erb @@ -2,15 +2,143 @@ <%= render MainSimpleComponent.new do %>
-

Connected Apps

- <% if @rs_auths.any? %> -
- <% @rs_auths.each do |auth| %> - <%= render RsAuthComponent.new(auth: auth) %> - <% end %> +

+ Store and synchronize your app data across different devices. +

+
+ + <%= render partial: "shared/tabnav_remotestorage" %> + +
+

Your Storage Address

+

+ In order to connect an app to your storage account, give it your address: +

+

+ disabled="disabled" + data-clipboard-target="source" /> + +

+
+ +
+

Recommended Apps

+
+ + + + + + + +
- <% else %> -

No apps connected yet.

- <% end %>
<% end %> diff --git a/app/views/services/rs_auths/index.html.erb b/app/views/services/rs_auths/index.html.erb new file mode 100644 index 0000000..939df14 --- /dev/null +++ b/app/views/services/rs_auths/index.html.erb @@ -0,0 +1,33 @@ +<%= render HeaderComponent.new(title: "Storage") %> + +<%= render MainSimpleComponent.new do %> +
+

+ Store and synchronize your app data across different devices. +

+
+ + <%= render partial: "shared/tabnav_remotestorage" %> + +
+ <% if @rs_auths.any? %> +
+ <% @rs_auths.each do |auth| %> + <%= render RsAuthComponent.new(auth: auth) %> + <% end %> +
+ <% else %> +
+

+ <%= image_tag("/img/illustrations/undraw_friends_r511.svg", class: 'h-48') %> +

+

+ No apps connected +

+

+ When connected, your apps will show up here. +

+
+ <% end %> +
+<% end %> diff --git a/app/views/shared/_tabnav_remotestorage.html.erb b/app/views/shared/_tabnav_remotestorage.html.erb new file mode 100644 index 0000000..0e0f8e4 --- /dev/null +++ b/app/views/shared/_tabnav_remotestorage.html.erb @@ -0,0 +1,14 @@ +
+
+ +
+
diff --git a/config/routes.rb b/config/routes.rb index 383e497..07e1ffe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,7 +48,8 @@ Rails.application.routes.draw do end resource :storage, controller: 'remotestorage', only: [:show] do - resources :rs_auths, only: [:destroy] do + get :apps, to: "rs_auths#index" + resources :rs_auths, only: [:index, :destroy] do member do get :revoke, to: 'rs_auths#destroy' get :launch_app diff --git a/public/img/app_icons/hyperdraft.png b/public/img/app_icons/hyperdraft.png new file mode 100644 index 0000000..d777678 Binary files /dev/null and b/public/img/app_icons/hyperdraft.png differ diff --git a/public/img/app_icons/kommit.png b/public/img/app_icons/kommit.png new file mode 100644 index 0000000..f87f6ae Binary files /dev/null and b/public/img/app_icons/kommit.png differ diff --git a/public/img/app_icons/notes-together.png b/public/img/app_icons/notes-together.png new file mode 100644 index 0000000..09c9e4c Binary files /dev/null and b/public/img/app_icons/notes-together.png differ diff --git a/public/img/app_icons/papiers.png b/public/img/app_icons/papiers.png new file mode 100644 index 0000000..28f324f Binary files /dev/null and b/public/img/app_icons/papiers.png differ diff --git a/public/img/app_icons/petrolette.png b/public/img/app_icons/petrolette.png new file mode 100644 index 0000000..0f89959 Binary files /dev/null and b/public/img/app_icons/petrolette.png differ diff --git a/public/img/app_icons/sharesome.png b/public/img/app_icons/sharesome.png new file mode 100644 index 0000000..4840928 Binary files /dev/null and b/public/img/app_icons/sharesome.png differ diff --git a/public/img/app_icons/webmarks.png b/public/img/app_icons/webmarks.png new file mode 100644 index 0000000..e60a306 Binary files /dev/null and b/public/img/app_icons/webmarks.png differ diff --git a/public/img/illustrations/undraw_friends_r511.svg b/public/img/illustrations/undraw_friends_r511.svg new file mode 100644 index 0000000..dc572e3 --- /dev/null +++ b/public/img/illustrations/undraw_friends_r511.svg @@ -0,0 +1 @@ +friends \ No newline at end of file diff --git a/spec/requests/well_known_spec.rb b/spec/requests/well_known_spec.rb index 989ed00..97c617f 100644 --- a/spec/requests/well_known_spec.rb +++ b/spec/requests/well_known_spec.rb @@ -47,6 +47,10 @@ RSpec.describe "Well-known URLs", type: :request do end context "without relay configured" do + before do + Setting.nostr_relay_url = "" + end + it "does not include a recommended relay" do get "/.well-known/nostr.json?name=bobdylan" res = JSON.parse(response.body) diff --git a/spec/services/nostr_manager/publish_zap_receipt_spec.rb b/spec/services/nostr_manager/publish_zap_receipt_spec.rb index 5136af9..02885bb 100644 --- a/spec/services/nostr_manager/publish_zap_receipt_spec.rb +++ b/spec/services/nostr_manager/publish_zap_receipt_spec.rb @@ -4,6 +4,10 @@ RSpec.describe NostrManager::PublishZapReceipt, type: :model do let(:user) { create :user, ln_account: "123456abcdef" } let(:zap) { create :zap, user: user } + before do + Setting.nostr_relay_url = "" + end + describe "Default/delayed execution" do it "publishes zap receipts to all requested relays" do expect(NostrPublishEventJob).to receive(:perform_later)