Compare commits
32
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
407d9f633e
|
||
|
|
a9045fa413
|
||
|
|
52742ba305
|
||
|
|
6bfe63c234
|
||
|
|
12a1570c7d
|
||
|
|
4c20e8d7e0
|
||
|
|
d2152d0ca4
|
||
|
|
cbde625a5d
|
||
|
|
2fd71d64aa
|
||
|
|
22d29b642c
|
||
|
|
c11534ab81
|
||
|
|
6577fd0251
|
||
|
|
949d158b15
|
||
|
|
ea4767acc9
|
||
|
|
0dcd07c6f7
|
||
|
|
4f22471aa0
|
||
|
|
3e6971b2d1
|
||
|
|
7ebc4d3833
|
||
|
|
82385913b2
|
||
|
|
79e78623e0
|
||
|
|
4536b6505c
|
||
|
|
8453c38f41
|
||
|
|
1957df3bbd
|
||
|
|
d196c161df
|
||
|
|
44b5a0b36b
|
||
|
|
5ebf496096
|
||
|
|
7a63c87b03
|
||
|
|
6cc35f07eb
|
||
|
|
89423ecf84
|
||
|
|
c79c421b89
|
||
|
|
8a8d407bcc
|
||
|
|
045df94c29
|
@@ -87,6 +87,7 @@
|
||||
# NOSTR_PRIVATE_KEY='123456abcdef...'
|
||||
# NOSTR_PUBLIC_KEY='123456abcdef...'
|
||||
# NOSTR_RELAY_URL='wss://nostr.kosmos.org'
|
||||
# NOSTR_BLOSSOM_SERVER_URL='https://blossom.kosmos.org'
|
||||
|
||||
# RS_STORAGE_URL='https://storage.kosmos.org'
|
||||
# RS_REDIS_URL='redis://localhost:6379/2'
|
||||
|
||||
@@ -63,7 +63,6 @@ Warden `Test::Helpers`, DatabaseCleaner (transactional fixtures **off**), ViewCo
|
||||
and assert on DB rows / `enqueued_jobs`.
|
||||
- **Request/component/mailer/job/model/helper** specs in matching `spec/` subdirs.
|
||||
Fixtures live in `spec/fixtures/`; factories in `spec/factories/`.
|
||||
- `spec_helper.rb` reloads routes before each `type: :controller` spec (Devise + Rails 8 workaround).
|
||||
|
||||
## Notes & gotchas
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ source 'https://rubygems.org'
|
||||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '~> 8.0'
|
||||
gem 'rails', '~> 8.1'
|
||||
# Use Puma as the app server
|
||||
gem 'puma', '~> 6.6'
|
||||
gem 'puma', '~> 8.0'
|
||||
# View components
|
||||
gem "view_component"
|
||||
# Asset bundler
|
||||
@@ -18,7 +18,7 @@ gem "turbo-rails"
|
||||
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
||||
gem "stimulus-rails"
|
||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||
gem 'jbuilder', '~> 2.7'
|
||||
gem 'jbuilder', '~> 2.15'
|
||||
# Use Active Model has_secure_password
|
||||
gem 'bcrypt', '~> 3.1'
|
||||
|
||||
@@ -27,7 +27,7 @@ gem 'dotenv-rails'
|
||||
|
||||
# Authentication
|
||||
gem 'warden'
|
||||
gem 'devise', '~> 4.9.0'
|
||||
gem 'devise', '~> 5.0'
|
||||
gem 'devise_ldap_authenticatable'
|
||||
gem 'net-ldap'
|
||||
|
||||
@@ -73,7 +73,7 @@ end
|
||||
|
||||
group :development do
|
||||
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
||||
gem 'web-console', '~> 4.2'
|
||||
gem 'web-console', '~> 4.3'
|
||||
gem 'listen', '~> 3.2'
|
||||
gem 'letter_opener'
|
||||
gem 'letter_opener_web'
|
||||
|
||||
+149
-140
@@ -3,29 +3,31 @@ GEM
|
||||
specs:
|
||||
aasm (5.5.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
action_text-trix (2.1.19)
|
||||
railties
|
||||
actioncable (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activestorage (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
actionmailbox (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activestorage (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
actionview (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
actionmailer (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
actionview (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (8.0.2)
|
||||
actionview (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
actionpack (8.1.3.1)
|
||||
actionview (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
nokogiri (>= 1.8.5)
|
||||
rack (>= 2.2.4)
|
||||
rack-session (>= 1.0.1)
|
||||
@@ -33,42 +35,43 @@ GEM
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
useragent (~> 0.16)
|
||||
actiontext (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activestorage (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
actiontext (8.1.3.1)
|
||||
action_text-trix (~> 2.1.15)
|
||||
actionpack (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activestorage (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
actionview (8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
activejob (8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
activejob (8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
activerecord (8.0.2)
|
||||
activemodel (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
activemodel (8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
activerecord (8.1.3.1)
|
||||
activemodel (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
activestorage (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
marcel (~> 1.0)
|
||||
activesupport (8.0.2)
|
||||
activesupport (8.1.3.1)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
json
|
||||
logger (>= 1.4.2)
|
||||
minitest (>= 5.1)
|
||||
securerandom (>= 0.3)
|
||||
@@ -96,12 +99,12 @@ GEM
|
||||
aws-sigv4 (1.11.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
backport (1.2.0)
|
||||
base64 (0.2.0)
|
||||
bcrypt (3.1.20)
|
||||
base64 (0.3.0)
|
||||
bcrypt (3.1.22)
|
||||
bech32 (1.5.0)
|
||||
thor (>= 1.1.0)
|
||||
benchmark (0.4.0)
|
||||
bigdecimal (3.1.9)
|
||||
benchmark (0.5.0)
|
||||
bigdecimal (4.1.2)
|
||||
bindex (0.8.1)
|
||||
bip-schnorr (0.7.0)
|
||||
ecdsa_ext (~> 0.5.0)
|
||||
@@ -118,12 +121,12 @@ GEM
|
||||
childprocess (5.1.0)
|
||||
logger (~> 1.5)
|
||||
chunky_png (1.4.0)
|
||||
concurrent-ruby (1.3.4)
|
||||
connection_pool (2.5.2)
|
||||
concurrent-ruby (1.3.8)
|
||||
connection_pool (3.0.2)
|
||||
crack (1.0.0)
|
||||
bigdecimal
|
||||
rexml
|
||||
crass (1.0.6)
|
||||
crass (1.0.7)
|
||||
cssbundling-rails (1.4.3)
|
||||
railties (>= 6.0.0)
|
||||
database_cleaner (2.1.0)
|
||||
@@ -132,17 +135,17 @@ GEM
|
||||
activerecord (>= 5.a)
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
database_cleaner-core (2.0.1)
|
||||
date (3.4.1)
|
||||
devise (4.9.4)
|
||||
date (3.5.1)
|
||||
devise (5.0.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
railties (>= 7.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
devise_ldap_authenticatable (0.8.7)
|
||||
devise (>= 3.4.1)
|
||||
net-ldap (>= 0.16.0)
|
||||
diff-lcs (1.6.1)
|
||||
diff-lcs (1.6.2)
|
||||
discourse_api (2.0.1)
|
||||
faraday (~> 2.7)
|
||||
faraday-follow_redirects
|
||||
@@ -154,12 +157,13 @@ GEM
|
||||
railties (>= 6.1)
|
||||
down (5.4.2)
|
||||
addressable (~> 2.8)
|
||||
drb (2.2.1)
|
||||
drb (2.2.3)
|
||||
ecdsa (1.2.0)
|
||||
ecdsa_ext (0.5.1)
|
||||
ecdsa (~> 1.2.0)
|
||||
erb (6.0.7)
|
||||
erubi (1.13.1)
|
||||
et-orbi (1.2.11)
|
||||
et-orbi (1.4.1)
|
||||
tzinfo
|
||||
event_emitter (0.2.6)
|
||||
eventmachine (1.2.7)
|
||||
@@ -196,34 +200,35 @@ GEM
|
||||
rack-protection (>= 1.5.3, < 5.0.0)
|
||||
rack-session (>= 1.0.2, < 3.0.0)
|
||||
sanitize (< 8)
|
||||
fugit (1.11.1)
|
||||
et-orbi (~> 1, >= 1.2.11)
|
||||
fugit (1.13.0)
|
||||
et-orbi (~> 1.4)
|
||||
raabro (~> 1.4)
|
||||
globalid (1.2.1)
|
||||
globalid (1.4.0)
|
||||
activesupport (>= 6.1)
|
||||
gpgme (2.0.24)
|
||||
mini_portile2 (~> 2.7)
|
||||
hashdiff (1.1.2)
|
||||
i18n (1.14.7)
|
||||
i18n (1.15.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
image_processing (1.12.2)
|
||||
mini_magick (>= 4.9.5, < 5)
|
||||
ruby-vips (>= 2.0.17, < 3)
|
||||
importmap-rails (2.1.0)
|
||||
importmap-rails (2.2.3)
|
||||
actionpack (>= 6.0.0)
|
||||
activesupport (>= 6.0.0)
|
||||
railties (>= 6.0.0)
|
||||
io-console (0.8.0)
|
||||
irb (1.15.2)
|
||||
io-console (0.9.2)
|
||||
irb (1.18.0)
|
||||
pp (>= 0.6.0)
|
||||
prism (>= 1.3.0)
|
||||
rdoc (>= 4.0.0)
|
||||
reline (>= 0.4.2)
|
||||
jaro_winkler (1.6.0)
|
||||
jbuilder (2.13.0)
|
||||
actionview (>= 5.0.0)
|
||||
activesupport (>= 5.0.0)
|
||||
jbuilder (2.15.1)
|
||||
actionview (>= 7.0.0)
|
||||
activesupport (>= 7.0.0)
|
||||
jmespath (1.6.2)
|
||||
json (2.11.3)
|
||||
json (2.21.2)
|
||||
kramdown (2.5.1)
|
||||
rexml (>= 3.3.9)
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
@@ -247,10 +252,11 @@ GEM
|
||||
lnurl (1.1.1)
|
||||
bech32 (~> 1.1)
|
||||
logger (1.7.0)
|
||||
loofah (2.24.0)
|
||||
loofah (2.25.2)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.12.0)
|
||||
mail (2.8.1)
|
||||
mail (2.9.1)
|
||||
logger
|
||||
mini_mime (>= 0.1.1)
|
||||
net-imap
|
||||
net-pop
|
||||
@@ -259,14 +265,15 @@ GEM
|
||||
faraday (~> 2.9.0)
|
||||
faraday-follow_redirects (= 0.3.0)
|
||||
nokogiri (~> 1.16.0)
|
||||
marcel (1.0.4)
|
||||
marcel (1.2.1)
|
||||
matrix (0.4.2)
|
||||
method_source (1.1.0)
|
||||
mini_magick (4.13.2)
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.8)
|
||||
minitest (5.25.5)
|
||||
mission_control-jobs (1.0.2)
|
||||
mini_portile2 (2.8.9)
|
||||
minitest (6.0.6)
|
||||
drb (~> 2.0)
|
||||
prism (~> 1.5)
|
||||
mission_control-jobs (1.1.0)
|
||||
actioncable (>= 7.1)
|
||||
actionpack (>= 7.1)
|
||||
activejob (>= 7.1)
|
||||
@@ -279,7 +286,7 @@ GEM
|
||||
multipart-post (2.4.1)
|
||||
net-http (0.6.0)
|
||||
uri
|
||||
net-imap (0.5.7)
|
||||
net-imap (0.6.6)
|
||||
date
|
||||
net-protocol
|
||||
net-ldap (0.19.0)
|
||||
@@ -289,7 +296,7 @@ GEM
|
||||
timeout
|
||||
net-smtp (0.5.1)
|
||||
net-protocol
|
||||
nio4r (2.7.4)
|
||||
nio4r (2.7.5)
|
||||
nokogiri (1.16.8)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
@@ -313,24 +320,23 @@ GEM
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
pg (1.5.9)
|
||||
pp (0.6.2)
|
||||
pp (0.6.4)
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
prism (1.4.0)
|
||||
propshaft (1.1.0)
|
||||
prism (1.9.0)
|
||||
propshaft (1.3.2)
|
||||
actionpack (>= 7.0.0)
|
||||
activesupport (>= 7.0.0)
|
||||
rack
|
||||
railties (>= 7.0.0)
|
||||
psych (5.2.3)
|
||||
psych (5.4.0)
|
||||
date
|
||||
stringio
|
||||
public_suffix (6.0.1)
|
||||
puma (6.6.0)
|
||||
puma (8.0.2)
|
||||
nio4r (~> 2.0)
|
||||
raabro (1.4.0)
|
||||
raabro (1.5.0)
|
||||
racc (1.8.1)
|
||||
rack (2.2.13)
|
||||
rack (2.2.23)
|
||||
rack-protection (3.2.0)
|
||||
base64 (>= 0.1.0)
|
||||
rack (~> 2.2, >= 2.2.4)
|
||||
@@ -341,61 +347,64 @@ GEM
|
||||
rackup (1.0.1)
|
||||
rack (< 3)
|
||||
webrick
|
||||
rails (8.0.2)
|
||||
actioncable (= 8.0.2)
|
||||
actionmailbox (= 8.0.2)
|
||||
actionmailer (= 8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
actiontext (= 8.0.2)
|
||||
actionview (= 8.0.2)
|
||||
activejob (= 8.0.2)
|
||||
activemodel (= 8.0.2)
|
||||
activerecord (= 8.0.2)
|
||||
activestorage (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
rails (8.1.3.1)
|
||||
actioncable (= 8.1.3.1)
|
||||
actionmailbox (= 8.1.3.1)
|
||||
actionmailer (= 8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
actiontext (= 8.1.3.1)
|
||||
actionview (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activemodel (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activestorage (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 8.0.2)
|
||||
railties (= 8.1.3.1)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
rails-dom-testing (2.2.0)
|
||||
rails-dom-testing (2.3.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.6.2)
|
||||
loofah (~> 2.21)
|
||||
rails-html-sanitizer (1.7.1)
|
||||
loofah (~> 2.25, >= 2.25.2)
|
||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||
rails-settings-cached (2.8.3)
|
||||
activerecord (>= 5.0.0)
|
||||
railties (>= 5.0.0)
|
||||
railties (8.0.2)
|
||||
actionpack (= 8.0.2)
|
||||
activesupport (= 8.0.2)
|
||||
railties (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
tsort (>= 0.2)
|
||||
zeitwerk (~> 2.6)
|
||||
rainbow (3.1.1)
|
||||
rake (13.2.1)
|
||||
rake (13.4.2)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.11.1)
|
||||
ffi (~> 1.0)
|
||||
rbs (3.9.2)
|
||||
logger
|
||||
rdoc (6.13.1)
|
||||
rdoc (7.2.0)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
tsort
|
||||
redis (5.4.0)
|
||||
redis-client (>= 0.22.0)
|
||||
redis-client (0.24.0)
|
||||
connection_pool
|
||||
regexp_parser (2.10.0)
|
||||
reline (0.6.1)
|
||||
reline (0.7.0)
|
||||
io-console (~> 0.5)
|
||||
responders (3.1.1)
|
||||
actionpack (>= 5.2)
|
||||
railties (>= 5.2)
|
||||
responders (3.2.0)
|
||||
actionpack (>= 7.0)
|
||||
railties (>= 7.0)
|
||||
reverse_markdown (3.0.0)
|
||||
nokogiri
|
||||
rexml (3.4.1)
|
||||
@@ -403,23 +412,23 @@ GEM
|
||||
chunky_png (~> 1.0)
|
||||
rqrcode_core (~> 1.0)
|
||||
rqrcode_core (1.2.0)
|
||||
rspec-core (3.13.3)
|
||||
rspec-core (3.13.6)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-expectations (3.13.3)
|
||||
rspec-expectations (3.13.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-mocks (3.13.2)
|
||||
rspec-mocks (3.13.8)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (7.1.1)
|
||||
actionpack (>= 7.0)
|
||||
activesupport (>= 7.0)
|
||||
railties (>= 7.0)
|
||||
rspec-core (~> 3.13)
|
||||
rspec-expectations (~> 3.13)
|
||||
rspec-mocks (~> 3.13)
|
||||
rspec-support (~> 3.13)
|
||||
rspec-support (3.13.2)
|
||||
rspec-rails (8.0.4)
|
||||
actionpack (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
railties (>= 7.2)
|
||||
rspec-core (>= 3.13.0, < 5.0.0)
|
||||
rspec-expectations (>= 3.13.0, < 5.0.0)
|
||||
rspec-mocks (>= 3.13.0, < 5.0.0)
|
||||
rspec-support (>= 3.13.0, < 5.0.0)
|
||||
rspec-support (3.13.7)
|
||||
rubocop (1.75.3)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
@@ -467,24 +476,25 @@ GEM
|
||||
tilt (~> 2.0)
|
||||
yard (~> 0.9, >= 0.9.24)
|
||||
yard-solargraph (~> 0.1)
|
||||
solid_queue (1.1.5)
|
||||
solid_queue (1.6.0)
|
||||
activejob (>= 7.1)
|
||||
activerecord (>= 7.1)
|
||||
concurrent-ruby (>= 1.3.1)
|
||||
fugit (~> 1.11.0)
|
||||
fugit (~> 1.11)
|
||||
railties (>= 7.1)
|
||||
thor (~> 1.3.1)
|
||||
thor (>= 1.3.1)
|
||||
sqlite3 (2.6.0)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
sqlite3 (2.6.0-arm64-darwin)
|
||||
sqlite3 (2.6.0-x86_64-linux-gnu)
|
||||
stimulus-rails (1.3.4)
|
||||
railties (>= 6.0.0)
|
||||
stringio (3.1.7)
|
||||
thor (1.3.2)
|
||||
stringio (3.2.0)
|
||||
thor (1.5.0)
|
||||
tilt (2.6.0)
|
||||
timeout (0.4.3)
|
||||
turbo-rails (2.0.13)
|
||||
timeout (0.6.1)
|
||||
tsort (0.2.0)
|
||||
turbo-rails (2.0.23)
|
||||
actionpack (>= 7.1.0)
|
||||
railties (>= 7.1.0)
|
||||
tzinfo (2.0.6)
|
||||
@@ -492,25 +502,24 @@ GEM
|
||||
unicode-display_width (3.1.4)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
unicode-emoji (4.0.4)
|
||||
uri (1.0.3)
|
||||
uri (1.1.1)
|
||||
useragent (0.16.11)
|
||||
view_component (3.22.0)
|
||||
activesupport (>= 5.2.0, < 8.1)
|
||||
concurrent-ruby (= 1.3.4)
|
||||
method_source (~> 1.0)
|
||||
view_component (4.12.0)
|
||||
actionview (>= 7.1.0)
|
||||
activesupport (>= 7.1.0)
|
||||
concurrent-ruby (~> 1)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
web-console (4.2.1)
|
||||
actionview (>= 6.0.0)
|
||||
activemodel (>= 6.0.0)
|
||||
web-console (4.3.0)
|
||||
actionview (>= 8.0.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 6.0.0)
|
||||
railties (>= 8.0.0)
|
||||
webmock (3.25.1)
|
||||
addressable (>= 2.8.0)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff (>= 0.4.0, < 2.0.0)
|
||||
webrick (1.9.1)
|
||||
websocket-driver (0.7.7)
|
||||
webrick (1.9.2)
|
||||
websocket-driver (0.8.2)
|
||||
base64
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
@@ -520,7 +529,7 @@ GEM
|
||||
yard-solargraph (0.1.0)
|
||||
yard (~> 0.9)
|
||||
zbase32 (0.1.1)
|
||||
zeitwerk (2.7.2)
|
||||
zeitwerk (2.8.3)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-22
|
||||
@@ -534,7 +543,7 @@ DEPENDENCIES
|
||||
capybara
|
||||
cssbundling-rails
|
||||
database_cleaner
|
||||
devise (~> 4.9.0)
|
||||
devise (~> 5.0)
|
||||
devise_ldap_authenticatable
|
||||
discourse_api
|
||||
dotenv-rails
|
||||
@@ -548,7 +557,7 @@ DEPENDENCIES
|
||||
gpgme (~> 2.0.24)
|
||||
image_processing (~> 1.12.2)
|
||||
importmap-rails
|
||||
jbuilder (~> 2.7)
|
||||
jbuilder (~> 2.15)
|
||||
kramdown
|
||||
letter_opener
|
||||
letter_opener_web
|
||||
@@ -561,8 +570,8 @@ DEPENDENCIES
|
||||
pagy (~> 6.0, >= 6.0.2)
|
||||
pg (~> 1.5)
|
||||
propshaft
|
||||
puma (~> 6.6)
|
||||
rails (~> 8.0)
|
||||
puma (~> 8.0)
|
||||
rails (~> 8.1)
|
||||
rails-controller-testing
|
||||
rails-settings-cached (~> 2.8.3)
|
||||
redis (~> 5.4)
|
||||
@@ -578,7 +587,7 @@ DEPENDENCIES
|
||||
tzinfo-data
|
||||
view_component
|
||||
warden
|
||||
web-console (~> 4.2)
|
||||
web-console (~> 4.3)
|
||||
webmock
|
||||
zbase32 (~> 0.1.1)
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<div class="w-[72vw] md:w-[500px]">
|
||||
<header class="absolute z-10 h-36 sm:h-44 inset-x-1 top-1 rounded-t
|
||||
bg-cover bg-center bg-gray-50"
|
||||
style="background-image: url('<%= @profile["banner"]%>');">
|
||||
<div class="inline-block z-20 size-28 sm:size-32 ml-4 mt-16 sm:mt-20">
|
||||
<% if @profile["picture"].present? %>
|
||||
<img src="<%= @profile["picture"] %>"
|
||||
class="inline-block size:28 sm:size-32 rounded-full border-2 border-white" />
|
||||
<% else %>
|
||||
<span class="inline-block size:28 sm:size-32 overflow-hidden rounded-full border-2 border-white bg-gray-100">
|
||||
<svg class="size-full text-gray-300" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z" />
|
||||
</svg>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</header>
|
||||
<main class="mt-44 sm:mt-52">
|
||||
<%= form_for(@user, url: setting_path(:nostr), html: { :method => :put }) do |f| %>
|
||||
<%= render FormElements::FieldsetComponent.new(tag: "div", title: "Display name") do %>
|
||||
<%= f.text_field :display_name, value: @display_name, class: "w-full sm:w-3/5" %>
|
||||
<% if @validation_errors.present? && @validation_errors[:display_name].present? %>
|
||||
<p class="error-msg mt-2"><%= @validation_errors[:display_name].first %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render FormElements::FieldsetComponent.new(tag: "div", title: "Nostr address (NIP-05)") do %>
|
||||
<%= f.text_field :nip05_address, value: @profile["nip05"], class: "w-full sm:w-3/5" %>
|
||||
<% if @validation_errors.present? && @validation_errors[:nip05_address].present? %>
|
||||
<p class="error-msg mt-2"><%= @validation_errors[:nip05_address].first %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render FormElements::FieldsetComponent.new(tag: "div", title: "Ligtning address for Zaps") do %>
|
||||
<%= f.text_field :lud16_address, value: @profile["lud16"], class: "w-full sm:w-3/5" %>
|
||||
<% if @validation_errors.present? && @validation_errors[:lud16_address].present? %>
|
||||
<p class="error-msg mt-2"><%= @validation_errors[:lud16_address].first %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</main>
|
||||
<footer>
|
||||
<%# <%= @profile.inspect %>
|
||||
<%# <%= @profile_event.inspect %>
|
||||
</footer>
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Settings
|
||||
class NostrEditProfileComponent < ViewComponent::Base
|
||||
def initialize(user:, profile_event:)
|
||||
@user = user
|
||||
@profile_event = profile_event
|
||||
@profile = {}
|
||||
@display_name = nil
|
||||
|
||||
if profile_event.present? && profile_event["content"].present?
|
||||
@profile = JSON.parse(profile_event["content"]) rescue {}
|
||||
@display_name = @profile["display_name"] || @profile["displayName"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,45 @@
|
||||
<div class="w-[72vw] md:w-[500px]">
|
||||
<h3 class="mb-6">Edit relays</h3>
|
||||
<%= form_with url: "#", local: true,
|
||||
html: { data: { controller: "relay-list-editor" } } do |f| %>
|
||||
<ul data-relay-list-editor-target="list" class="mb-4 space-y-2">
|
||||
<% @relays.each do |relay| %>
|
||||
<li class="flex gap-x-2 items-center">
|
||||
<input type="text" name="relay_urls[]" value="<%= relay[:url] %>" class="grow" />
|
||||
<select name="relay_markers[]" class="shrink-0 w-32">
|
||||
<option value=""<%= %( selected="selected") if relay[:marker].nil? %>>Read & write</option>
|
||||
<option value="read"<%= %( selected="selected") if relay[:marker] == "read" %>>Read only</option>
|
||||
<option value="write"<%= %( selected="selected") if relay[:marker] == "write" %>>Write only</option>
|
||||
</select>
|
||||
<button type="button" class="btn-md btn-icon btn-outline text-red-700 shrink-0"
|
||||
data-action="click->relay-list-editor#remove" title="Remove relay">
|
||||
<%= render partial: "icons/trash-2", locals: { custom_class: "h-4 w-4" } %>
|
||||
</button>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<template data-relay-list-editor-target="template">
|
||||
<li class="flex gap-x-2 items-center">
|
||||
<input type="text" name="relay_urls[]" value="" class="grow" />
|
||||
<select name="relay_markers[]" class="shrink-0 w-32">
|
||||
<option value="">Read & write</option>
|
||||
<option value="read">Read only</option>
|
||||
<option value="write">Write only</option>
|
||||
</select>
|
||||
<button type="button" class="btn-md btn-icon btn-outline text-red-700 shrink-0"
|
||||
data-action="click->relay-list-editor#remove" title="Remove relay">
|
||||
<%= render partial: "icons/trash-2", locals: { custom_class: "h-4 w-4" } %>
|
||||
</button>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<button type="button" class="btn-md btn-gray w-full mb-6"
|
||||
data-action="click->relay-list-editor#add">
|
||||
<%= render partial: "icons/plus", locals: { custom_class: "h-4 w-4 inline mr-1" } %>
|
||||
Add relay
|
||||
</button>
|
||||
|
||||
<%= f.submit "Save relay list", class: "btn-md btn-blue w-full" %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Settings
|
||||
class NostrEditRelaysComponent < ViewComponent::Base
|
||||
def initialize(nip65_event: nil)
|
||||
@nip65_event = nip65_event
|
||||
@relays = build_relays
|
||||
ensure_site_relay
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_relays
|
||||
if @nip65_event.present?
|
||||
@nip65_event["tags"]
|
||||
.select { |t| t[0] == "r" }
|
||||
.map { |t| { url: t[1], marker: t[2] } }
|
||||
else
|
||||
Setting.nostr_discovery_relays.map { |url| { url: url, marker: nil } }
|
||||
end
|
||||
end
|
||||
|
||||
def ensure_site_relay
|
||||
site_relay_url = Setting.nostr_relay_url
|
||||
return if site_relay_url.blank?
|
||||
|
||||
@relays.reject! { |r| r[:url] == site_relay_url }
|
||||
@relays.unshift({ url: site_relay_url, marker: nil })
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
<% @statuses.each do |status| %>
|
||||
<%= render StatusTextComponent.new(
|
||||
text: status[:text],
|
||||
icon_name: status[:icon_name],
|
||||
icon_color: status[:icon_color]
|
||||
) %>
|
||||
<% end %>
|
||||
|
||||
<% if @status == 1 %>
|
||||
<p class="mt-8">
|
||||
<button class="btn-md btn-blue">
|
||||
Edit my profile
|
||||
</button>
|
||||
</p>
|
||||
<% elsif @status == 2 %>
|
||||
<p class="mt-8">
|
||||
<button class="btn-md btn-blue">
|
||||
Create my profile
|
||||
</button>
|
||||
</p>
|
||||
<% end %>
|
||||
@@ -0,0 +1,53 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Settings
|
||||
class NostrProfileStatusComponent < ViewComponent::Base
|
||||
def initialize(profile_event:, user_address:)
|
||||
@statuses = []
|
||||
|
||||
if profile_event.present?
|
||||
profile = JSON.parse(profile_event["content"])
|
||||
|
||||
@statuses.push({
|
||||
text: "You have a public Nostr profile",
|
||||
icon_name: "check-circle",
|
||||
icon_color: "emerald-500"
|
||||
})
|
||||
|
||||
if profile["nip05"].present? && profile["nip05"] == user_address
|
||||
@statuses.push({
|
||||
text: "Your profile's Nostr address is set to <strong>#{ user_address }</strong>",
|
||||
icon_name: "check-circle",
|
||||
icon_color: "emerald-500"
|
||||
})
|
||||
else
|
||||
@statuses.push({
|
||||
text: "Your profile's Nostr address is not set to <strong>#{ user_address }</strong> yet",
|
||||
icon_name: "alert-octagon",
|
||||
icon_color: "amber-500"
|
||||
})
|
||||
end
|
||||
|
||||
if profile["lud16"].present? && profile["lud16"] == user_address
|
||||
@statuses.push({
|
||||
text: "Your profile's Lightning address is set to <strong>#{ user_address }</strong>",
|
||||
icon_name: "check-circle",
|
||||
icon_color: "emerald-500"
|
||||
})
|
||||
else
|
||||
@statuses.push({
|
||||
text: "Your profile's Lightning address is not set to <strong>#{ user_address }</strong> yet",
|
||||
icon_name: "alert-octagon",
|
||||
icon_color: "amber-500"
|
||||
})
|
||||
end
|
||||
else
|
||||
@statuses.push({
|
||||
text: "We could not find a profile for your public key",
|
||||
icon_name: "alert-octagon",
|
||||
icon_color: "amber-500"
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
<% @statuses.each do |status| %>
|
||||
<%= render StatusTextComponent.new(
|
||||
text: status[:text],
|
||||
icon_name: status[:icon_name],
|
||||
icon_color: status[:icon_color]
|
||||
) %>
|
||||
<% end %>
|
||||
|
||||
<div class="mt-8" data-controller="modal" data-action="keydown.esc->modal#close">
|
||||
<button data-action="click->modal#open" class="btn-md btn-blue w-full sm:w-auto">
|
||||
<%= @button_text %>
|
||||
</button>
|
||||
<%= render ModalComponent.new(show_close_button: false) do %>
|
||||
<%= render Settings::NostrEditRelaysComponent.new(
|
||||
nip65_event: @nip65_event
|
||||
) %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Settings
|
||||
class NostrRelayStatusComponent < ViewComponent::Base
|
||||
def initialize(nip65_event:, relay_url: Setting.nostr_relay_url)
|
||||
@nip65_event = nip65_event
|
||||
@relay_url = relay_url
|
||||
@relay_host = relay_url.present? ? URI.parse(relay_url).host : nil
|
||||
@statuses = []
|
||||
|
||||
if nip65_event.present?
|
||||
@statuses.push({
|
||||
text: "You have a relay list configured",
|
||||
icon_name: "check-circle",
|
||||
icon_color: "emerald-500"
|
||||
})
|
||||
|
||||
if relay_urls(nip65_event).include?(@relay_url)
|
||||
@statuses.push({
|
||||
text: "The <strong>#{@relay_host}</strong> relay is part of your relay list",
|
||||
icon_name: "check-circle",
|
||||
icon_color: "emerald-500"
|
||||
})
|
||||
else
|
||||
@statuses.push({
|
||||
text: "The <strong>#{@relay_host}</strong> relay is missing from your relay list",
|
||||
icon_name: "alert-octagon",
|
||||
icon_color: "amber-500"
|
||||
})
|
||||
end
|
||||
else
|
||||
@statuses.push({
|
||||
text: "We could not find a relay list for your public key",
|
||||
icon_name: "alert-octagon",
|
||||
icon_color: "amber-500"
|
||||
})
|
||||
end
|
||||
|
||||
@button_text = (nip65_event.present? ? "Edit relays" : "Set up relays")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def relay_urls(nip65_event)
|
||||
nip65_event["tags"].select { |t| t[0] == "r" }.map { |t| t[1] }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
<p class="flex gap-x-4 items-center">
|
||||
<span class="inline-block h-6 w-6 grow-0 text-<%= @icon_color %>">
|
||||
<%= render "icons/#{@icon_name}" %>
|
||||
</span>
|
||||
<span>
|
||||
<%= raw @text %>
|
||||
</span>
|
||||
</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
class StatusTextComponent < ViewComponent::Base
|
||||
def initialize(text:, icon_name:, icon_color:)
|
||||
@text = text
|
||||
@icon_name = icon_name
|
||||
@icon_color = icon_color
|
||||
end
|
||||
end
|
||||
@@ -4,8 +4,13 @@ require "bcrypt"
|
||||
class SettingsController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :set_main_nav_section
|
||||
before_action :set_settings_section, only: [:show, :update, :update_email, :reset_email_password]
|
||||
before_action :set_user, only: [:show, :update, :update_email, :reset_email_password]
|
||||
before_action :set_settings_section, only: [
|
||||
:show, :update, :update_email, :reset_email_password
|
||||
]
|
||||
before_action :set_user, only: [
|
||||
:show, :update, :update_email, :reset_email_password,
|
||||
:fetch_nostr_metadata
|
||||
]
|
||||
|
||||
def index
|
||||
redirect_to setting_path(:profile)
|
||||
@@ -143,12 +148,63 @@ class SettingsController < ApplicationController
|
||||
}
|
||||
end
|
||||
|
||||
def fetch_nostr_metadata
|
||||
return render plain: "no pubkey", status: :bad_request if @user.nostr_pubkey.blank?
|
||||
|
||||
cache_key = "nostr_metadata:#{@user.id}"
|
||||
|
||||
case params[:step]
|
||||
when "relays"
|
||||
nip65_event = NostrManager::DiscoverUserRelays.call(pubkey: @user.nostr_pubkey)
|
||||
write_relays = nip65_event ? extract_write_relays(nip65_event) : []
|
||||
|
||||
if nip65_event && write_relays.any? && stale?(nip65_event)
|
||||
auth_event = NostrManager::DiscoverUserRelays.call(
|
||||
pubkey: @user.nostr_pubkey, relays: write_relays
|
||||
)
|
||||
nip65_event = auth_event if auth_event
|
||||
write_relays = extract_write_relays(nip65_event) if auth_event
|
||||
end
|
||||
|
||||
Rails.cache.write("#{cache_key}:nip65", nip65_event, expires_in: 5.minutes)
|
||||
Rails.cache.write("#{cache_key}:write_relays", write_relays, expires_in: 5.minutes)
|
||||
render json: { next: "profile" }
|
||||
|
||||
when "profile"
|
||||
write_relays = Rails.cache.read("#{cache_key}:write_relays") || []
|
||||
relays = write_relays.any? ? write_relays : nil
|
||||
profile = NostrManager::DiscoverUserProfile.call(
|
||||
pubkey: @user.nostr_pubkey, relays: relays
|
||||
)
|
||||
Rails.cache.write("#{cache_key}:profile", profile, expires_in: 5.minutes)
|
||||
render json: { next: "render" }
|
||||
|
||||
when "render", nil
|
||||
@nip65_event = Rails.cache.read("#{cache_key}:nip65")
|
||||
@profile = Rails.cache.read("#{cache_key}:profile")
|
||||
render partial: "nostr_metadata", formats: :html
|
||||
|
||||
else
|
||||
render plain: "invalid step", status: :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_main_nav_section
|
||||
@current_section = :settings
|
||||
end
|
||||
|
||||
def extract_write_relays(nip65_event)
|
||||
nip65_event["tags"]
|
||||
.select { |t| t[0] == "r" && t[2] != "read" }
|
||||
.map { |t| t[1] }
|
||||
end
|
||||
|
||||
def stale?(event, threshold = 30.minutes)
|
||||
Time.at(event["created_at"]) < threshold.ago
|
||||
end
|
||||
|
||||
def set_settings_section
|
||||
@settings_section = params[:section]
|
||||
allowed_sections = [
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
class TurboController < ApplicationController
|
||||
class Responder < ActionController::Responder
|
||||
def to_turbo_stream
|
||||
controller.render(options.merge(formats: :html))
|
||||
rescue ActionView::MissingTemplate => error
|
||||
if get?
|
||||
raise error
|
||||
elsif has_errors? && default_action
|
||||
render rendering_options.merge(formats: :html, status: :unprocessable_entity)
|
||||
else
|
||||
redirect_to navigation_location
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.responder = Responder
|
||||
respond_to :html, :turbo_stream
|
||||
end
|
||||
@@ -6,7 +6,7 @@ class Users::DeviseController < ApplicationController
|
||||
if get?
|
||||
raise error
|
||||
elsif has_errors? && default_action
|
||||
render rendering_options.merge(formats: :html, status: :unprocessable_entity)
|
||||
render error_rendering_options.merge(formats: :html, status: :unprocessable_entity)
|
||||
else
|
||||
redirect_to navigation_location
|
||||
end
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "status", "loading", "content" ]
|
||||
static values = { url: String }
|
||||
|
||||
connect () {
|
||||
this.runStep("relays")
|
||||
}
|
||||
|
||||
async runStep (step) {
|
||||
const messages = {
|
||||
relays: "Looking up your relay list…",
|
||||
profile: "Fetching your profile…",
|
||||
blossom: "Fetching your media server list…",
|
||||
render: null
|
||||
}
|
||||
|
||||
if (messages[step]) {
|
||||
this.statusTarget.textContent = messages[step]
|
||||
}
|
||||
|
||||
try {
|
||||
const headers = (step === "render")
|
||||
? { "Accept": "text/html" }
|
||||
: { "Accept": "application/json" }
|
||||
|
||||
const res = await fetch(`${this.urlValue}?step=${step}`, { headers })
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`HTTP ${res.status}`)
|
||||
}
|
||||
|
||||
if (step === "render") {
|
||||
const html = await res.text()
|
||||
this.loadingTarget.classList.add("hidden")
|
||||
this.contentTarget.classList.remove("hidden")
|
||||
this.contentTarget.innerHTML = html
|
||||
} else {
|
||||
const data = await res.json()
|
||||
if (data.next) {
|
||||
this.runStep(data.next)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Nostr metadata fetch failed:", error.message)
|
||||
this.statusTarget.textContent = "Something went wrong. Please reload."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "list", "template" ]
|
||||
|
||||
add (event) {
|
||||
event.preventDefault()
|
||||
const row = this.templateTarget.content.cloneNode(true)
|
||||
this.listTarget.appendChild(row)
|
||||
}
|
||||
|
||||
remove (event) {
|
||||
event.preventDefault()
|
||||
const row = event.target.closest("li")
|
||||
row.remove()
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,23 @@ module Settings
|
||||
field :nostr_relay_url, type: :string,
|
||||
default: ENV["NOSTR_RELAY_URL"].presence
|
||||
|
||||
field :nostr_blossom_server_url, type: :string,
|
||||
default: ENV["NOSTR_BLOSSOM_SERVER_URL"].presence
|
||||
|
||||
field :nostr_zaps_relay_limit, type: :integer,
|
||||
default: 12
|
||||
|
||||
field :nostr_discovery_relays, type: :array, default: %w[
|
||||
wss://nostr.kosmos.org
|
||||
wss://relay.nostr.band
|
||||
wss://njump.me
|
||||
wss://relay.damus.io
|
||||
]
|
||||
|
||||
def self.nostr_relay_url_http
|
||||
self.nostr_relay_url.gsub(/^ws:/, "http:")
|
||||
.gsub(/^wss:/, "https:")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,18 +10,18 @@ class LndhubUser < LndhubBase
|
||||
foreign_key: "login"
|
||||
|
||||
def balance
|
||||
accounts.current.first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
accounts.current.order(:id).first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
end
|
||||
|
||||
def sum_outgoing
|
||||
accounts.outgoing.first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
accounts.outgoing.order(:id).first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
end
|
||||
|
||||
def sum_incoming
|
||||
accounts.incoming.first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
accounts.incoming.order(:id).first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
end
|
||||
|
||||
def sum_fees
|
||||
accounts.fees.first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
accounts.fees.order(:id).first.ledgers.sum("account_ledgers.amount").to_i.abs
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,6 @@ module EjabberdManager
|
||||
raise res.inspect if res.status != 200
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -78,3 +77,4 @@ module EjabberdManager
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
module NostrManager
|
||||
class DiscoverUserProfile < NostrManagerService
|
||||
def initialize(pubkey:, relays: nil)
|
||||
@pubkey = pubkey
|
||||
@relays = relays.present? ? relays : Setting.nostr_discovery_relays
|
||||
end
|
||||
|
||||
def call
|
||||
filter = Nostr::Filter.new(
|
||||
authors: [@pubkey],
|
||||
kinds: [0],
|
||||
limit: 1,
|
||||
)
|
||||
|
||||
NostrManager::FetchLatestEvent.call(
|
||||
relays: @relays,
|
||||
filter: filter
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
module NostrManager
|
||||
class DiscoverUserRelays < NostrManagerService
|
||||
def initialize(pubkey:, relays: nil)
|
||||
@pubkey = pubkey
|
||||
@relays = relays.present? ? relays : Setting.nostr_discovery_relays
|
||||
end
|
||||
|
||||
def call
|
||||
filter = Nostr::Filter.new(
|
||||
authors: [@pubkey],
|
||||
kinds: [10002],
|
||||
limit: 1,
|
||||
)
|
||||
|
||||
NostrManager::FetchLatestEvent.call(
|
||||
relays: @relays,
|
||||
filter: filter
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,61 @@
|
||||
module NostrManager
|
||||
class FetchEvent < NostrManagerService
|
||||
TIMEOUT = 10
|
||||
|
||||
def initialize(filter:, relay_url:)
|
||||
@filter = filter
|
||||
@relay = new_relay(relay_url)
|
||||
@client = Nostr::Client.new
|
||||
end
|
||||
|
||||
def call
|
||||
filter, client, relay = @filter, @client, @relay
|
||||
event = nil
|
||||
mutex = Mutex.new
|
||||
received_event = ConditionVariable.new
|
||||
log_prefix = "[nostr][#{@relay.name}]"
|
||||
|
||||
thread = Thread.new do
|
||||
client.on :connect do
|
||||
client.subscribe(filter: filter)
|
||||
end
|
||||
|
||||
client.on :error do |e|
|
||||
Rails.logger.info "#{log_prefix} Error: #{e}"
|
||||
Thread.current.exit
|
||||
end
|
||||
|
||||
client.on :message do |m|
|
||||
msg = JSON.parse(m) rescue nil
|
||||
if msg && msg[0] == "EVENT" && msg[2]
|
||||
Rails.logger.debug "#{log_prefix} Event received: #{msg[2]["id"]}"
|
||||
mutex.synchronize do
|
||||
event = msg[2]
|
||||
received_event.signal
|
||||
end
|
||||
elsif msg && msg[0] == "EOSE"
|
||||
mutex.synchronize do
|
||||
received_event.signal
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
client.connect relay
|
||||
end
|
||||
|
||||
begin
|
||||
Timeout.timeout(TIMEOUT) do
|
||||
mutex.synchronize do
|
||||
received_event.wait(mutex) if event.nil?
|
||||
end
|
||||
end
|
||||
rescue Timeout::Error
|
||||
Rails.logger.debug "#{log_prefix} Timeout: No event received within #{TIMEOUT} seconds"
|
||||
ensure
|
||||
thread.exit
|
||||
end
|
||||
|
||||
event
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
module NostrManager
|
||||
class FetchLatestEvent < NostrManagerService
|
||||
TIMEOUT = 20
|
||||
|
||||
def initialize(relays:, filter:, max_events: 2)
|
||||
@relays = relays
|
||||
@filter = filter
|
||||
@max_events = max_events
|
||||
end
|
||||
|
||||
def call
|
||||
events = []
|
||||
|
||||
begin
|
||||
Timeout.timeout(TIMEOUT) do
|
||||
@relays.each do |url|
|
||||
event = NostrManager::FetchEvent.call(filter: @filter, relay_url: url)
|
||||
|
||||
if event.present? && events.none? { |e| e["id"] == event["id"] }
|
||||
events << event
|
||||
break if events.size >= @max_events
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue Timeout::Error
|
||||
Rails.logger.debug "[nostr] Timeout after #{TIMEOUT}s, found #{events.size} events"
|
||||
end
|
||||
|
||||
events.max_by { |e| e["created_at"] }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -19,28 +19,28 @@ module NostrManager
|
||||
|
||||
thread = Thread.new do
|
||||
client.on :connect do
|
||||
puts "#{log_prefix} Publishing #{event.id}..."
|
||||
Rails.logger.debug "#{log_prefix} Publishing #{event.id}..."
|
||||
client.publish event
|
||||
end
|
||||
|
||||
client.on :error do |e|
|
||||
puts "#{log_prefix} Error: #{e}"
|
||||
puts "#{log_prefix} Closing thread..."
|
||||
Rails.logger.debug "#{log_prefix} Error: #{e}"
|
||||
Rails.logger.debug "#{log_prefix} Closing thread..."
|
||||
thread.exit
|
||||
end
|
||||
|
||||
client.on :message do |m|
|
||||
puts "#{log_prefix} Message: #{m}"
|
||||
Rails.logger.debug "#{log_prefix} Message: #{m}"
|
||||
msg = JSON.parse(m) rescue []
|
||||
if msg[0] == "OK" && msg[1] == event.id && msg[2]
|
||||
puts "#{log_prefix} Event published. Closing thread..."
|
||||
Rails.logger.debug "#{log_prefix} Event published. Closing thread..."
|
||||
else
|
||||
puts "#{log_prefix} Unexpected message from relay. Closing thread..."
|
||||
Rails.logger.debug "#{log_prefix} Unexpected message from relay. Closing thread..."
|
||||
end
|
||||
thread.exit
|
||||
end
|
||||
|
||||
puts "#{log_prefix} Connecting to #{relay.url}..."
|
||||
Rails.logger.debug "#{log_prefix} Connecting to #{relay.url}..."
|
||||
client.connect relay
|
||||
end
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ require "nostr"
|
||||
class NostrManagerService < ApplicationService
|
||||
def parse_tags(tags)
|
||||
out = {}
|
||||
# TODO support more than 1 item for each tag type
|
||||
tags.each do |tag|
|
||||
out[tag[0].to_sym] = tag[1, tag.length]
|
||||
end
|
||||
@@ -19,4 +20,8 @@ class NostrManagerService < ApplicationService
|
||||
def site_user
|
||||
Nostr::User.new(keypair: site_keypair)
|
||||
end
|
||||
|
||||
def new_relay(url)
|
||||
Nostr::Relay.new(url: url, name: URI.parse(url).host)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,15 +29,35 @@
|
||||
title: "Relay URL",
|
||||
description: "Websockets URL of a relay associated with #{Setting.primary_domain}"
|
||||
) %>
|
||||
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||
key: :nostr_blossom_server_url,
|
||||
title: "Blossom server URL",
|
||||
description: "HTTP URL of the Blossom media server to add to users' server lists during onboarding"
|
||||
) %>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3>Zaps</h3>
|
||||
<ul role="list">
|
||||
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||
key: :nostr_zaps_relay_limit,
|
||||
title: "Relay limit",
|
||||
description: "The maximum number of relays to publish zap receipts to"
|
||||
description: "The maximum number of sender-defined relays to try to publish zap receipts to"
|
||||
) %>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3>Onboarding</h3>
|
||||
<ul role="list">
|
||||
<%= render FormElements::FieldsetComponent.new(
|
||||
title: "Discovery relays",
|
||||
description: "Used to discover a user's published relay list and/or profile"
|
||||
) do %>
|
||||
<%= f.text_area :nostr_discovery_relays,
|
||||
value: Setting.nostr_discovery_relays.join("\n"),
|
||||
class: "h-44 w-80" %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% if resource.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<div id="error_explanation" class="mb-6">
|
||||
<ul>
|
||||
<% resource.errors.full_messages.each do |message| %>
|
||||
<li class="text-red-600"><%= message %></li>
|
||||
|
||||
@@ -1,47 +1,46 @@
|
||||
<section>
|
||||
<h3>Nostr</h3>
|
||||
<h4 class="mb-0">Public Key</h4>
|
||||
<div data-controller="settings--nostr-pubkey"
|
||||
data-settings--nostr-pubkey-user-address-value="<%= current_user.address %>"
|
||||
data-settings--nostr-pubkey-site-value="<%= Setting.accounts_domain %>"
|
||||
data-settings--nostr-pubkey-shared-secret-value="<%= session[:shared_secret] %>"
|
||||
data-settings--nostr-pubkey-pubkey-hex-value="<%= current_user.nostr_pubkey %>">
|
||||
|
||||
<p class="<%= current_user.nostr_pubkey.present? ? '' : 'hidden' %> mt-2 flex gap-1">
|
||||
<section class="mb-8 sm:mb-12">
|
||||
<h3>Nostr</h3>
|
||||
<h4 class="mb-0">
|
||||
Public Key
|
||||
</h4>
|
||||
<p class="<%= current_user.nostr_pubkey.present? ? '' : 'hidden' %> mt-2 flex gap-x-1">
|
||||
<input type="text" value="<%= current_user.nostr_pubkey_bech32 %>" disabled
|
||||
data-settings--nostr-pubkey-target="pubkeyBech32Input"
|
||||
name="nostr_public_key" class="relative grow" />
|
||||
name="nostr_public_key" class="w-full" />
|
||||
<%= link_to nostr_pubkey_settings_path,
|
||||
class: 'btn-md btn-outline text-red-700 relative shrink-0',
|
||||
class: 'btn-md btn-outline relative grow-0 shrink-0 text-red-700',
|
||||
data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } do %>
|
||||
Remove
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<% if current_user.nostr_pubkey.present? %>
|
||||
<div class="rounded-md bg-blue-50 p-4">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-5 w-5 text-blue-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3 flex-1">
|
||||
<p class="text-sm text-blue-800">
|
||||
Your user address <strong><%= current_user.address %></strong> is
|
||||
also a Nostr address now. Use your favorite Nostr app, or for
|
||||
example <a href="http://metadata.nostr.com" target="_blank"
|
||||
class="underline">metadata.nostr.com</a>, to add this
|
||||
<strong>NIP-05</strong> address to your public profile.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div> -->
|
||||
<!-- Pubkey present -->
|
||||
<!-- </div> -->
|
||||
<% else %>
|
||||
<p class="my-4">
|
||||
If you use any apps on the Nostr network, you can verify your public key
|
||||
with us in order to enable Nostr-specific features for your account.
|
||||
Verify your Nostr public key with us in order to enable Nostr-specific
|
||||
features for your account:
|
||||
</p>
|
||||
<ul class="list-disc list-inside">
|
||||
<li>Log in with Nostr (no password needed)</li>
|
||||
<li>Verified Nostr address</li>
|
||||
<% if Setting.lndhub_enabled? %>
|
||||
<li>Receive zaps in your Lightning account</li>
|
||||
<% end %>
|
||||
<% if Setting.nostr_relay_url.present? %>
|
||||
<li>Publish notes and other stuff on our Nostr relay</li>
|
||||
<% end %>
|
||||
<% if Setting.nostr_blossom_server_url.present? %>
|
||||
<li>Publish media files on our Nostr media server</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<div data-settings--nostr-pubkey-target="noExtension"
|
||||
@@ -58,8 +57,8 @@
|
||||
</h3>
|
||||
<div class="mt-2 mb-0 text-sm text-blue-800">
|
||||
<p>
|
||||
We recommend Alby, which you can also use for your Lightning
|
||||
Wallet.
|
||||
We recommend Alby, which you can also use a wallet for your
|
||||
Lightning account.
|
||||
</p>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
@@ -86,5 +85,18 @@
|
||||
</button>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<% if current_user.nostr_pubkey.present? %>
|
||||
<div data-controller="nostr-metadata"
|
||||
data-nostr-metadata-url-value="<%= nostr_metadata_settings_path %>">
|
||||
<div data-nostr-metadata-target="loading"
|
||||
class="flex flex-col items-center justify-center py-16">
|
||||
<div class="mb-4 h-12 w-12"></div>
|
||||
<p data-nostr-metadata-target="status"
|
||||
class="text-gray-500 animate-pulse">Loading…</p>
|
||||
</div>
|
||||
<div data-nostr-metadata-target="content" class="hidden"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<section class="">
|
||||
<h3>Profile</h3>
|
||||
<%= render Settings::NostrProfileStatusComponent.new(
|
||||
profile_event: @profile,
|
||||
user_address: current_user.address
|
||||
) %>
|
||||
<div class="mt-8" data-controller="modal" data-action="keydown.esc->modal#close">
|
||||
<button data-action="click->modal#open" class="btn-md btn-blue w-full sm:w-auto">
|
||||
Edit profile
|
||||
</button>
|
||||
<%= render ModalComponent.new(show_close_button: false) do %>
|
||||
<%= render Settings::NostrEditProfileComponent.new(
|
||||
user: current_user,
|
||||
profile_event: @profile
|
||||
) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mb-8 sm:mb-12">
|
||||
<h3>Relays</h3>
|
||||
<%= render Settings::NostrRelayStatusComponent.new(
|
||||
nip65_event: @nip65_event
|
||||
) %>
|
||||
</section>
|
||||
@@ -19,12 +19,6 @@
|
||||
active: @settings_section.to_s == "email"
|
||||
) %>
|
||||
<% end %>
|
||||
<% if Setting.lndhub_enabled %>
|
||||
<%= render SidenavLinkComponent.new(
|
||||
name: "Lightning", path: setting_path(:lightning), icon: "zap",
|
||||
active: @settings_section.to_s == "lightning"
|
||||
) %>
|
||||
<% end %>
|
||||
<% if Setting.remotestorage_enabled? &&
|
||||
Flipper.enabled?(:remotestorage, current_user) %>
|
||||
<%= render SidenavLinkComponent.new(
|
||||
@@ -32,6 +26,12 @@
|
||||
active: @settings_section.to_s == "remotestorage"
|
||||
) %>
|
||||
<% end %>
|
||||
<% if Setting.lndhub_enabled %>
|
||||
<%= render SidenavLinkComponent.new(
|
||||
name: "Lightning", path: setting_path(:lightning), icon: "zap",
|
||||
active: @settings_section.to_s == "lightning"
|
||||
) %>
|
||||
<% end %>
|
||||
<% if Setting.nostr_enabled %>
|
||||
<%= render SidenavLinkComponent.new(
|
||||
name: "Nostr", path: setting_path(:nostr), icon: "nostrich-head",
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<%= profile.inspect %>
|
||||
</div>
|
||||
@@ -21,7 +21,7 @@ Bundler.require(*Rails.groups)
|
||||
module Akkounts
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 8.0
|
||||
config.load_defaults 8.1
|
||||
|
||||
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||
|
||||
@@ -24,7 +24,7 @@ Rails.application.configure do
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.cache_store = :null_store
|
||||
config.cache_store = :memory_store
|
||||
end
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
|
||||
@@ -6,6 +6,7 @@ require 'securerandom'
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
Devise.setup do |config|
|
||||
# Hotwire/Turbo
|
||||
config.parent_controller = 'Users::DeviseController'
|
||||
config.responder.error_status = :unprocessable_entity
|
||||
config.responder.redirect_status = :see_other
|
||||
|
||||
@@ -325,9 +326,9 @@ Devise.setup do |config|
|
||||
# config.sign_in_after_change_password = true
|
||||
end
|
||||
|
||||
# https://github.com/heartcombo/devise/issues/5644
|
||||
class Devise::SecretKeyFinder
|
||||
def find
|
||||
@application.secret_key_base
|
||||
end
|
||||
# Turbo-aware responder for Devise controllers
|
||||
ActiveSupport.on_load(:devise_controller) do
|
||||
self.responder = Users::DeviseController::Responder
|
||||
Users::DeviseController::Responder.error_status = :unprocessable_entity
|
||||
Users::DeviseController::Responder.redirect_status = :see_other
|
||||
end
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# See https://alvincrespo.hashnode.dev/rails-8s-lazy-route-loading-devise
|
||||
# TODO remove when Devise is fixed
|
||||
require 'devise'
|
||||
Devise # make sure it's already loaded
|
||||
|
||||
module Devise
|
||||
def self.mappings
|
||||
Rails.application.try(:reload_routes_unless_loaded)
|
||||
@@mappings
|
||||
end
|
||||
end
|
||||
@@ -38,6 +38,8 @@ plugin :tmp_restart
|
||||
# Run the Solid Queue supervisor inside of Puma for single-server deployments
|
||||
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
||||
|
||||
force_shutdown_after 25
|
||||
|
||||
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
||||
# In other environments, only set the PID file if requested.
|
||||
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
||||
|
||||
@@ -68,6 +68,7 @@ Rails.application.routes.draw do
|
||||
post 'reset_email_password'
|
||||
post 'set_nostr_pubkey'
|
||||
delete 'nostr_pubkey', to: 'settings#remove_nostr_pubkey'
|
||||
get 'fetch_nostr_metadata', as: 'nostr_metadata'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+40
-40
@@ -10,44 +10,44 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 1) do
|
||||
ActiveRecord::Schema[8.1].define(version: 1) do
|
||||
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||
t.bigint "job_id", null: false
|
||||
t.string "queue_name", null: false
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.string "concurrency_key", null: false
|
||||
t.datetime "expires_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "expires_at", null: false
|
||||
t.bigint "job_id", null: false
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.string "queue_name", null: false
|
||||
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
|
||||
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||
end
|
||||
|
||||
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.bigint "job_id", null: false
|
||||
t.bigint "process_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||
end
|
||||
|
||||
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||
t.bigint "job_id", null: false
|
||||
t.text "error"
|
||||
t.datetime "created_at", null: false
|
||||
t.text "error"
|
||||
t.bigint "job_id", null: false
|
||||
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||
end
|
||||
|
||||
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||
t.string "queue_name", null: false
|
||||
t.string "class_name", null: false
|
||||
t.text "arguments"
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.string "active_job_id"
|
||||
t.datetime "scheduled_at"
|
||||
t.datetime "finished_at"
|
||||
t.text "arguments"
|
||||
t.string "class_name", null: false
|
||||
t.string "concurrency_key"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "finished_at"
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.string "queue_name", null: false
|
||||
t.datetime "scheduled_at"
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
|
||||
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
|
||||
@@ -57,76 +57,76 @@ ActiveRecord::Schema[8.0].define(version: 1) do
|
||||
end
|
||||
|
||||
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||
t.string "queue_name", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.string "queue_name", null: false
|
||||
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||
end
|
||||
|
||||
create_table "solid_queue_processes", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.string "hostname"
|
||||
t.string "kind", null: false
|
||||
t.datetime "last_heartbeat_at", null: false
|
||||
t.bigint "supervisor_id"
|
||||
t.integer "pid", null: false
|
||||
t.string "hostname"
|
||||
t.text "metadata"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "name", null: false
|
||||
t.integer "pid", null: false
|
||||
t.bigint "supervisor_id"
|
||||
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||
t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
|
||||
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
|
||||
end
|
||||
|
||||
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||
t.bigint "job_id", null: false
|
||||
t.string "queue_name", null: false
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.bigint "job_id", null: false
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.string "queue_name", null: false
|
||||
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
|
||||
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
|
||||
end
|
||||
|
||||
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||
t.bigint "job_id", null: false
|
||||
t.string "task_key", null: false
|
||||
t.datetime "run_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.bigint "job_id", null: false
|
||||
t.datetime "run_at", null: false
|
||||
t.string "task_key", null: false
|
||||
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||
end
|
||||
|
||||
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
|
||||
t.string "key", null: false
|
||||
t.string "schedule", null: false
|
||||
t.string "command", limit: 2048
|
||||
t.string "class_name"
|
||||
t.text "arguments"
|
||||
t.string "queue_name"
|
||||
t.integer "priority", default: 0
|
||||
t.boolean "static", default: true, null: false
|
||||
t.text "description"
|
||||
t.string "class_name"
|
||||
t.string "command", limit: 2048
|
||||
t.datetime "created_at", null: false
|
||||
t.text "description"
|
||||
t.string "key", null: false
|
||||
t.integer "priority", default: 0
|
||||
t.string "queue_name"
|
||||
t.string "schedule", null: false
|
||||
t.boolean "static", default: true, null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
|
||||
t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
|
||||
end
|
||||
|
||||
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||
t.bigint "job_id", null: false
|
||||
t.string "queue_name", null: false
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.datetime "scheduled_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.bigint "job_id", null: false
|
||||
t.integer "priority", default: 0, null: false
|
||||
t.string "queue_name", null: false
|
||||
t.datetime "scheduled_at", null: false
|
||||
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
|
||||
end
|
||||
|
||||
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||
t.string "key", null: false
|
||||
t.integer "value", default: 1, null: false
|
||||
t.datetime "expires_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "expires_at", null: false
|
||||
t.string "key", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "value", default: 1, null: false
|
||||
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
|
||||
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||
|
||||
+56
-56
@@ -10,26 +10,26 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_05_28_092931) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2025_05_28_092931) do
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "record_type", null: false
|
||||
t.bigint "record_id", null: false
|
||||
t.bigint "blob_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.string "name", null: false
|
||||
t.bigint "record_id", null: false
|
||||
t.string "record_type", null: false
|
||||
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
||||
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
||||
end
|
||||
|
||||
create_table "active_storage_blobs", force: :cascade do |t|
|
||||
t.string "key", null: false
|
||||
t.string "filename", null: false
|
||||
t.string "content_type"
|
||||
t.text "metadata"
|
||||
t.string "service_name", null: false
|
||||
t.bigint "byte_size", null: false
|
||||
t.string "checksum"
|
||||
t.string "content_type"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "filename", null: false
|
||||
t.string "key", null: false
|
||||
t.text "metadata"
|
||||
t.string "service_name", null: false
|
||||
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
||||
end
|
||||
|
||||
@@ -40,77 +40,77 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_28_092931) do
|
||||
end
|
||||
|
||||
create_table "app_catalog_web_apps", force: :cascade do |t|
|
||||
t.string "url"
|
||||
t.string "name"
|
||||
t.text "metadata"
|
||||
t.datetime "created_at", null: false
|
||||
t.text "metadata"
|
||||
t.string "name"
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "url"
|
||||
end
|
||||
|
||||
create_table "donations", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "amount_sats"
|
||||
t.integer "fiat_amount"
|
||||
t.string "public_name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "paid_at", precision: nil
|
||||
t.string "fiat_currency", default: "USD"
|
||||
t.string "donation_method"
|
||||
t.string "payment_method"
|
||||
t.string "btcpay_invoice_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "donation_method"
|
||||
t.integer "fiat_amount"
|
||||
t.string "fiat_currency", default: "USD"
|
||||
t.datetime "paid_at", precision: nil
|
||||
t.string "payment_method"
|
||||
t.string "payment_status"
|
||||
t.string "public_name"
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "user_id"
|
||||
t.index ["payment_status"], name: "index_donations_on_payment_status"
|
||||
t.index ["user_id"], name: "index_donations_on_user_id"
|
||||
end
|
||||
|
||||
create_table "editable_contents", force: :cascade do |t|
|
||||
t.text "content"
|
||||
t.string "context"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "key"
|
||||
t.string "lang", default: "en"
|
||||
t.text "content"
|
||||
t.boolean "rich_text", default: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "flipper_features", force: :cascade do |t|
|
||||
t.string "key", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.string "key", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["key"], name: "index_flipper_features_on_key", unique: true
|
||||
end
|
||||
|
||||
create_table "flipper_gates", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.string "feature_key", null: false
|
||||
t.string "key", null: false
|
||||
t.text "value"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.text "value"
|
||||
t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true
|
||||
end
|
||||
|
||||
create_table "invitations", force: :cascade do |t|
|
||||
t.string "token"
|
||||
t.integer "user_id"
|
||||
t.integer "invited_user_id"
|
||||
t.datetime "used_at", precision: nil
|
||||
t.datetime "created_at", null: false
|
||||
t.integer "invited_user_id"
|
||||
t.string "token"
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "used_at", precision: nil
|
||||
t.integer "user_id"
|
||||
t.index ["invited_user_id"], name: "index_invitations_on_invited_user_id"
|
||||
t.index ["user_id"], name: "index_invitations_on_user_id"
|
||||
end
|
||||
|
||||
create_table "remote_storage_authorizations", force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.string "token"
|
||||
t.text "permissions", default: "--- []\n"
|
||||
t.string "client_id"
|
||||
t.string "redirect_uri"
|
||||
t.string "app_name"
|
||||
t.datetime "expire_at"
|
||||
t.string "client_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "expire_at"
|
||||
t.text "permissions", default: "--- []\n"
|
||||
t.string "redirect_uri"
|
||||
t.string "token"
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "user_id", null: false
|
||||
t.integer "web_app_id"
|
||||
t.index ["permissions"], name: "index_remote_storage_authorizations_on_permissions"
|
||||
t.index ["user_id"], name: "index_remote_storage_authorizations_on_user_id"
|
||||
@@ -118,45 +118,45 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_28_092931) do
|
||||
end
|
||||
|
||||
create_table "settings", force: :cascade do |t|
|
||||
t.string "var", null: false
|
||||
t.text "value"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.text "value"
|
||||
t.string "var", null: false
|
||||
t.index ["var"], name: "index_settings_on_var", unique: true
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "cn"
|
||||
t.string "ou"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "email", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at", precision: nil
|
||||
t.datetime "confirmation_sent_at", precision: nil
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at", precision: nil
|
||||
t.datetime "confirmation_sent_at", precision: nil
|
||||
t.string "unconfirmed_email"
|
||||
t.datetime "created_at", null: false
|
||||
t.string "email", default: "", null: false
|
||||
t.text "lndhub_password"
|
||||
t.string "lndhub_username"
|
||||
t.bigint "mastodon_id"
|
||||
t.string "ou"
|
||||
t.string "pgp_fpr"
|
||||
t.text "preferences"
|
||||
t.datetime "remember_created_at"
|
||||
t.string "remember_token"
|
||||
t.text "preferences"
|
||||
t.string "pgp_fpr"
|
||||
t.string "lndhub_username"
|
||||
t.text "lndhub_password"
|
||||
t.bigint "mastodon_id"
|
||||
t.datetime "reset_password_sent_at", precision: nil
|
||||
t.string "reset_password_token"
|
||||
t.string "unconfirmed_email"
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
end
|
||||
|
||||
create_table "zaps", force: :cascade do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.json "request"
|
||||
t.json "receipt"
|
||||
t.text "payment_request"
|
||||
t.bigint "amount"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.text "payment_request"
|
||||
t.json "receipt"
|
||||
t.json "request"
|
||||
t.datetime "settled_at"
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "user_id", null: false
|
||||
t.index ["user_id"], name: "index_zaps_on_user_id"
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
"postcss-preset-env": "^7.8.3",
|
||||
"tailwindcss": "^3.4.0"
|
||||
},
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.1",
|
||||
"scripts": {
|
||||
"build:css:tailwind": "bun ./node_modules/tailwindcss/lib/cli.js --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css",
|
||||
"build:css": "bun run build:css:tailwind"
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
require 'rails_helper'
|
||||
require 'webmock/rspec'
|
||||
require 'digest'
|
||||
|
||||
RSpec.describe EjabberdManager::SetAvatar, type: :model do
|
||||
let(:user) { create :user, cn: "willherschel", ou: "kosmos.org" }
|
||||
let(:fixture_path) { Rails.root.join("spec/fixtures/files/bender.png") }
|
||||
let(:img_data) do
|
||||
ImageProcessing::Vips
|
||||
.source(File.open(fixture_path))
|
||||
.resize_to_fill(256, 256)
|
||||
.convert("png")
|
||||
.call.read
|
||||
end
|
||||
let(:sha1_hash) { Digest::SHA1.hexdigest(img_data) }
|
||||
let(:base64_data) { Base64.strict_encode64(img_data) }
|
||||
|
||||
before do
|
||||
ActiveStorage::Blob.create_and_upload!(
|
||||
io: File.open(fixture_path),
|
||||
filename: "bender.png",
|
||||
content_type: "image/png"
|
||||
).tap { |blob| user.avatar.attach(blob) }
|
||||
end
|
||||
|
||||
def stub_send_stanza_ok
|
||||
stub_request(:post, "http://xmpp.example.com/api/send_stanza")
|
||||
.to_return(status: 200, body: "", headers: {})
|
||||
end
|
||||
|
||||
context "when an avatar is already set and overwrite is false" do
|
||||
before do
|
||||
allow(EjabberdManager::GetAvatar).to receive(:call).with(user: user).and_return({ img_base64: "abc", content_type: "image/png" })
|
||||
stub_send_stanza_ok
|
||||
end
|
||||
|
||||
it "does not send any stanzas" do
|
||||
described_class.call(user: user)
|
||||
expect(WebMock).not_to have_requested(:post, "http://xmpp.example.com/api/send_stanza")
|
||||
end
|
||||
end
|
||||
|
||||
context "when no avatar is set yet" do
|
||||
let(:sent_stanzas) { [] }
|
||||
|
||||
before do
|
||||
allow(EjabberdManager::GetAvatar).to receive(:call).with(user: user).and_return(nil)
|
||||
stub_request(:post, "http://xmpp.example.com/api/send_stanza")
|
||||
.to_return(status: 200, body: "", headers: {})
|
||||
end
|
||||
|
||||
it "publishes the XEP-0084 data and metadata stanzas" do
|
||||
service = described_class.new(user: user)
|
||||
allow(service).to receive(:send_stanza) do |payload|
|
||||
sent_stanzas << payload[:stanza]
|
||||
double(status: 200)
|
||||
end
|
||||
|
||||
service.call
|
||||
|
||||
expect(sent_stanzas.length).to eq(2)
|
||||
|
||||
data_stanza = sent_stanzas.find { |s| s.include?("urn:xmpp:avatar:data") }
|
||||
meta_stanza = sent_stanzas.find { |s| s.include?("urn:xmpp:avatar:metadata") }
|
||||
|
||||
expect(data_stanza).to include("from='willherschel@kosmos.org'")
|
||||
expect(data_stanza).to include("<item id='#{sha1_hash}'>")
|
||||
expect(data_stanza).to include("<data xmlns='urn:xmpp:avatar:data'>#{base64_data}</data>")
|
||||
|
||||
expect(meta_stanza).to include("from='willherschel@kosmos.org'")
|
||||
expect(meta_stanza).to include("<item id='#{sha1_hash}'>")
|
||||
expect(meta_stanza).to include("bytes='#{img_data.size}'")
|
||||
expect(meta_stanza).to include("id='#{sha1_hash}'")
|
||||
expect(meta_stanza).to include("type='image/png'")
|
||||
expect(meta_stanza).to include("height='256'")
|
||||
expect(meta_stanza).to include("width='256'")
|
||||
end
|
||||
end
|
||||
|
||||
context "when overwrite is true" do
|
||||
before do
|
||||
allow(EjabberdManager::GetAvatar).to receive(:call).and_return({ img_base64: "abc", content_type: "image/png" })
|
||||
stub_send_stanza_ok
|
||||
end
|
||||
|
||||
it "does not check for an existing avatar and sends stanzas" do
|
||||
described_class.call(user: user, overwrite: true)
|
||||
expect(EjabberdManager::GetAvatar).not_to have_received(:call)
|
||||
expect(WebMock).to have_requested(:post, "http://xmpp.example.com/api/send_stanza").twice
|
||||
end
|
||||
end
|
||||
|
||||
context "when the ejabberd API returns a non-200 status" do
|
||||
before do
|
||||
allow(EjabberdManager::GetAvatar).to receive(:call).with(user: user).and_return(nil)
|
||||
stub_request(:post, "http://xmpp.example.com/api/send_stanza")
|
||||
.to_return(status: 500, body: "error", headers: {})
|
||||
end
|
||||
|
||||
it "raises" do
|
||||
expect { described_class.call(user: user) }.to raise_error(RuntimeError)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,88 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe NostrManager::FetchLatestEvent, type: :model do
|
||||
let(:filter) { Nostr::Filter.new(authors: ["pubkey"], kinds: [0], limit: 1) }
|
||||
let(:event_v1) { { "id" => "aaa", "created_at" => 1000, "content" => "v1" } }
|
||||
let(:event_v2) { { "id" => "bbb", "created_at" => 2000, "content" => "v2" } }
|
||||
|
||||
describe "with no events found" do
|
||||
it "returns nil" do
|
||||
allow(NostrManager::FetchEvent).to receive(:call).and_return(nil)
|
||||
|
||||
result = described_class.call(relays: ["wss://a", "wss://b"], filter: filter)
|
||||
expect(result).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "with event on 1 relay only" do
|
||||
it "returns the event" do
|
||||
allow(NostrManager::FetchEvent).to receive(:call) do |args|
|
||||
case args[:relay_url]
|
||||
when "wss://a" then event_v1
|
||||
else nil
|
||||
end
|
||||
end
|
||||
|
||||
result = described_class.call(
|
||||
relays: ["wss://a", "wss://b", "wss://c"], filter: filter
|
||||
)
|
||||
expect(result).to eq(event_v1)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with events on 2 relays, different versions" do
|
||||
it "returns the latest event (max created_at)" do
|
||||
allow(NostrManager::FetchEvent).to receive(:call) do |args|
|
||||
case args[:relay_url]
|
||||
when "wss://a" then event_v1
|
||||
when "wss://b" then event_v2
|
||||
end
|
||||
end
|
||||
|
||||
result = described_class.call(relays: ["wss://a", "wss://b"], filter: filter)
|
||||
expect(result).to eq(event_v2)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with duplicate events (same ID) on 2 relays" do
|
||||
it "returns the single event without double-counting" do
|
||||
allow(NostrManager::FetchEvent).to receive(:call).and_return(event_v1)
|
||||
|
||||
result = described_class.call(relays: ["wss://a", "wss://b"], filter: filter)
|
||||
expect(result).to eq(event_v1)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with timeout after finding 1 event" do
|
||||
it "still returns the found event" do
|
||||
allow(NostrManager::FetchEvent).to receive(:call) do |args|
|
||||
case args[:relay_url]
|
||||
when "wss://a" then event_v1
|
||||
when "wss://b" then raise Timeout::Error
|
||||
end
|
||||
end
|
||||
|
||||
result = described_class.call(relays: ["wss://a", "wss://b"], filter: filter)
|
||||
expect(result).to eq(event_v1)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with max_events reached" do
|
||||
it "stops querying further relays" do
|
||||
call_count = 0
|
||||
allow(NostrManager::FetchEvent).to receive(:call) do |args|
|
||||
call_count += 1
|
||||
raise "should not query wss://c" if args[:relay_url] == "wss://c"
|
||||
case args[:relay_url]
|
||||
when "wss://a" then event_v1
|
||||
when "wss://b" then event_v2
|
||||
end
|
||||
end
|
||||
|
||||
described_class.call(
|
||||
relays: ["wss://a", "wss://b", "wss://c"], filter: filter
|
||||
)
|
||||
expect(call_count).to eq(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -14,11 +14,6 @@
|
||||
#
|
||||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
||||
RSpec.configure do |config|
|
||||
# TODO Remove when Devise fixes https://github.com/heartcombo/devise/issues/5705
|
||||
config.before(:each, type: :controller) do
|
||||
Rails.application.reload_routes_unless_loaded
|
||||
end
|
||||
|
||||
# rspec-expectations config goes here. You can use an alternate
|
||||
# assertion/expectation library such as wrong or the stdlib/minitest
|
||||
# assertions if you prefer.
|
||||
|
||||
Reference in New Issue
Block a user