33 Commits

Author SHA1 Message Date
d12c63db26 Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-10 16:07:24 +02:00
af3da0a26c Set CORS headers for all .well-known responses
All checks were successful
continuous-integration/drone/push Build is passing
So we don't have to consider it for reverse proxies etc.
2024-09-10 16:06:11 +02:00
45137e0cfe Merge pull request 'Fix Ruby issue on Apple silicon (without compiling a patched Ruby)' (#201) from chore/update_docker_image into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #201
Reviewed-by: galfert <garret.alfert@gmail.com>
2024-08-28 08:12:31 +00:00
717fe93104 Fix spec
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-22 14:07:54 +02:00
e6a9ef84ce Merge branch 'master' into live
Some checks failed
continuous-integration/drone/push Build is failing
2024-08-19 15:13:46 +02:00
fdac789ccb Add compatibility section to RS service page
Some checks failed
continuous-integration/drone/push Build is failing
2024-08-19 15:13:19 +02:00
b7e91344a0 Merge branch 'master' into live
Some checks failed
continuous-integration/drone/push Build is failing
2024-08-19 14:48:35 +02:00
9355dab6b6 Enable RS service for all new users for now
Some checks failed
continuous-integration/drone/push Build is failing
2024-08-19 14:48:24 +02:00
0f07e32781 Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-17 14:49:29 +02:00
1311b5ed6a Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-17 14:46:00 +02:00
12f82061e8 Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-17 14:42:32 +02:00
e08ea64f47 Update Docker base image
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 5s
Fixes the bug with Ruby on Apple silicon
2024-08-12 10:34:02 +02:00
8cc2c9554f Revert "Fix Ruby in Docker container on Apple silicon"
This reverts commit bbf3fb91a0.
2024-08-12 10:15:18 +02:00
a07b4369ab Hide njump link for users without pubkey
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-23 17:33:34 +02:00
2605c06807 Merge branch 'feature/admin_pages' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-23 17:30:22 +02:00
1db768fb15 Merge branch 'feature/admin_pages' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-23 17:27:03 +02:00
8a7403df32 Merge branch 'feature/own_relay' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-20 15:52:03 +02:00
f0295fef7a Merge branch 'feature/own_relay' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-20 15:28:55 +02:00
090affd304 Merge branch 'feature/own_relay' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-20 14:51:20 +02:00
bafddd436b Merge branch 'feature/own_relay' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-20 13:59:59 +02:00
560f193c4b Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-20 13:56:11 +02:00
8aabbad5bb Merge branch 'feature/strfry_zap_receipts' into live 2024-06-20 13:56:00 +02:00
ba8d21eb7a Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-09 13:29:57 +02:00
53df455d53 Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-09 13:17:51 +02:00
9f1af3a9aa Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-07 14:13:53 +02:00
1d09008ce2 Merge branch 'master' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-06-04 17:45:13 +02:00
57c5317c38 Merge branch 'feature/170-nostr_zaps' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-21 18:29:13 +02:00
41bd920060 Merge branch 'feature/170-nostr_zaps' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-21 18:09:09 +02:00
0815fa6040 Merge branch 'feature/170-nostr_zaps' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-19 17:07:58 +02:00
af0e99aa50 Merge branch 'feature/170-nostr_zaps' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-19 16:55:10 +02:00
f05eec5255 Merge branch 'feature/170-nostr_zaps' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-19 16:48:28 +02:00
66ca2dc6b0 Merge branch 'feature/173-nostr_ldap' into live
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-19 13:44:24 +02:00
800183e9da Increase sidekiq concurrency in prod
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-19 13:44:01 +02:00
11 changed files with 50 additions and 51 deletions

View File

@@ -1,18 +1,11 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM debian:bullseye-slim as base FROM ruby:3.3.4
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# TODO Remove when upstream Ruby works properly on Apple silicon RUN apt-get update -qq && apt-get install -y --no-install-recommends curl \
RUN apt update && apt install -y build-essential wget autoconf libpq-dev pkg-config ldap-utils tini libvips
RUN wget https://github.com/postmodern/ruby-install/releases/download/v0.9.3/ruby-install-0.9.3.tar.gz \
&& tar -xzvf ruby-install-0.9.3.tar.gz \
&& cd ruby-install-0.9.3/ \
&& make install
RUN ruby-install -p https://github.com/ruby/ruby/pull/9371.diff ruby 3.3.0
ENV PATH="/opt/rubies/ruby-3.3.0/bin:${PATH}"
RUN apt-get install -y --no-install-recommends curl ldap-utils tini libvips
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get update && apt-get install -y nodejs RUN apt-get update && apt-get install -y nodejs

View File

@@ -1,8 +1,6 @@
class WebfingerController < ApplicationController class WebfingerController < WellKnownController
before_action :allow_cross_origin_requests, only: [:show] before_action :allow_cross_origin_requests, only: [:show]
layout false
def show def show
resource = params[:resource] resource = params[:resource]
@@ -91,10 +89,4 @@ class WebfingerController < ApplicationController
} }
} }
end end
def allow_cross_origin_requests
return unless Rails.env.development?
headers['Access-Control-Allow-Origin'] = "*"
headers['Access-Control-Allow-Methods'] = "GET"
end
end end

View File

@@ -1,5 +1,8 @@
class WellKnownController < ApplicationController class WellKnownController < ApplicationController
before_action :require_nostr_enabled, only: [ :nostr ] before_action :require_nostr_enabled, only: [ :nostr ]
before_action :allow_cross_origin_requests, only: [ :nostr ]
layout false
def nostr def nostr
http_status :unprocessable_entity and return if params[:name].blank? http_status :unprocessable_entity and return if params[:name].blank?
@@ -30,4 +33,9 @@ class WellKnownController < ApplicationController
def require_nostr_enabled def require_nostr_enabled
http_status :not_found unless Setting.nostr_enabled? http_status :not_found unless Setting.nostr_enabled?
end end
def allow_cross_origin_requests
headers['Access-Control-Allow-Origin'] = "*"
headers['Access-Control-Allow-Methods'] = "GET"
end
end end

View File

@@ -222,6 +222,6 @@ class Setting < RailsSettings::Base
def self.default_services def self.default_services
# TODO Make configurable from respective service settings page # TODO Make configurable from respective service settings page
%w[ discourse gitea mastodon mediawiki xmpp ] %w[ discourse gitea mastodon mediawiki remotestorage xmpp ]
end end
end end

View File

@@ -205,7 +205,9 @@
) %> ) %>
</td> </td>
<td class="text-right"> <td class="text-right">
<% if @user.nostr_pubkey.present? %>
<%= link_to "Open profile", "https://njump.me/#{@user.nostr_pubkey_bech32}", class: "btn-sm btn-gray" %> <%= link_to "Open profile", "https://njump.me/#{@user.nostr_pubkey_bech32}", class: "btn-sm btn-gray" %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@@ -14,7 +14,8 @@
<p class="mb-6"> <p class="mb-6">
In order to connect an app to your storage account, give it your address: In order to connect an app to your storage account, give it your address:
</p> </p>
<p data-controller="clipboard" class="flex gap-1 sm:w-2/5"> <p data-controller="clipboard" class="flex items-center gap-1 sm:w-2/5">
<img src="/img/logos/icon_remotestorage.svg" class="inline-block h-6 w-6 mr-1">
<input type="text" id="user_address" class="grow" <input type="text" id="user_address" class="grow"
value=<%= current_user.address %> disabled="disabled" value=<%= current_user.address %> disabled="disabled"
data-clipboard-target="source" /> data-clipboard-target="source" />
@@ -31,6 +32,24 @@
</p> </p>
</section> </section>
<section>
<h3>Compatible Apps</h3>
<p>
Your Storage account is based on a new open standard called
<a href="https://remotestorage.io" target="_blank">
<img src="/img/logos/icon_remotestorage.svg" class="h-4 w-4 inline">
<strong>remoteStorage</strong>
</a>, which is not yet widely supported. Look
for the remoteStorage icon, or check the Sync settings in apps.
</p>
<p>
If you want your favorite apps to support syncing data with your own
Storage account, let the developers know! All relevant information is
available on the <a href="https://remotestorage.io"
target="_blank" class="ks-text-link">remoteStorage website</a>.
</p>
</section>
<section> <section>
<h3>Recommended Apps</h3> <h3>Recommended Apps</h3>
<div data-controller="tabs" <div data-controller="tabs"

View File

@@ -1,4 +1,6 @@
:concurrency: 2 :concurrency: 2
production:
:concurrency: 10
:queues: :queues:
- default - default
- mailers - mailers

View File

@@ -1,29 +0,0 @@
# strfry (nostr relay)
## LDAP policy
...
## Useful scripts
### Syncing events for all local nostr users from a remote relay
You can sync all events of all local users with a pubkey stored in LDAP from a
specified remote relay to the local relay with the `strfry-sync.ts` script:
deno run -A /opt/strfry-sync.ts wss://relay.example.com
Doing the same with Docker Compose (great for seeding data to your local relay
in development):
docker compose run strfry deno run -A /opt/strfry-sync.ts wss://relay.example.com
## Docker image
In order to use the LDAP policy with Docker, you will need
[Deno](https://deno.com/) installed in your strfry container. We provide a
custom Docker image for strfry with Deno included (which we use in
development):
* Registry: https://gitea.kosmos.org/kosmos/-/packages/container/strfry-deno/1.1.1
* Source: https://github.com/raucao/strfry/blob/docker_deno/ubuntu.Dockerfile

View File

@@ -178,7 +178,7 @@ RSpec.describe User, type: :model do
after { clear_enqueued_jobs } after { clear_enqueued_jobs }
it "enables default services" do it "enables default services" do
expect(user).to receive(:enable_service).with(%w[ discourse gitea mastodon mediawiki xmpp ]) expect(user).to receive(:enable_service).with(%w[ discourse gitea mastodon mediawiki remotestorage xmpp ])
user.send :devise_after_confirmation user.send :devise_after_confirmation
end end

View File

@@ -94,6 +94,12 @@ RSpec.describe "WebFinger", type: :request do
oauth_url = rs_link["properties"]["http://tools.ietf.org/html/rfc6749#section-4.2"] oauth_url = rs_link["properties"]["http://tools.ietf.org/html/rfc6749#section-4.2"]
expect(oauth_url).to eql("http://www.example.com/rs/oauth/tony") expect(oauth_url).to eql("http://www.example.com/rs/oauth/tony")
end end
it "returns CORS headers" do
get "/.well-known/nostr.json?name=bobdylan"
expect(response.headers['Access-Control-Allow-Origin']).to eq("*")
expect(response.headers['Access-Control-Allow-Methods']).to eq('GET')
end
end end
context "remoteStorage not enabled for user" do context "remoteStorage not enabled for user" do

View File

@@ -46,6 +46,12 @@ RSpec.describe "Well-known URLs", type: :request do
expect(res["names"]["bobdylan"]).to eq(user.nostr_pubkey) expect(res["names"]["bobdylan"]).to eq(user.nostr_pubkey)
end end
it "returns CORS headers" do
get "/.well-known/nostr.json?name=bobdylan"
expect(response.headers['Access-Control-Allow-Origin']).to eq("*")
expect(response.headers['Access-Control-Allow-Methods']).to eq('GET')
end
context "without relay configured" do context "without relay configured" do
before do before do
Setting.nostr_relay_url = "" Setting.nostr_relay_url = ""