Compare commits
172 Commits
fb3b9af3e5
...
v0.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6739b38f4c
|
||
| 7e1272c936 | |||
|
|
ecdeb4c122
|
||
|
|
8614e2f12b
|
||
|
|
a038a857d9
|
||
|
|
eee81d0cf1
|
||
|
|
b7fa4b012a
|
||
|
|
10bcd5c32b
|
||
|
|
f79d5d4724
|
||
|
|
866ffbe615
|
||
|
|
3c1fe3396d
|
||
|
|
e4242333d9
|
||
|
|
138f13c1a0
|
||
|
|
ad5e515200
|
||
|
|
1ea8b22a59
|
||
|
|
f49aff262c
|
||
| 852e2fea1e | |||
|
|
353b55fe1a
|
||
|
|
ba0cbba96b
|
||
|
|
5f921f1b53
|
||
|
|
a2d27bf575
|
||
|
|
fcf9a065e1
|
||
|
|
ec9bcacd46
|
||
|
|
645abac810 | ||
|
|
e11be727a1 | ||
|
|
12b24337e7 | ||
|
|
b0bfc290c4 | ||
|
|
4c6c81171b | ||
|
|
4d88a40109
|
||
|
|
d9b39b36fb
|
||
|
|
06aed8c33d
|
||
| 0a778e92d8 | |||
|
|
e5a5633e44
|
||
|
|
a68825493f
|
||
|
|
e1e83386a8
|
||
|
|
3adc1917f6
|
||
|
|
8a570ce724
|
||
|
|
c78df9e5f1
|
||
|
5c2df3df07
|
|||
| 83e3e2ecd8 | |||
| b32e2fcb7b | |||
| 96a4db5bae | |||
| c7925f132e | |||
| e4406bf6ff | |||
| ee7769c8c7 | |||
| fdf3218f88 | |||
| 652ed5f7e3 | |||
|
|
e4ed797920
|
||
|
|
93740f17ef
|
||
|
|
affb058671
|
||
|
|
6acc3f2f59
|
||
| 7987e92723 | |||
|
|
d922e7f869
|
||
|
716d4b944a
|
|||
|
42af148168
|
|||
|
|
89c67f3617
|
||
| 1b959b5643 | |||
|
|
4551a14362
|
||
|
|
bfc0969829
|
||
|
|
a1be338ba1
|
||
|
|
589e46bc63
|
||
|
|
34e4cec503
|
||
|
|
c48538a1c6
|
||
|
|
2cced696f5
|
||
|
|
beaafa5d7e
|
||
|
|
9cf309aaa8
|
||
|
|
e8bbe6c713
|
||
|
|
49de4007ab
|
||
|
|
bc4d9ff528
|
||
|
|
b03c6e9513
|
||
|
|
332ad757a5
|
||
|
|
07fe8dba71
|
||
|
|
aedaabc7ba
|
||
|
|
8eb5f093a4
|
||
| de45d070aa | |||
| c0b1112e49 | |||
|
|
2f90393eb6
|
||
|
|
8b87072485
|
||
|
|
82019f47be
|
||
|
|
259e72167b
|
||
|
|
7000908891
|
||
|
|
df0c13b400
|
||
|
|
387a2fa2e6
|
||
| 68eba80fd7 | |||
|
|
7e05530ab7
|
||
|
|
745a319b3d
|
||
|
|
f829bb3379
|
||
|
|
19bafe081f
|
||
| d130f2f68b | |||
|
|
e284996c1c
|
||
|
|
51489a83ab
|
||
|
|
05426e4ced
|
||
|
|
445cdfa024
|
||
|
|
f74227fedb
|
||
|
|
32d1992632
|
||
| 48be35f1b1 | |||
| 87720ef285 | |||
|
|
193a4c2edd
|
||
|
|
134c81460a
|
||
|
|
b1a693e7cf
|
||
|
|
75bd879f84
|
||
|
|
33a9e1eaa9
|
||
|
|
7b321577db
|
||
|
|
61f12c2741
|
||
|
|
c58358c66e
|
||
|
|
287adbd365
|
||
|
|
9048052318
|
||
| cddc1e86f6 | |||
|
|
ce7387a409
|
||
|
|
f1ae5667de
|
||
|
|
67a9fc02d7
|
||
|
|
34849b28b0
|
||
| 8ce5f9708f | |||
|
|
cb2197893c
|
||
|
|
dabd892a25
|
||
|
|
eeabbdb7df
|
||
| 7a50bd23d6 | |||
| 64c8c3cb06 | |||
|
|
a2100b23a9
|
||
| 27195f693a | |||
|
9e74c89a80
|
|||
|
0774c88918
|
|||
| ef2d2b6422 | |||
|
a47e4fc16b
|
|||
|
9b89101afc
|
|||
|
|
ad90fcd539
|
||
|
|
705bd63b42
|
||
|
|
83e418cdee
|
||
|
|
7a193d6647
|
||
|
|
bb82b6b462
|
||
|
|
4e2e13108c
|
||
|
|
ca7475dca2
|
||
|
|
43a43e1a2c
|
||
|
|
595bb03c5a
|
||
|
|
62cd0eb7d1
|
||
|
|
f19baaf22a
|
||
|
|
23821f9e65
|
||
|
|
a33410eeb4
|
||
|
|
a1b238e86b
|
||
|
|
334b47353e
|
||
|
|
6848bd739c
|
||
|
|
7f77ad5528
|
||
| 6f2160b479 | |||
|
|
f08bb56a7a
|
||
|
|
fe1dfd8ec8
|
||
| c1f275463e | |||
| 324809f77e | |||
|
|
f9b07bcb01
|
||
|
|
986eb5387c
|
||
| f76e2c2f14 | |||
|
|
22a7bbe6eb
|
||
| 18f4deb30f | |||
|
|
9f9bf6fd80
|
||
|
|
d2987da70a
|
||
|
|
6b7a80e23a
|
||
|
|
42b9b27561
|
||
|
|
c17c980b69
|
||
|
ee42d68471
|
|||
|
7acc3b2106
|
|||
|
20c014607c
|
|||
|
|
f199d5d12a
|
||
|
|
4b17afa93d
|
||
|
|
6d52af53ae
|
||
|
|
4c5ad67652
|
||
|
|
3437a756eb
|
||
| 0d9fc4aa74 | |||
| 82475161a9 | |||
| e1e7d8f87d | |||
|
|
5b46f3adf5
|
||
|
|
a8a8fba14c
|
||
|
|
8a7016a30b
|
||
|
|
e2618de7c6
|
10
.drone.yml
10
.drone.yml
@@ -12,7 +12,7 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
restore: true
|
restore: true
|
||||||
mount:
|
mount:
|
||||||
- ./vendor
|
- ./vendor/cache
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
@@ -20,6 +20,8 @@ steps:
|
|||||||
image: guildeducation/rails:2.7.2-14.20.0
|
image: guildeducation/rails:2.7.2-14.20.0
|
||||||
environment:
|
environment:
|
||||||
RAILS_ENV: test
|
RAILS_ENV: test
|
||||||
|
REDIS_URL: redis://redis:6379/0
|
||||||
|
RS_REDIS_URL: redis://redis:6379/1
|
||||||
commands:
|
commands:
|
||||||
- bundle config unset deployment
|
- bundle config unset deployment
|
||||||
- bundle config set cache_all 'true'
|
- bundle config set cache_all 'true'
|
||||||
@@ -37,11 +39,15 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
rebuild: true
|
rebuild: true
|
||||||
mount:
|
mount:
|
||||||
- ./vendor
|
- ./vendor/cache
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: redis
|
||||||
|
image: redis
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: cache
|
- name: cache
|
||||||
host:
|
host:
|
||||||
|
|||||||
11
.env.example
11
.env.example
@@ -1,3 +1,6 @@
|
|||||||
|
PRIMARY_DOMAIN=kosmos.org
|
||||||
|
AKKOUNTS_DOMAIN=accounts.example.com
|
||||||
|
|
||||||
SMTP_SERVER=smtp.example.com
|
SMTP_SERVER=smtp.example.com
|
||||||
SMTP_PORT=587
|
SMTP_PORT=587
|
||||||
SMTP_LOGIN=accounts
|
SMTP_LOGIN=accounts
|
||||||
@@ -12,12 +15,20 @@ LDAP_PORT=389
|
|||||||
LDAP_ADMIN_PASSWORD=passthebutter
|
LDAP_ADMIN_PASSWORD=passthebutter
|
||||||
LDAP_SUFFIX='dc=kosmos,dc=org'
|
LDAP_SUFFIX='dc=kosmos,dc=org'
|
||||||
|
|
||||||
|
REDIS_URL='redis://localhost:6379/1'
|
||||||
|
|
||||||
WEBHOOKS_ALLOWED_IPS='10.1.1.163'
|
WEBHOOKS_ALLOWED_IPS='10.1.1.163'
|
||||||
|
|
||||||
DISCOURSE_PUBLIC_URL='https://community.kosmos.org'
|
DISCOURSE_PUBLIC_URL='https://community.kosmos.org'
|
||||||
|
DISCOURSE_CONNECT_SECRET='discourse_connect_ftw'
|
||||||
|
|
||||||
|
DRONECI_PUBLIC_URL='https://drone.kosmos.org'
|
||||||
|
|
||||||
GITEA_PUBLIC_URL='https://gitea.kosmos.org'
|
GITEA_PUBLIC_URL='https://gitea.kosmos.org'
|
||||||
MASTODON_PUBLIC_URL='https://kosmos.social'
|
MASTODON_PUBLIC_URL='https://kosmos.social'
|
||||||
MEDIAWIKI_PUBLIC_URL='https://wiki.kosmos.org'
|
MEDIAWIKI_PUBLIC_URL='https://wiki.kosmos.org'
|
||||||
|
RS_STORAGE_URL='https://storage.kosmos.org'
|
||||||
|
RS_REDIS_URL='redis://localhost:6379/2'
|
||||||
|
|
||||||
EJABBERD_ADMIN_URL='https://xmpp.kosmos.org/admin'
|
EJABBERD_ADMIN_URL='https://xmpp.kosmos.org/admin'
|
||||||
EJABBERD_API_URL='https://xmpp.kosmos.org/api'
|
EJABBERD_API_URL='https://xmpp.kosmos.org/api'
|
||||||
|
|||||||
10
.env.test
10
.env.test
@@ -1,3 +1,10 @@
|
|||||||
|
PRIMARY_DOMAIN=kosmos.org
|
||||||
|
|
||||||
|
REDIS_URL='redis://localhost:6379/0'
|
||||||
|
|
||||||
|
DISCOURSE_PUBLIC_URL='http://discourse.example.com'
|
||||||
|
DISCOURSE_CONNECT_SECRET='discourse_connect_ftw'
|
||||||
|
|
||||||
EJABBERD_API_URL='http://xmpp.example.com/api'
|
EJABBERD_API_URL='http://xmpp.example.com/api'
|
||||||
|
|
||||||
BTCPAY_API_URL='http://btcpay.example.com/api/v1'
|
BTCPAY_API_URL='http://btcpay.example.com/api/v1'
|
||||||
@@ -6,4 +13,7 @@ LNDHUB_API_URL='http://localhost:3026'
|
|||||||
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
||||||
LNDHUB_PUBLIC_KEY='024cd3be18617f39cf645851e3ba63f51fc13f0bb09e3bb25e6fd4de556486d946'
|
LNDHUB_PUBLIC_KEY='024cd3be18617f39cf645851e3ba63f51fc13f0bb09e3bb25e6fd4de556486d946'
|
||||||
|
|
||||||
|
RS_STORAGE_URL='https://storage.kosmos.org'
|
||||||
|
RS_REDIS_URL='redis://localhost:6379/1'
|
||||||
|
|
||||||
WEBHOOKS_ALLOWED_IPS='10.1.1.23'
|
WEBHOOKS_ALLOWED_IPS='10.1.1.23'
|
||||||
|
|||||||
14
.gitea/release-drafter.yml
Normal file
14
.gitea/release-drafter.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name-template: 'v$RESOLVED_VERSION'
|
||||||
|
tag-template: 'v$RESOLVED_VERSION'
|
||||||
|
version-resolver:
|
||||||
|
major:
|
||||||
|
labels:
|
||||||
|
- 'release/major'
|
||||||
|
minor:
|
||||||
|
labels:
|
||||||
|
- 'release/minor'
|
||||||
|
- 'feature'
|
||||||
|
patch:
|
||||||
|
labels:
|
||||||
|
- 'release/patch'
|
||||||
|
default: patch
|
||||||
11
.gitea/workflows/release_drafter.yml
Normal file
11
.gitea/workflows/release_drafter.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: Release Drafter
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
jobs:
|
||||||
|
release_drafter_job:
|
||||||
|
name: Update release notes draft
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Release Drafter
|
||||||
|
uses: https://github.com/raucao/gitea-release-drafter@dev
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -39,6 +39,7 @@ yarn-debug.log*
|
|||||||
|
|
||||||
# Ignore local dotenv config file
|
# Ignore local dotenv config file
|
||||||
.env
|
.env
|
||||||
|
.env.development
|
||||||
|
|
||||||
# Ignore redis dumps from sidekiq
|
# Ignore redis dumps from sidekiq
|
||||||
dump.rdb
|
dump.rdb
|
||||||
|
|||||||
21
Dockerfile
21
Dockerfile
@@ -1,22 +1,21 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM ruby:2.7.6
|
FROM ruby:2.7.6
|
||||||
RUN apt-get update -qq && apt-get install -y curl ldap-utils
|
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
RUN apt-get update -qq && apt-get install -y --no-install-recommends curl \
|
||||||
|
ldap-utils tini
|
||||||
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
|
||||||
|
|
||||||
WORKDIR /akkounts
|
WORKDIR /akkounts
|
||||||
COPY Gemfile /akkounts/Gemfile
|
|
||||||
COPY Gemfile.lock /akkounts/Gemfile.lock
|
COPY ["Gemfile", "Gemfile.lock", "package.json", "./"]
|
||||||
COPY package.json /akkounts/package.json
|
|
||||||
RUN bundle install
|
RUN bundle install
|
||||||
RUN gem install foreman
|
RUN gem install foreman
|
||||||
RUN npm install -g yarn
|
RUN npm install -g yarn
|
||||||
RUN yarn install
|
RUN yarn install
|
||||||
|
|
||||||
# Add a script to be executed every time the container starts.
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||||
COPY docker/entrypoint.sh /usr/bin/
|
|
||||||
RUN chmod +x /usr/bin/entrypoint.sh
|
|
||||||
ENTRYPOINT ["entrypoint.sh"]
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Configure the main process to run when running the image
|
|
||||||
CMD ["bin", "dev"]
|
|
||||||
|
|||||||
14
Gemfile
14
Gemfile
@@ -40,6 +40,9 @@ gem 'net-ldap'
|
|||||||
gem "rqrcode", "~> 2.0"
|
gem "rqrcode", "~> 2.0"
|
||||||
gem 'rails-settings-cached', '~> 2.8.3'
|
gem 'rails-settings-cached', '~> 2.8.3'
|
||||||
gem 'pagy', '~> 6.0', '>= 6.0.2'
|
gem 'pagy', '~> 6.0', '>= 6.0.2'
|
||||||
|
gem 'flipper'
|
||||||
|
gem 'flipper-active_record'
|
||||||
|
gem 'flipper-ui'
|
||||||
|
|
||||||
# HTTP requests
|
# HTTP requests
|
||||||
gem 'faraday'
|
gem 'faraday'
|
||||||
@@ -48,10 +51,20 @@ gem 'faraday'
|
|||||||
gem 'sidekiq', '< 7'
|
gem 'sidekiq', '< 7'
|
||||||
gem 'sidekiq-scheduler'
|
gem 'sidekiq-scheduler'
|
||||||
|
|
||||||
|
# Monitoring
|
||||||
|
gem "sentry-ruby"
|
||||||
|
gem "sentry-rails"
|
||||||
|
|
||||||
|
# Services
|
||||||
|
gem 'discourse_api'
|
||||||
|
gem "lnurl"
|
||||||
|
gem 'nostr', git: 'https://gitea.kosmos.org/kosmos/nostr-gem.git', branch: 'feature/ruby_2.7_compat'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
# Use sqlite3 as the database for Active Record
|
# Use sqlite3 as the database for Active Record
|
||||||
gem 'sqlite3', '~> 1.4'
|
gem 'sqlite3', '~> 1.4'
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
|
gem 'rails-controller-testing'
|
||||||
gem "byebug", "~> 11.1"
|
gem "byebug", "~> 11.1"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -62,6 +75,7 @@ group :development do
|
|||||||
gem 'letter_opener'
|
gem 'letter_opener'
|
||||||
gem 'letter_opener_web'
|
gem 'letter_opener_web'
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
|
gem 'solargraph'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
|||||||
376
Gemfile.lock
376
Gemfile.lock
@@ -1,78 +1,98 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://gitea.kosmos.org/kosmos/nostr-gem.git
|
||||||
|
revision: 596529d9eb50d13b3f385245636698fccf37b442
|
||||||
|
branch: feature/ruby_2.7_compat
|
||||||
|
specs:
|
||||||
|
nostr (0.4.0)
|
||||||
|
bech32 (~> 1.3)
|
||||||
|
bip-schnorr (~> 0.4)
|
||||||
|
ecdsa (~> 1.2)
|
||||||
|
event_emitter (~> 0.2)
|
||||||
|
faye-websocket (~> 0.11)
|
||||||
|
json (~> 2.6)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (7.0.4)
|
actioncable (7.0.5)
|
||||||
actionpack (= 7.0.4)
|
actionpack (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (7.0.4)
|
actionmailbox (7.0.5)
|
||||||
actionpack (= 7.0.4)
|
actionpack (= 7.0.5)
|
||||||
activejob (= 7.0.4)
|
activejob (= 7.0.5)
|
||||||
activerecord (= 7.0.4)
|
activerecord (= 7.0.5)
|
||||||
activestorage (= 7.0.4)
|
activestorage (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
actionmailer (7.0.4)
|
actionmailer (7.0.5)
|
||||||
actionpack (= 7.0.4)
|
actionpack (= 7.0.5)
|
||||||
actionview (= 7.0.4)
|
actionview (= 7.0.5)
|
||||||
activejob (= 7.0.4)
|
activejob (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (7.0.4)
|
actionpack (7.0.5)
|
||||||
actionview (= 7.0.4)
|
actionview (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
rack (~> 2.0, >= 2.2.0)
|
rack (~> 2.0, >= 2.2.4)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
actiontext (7.0.4)
|
actiontext (7.0.5)
|
||||||
actionpack (= 7.0.4)
|
actionpack (= 7.0.5)
|
||||||
activerecord (= 7.0.4)
|
activerecord (= 7.0.5)
|
||||||
activestorage (= 7.0.4)
|
activestorage (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
globalid (>= 0.6.0)
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.0.4)
|
actionview (7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||||
activejob (7.0.4)
|
activejob (7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (7.0.4)
|
activemodel (7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
activerecord (7.0.4)
|
activerecord (7.0.5)
|
||||||
activemodel (= 7.0.4)
|
activemodel (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
activestorage (7.0.4)
|
activestorage (7.0.5)
|
||||||
actionpack (= 7.0.4)
|
actionpack (= 7.0.5)
|
||||||
activejob (= 7.0.4)
|
activejob (= 7.0.5)
|
||||||
activerecord (= 7.0.4)
|
activerecord (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
mini_mime (>= 1.1.0)
|
mini_mime (>= 1.1.0)
|
||||||
activesupport (7.0.4)
|
activesupport (7.0.5)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0)
|
||||||
addressable (2.8.1)
|
addressable (2.8.4)
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
|
ast (2.4.2)
|
||||||
|
backport (1.2.0)
|
||||||
bcrypt (3.1.18)
|
bcrypt (3.1.18)
|
||||||
|
bech32 (1.3.0)
|
||||||
|
thor (>= 1.1.0)
|
||||||
|
benchmark (0.2.1)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
|
bip-schnorr (0.6.0)
|
||||||
|
ecdsa_ext (~> 0.5.0)
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
byebug (11.1.3)
|
byebug (11.1.3)
|
||||||
capybara (3.38.0)
|
capybara (3.39.2)
|
||||||
addressable
|
addressable
|
||||||
matrix
|
matrix
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
@@ -82,20 +102,21 @@ GEM
|
|||||||
regexp_parser (>= 1.5, < 3.0)
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
chunky_png (1.4.0)
|
chunky_png (1.4.0)
|
||||||
concurrent-ruby (1.1.10)
|
concurrent-ruby (1.2.2)
|
||||||
connection_pool (2.3.0)
|
connection_pool (2.4.1)
|
||||||
crack (0.4.5)
|
crack (0.4.5)
|
||||||
rexml
|
rexml
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
cssbundling-rails (1.1.1)
|
cssbundling-rails (1.1.2)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
database_cleaner (2.0.1)
|
database_cleaner (2.0.2)
|
||||||
database_cleaner-active_record (~> 2.0.0)
|
database_cleaner-active_record (>= 2, < 3)
|
||||||
database_cleaner-active_record (2.0.1)
|
database_cleaner-active_record (2.1.0)
|
||||||
activerecord (>= 5.a)
|
activerecord (>= 5.a)
|
||||||
database_cleaner-core (~> 2.0.0)
|
database_cleaner-core (~> 2.0.0)
|
||||||
database_cleaner-core (2.0.1)
|
database_cleaner-core (2.0.1)
|
||||||
devise (4.9.0)
|
date (3.3.3)
|
||||||
|
devise (4.9.2)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
@@ -105,41 +126,76 @@ GEM
|
|||||||
devise (>= 3.4.1)
|
devise (>= 3.4.1)
|
||||||
net-ldap (>= 0.16.0)
|
net-ldap (>= 0.16.0)
|
||||||
diff-lcs (1.5.0)
|
diff-lcs (1.5.0)
|
||||||
|
discourse_api (2.0.1)
|
||||||
|
faraday (~> 2.7)
|
||||||
|
faraday-follow_redirects
|
||||||
|
faraday-multipart
|
||||||
|
rack (>= 1.6)
|
||||||
dotenv (2.8.1)
|
dotenv (2.8.1)
|
||||||
dotenv-rails (2.8.1)
|
dotenv-rails (2.8.1)
|
||||||
dotenv (= 2.8.1)
|
dotenv (= 2.8.1)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
erubi (1.11.0)
|
e2mmap (0.1.0)
|
||||||
|
ecdsa (1.2.0)
|
||||||
|
ecdsa_ext (0.5.0)
|
||||||
|
ecdsa (~> 1.2.0)
|
||||||
|
erubi (1.12.0)
|
||||||
et-orbi (1.2.7)
|
et-orbi (1.2.7)
|
||||||
tzinfo
|
tzinfo
|
||||||
|
event_emitter (0.2.6)
|
||||||
|
eventmachine (1.2.7)
|
||||||
factory_bot (6.2.1)
|
factory_bot (6.2.1)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
factory_bot_rails (6.2.0)
|
factory_bot_rails (6.2.0)
|
||||||
factory_bot (~> 6.2.0)
|
factory_bot (~> 6.2.0)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
faker (3.0.0)
|
faker (3.2.0)
|
||||||
i18n (>= 1.8.11, < 2)
|
i18n (>= 1.8.11, < 2)
|
||||||
faraday (2.7.1)
|
faraday (2.7.6)
|
||||||
faraday-net_http (>= 2.0, < 3.1)
|
faraday-net_http (>= 2.0, < 3.1)
|
||||||
ruby2_keywords (>= 0.0.4)
|
ruby2_keywords (>= 0.0.4)
|
||||||
|
faraday-follow_redirects (0.3.0)
|
||||||
|
faraday (>= 1, < 3)
|
||||||
|
faraday-multipart (1.0.4)
|
||||||
|
multipart-post (~> 2)
|
||||||
faraday-net_http (3.0.2)
|
faraday-net_http (3.0.2)
|
||||||
|
faye-websocket (0.11.2)
|
||||||
|
eventmachine (>= 0.12.0)
|
||||||
|
websocket-driver (>= 0.5.1)
|
||||||
ffi (1.15.5)
|
ffi (1.15.5)
|
||||||
fugit (1.7.2)
|
flipper (0.28.0)
|
||||||
|
concurrent-ruby (< 2)
|
||||||
|
flipper-active_record (0.28.0)
|
||||||
|
activerecord (>= 4.2, < 8)
|
||||||
|
flipper (~> 0.28.0)
|
||||||
|
flipper-ui (0.28.0)
|
||||||
|
erubi (>= 1.0.0, < 2.0.0)
|
||||||
|
flipper (~> 0.28.0)
|
||||||
|
rack (>= 1.4, < 3)
|
||||||
|
rack-protection (>= 1.5.3, <= 4.0.0)
|
||||||
|
sanitize (< 7)
|
||||||
|
fugit (1.8.1)
|
||||||
et-orbi (~> 1, >= 1.2.7)
|
et-orbi (~> 1, >= 1.2.7)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
globalid (1.0.0)
|
globalid (1.1.0)
|
||||||
activesupport (>= 5.0)
|
activesupport (>= 5.0)
|
||||||
hashdiff (1.0.1)
|
hashdiff (1.0.1)
|
||||||
i18n (1.12.0)
|
i18n (1.14.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
importmap-rails (1.1.5)
|
importmap-rails (1.1.6)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
|
jaro_winkler (1.5.6)
|
||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
launchy (2.5.0)
|
json (2.6.3)
|
||||||
addressable (~> 2.7)
|
kramdown (2.4.0)
|
||||||
|
rexml
|
||||||
|
kramdown-parser-gfm (1.1.0)
|
||||||
|
kramdown (~> 2.0)
|
||||||
|
launchy (2.5.2)
|
||||||
|
addressable (~> 2.8)
|
||||||
letter_opener (1.8.1)
|
letter_opener (1.8.1)
|
||||||
launchy (>= 2.2, < 3)
|
launchy (>= 2.2, < 3)
|
||||||
letter_opener_web (2.0.0)
|
letter_opener_web (2.0.0)
|
||||||
@@ -147,145 +203,198 @@ GEM
|
|||||||
letter_opener (~> 1.7)
|
letter_opener (~> 1.7)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
rexml
|
rexml
|
||||||
listen (3.7.1)
|
listen (3.8.0)
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
lockbox (1.1.0)
|
lnurl (1.0.1)
|
||||||
loofah (2.19.0)
|
bech32 (~> 1.1)
|
||||||
|
lockbox (1.2.0)
|
||||||
|
loofah (2.21.3)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.12.0)
|
||||||
mail (2.7.1)
|
mail (2.8.1)
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
|
net-imap
|
||||||
|
net-pop
|
||||||
|
net-smtp
|
||||||
marcel (1.0.2)
|
marcel (1.0.2)
|
||||||
matrix (0.4.2)
|
matrix (0.4.2)
|
||||||
method_source (1.0.0)
|
method_source (1.0.0)
|
||||||
mini_mime (1.1.2)
|
mini_mime (1.1.2)
|
||||||
mini_portile2 (2.8.0)
|
minitest (5.18.0)
|
||||||
minitest (5.16.3)
|
multipart-post (2.3.0)
|
||||||
net-imap (0.3.1)
|
net-imap (0.3.6)
|
||||||
|
date
|
||||||
net-protocol
|
net-protocol
|
||||||
net-ldap (0.17.1)
|
net-ldap (0.18.0)
|
||||||
net-pop (0.1.2)
|
net-pop (0.1.2)
|
||||||
net-protocol
|
net-protocol
|
||||||
net-protocol (0.1.3)
|
net-protocol (0.2.1)
|
||||||
timeout
|
timeout
|
||||||
net-smtp (0.3.3)
|
net-smtp (0.3.3)
|
||||||
net-protocol
|
net-protocol
|
||||||
nio4r (2.5.8)
|
nio4r (2.5.9)
|
||||||
nokogiri (1.13.9)
|
nokogiri (1.15.2-arm64-darwin)
|
||||||
mini_portile2 (~> 2.8.0)
|
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.13.9-x86_64-linux)
|
nokogiri (1.15.2-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
pagy (6.0.2)
|
pagy (6.0.4)
|
||||||
|
parallel (1.23.0)
|
||||||
|
parser (3.2.2.3)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
racc
|
||||||
pg (1.2.3)
|
pg (1.2.3)
|
||||||
public_suffix (5.0.0)
|
public_suffix (5.0.1)
|
||||||
puma (4.3.12)
|
puma (4.3.12)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
racc (1.6.0)
|
racc (1.7.1)
|
||||||
rack (2.2.4)
|
rack (2.2.7)
|
||||||
rack-test (2.0.2)
|
rack-protection (3.0.6)
|
||||||
|
rack
|
||||||
|
rack-test (2.1.0)
|
||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rails (7.0.4)
|
rails (7.0.5)
|
||||||
actioncable (= 7.0.4)
|
actioncable (= 7.0.5)
|
||||||
actionmailbox (= 7.0.4)
|
actionmailbox (= 7.0.5)
|
||||||
actionmailer (= 7.0.4)
|
actionmailer (= 7.0.5)
|
||||||
actionpack (= 7.0.4)
|
actionpack (= 7.0.5)
|
||||||
actiontext (= 7.0.4)
|
actiontext (= 7.0.5)
|
||||||
actionview (= 7.0.4)
|
actionview (= 7.0.5)
|
||||||
activejob (= 7.0.4)
|
activejob (= 7.0.5)
|
||||||
activemodel (= 7.0.4)
|
activemodel (= 7.0.5)
|
||||||
activerecord (= 7.0.4)
|
activerecord (= 7.0.5)
|
||||||
activestorage (= 7.0.4)
|
activestorage (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 7.0.4)
|
railties (= 7.0.5)
|
||||||
|
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.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
nokogiri (>= 1.6)
|
nokogiri (>= 1.6)
|
||||||
rails-html-sanitizer (1.4.3)
|
rails-html-sanitizer (1.6.0)
|
||||||
loofah (~> 2.3)
|
loofah (~> 2.21)
|
||||||
|
nokogiri (~> 1.14)
|
||||||
rails-settings-cached (2.8.3)
|
rails-settings-cached (2.8.3)
|
||||||
activerecord (>= 5.0.0)
|
activerecord (>= 5.0.0)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
railties (7.0.4)
|
railties (7.0.5)
|
||||||
actionpack (= 7.0.4)
|
actionpack (= 7.0.5)
|
||||||
activesupport (= 7.0.4)
|
activesupport (= 7.0.5)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
zeitwerk (~> 2.5)
|
zeitwerk (~> 2.5)
|
||||||
|
rainbow (3.1.1)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
rb-fsevent (0.11.2)
|
rb-fsevent (0.11.2)
|
||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
redis (5.0.5)
|
rbs (2.8.4)
|
||||||
redis-client (>= 0.9.0)
|
redis (4.8.1)
|
||||||
redis-client (0.11.2)
|
regexp_parser (2.8.1)
|
||||||
connection_pool
|
|
||||||
regexp_parser (2.6.1)
|
|
||||||
responders (3.1.0)
|
responders (3.1.0)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
|
reverse_markdown (2.1.1)
|
||||||
|
nokogiri
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rqrcode (2.1.2)
|
rqrcode (2.2.0)
|
||||||
chunky_png (~> 1.0)
|
chunky_png (~> 1.0)
|
||||||
rqrcode_core (~> 1.0)
|
rqrcode_core (~> 1.0)
|
||||||
rqrcode_core (1.2.0)
|
rqrcode_core (1.2.0)
|
||||||
rspec-core (3.12.0)
|
rspec-core (3.12.2)
|
||||||
rspec-support (~> 3.12.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-expectations (3.12.0)
|
rspec-expectations (3.12.3)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.12.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-mocks (3.12.0)
|
rspec-mocks (3.12.5)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.12.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-rails (6.0.1)
|
rspec-rails (6.0.3)
|
||||||
actionpack (>= 6.1)
|
actionpack (>= 6.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
railties (>= 6.1)
|
railties (>= 6.1)
|
||||||
rspec-core (~> 3.11)
|
rspec-core (~> 3.12)
|
||||||
rspec-expectations (~> 3.11)
|
rspec-expectations (~> 3.12)
|
||||||
rspec-mocks (~> 3.11)
|
rspec-mocks (~> 3.12)
|
||||||
rspec-support (~> 3.11)
|
rspec-support (~> 3.12)
|
||||||
rspec-support (3.12.0)
|
rspec-support (3.12.0)
|
||||||
|
rubocop (1.52.1)
|
||||||
|
json (~> 2.3)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.2.2.3)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
|
rexml (>= 3.2.5, < 4.0)
|
||||||
|
rubocop-ast (>= 1.28.0, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
|
rubocop-ast (1.29.0)
|
||||||
|
parser (>= 3.2.1.0)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
rufus-scheduler (3.8.2)
|
rufus-scheduler (3.9.1)
|
||||||
fugit (~> 1.1, >= 1.1.6)
|
fugit (~> 1.1, >= 1.1.6)
|
||||||
sidekiq (6.5.5)
|
sanitize (6.0.1)
|
||||||
connection_pool (>= 2.2.2)
|
crass (~> 1.0.2)
|
||||||
|
nokogiri (>= 1.12.0)
|
||||||
|
sentry-rails (5.9.0)
|
||||||
|
railties (>= 5.0)
|
||||||
|
sentry-ruby (~> 5.9.0)
|
||||||
|
sentry-ruby (5.9.0)
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
sidekiq (6.5.9)
|
||||||
|
connection_pool (>= 2.2.5, < 3)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
redis (>= 4.5.0)
|
redis (>= 4.5.0, < 5)
|
||||||
sidekiq-scheduler (4.0.3)
|
sidekiq-scheduler (5.0.3)
|
||||||
redis (>= 4.2.0)
|
|
||||||
rufus-scheduler (~> 3.2)
|
rufus-scheduler (~> 3.2)
|
||||||
sidekiq (>= 4, < 7)
|
sidekiq (>= 6, < 8)
|
||||||
tilt (>= 1.4.0)
|
tilt (>= 1.4.0)
|
||||||
sprockets (4.1.1)
|
solargraph (0.49.0)
|
||||||
|
backport (~> 1.2)
|
||||||
|
benchmark
|
||||||
|
bundler (~> 2.0)
|
||||||
|
diff-lcs (~> 1.4)
|
||||||
|
e2mmap
|
||||||
|
jaro_winkler (~> 1.5)
|
||||||
|
kramdown (~> 2.3)
|
||||||
|
kramdown-parser-gfm (~> 1.1)
|
||||||
|
parser (~> 3.0)
|
||||||
|
rbs (~> 2.0)
|
||||||
|
reverse_markdown (~> 2.0)
|
||||||
|
rubocop (~> 1.38)
|
||||||
|
thor (~> 1.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
|
yard (~> 0.9, >= 0.9.24)
|
||||||
|
sprockets (4.2.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (>= 2.2.4, < 4)
|
||||||
sprockets-rails (3.4.2)
|
sprockets-rails (3.4.2)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 5.2)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sqlite3 (1.5.4)
|
sqlite3 (1.6.3-arm64-darwin)
|
||||||
mini_portile2 (~> 2.8.0)
|
sqlite3 (1.6.3-x86_64-linux)
|
||||||
sqlite3 (1.5.4-x86_64-linux)
|
|
||||||
stimulus-rails (1.2.1)
|
stimulus-rails (1.2.1)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
thor (1.2.1)
|
thor (1.2.2)
|
||||||
tilt (2.0.11)
|
tilt (2.2.0)
|
||||||
timeout (0.3.0)
|
timeout (0.3.2)
|
||||||
turbo-rails (1.3.2)
|
turbo-rails (1.4.0)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
activejob (>= 6.0.0)
|
activejob (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
tzinfo (2.0.5)
|
tzinfo (2.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
view_component (2.78.0)
|
unicode-display_width (2.4.2)
|
||||||
activesupport (>= 5.0.0, < 8.0)
|
view_component (3.2.0)
|
||||||
|
activesupport (>= 5.2.0, < 8.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
warden (1.2.9)
|
warden (1.2.9)
|
||||||
@@ -304,10 +413,11 @@ GEM
|
|||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.6.6)
|
yard (0.9.34)
|
||||||
|
zeitwerk (2.6.8)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
arm64-darwin-22
|
||||||
x86_64-linux
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
@@ -317,26 +427,36 @@ DEPENDENCIES
|
|||||||
database_cleaner
|
database_cleaner
|
||||||
devise (~> 4.9.0)
|
devise (~> 4.9.0)
|
||||||
devise_ldap_authenticatable
|
devise_ldap_authenticatable
|
||||||
|
discourse_api
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
factory_bot_rails
|
factory_bot_rails
|
||||||
faker
|
faker
|
||||||
faraday
|
faraday
|
||||||
|
flipper
|
||||||
|
flipper-active_record
|
||||||
|
flipper-ui
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder (~> 2.7)
|
jbuilder (~> 2.7)
|
||||||
letter_opener
|
letter_opener
|
||||||
letter_opener_web
|
letter_opener_web
|
||||||
listen (~> 3.2)
|
listen (~> 3.2)
|
||||||
|
lnurl
|
||||||
lockbox
|
lockbox
|
||||||
net-ldap
|
net-ldap
|
||||||
|
nostr!
|
||||||
pagy (~> 6.0, >= 6.0.2)
|
pagy (~> 6.0, >= 6.0.2)
|
||||||
pg (~> 1.2.3)
|
pg (~> 1.2.3)
|
||||||
puma (~> 4.1)
|
puma (~> 4.1)
|
||||||
rails (~> 7.0.2)
|
rails (~> 7.0.2)
|
||||||
|
rails-controller-testing
|
||||||
rails-settings-cached (~> 2.8.3)
|
rails-settings-cached (~> 2.8.3)
|
||||||
rqrcode (~> 2.0)
|
rqrcode (~> 2.0)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
|
sentry-rails
|
||||||
|
sentry-ruby
|
||||||
sidekiq (< 7)
|
sidekiq (< 7)
|
||||||
sidekiq-scheduler
|
sidekiq-scheduler
|
||||||
|
solargraph
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
sqlite3 (~> 1.4)
|
sqlite3 (~> 1.4)
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
|
|||||||
36
README.md
36
README.md
@@ -14,7 +14,6 @@ so:
|
|||||||
|
|
||||||
1. Make sure [Docker Compose is installed][1] and Docker is running (included in
|
1. Make sure [Docker Compose is installed][1] and Docker is running (included in
|
||||||
Docker Desktop)
|
Docker Desktop)
|
||||||
2. Uncomment the `web` section in `docker-compose.yml`
|
|
||||||
3. Run `docker compose up` and wait until 389ds announces its successful start
|
3. Run `docker compose up` and wait until 389ds announces its successful start
|
||||||
in the log output
|
in the log output
|
||||||
4. `docker-compose exec ldap dsconf localhost backend create --suffix="dc=kosmos,dc=org" --be-name="dev"`
|
4. `docker-compose exec ldap dsconf localhost backend create --suffix="dc=kosmos,dc=org" --be-name="dev"`
|
||||||
@@ -23,9 +22,8 @@ so:
|
|||||||
|
|
||||||
After these steps, you should have a working Rails app with a handful of test
|
After these steps, you should have a working Rails app with a handful of test
|
||||||
users running on [http://localhost:3000](http://localhost:3000).
|
users running on [http://localhost:3000](http://localhost:3000).
|
||||||
|
|
||||||
Log in with username "admin" and password "admin is admin". All users listed on
|
Log in with username "admin" and password "admin is admin". All users listed on
|
||||||
[http://localhost:3000/admin/ldap_users](http://localhost:3000/admin/ldap_users)
|
[http://localhost:3000/admin/users](http://localhost:3000/admin/users)
|
||||||
have the password "user is user".
|
have the password "user is user".
|
||||||
|
|
||||||
### Rails app
|
### Rails app
|
||||||
@@ -54,12 +52,14 @@ Running all specs:
|
|||||||
|
|
||||||
### Docker (Compose)
|
### Docker (Compose)
|
||||||
|
|
||||||
There is a working Docker Compose config file, which allows you to spin up both
|
There is a working Docker Compose config file, which define a number of services including
|
||||||
an app server for Rails as well as a local 389ds (LDAP) server.
|
an app server for Rails as well as a local 389ds (LDAP) server.
|
||||||
|
|
||||||
By default, `docker-compose up` will only start the LDAP server, listening on
|
For Rails developers, you probably just want to start the LDAP server: `docker-compose up ldap`,
|
||||||
port 389 on your machine. Uncomment other services in `docker-compose.yml` if
|
listening on port 389 on your machine.
|
||||||
you want to use them.
|
|
||||||
|
You can pick and choose your services adding them by name (listed in `docker-compose.yml`) at
|
||||||
|
the end of the docker compose command. eg. `docker compose up ldap redis`
|
||||||
|
|
||||||
#### LDAP server
|
#### LDAP server
|
||||||
|
|
||||||
@@ -79,6 +79,22 @@ The setup task will first delete any existing entries in the directory tree
|
|||||||
Note that all 389ds data is stored in `tmp/389ds`. So if you want to start over
|
Note that all 389ds data is stored in `tmp/389ds`. So if you want to start over
|
||||||
with a fresh installation, delete both that directory as well as the container.
|
with a fresh installation, delete both that directory as well as the container.
|
||||||
|
|
||||||
|
### Adding npm modules to use with Stimulus controllers
|
||||||
|
|
||||||
|
The following command downloads the specified npm module to `vendor/javascript`
|
||||||
|
and adds an entry for it to `config/importmap.rb`.
|
||||||
|
|
||||||
|
bin/importmap pin bech32 --download
|
||||||
|
|
||||||
|
### Solargraph
|
||||||
|
|
||||||
|
[Solargraph](https://solargraph.org/) is a Ruby language server, which you may
|
||||||
|
use with your editor to add features like auto-completion and syntax
|
||||||
|
validation. You can add inline documentation for bundled gems with this
|
||||||
|
command:
|
||||||
|
|
||||||
|
bundle exec yard gems
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
### Rails
|
### Rails
|
||||||
@@ -90,6 +106,8 @@ with a fresh installation, delete both that directory as well as the container.
|
|||||||
|
|
||||||
* [Tailwind CSS](https://tailwindcss.com/)
|
* [Tailwind CSS](https://tailwindcss.com/)
|
||||||
* [Sass](https://sass-lang.com/documentation)
|
* [Sass](https://sass-lang.com/documentation)
|
||||||
|
* [Stimulus](https://stimulus.hotwired.dev/handbook/)
|
||||||
|
* [Tailwind Stimulus Components](https://github.com/excid3/tailwindcss-stimulus-components)
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
@@ -106,6 +124,10 @@ with a fresh installation, delete both that directory as well as the container.
|
|||||||
* [Sidekiq](https://github.com/mperham/sidekiq/wiki/)
|
* [Sidekiq](https://github.com/mperham/sidekiq/wiki/)
|
||||||
* [ActiveJob](https://github.com/mperham/sidekiq/wiki/Active-Job)
|
* [ActiveJob](https://github.com/mperham/sidekiq/wiki/Active-Job)
|
||||||
|
|
||||||
|
### Feature Flags
|
||||||
|
|
||||||
|
* [Flipper](https://www.flippercloud.io/docs/get-started/self-hosted)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0/)
|
[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
//= link_tree ../images
|
//= link_tree ../images
|
||||||
//= link_tree ../../javascript .js
|
//= link_tree ../../javascript .js
|
||||||
//= link_tree ../builds
|
//= link_tree ../builds
|
||||||
|
//= link_tree ../../../vendor/javascript .js
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
@import "tailwindcss/components";
|
@import "tailwindcss/components";
|
||||||
@import "tailwindcss/utilities";
|
@import "tailwindcss/utilities";
|
||||||
|
|
||||||
|
@import "components/animations";
|
||||||
@import "components/base";
|
@import "components/base";
|
||||||
@import "components/buttons";
|
@import "components/buttons";
|
||||||
@import "components/dashboard_services";
|
@import "components/dashboard_services";
|
||||||
|
|||||||
16
app/assets/stylesheets/components/animations.css
Normal file
16
app/assets/stylesheets/components/animations.css
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
@keyframes scaleIn {
|
||||||
|
from {
|
||||||
|
transform: scale(0.5);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: scale(1);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-scale-in {
|
||||||
|
animation-name: scaleIn;
|
||||||
|
animation-duration: 0.15s;
|
||||||
|
animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1);
|
||||||
|
}
|
||||||
@@ -24,6 +24,10 @@
|
|||||||
@apply text-xl mb-6;
|
@apply text-xl mb-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
@apply font-bold mb-4 leading-6;
|
||||||
|
}
|
||||||
|
|
||||||
main section {
|
main section {
|
||||||
@apply pt-8 sm:pt-12;
|
@apply pt-8 sm:pt-12;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-icon {
|
.btn-icon {
|
||||||
@apply px-3;
|
@apply py-2 px-3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-outline {
|
||||||
|
@apply py-2 border-2 border-gray-100 hover:bg-gray-100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-gray {
|
.btn-gray {
|
||||||
@@ -33,7 +37,8 @@
|
|||||||
focus:ring-red-500 focus:ring-opacity-75;
|
focus:ring-red-500 focus:ring-opacity-75;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text]:disabled {
|
.btn:disabled {
|
||||||
@apply text-gray-700;
|
@apply bg-gray-100 hover:bg-gray-200 text-gray-400
|
||||||
|
focus:ring-gray-300 focus:ring-opacity-75;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,17 @@
|
|||||||
focus:ring-blue-600 focus:ring-opacity-75;
|
focus:ring-blue-600 focus:ring-opacity-75;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field_with_errors {
|
input[type=text]:disabled,
|
||||||
@apply inline-block;
|
input[type=email]:disabled {
|
||||||
|
@apply text-gray-700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field_with_errors input {
|
input.field_with_errors {
|
||||||
@apply w-full bg-red-100;
|
@apply border-b-red-600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field_with_errors {
|
||||||
|
@apply inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-msg {
|
.error-msg {
|
||||||
|
|||||||
@@ -5,10 +5,4 @@
|
|||||||
&:visited { @apply text-indigo-600; }
|
&:visited { @apply text-indigo-600; }
|
||||||
&:active { @apply text-red-600; }
|
&:active { @apply text-red-600; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.devise-links {
|
|
||||||
a {
|
|
||||||
@apply ks-text-link;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
15
app/components/app_info_component.html.erb
Normal file
15
app/components/app_info_component.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<div class="flex">
|
||||||
|
<div class="<%= @icon_container_class %>">
|
||||||
|
<%= image_tag(@icon_path, class: 'h-full w-full') %>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1 px-4">
|
||||||
|
<h4 class="sm:pt-2 mb-2 text-lg font-bold"><%= @name %></h4>
|
||||||
|
<p class="leading-snug"><%= @description %></p>
|
||||||
|
<p class="leading-snug flex flex-wrap gap-3">
|
||||||
|
<% @links.each do |link| %>
|
||||||
|
<a href="<%= link[1] %>" target="_blank"
|
||||||
|
class="flex-0 btn-sm btn-gray"><%= link[0] %></a>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
19
app/components/app_info_component.rb
Normal file
19
app/components/app_info_component.rb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AppInfoComponent < ViewComponent::Base
|
||||||
|
def initialize(name:, description:, icon_path: , icon_fill_box: false, links: [])
|
||||||
|
@name = name
|
||||||
|
@description = description
|
||||||
|
@icon_path = icon_path
|
||||||
|
@icon_container_class = icon_container_class(icon_fill_box)
|
||||||
|
@links = links
|
||||||
|
end
|
||||||
|
|
||||||
|
def icon_container_class(icon_fill_box)
|
||||||
|
str = "flex-0 h-16 w-16 sm:h-28 sm:w-28 bg-white rounded-3xl overflow-hidden"
|
||||||
|
unless icon_fill_box
|
||||||
|
str += " p-2 border border-gray-200"
|
||||||
|
end
|
||||||
|
str
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
<%= tag.public_send(@tag, class: "mb-6 last:mb-0") do %>
|
<%= tag.public_send(@tag, class: "mb-6 last:mb-0", data: {
|
||||||
|
:'field-name' => @field_name
|
||||||
|
}) do %>
|
||||||
|
<% if @positioning == :vertical %>
|
||||||
<label class="block">
|
<label class="block">
|
||||||
<p class="font-bold <%= @descripton.present? ? "mb-1" : "mb-2" %>">
|
<p class="font-bold <%= @descripton.present? ? "mb-1" : "mb-2" %>">
|
||||||
<%= @title %>
|
<%= @title %>
|
||||||
@@ -8,6 +11,35 @@
|
|||||||
<%= @descripton %>
|
<%= @descripton %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= content %>
|
|
||||||
|
<%= tag.p class: "flex gap-x-1", data: {
|
||||||
|
controller: @resettable ? "settings--resettable-field" : nil,
|
||||||
|
} do %>
|
||||||
|
<%= content %>
|
||||||
|
<% if @resettable %>
|
||||||
|
<button type="button"
|
||||||
|
class="relative grow-0 shrink-0 btn-md btn-outline text-red-700"
|
||||||
|
title="Reset to default value"
|
||||||
|
data-settings--resettable-field-target="resetButton"
|
||||||
|
data-action="settings--resettable-field#resetField">
|
||||||
|
Reset
|
||||||
|
</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</label>
|
</label>
|
||||||
|
<% elsif @positioning == :horizontal %>
|
||||||
|
<label class="block flex items-center justify-between">
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<label class="font-bold mb-1"><%= @title %></label>
|
||||||
|
<% if @descripton.present? %>
|
||||||
|
<p class="text-gray-500"><%= @descripton %></p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="relative ml-4 inline-flex flex-shrink-0">
|
||||||
|
<%= content %>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<% else %>
|
||||||
|
<p>Invalid <code>positioning<code> argument for <code>FieldsetComponent</code>.</p>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -2,10 +2,15 @@
|
|||||||
|
|
||||||
module FormElements
|
module FormElements
|
||||||
class FieldsetComponent < ViewComponent::Base
|
class FieldsetComponent < ViewComponent::Base
|
||||||
def initialize(tag: "li", title:, description: nil)
|
def initialize(tag: "li", positioning: :vertical,
|
||||||
@tag = tag
|
title:, description: nil,
|
||||||
@title = title
|
field_name: nil, resettable: false)
|
||||||
@descripton = description
|
@tag = tag
|
||||||
|
@positioning = positioning
|
||||||
|
@title = title
|
||||||
|
@descripton = description
|
||||||
|
@field_name = field_name
|
||||||
|
@resettable = resettable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<%= render FormElements::FieldsetComponent.new(
|
||||||
|
title: @title,
|
||||||
|
description: @description,
|
||||||
|
field_name: "setting_#{@key.to_s}",
|
||||||
|
resettable: @resettable
|
||||||
|
) do %>
|
||||||
|
<%= method("#{@type}_field").call :setting, @key,
|
||||||
|
value: Setting.public_send(@key),
|
||||||
|
data: {
|
||||||
|
:'default-value' => Setting.get_field(@key)[:default]
|
||||||
|
},
|
||||||
|
class: "w-full" %>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module FormElements
|
||||||
|
class FieldsetResettableSettingComponent < ViewComponent::Base
|
||||||
|
def initialize(tag: "li", key:, type: :text, title:, description: nil)
|
||||||
|
@tag = tag
|
||||||
|
@positioning = :vertical
|
||||||
|
@title = title
|
||||||
|
@descripton = description
|
||||||
|
@key = key.to_sym
|
||||||
|
@type = type
|
||||||
|
@resettable = is_resettable?(@key)
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_resettable?(key)
|
||||||
|
default_value = Setting.get_field(key)[:default]
|
||||||
|
default_value.present? && (default_value != Setting.send(key))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<%= tag.public_send @tag, class: "flex items-center justify-between mb-6 last:mb-0",
|
<%= tag.public_send @tag, class: "flex items-center justify-between mb-6 last:mb-0",
|
||||||
data: @form.present? ? {
|
data: @form_enabled ? {
|
||||||
controller: "settings--toggle",
|
controller: "settings--toggle",
|
||||||
:'settings--toggle-switch-enabled-value' => @enabled.to_s
|
:'settings--toggle-switch-enabled-value' => @enabled.to_s
|
||||||
} : nil do %>
|
} : nil do %>
|
||||||
@@ -11,16 +11,23 @@
|
|||||||
<%= render FormElements::ToggleComponent.new(
|
<%= render FormElements::ToggleComponent.new(
|
||||||
enabled: @enabled,
|
enabled: @enabled,
|
||||||
input_enabled: @input_enabled,
|
input_enabled: @input_enabled,
|
||||||
class_names: @form.present? ? "hidden" : nil,
|
class_names: @form_enabled ? "hidden" : nil,
|
||||||
data: {
|
data: {
|
||||||
:'settings--toggle-target' => "button",
|
:'settings--toggle-target' => "button",
|
||||||
action: "settings--toggle#toggleSwitch"
|
action: "settings--toggle#toggleSwitch"
|
||||||
}) %>
|
}) %>
|
||||||
<% if @form.present? %>
|
<% if @form_enabled %>
|
||||||
<%= @form.check_box @attribute, {
|
<% if @attribute.present? %>
|
||||||
checked: @enabled,
|
<%= @form.check_box @attribute, {
|
||||||
data: { :'settings--toggle-target' => "checkbox" }
|
checked: @enabled,
|
||||||
}, "true", "false" %>
|
data: { :'settings--toggle-target' => "checkbox" }
|
||||||
|
}, "true", "false" %>
|
||||||
|
<% else %>
|
||||||
|
<input name="<%= @field_name %>" type="hidden" value="false" autocomplete="off">
|
||||||
|
<%= check_box_tag @field_name, "true", @enabled, {
|
||||||
|
data: { :'settings--toggle-target' => "checkbox" }
|
||||||
|
} %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
module FormElements
|
module FormElements
|
||||||
class FieldsetToggleComponent < ViewComponent::Base
|
class FieldsetToggleComponent < ViewComponent::Base
|
||||||
def initialize(form: nil, attribute: nil, tag: "li", enabled: false,
|
def initialize(tag: "li", form: nil, attribute: nil, field_name: nil,
|
||||||
input_enabled: true, title:, description:)
|
enabled: false, input_enabled: true, title:, description:)
|
||||||
|
@tag = tag
|
||||||
@form = form
|
@form = form
|
||||||
@attribute = attribute
|
@attribute = attribute
|
||||||
@tag = tag
|
@field_name = field_name
|
||||||
|
@form_enabled = @form.present? || @field_name.present?
|
||||||
@enabled = enabled
|
@enabled = enabled
|
||||||
@input_enabled = input_enabled
|
@input_enabled = input_enabled
|
||||||
@title = title
|
@title = title
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<%= button_tag type: "button", name: "toggle", data: @data,
|
<%= button_tag type: "button", name: "toggle", data: @data,
|
||||||
role: "switch", aria: { checked: @enabled.to_s },
|
role: "switch", aria: { checked: @enabled.to_s },
|
||||||
disabled: !@input_enabled,
|
tabindex: @tabindex, disabled: !@input_enabled,
|
||||||
class: "#{ @enabled ? 'bg-blue-600' : 'bg-gray-200' }
|
class: "#{ @enabled ? 'bg-blue-600' : 'bg-gray-200' }
|
||||||
#{ @class_names.present? ? @class_names : '' }
|
#{ @class_names.present? ? @class_names : '' }
|
||||||
relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer
|
relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
module FormElements
|
module FormElements
|
||||||
class ToggleComponent < ViewComponent::Base
|
class ToggleComponent < ViewComponent::Base
|
||||||
def initialize(enabled:, input_enabled: true, data: nil, class_names: nil)
|
def initialize(enabled:, input_enabled: true, data: nil, class_names: nil, tabindex: nil)
|
||||||
@enabled = !!enabled
|
@enabled = !!enabled
|
||||||
@input_enabled = input_enabled
|
@input_enabled = input_enabled
|
||||||
@data = data
|
@data = data
|
||||||
@class_names = class_names
|
@class_names = class_names
|
||||||
|
@tabindex = tabindex
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
28
app/components/modal_component.html.erb
Normal file
28
app/components/modal_component.html.erb
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<div tabindex="-1" class="relative z-10">
|
||||||
|
<!-- Modal Background -->
|
||||||
|
<div class="hidden fixed inset-0 bg-black bg-opacity-80 overflow-y-auto flex items-center justify-center"
|
||||||
|
data-modal-target="background"
|
||||||
|
data-action="click->modal#closeBackground"
|
||||||
|
data-transition-enter="transition-all ease-in-out duration-100"
|
||||||
|
data-transition-enter-from="bg-opacity-0"
|
||||||
|
data-transition-enter-to="bg-opacity-80"
|
||||||
|
data-transition-leave="transition-all ease-in-out duration-100"
|
||||||
|
data-transition-leave-from="bg-opacity-80"
|
||||||
|
data-transition-leave-to="bg-opacity-0">
|
||||||
|
|
||||||
|
<!-- Modal Container -->
|
||||||
|
<div data-modal-target="container"
|
||||||
|
class="max-h-screen w-auto max-w-lg relative
|
||||||
|
hidden animate-scale-in fixed inset-0 overflow-y-auto flex items-center justify-center">
|
||||||
|
<!-- Modal Card -->
|
||||||
|
<div class="m-1 bg-white rounded shadow">
|
||||||
|
<div class="p-8">
|
||||||
|
<%= content %>
|
||||||
|
<div class="flex justify-end items-center flex-wrap mt-6">
|
||||||
|
<button class="btn-md btn-blue" data-action="click->modal#close:prevent">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
2
app/components/modal_component.rb
Normal file
2
app/components/modal_component.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
class ModalComponent < ViewComponent::Base
|
||||||
|
end
|
||||||
6
app/components/qr_code_modal_component.html.erb
Normal file
6
app/components/qr_code_modal_component.html.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<%= render ModalComponent.new do %>
|
||||||
|
<% if @descripton.present? %>
|
||||||
|
<p class="mb-6"><%= @description %></p>
|
||||||
|
<% end %>
|
||||||
|
<p><%= raw @qr_code_svg %></p>
|
||||||
|
<% end %>
|
||||||
24
app/components/qr_code_modal_component.rb
Normal file
24
app/components/qr_code_modal_component.rb
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
require "rqrcode"
|
||||||
|
|
||||||
|
class QrCodeModalComponent < ViewComponent::Base
|
||||||
|
def initialize(qr_content:, description: nil)
|
||||||
|
@description = description
|
||||||
|
@qr_code_svg = qr_code_svg(qr_content)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def qr_code_svg(content)
|
||||||
|
qr_code = RQRCode::QRCode.new(content)
|
||||||
|
qr_code.as_svg(
|
||||||
|
color: "000",
|
||||||
|
shape_rendering: "crispEdges",
|
||||||
|
module_size: 6,
|
||||||
|
standalone: true,
|
||||||
|
use_path: true,
|
||||||
|
svg_attributes: {
|
||||||
|
class: 'inline-block'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class AccountController < ApplicationController
|
class AccountController < ApplicationController
|
||||||
before_action :require_user_signed_in
|
before_action :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@current_section = :account
|
@current_section = :account
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Admin::UsersController < Admin::BaseController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
ldap = LdapService.new
|
ldap = LdapService.new
|
||||||
@ou = params[:ou] || "kosmos.org"
|
@ou = params[:ou] || Setting.primary_domain
|
||||||
@orgs = ldap.fetch_organizations
|
@orgs = ldap.fetch_organizations
|
||||||
@pagy, @users = pagy(User.where(ou: @ou).order(cn: :asc))
|
@pagy, @users = pagy(User.where(ou: @ou).order(cn: :asc))
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,18 @@ class ApplicationController < ActionController::Base
|
|||||||
render :text => exception, :status => 500
|
render :text => exception, :status => 500
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before_action :sentry_set_user
|
||||||
|
|
||||||
|
def sentry_set_user
|
||||||
|
return unless Setting.sentry_enabled
|
||||||
|
|
||||||
|
if user_signed_in?
|
||||||
|
Sentry.set_user(id: current_user.id, username: current_user.cn)
|
||||||
|
else
|
||||||
|
Sentry.set_user({})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def require_user_signed_in
|
def require_user_signed_in
|
||||||
unless user_signed_in?
|
unless user_signed_in?
|
||||||
redirect_to welcome_path and return
|
redirect_to welcome_path and return
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Contributions::DonationsController < ApplicationController
|
class Contributions::DonationsController < ApplicationController
|
||||||
before_action :require_user_signed_in
|
before_action :authenticate_user!
|
||||||
|
|
||||||
# GET /donations
|
# GET /donations
|
||||||
# GET /donations.json
|
# GET /donations.json
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Contributions::ProjectsController < ApplicationController
|
class Contributions::ProjectsController < ApplicationController
|
||||||
before_action :require_user_signed_in
|
before_action :authenticate_user!
|
||||||
|
|
||||||
# GET /contributions
|
# GET /contributions
|
||||||
def index
|
def index
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ class DashboardController < ApplicationController
|
|||||||
before_action :require_user_signed_in
|
before_action :require_user_signed_in
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@current_section = :dashboard
|
@current_section = :services
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
17
app/controllers/discourse/sso_controller.rb
Normal file
17
app/controllers/discourse/sso_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
class Discourse::SsoController < ApplicationController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
|
||||||
|
def connect
|
||||||
|
secret = Setting.discourse_connect_secret
|
||||||
|
sso = DiscourseApi::SingleSignOn.parse(request.query_string, secret)
|
||||||
|
sso.external_id = current_user.id
|
||||||
|
sso.email = current_user.email
|
||||||
|
sso.username = current_user.cn
|
||||||
|
sso.name = current_user.display_name
|
||||||
|
sso.admin = current_user.is_admin?
|
||||||
|
sso.sso_secret = secret
|
||||||
|
|
||||||
|
redirect_to sso.to_url("#{Setting.discourse_public_url}/session/sso_login"),
|
||||||
|
allow_other_host: true
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class InvitationsController < ApplicationController
|
class InvitationsController < ApplicationController
|
||||||
before_action :require_user_signed_in, except: ["show"]
|
before_action :authenticate_user!, except: ["show"]
|
||||||
before_action :require_user_signed_out, only: ["show"]
|
before_action :require_user_signed_out, only: ["show"]
|
||||||
|
|
||||||
# GET /invitations
|
# GET /invitations
|
||||||
|
|||||||
145
app/controllers/rs/oauth_controller.rb
Normal file
145
app/controllers/rs/oauth_controller.rb
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
class Rs::OauthController < ApplicationController
|
||||||
|
before_action :require_signed_in_with_username, only: :new
|
||||||
|
before_action :authenticate_user!, only: :create
|
||||||
|
|
||||||
|
def new
|
||||||
|
username, org = params[:useraddress].split("@")
|
||||||
|
@user = User.where(cn: username.downcase, ou: org).first
|
||||||
|
@scopes = parse_scopes params[:scope]
|
||||||
|
@redirect_uri = params[:redirect_uri]
|
||||||
|
@client_id = params[:client_id]
|
||||||
|
@state = params[:state]
|
||||||
|
@root_access_requested = (@scopes & [":r",":rw"]).any?
|
||||||
|
|
||||||
|
@denial_url = url_with_state("#{@redirect_uri}#error=access_denied", @state)
|
||||||
|
|
||||||
|
@expire_at_dates = [["Never", nil],
|
||||||
|
["In 1 month", 1.month.from_now],
|
||||||
|
["In 1 day", 1.day.from_now]]
|
||||||
|
|
||||||
|
http_status :bad_request and return unless @redirect_uri.present?
|
||||||
|
|
||||||
|
unless current_user == @user
|
||||||
|
sign_out :user
|
||||||
|
|
||||||
|
redirect_to new_rs_oauth_url(@user.address,
|
||||||
|
scope: params[:scope],
|
||||||
|
redirect_uri: params[:redirect_uri],
|
||||||
|
client_id: params[:client_id],
|
||||||
|
state: params[:state])
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
unless @client_id.present?
|
||||||
|
redirect_to(url_with_state("#{@redirect_uri}#error=invalid_request", @state),
|
||||||
|
allow_other_host: true) and return
|
||||||
|
end
|
||||||
|
|
||||||
|
if @scopes.empty?
|
||||||
|
redirect_to(url_with_state("#{@redirect_uri}#error=invalid_scope", @state),
|
||||||
|
allow_other_host: true) and return
|
||||||
|
end
|
||||||
|
|
||||||
|
unless hostname_of(@client_id) == hostname_of(@redirect_uri)
|
||||||
|
redirect_to(url_with_state("#{@redirect_uri}#error=invalid_client", @state),
|
||||||
|
allow_other_host: true) and return
|
||||||
|
end
|
||||||
|
|
||||||
|
@client_id.gsub!(/http(s)?:\/\//, "")
|
||||||
|
|
||||||
|
if auth = current_user.remote_storage_authorizations.valid.where(permissions: @scopes, client_id: @client_id).first
|
||||||
|
redirect_to(url_with_state("#{@redirect_uri}#access_token=#{auth.token}", @state),
|
||||||
|
allow_other_host: true) and return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
unless current_user.id.to_s == params[:user_id]
|
||||||
|
Rails.logger.info("NO MATCH: #{params[:user_id]}, #{current_user.id}")
|
||||||
|
http_status :forbidden and return
|
||||||
|
end
|
||||||
|
|
||||||
|
permissions = parse_scopes params[:scope]
|
||||||
|
redirect_uri = params[:redirect_uri].presence
|
||||||
|
client_id = params[:client_id].presence
|
||||||
|
state = params[:state].presence
|
||||||
|
expire_at = params[:expire_at].presence
|
||||||
|
|
||||||
|
http_status :bad_request and return unless redirect_uri.present?
|
||||||
|
|
||||||
|
if permissions.empty?
|
||||||
|
redirect_to(url_with_state("#{redirect_uri}#error=invalid_scope", state),
|
||||||
|
allow_other_host: true) and return
|
||||||
|
end
|
||||||
|
|
||||||
|
unless client_id.present?
|
||||||
|
redirect_to(url_with_state("#{redirect_uri}#error=invalid_request", state),
|
||||||
|
allow_other_host: true) and return
|
||||||
|
end
|
||||||
|
|
||||||
|
unless hostname_of(client_id) == hostname_of(redirect_uri)
|
||||||
|
redirect_to(url_with_state("#{redirect_uri}#error=invalid_client", state),
|
||||||
|
allow_other_host: true) and return
|
||||||
|
end
|
||||||
|
|
||||||
|
client_id.gsub!(/http(s)?:\/\//, "")
|
||||||
|
|
||||||
|
auth = current_user.remote_storage_authorizations.create!(
|
||||||
|
permissions: permissions,
|
||||||
|
client_id: client_id,
|
||||||
|
redirect_uri: redirect_uri,
|
||||||
|
app_name: client_id, #TODO use user-defined name
|
||||||
|
expire_at: expire_at
|
||||||
|
)
|
||||||
|
|
||||||
|
redirect_to url_with_state("#{redirect_uri}#access_token=#{auth.token}", state),
|
||||||
|
allow_other_host: true
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /rs/oauth/token/:id/launch_app
|
||||||
|
def launch_app
|
||||||
|
auth = current_user.remote_storage_authorizations.find(params[:id])
|
||||||
|
|
||||||
|
redirect_to app_auth_url(auth), allow_other_host: true
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def require_signed_in_with_username
|
||||||
|
unless user_signed_in?
|
||||||
|
username, org = params[:useraddress].split("@")
|
||||||
|
redirect_to new_user_session_path(cn: username, ou: org)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def app_auth_url(auth)
|
||||||
|
url = "#{auth.url}#remotestorage=#{current_user.address}"
|
||||||
|
url += "&access_token=#{auth.token}"
|
||||||
|
url
|
||||||
|
end
|
||||||
|
|
||||||
|
def hostname_of(uri)
|
||||||
|
uri.gsub(/http(s)?:\/\//, "").split(":")[0].split("/")[0]
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_scopes(scope_string)
|
||||||
|
return [] if scope_string.blank?
|
||||||
|
|
||||||
|
scopes = scope_string.
|
||||||
|
gsub(/\[|\]/, "").
|
||||||
|
gsub(/\,/, " ").
|
||||||
|
gsub(/\/:/, ":").
|
||||||
|
split(/\s/).map(&:strip).
|
||||||
|
reject(&:empty?)
|
||||||
|
|
||||||
|
scopes = [":r"] if scopes.include?("*:r")
|
||||||
|
scopes = [":rw"] if scopes.include?("*:rw")
|
||||||
|
|
||||||
|
scopes
|
||||||
|
end
|
||||||
|
|
||||||
|
def url_with_state(url, state)
|
||||||
|
state ? "#{url}&state=#{CGI.escape(state)}" : url
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
9
app/controllers/services/base_controller.rb
Normal file
9
app/controllers/services/base_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class Services::BaseController < ApplicationController
|
||||||
|
before_action :set_current_section
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_current_section
|
||||||
|
@current_section = :services
|
||||||
|
end
|
||||||
|
end
|
||||||
14
app/controllers/services/chat_controller.rb
Normal file
14
app/controllers/services/chat_controller.rb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
class Services::ChatController < Services::BaseController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
before_action :require_service_available
|
||||||
|
|
||||||
|
def show
|
||||||
|
@service_enabled = current_user.services_enabled.include?(:xmpp)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def require_service_available
|
||||||
|
http_status :not_found unless Setting.ejabberd_enabled?
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,31 +1,58 @@
|
|||||||
require "rqrcode"
|
require "rqrcode"
|
||||||
|
require "lnurl"
|
||||||
|
|
||||||
class WalletController < ApplicationController
|
class Services::LightningController < ApplicationController
|
||||||
before_action :require_user_signed_in
|
before_action :authenticate_user!
|
||||||
before_action :authenticate_with_lndhub
|
before_action :authenticate_with_lndhub
|
||||||
before_action :set_current_section
|
before_action :set_current_section
|
||||||
before_action :fetch_balance
|
before_action :fetch_balance
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@wallet_url = "lndhub://#{current_user.ln_account}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
|
@wallet_setup_url = "lndhub://#{current_user.ln_account}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
|
||||||
|
|
||||||
qrcode = RQRCode::QRCode.new(@wallet_url)
|
|
||||||
@svg = qrcode.as_svg(
|
|
||||||
color: "000",
|
|
||||||
shape_rendering: "crispEdges",
|
|
||||||
module_size: 6,
|
|
||||||
standalone: true,
|
|
||||||
use_path: true,
|
|
||||||
svg_attributes: {
|
|
||||||
class: 'inline-block'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def transactions
|
def transactions
|
||||||
@transactions = fetch_transactions
|
@transactions = fetch_transactions
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def qr_lnurlp
|
||||||
|
lnurlp_url = "https://kosmos.org/.well-known/lnurlp/#{current_user.cn}"
|
||||||
|
lnurlp_bech32 = Lnurl.new(lnurlp_url).to_bech32
|
||||||
|
qr_code = RQRCode::QRCode.new("lightning:" + lnurlp_bech32)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.svg do
|
||||||
|
qr_svg = qr_code.as_svg(
|
||||||
|
color: "000",
|
||||||
|
shape_rendering: "crispEdges",
|
||||||
|
module_size: 6,
|
||||||
|
standalone: true,
|
||||||
|
use_path: true,
|
||||||
|
svg_attributes: {
|
||||||
|
class: 'inline-block'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
send_data(
|
||||||
|
qr_svg,
|
||||||
|
filename: "bitcoin-lightning-#{current_user.address}.svg",
|
||||||
|
type: "image/svg+xml"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
format.png do
|
||||||
|
qr_png = qr_code.as_png(
|
||||||
|
fill: "white",
|
||||||
|
color: "black",
|
||||||
|
size: 1024,
|
||||||
|
)
|
||||||
|
send_data(
|
||||||
|
qr_png,
|
||||||
|
filename: "bitcoin-lightning-#{current_user.address}.png",
|
||||||
|
type: "image/png"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def authenticate_with_lndhub(options={})
|
def authenticate_with_lndhub(options={})
|
||||||
@@ -37,21 +64,21 @@ class WalletController < ApplicationController
|
|||||||
session[:ln_auth_token] = auth_token
|
session[:ln_auth_token] = auth_token
|
||||||
@ln_auth_token = auth_token
|
@ln_auth_token = auth_token
|
||||||
end
|
end
|
||||||
rescue
|
rescue => e
|
||||||
# TODO add exception tracking
|
Sentry.capture_exception(e) if Setting.sentry_enabled?
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_current_section
|
def set_current_section
|
||||||
@current_section = :wallet
|
@current_section = :services
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_balance
|
def fetch_balance
|
||||||
lndhub = Lndhub.new
|
lndhub = Lndhub.new
|
||||||
data = lndhub.balance @ln_auth_token
|
data = lndhub.balance @ln_auth_token
|
||||||
@balance = data["BTC"]["AvailableBalance"] rescue nil
|
@balance = data["BTC"]["AvailableBalance"] rescue nil
|
||||||
rescue
|
rescue AuthError
|
||||||
authenticate_with_lndhub(force_reauth: true)
|
authenticate_with_lndhub(force_reauth: true)
|
||||||
return nil if @fetch_balance_retried
|
raise if @fetch_balance_retried
|
||||||
@fetch_balance_retried = true
|
@fetch_balance_retried = true
|
||||||
fetch_balance
|
fetch_balance
|
||||||
end
|
end
|
||||||
@@ -61,9 +88,9 @@ class WalletController < ApplicationController
|
|||||||
txs = lndhub.gettxs @ln_auth_token
|
txs = lndhub.gettxs @ln_auth_token
|
||||||
invoices = lndhub.getuserinvoices(@ln_auth_token).select{|i| i["ispaid"]}
|
invoices = lndhub.getuserinvoices(@ln_auth_token).select{|i| i["ispaid"]}
|
||||||
process_transactions(txs + invoices)
|
process_transactions(txs + invoices)
|
||||||
rescue
|
rescue AuthError
|
||||||
authenticate_with_lndhub(force_reauth: true)
|
authenticate_with_lndhub(force_reauth: true)
|
||||||
return [] if @fetch_transactions_retried
|
raise if @fetch_transactions_retried
|
||||||
@fetch_transactions_retried = true
|
@fetch_transactions_retried = true
|
||||||
fetch_transactions
|
fetch_transactions
|
||||||
end
|
end
|
||||||
@@ -78,6 +105,7 @@ class WalletController < ApplicationController
|
|||||||
tx["received"] = true
|
tx["received"] = true
|
||||||
else
|
else
|
||||||
tx["amount_sats"] = tx["value"] || tx["amt"]
|
tx["amount_sats"] = tx["value"] || tx["amt"]
|
||||||
|
tx["fee"] = tx["type"] == "paid_invoice" ? tx["fee"] : nil
|
||||||
tx["datetime"] = Time.at(tx["timestamp"].to_i)
|
tx["datetime"] = Time.at(tx["timestamp"].to_i)
|
||||||
tx["title"] = tx["type"] == "paid_invoice" ? "Sent" : "Received"
|
tx["title"] = tx["type"] == "paid_invoice" ? "Sent" : "Received"
|
||||||
tx["description"] = tx["memo"] || tx["description"]
|
tx["description"] = tx["memo"] || tx["description"]
|
||||||
@@ -85,6 +113,10 @@ class WalletController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Handle an edge case where lndhub.go includes a failed payment in the
|
||||||
|
# list, which wasn't actually booked
|
||||||
|
txs.reject!{ |tx| tx["type"] == "paid_invoice" && tx["payment_preimage"].blank? }
|
||||||
|
|
||||||
txs.sort{ |a,b| b["datetime"] <=> a["datetime"] }
|
txs.sort{ |a,b| b["datetime"] <=> a["datetime"] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
14
app/controllers/services/mastodon_controller.rb
Normal file
14
app/controllers/services/mastodon_controller.rb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
class Services::MastodonController < Services::BaseController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
before_action :require_service_available
|
||||||
|
|
||||||
|
def show
|
||||||
|
@service_enabled = current_user.services_enabled.include?(:mastodon)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def require_service_available
|
||||||
|
http_status :not_found unless Setting.mastodon_enabled?
|
||||||
|
end
|
||||||
|
end
|
||||||
23
app/controllers/services/remotestorage_controller.rb
Normal file
23
app/controllers/services/remotestorage_controller.rb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
class Services::RemotestorageController < Services::BaseController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
before_action :require_feature_enabled
|
||||||
|
before_action :require_service_available
|
||||||
|
|
||||||
|
def dashboard
|
||||||
|
# unless current_user.services_enabled.include?(:remotestorage)
|
||||||
|
# redirect_to service_remotestorage_info_path
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def require_feature_enabled
|
||||||
|
unless Flipper.enabled?(:remotestorage, current_user)
|
||||||
|
http_status :forbidden
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def require_service_available
|
||||||
|
http_status :not_found unless Setting.remotestorage_enabled?
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
class Settings::AccountController < SettingsController
|
|
||||||
|
|
||||||
def index
|
|
||||||
end
|
|
||||||
|
|
||||||
def reset_password
|
|
||||||
current_user.send_reset_password_instructions
|
|
||||||
sign_out current_user
|
|
||||||
msg = "We have sent you an email with a link to reset your password."
|
|
||||||
redirect_to check_your_email_path, notice: msg
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
class Settings::ProfileController < SettingsController
|
|
||||||
|
|
||||||
def index
|
|
||||||
@user = current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,13 +1,135 @@
|
|||||||
|
require 'securerandom'
|
||||||
|
|
||||||
class SettingsController < ApplicationController
|
class SettingsController < ApplicationController
|
||||||
before_action :require_user_signed_in
|
before_action :authenticate_user!
|
||||||
before_action :set_current_section
|
before_action :set_main_nav_section
|
||||||
|
before_action :set_settings_section, only: [:show, :update, :update_email]
|
||||||
|
before_action :set_user, only: [:show, :update, :update_email]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
redirect_to setting_path(:profile)
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
if @settings_section == "experiments"
|
||||||
|
session[:shared_secret] ||= SecureRandom.base64(12)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@user.preferences.merge!(user_params[:preferences] || {})
|
||||||
|
@user.display_name = user_params[:display_name]
|
||||||
|
|
||||||
|
if @user.save
|
||||||
|
if @user.display_name && (@user.display_name != @user.ldap_entry[:display_name])
|
||||||
|
LdapManager::UpdateDisplayName.call(@user.dn, user_params[:display_name])
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to setting_path(@settings_section), flash: {
|
||||||
|
success: 'Settings saved.'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
@validation_errors = @user.errors
|
||||||
|
render :show, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_email
|
||||||
|
if @user.valid_ldap_authentication?(email_params[:current_password])
|
||||||
|
if @user.update email: email_params[:email]
|
||||||
|
redirect_to setting_path(:account), flash: {
|
||||||
|
notice: 'Please confirm your new address using the confirmation link we just sent you.'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
@validation_errors = @user.errors
|
||||||
|
render :show, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
else
|
||||||
|
redirect_to setting_path(:account), flash: {
|
||||||
|
error: 'Password did not match your current password. Try again.'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reset_password
|
||||||
|
current_user.send_reset_password_instructions
|
||||||
|
sign_out current_user
|
||||||
|
msg = "We have sent you an email with a link to reset your password."
|
||||||
|
redirect_to check_your_email_path, notice: msg
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_nostr_pubkey
|
||||||
|
signed_event = nostr_event_params[:signed_event].to_h.symbolize_keys
|
||||||
|
is_valid_id = NostrManager::ValidateId.call(signed_event)
|
||||||
|
is_valid_sig = NostrManager::VerifySignature.call(signed_event)
|
||||||
|
is_correct_content = signed_event[:content] == "Connect my public key to #{current_user.address} (confirmation #{session[:shared_secret]})"
|
||||||
|
|
||||||
|
unless is_valid_id && is_valid_sig && is_correct_content
|
||||||
|
flash[:alert] = "Public key could not be verified"
|
||||||
|
http_status :unprocessable_entity and return
|
||||||
|
end
|
||||||
|
|
||||||
|
pubkey_taken = User.all_except(current_user).where(
|
||||||
|
ou: current_user.ou, nostr_pubkey: signed_event[:pubkey]
|
||||||
|
).any?
|
||||||
|
|
||||||
|
if pubkey_taken
|
||||||
|
flash[:alert] = "Public key already in use for a different account"
|
||||||
|
http_status :unprocessable_entity and return
|
||||||
|
end
|
||||||
|
|
||||||
|
current_user.update! nostr_pubkey: signed_event[:pubkey]
|
||||||
|
session[:shared_secret] = nil
|
||||||
|
|
||||||
|
flash[:success] = "Public key verification successful"
|
||||||
|
http_status :ok
|
||||||
|
rescue
|
||||||
|
flash[:alert] = "Public key could not be verified"
|
||||||
|
http_status :unprocessable_entity and return
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /settings/nostr_pubkey
|
||||||
|
def remove_nostr_pubkey
|
||||||
|
current_user.update! nostr_pubkey: nil
|
||||||
|
|
||||||
|
redirect_to setting_path(:experiments), flash: {
|
||||||
|
success: 'Public key removed from account'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_current_section
|
def set_main_nav_section
|
||||||
@current_section = :settings
|
@current_section = :settings
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_settings_section
|
||||||
|
@settings_section = params[:section]
|
||||||
|
allowed_sections = [:profile, :account, :lightning, :xmpp, :experiments]
|
||||||
|
|
||||||
|
unless allowed_sections.include?(@settings_section.to_sym)
|
||||||
|
redirect_to setting_path(:profile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_user
|
||||||
|
@user = current_user
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_params
|
||||||
|
params.require(:user).permit(:display_name, preferences: [
|
||||||
|
:lightning_notify_sats_received,
|
||||||
|
:xmpp_exchange_contacts_with_invitees
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
def email_params
|
||||||
|
params.require(:user).permit(:email, :current_password)
|
||||||
|
end
|
||||||
|
|
||||||
|
def nostr_event_params
|
||||||
|
params.permit(signed_event: [
|
||||||
|
:id, :pubkey, :created_at, :kind, :tags, :content, :sig
|
||||||
|
])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class SignupController < ApplicationController
|
|||||||
if session[:new_user].present?
|
if session[:new_user].present?
|
||||||
@user = User.new(session[:new_user])
|
@user = User.new(session[:new_user])
|
||||||
else
|
else
|
||||||
@user = User.new(ou: "kosmos.org")
|
@user = User.new(ou: Setting.primary_domain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ class SignupController < ApplicationController
|
|||||||
|
|
||||||
CreateAccount.call(
|
CreateAccount.call(
|
||||||
username: @user.cn,
|
username: @user.cn,
|
||||||
domain: "kosmos.org",
|
domain: Setting.primary_domain,
|
||||||
email: @user.email,
|
email: @user.email,
|
||||||
password: @user.password,
|
password: @user.password,
|
||||||
invitation: @invitation
|
invitation: @invitation
|
||||||
|
|||||||
57
app/controllers/webfinger_controller.rb
Normal file
57
app/controllers/webfinger_controller.rb
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
class WebfingerController < ApplicationController
|
||||||
|
before_action :allow_cross_origin_requests, only: [:show]
|
||||||
|
|
||||||
|
layout false
|
||||||
|
|
||||||
|
def show
|
||||||
|
resource = params[:resource]
|
||||||
|
|
||||||
|
if resource && resource.match(/acct:\w+/)
|
||||||
|
useraddress = resource.split(":").last
|
||||||
|
username, org = useraddress.split("@")
|
||||||
|
username.downcase!
|
||||||
|
unless User.where(cn: username, ou: org).any?
|
||||||
|
head 404 and return
|
||||||
|
end
|
||||||
|
|
||||||
|
render json: webfinger(useraddress).to_json,
|
||||||
|
content_type: "application/jrd+json"
|
||||||
|
else
|
||||||
|
head 422 and return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def webfinger(useraddress)
|
||||||
|
links = [];
|
||||||
|
|
||||||
|
links << remotestorage_link(useraddress) if Setting.remotestorage_enabled
|
||||||
|
|
||||||
|
{ "links" => links }
|
||||||
|
end
|
||||||
|
|
||||||
|
def remotestorage_link(useraddress)
|
||||||
|
# TODO use when OAuth routes are available
|
||||||
|
# auth_url = new_rs_oauth_url(useraddress)
|
||||||
|
auth_url = "https://example.com/rs/oauth"
|
||||||
|
storage_url = "#{Setting.rs_storage_url}/#{useraddress}"
|
||||||
|
|
||||||
|
{
|
||||||
|
"rel" => "http://tools.ietf.org/id/draft-dejong-remotestorage",
|
||||||
|
"href" => storage_url,
|
||||||
|
"properties" => {
|
||||||
|
"http://remotestorage.io/spec/version" => "draft-dejong-remotestorage-13",
|
||||||
|
"http://tools.ietf.org/html/rfc6749#section-4.2" => auth_url,
|
||||||
|
"http://tools.ietf.org/html/rfc6750#section-2.3" => nil, # access token via a HTTP query parameter
|
||||||
|
"http://tools.ietf.org/html/rfc7233": "GET", # content range requests
|
||||||
|
"http://remotestorage.io/spec/web-authoring": nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def allow_cross_origin_requests
|
||||||
|
headers['Access-Control-Allow-Origin'] = '*'
|
||||||
|
headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS'
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -12,22 +12,28 @@ class WebhooksController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
user = User.find_by!(ln_account: payload[:user_login])
|
user = User.find_by!(ln_account: payload[:user_login])
|
||||||
|
notify = user.preferences[:lightning_notify_sats_received]
|
||||||
# TODO make configurable
|
case notify
|
||||||
notify_xmpp(user.address, payload[:amount], payload[:memo])
|
when "xmpp"
|
||||||
|
notify_xmpp(user.address, payload[:amount], payload[:memo])
|
||||||
|
when "email"
|
||||||
|
NotificationMailer.with(user: user, amount_sats: payload[:amount])
|
||||||
|
.lightning_sats_received.deliver_later
|
||||||
|
end
|
||||||
|
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# TODO refactor into mailer-like generic class/service
|
||||||
def notify_xmpp(address, amt_sats, memo)
|
def notify_xmpp(address, amt_sats, memo)
|
||||||
payload = {
|
payload = {
|
||||||
type: "normal",
|
type: "normal",
|
||||||
from: "kosmos.org", # TODO domain config
|
from: Setting.primary_domain,
|
||||||
to: address,
|
to: address,
|
||||||
subject: "Sats received!",
|
subject: "Sats received!",
|
||||||
body: "#{amt_sats} sats received in your Lightning wallet:\n> #{memo}"
|
body: "#{helpers.number_with_delimiter amt_sats} sats received in your Lightning wallet:\n> #{memo}"
|
||||||
}
|
}
|
||||||
XmppSendMessageJob.perform_later(payload)
|
XmppSendMessageJob.perform_later(payload)
|
||||||
end
|
end
|
||||||
|
|||||||
16
app/controllers/well_known_controller.rb
Normal file
16
app/controllers/well_known_controller.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
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
|
||||||
|
@user = User.where(cn: params[:name], ou: domain).first
|
||||||
|
http_status :not_found and return if @user.nil? || @user.nostr_pubkey.blank?
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.json do
|
||||||
|
render json: {
|
||||||
|
names: { "#{@user.cn}": @user.nostr_pubkey }
|
||||||
|
}.to_json
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
1
app/errors/auth_error.rb
Normal file
1
app/errors/auth_error.rb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
class AuthError < StandardError; end
|
||||||
11
app/helpers/oauth_helper.rb
Normal file
11
app/helpers/oauth_helper.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
module OauthHelper
|
||||||
|
|
||||||
|
def scope_name(scope)
|
||||||
|
scope.gsub(/(\:.+)/, '')
|
||||||
|
end
|
||||||
|
|
||||||
|
def scope_permissions(scope)
|
||||||
|
scope.match(/\:r$/) ? "r" : "rw"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
import { Application } from "@hotwired/stimulus"
|
import { Application } from "@hotwired/stimulus"
|
||||||
|
import { Modal, Tabs } from "tailwindcss-stimulus-components"
|
||||||
|
|
||||||
const application = Application.start()
|
const application = Application.start()
|
||||||
|
|
||||||
|
application.register('modal', Modal)
|
||||||
|
application.register('tabs', Tabs)
|
||||||
|
|
||||||
// Configure Stimulus development experience
|
// Configure Stimulus development experience
|
||||||
application.debug = false
|
application.debug = false
|
||||||
window.Stimulus = application
|
window.Stimulus = application
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ export default class extends Controller {
|
|||||||
static targets = ["buttons", "countdown"]
|
static targets = ["buttons", "countdown"]
|
||||||
|
|
||||||
connect() {
|
connect() {
|
||||||
|
// Devise timeoutable ends up adding a second flash message without content
|
||||||
|
// TODO investigate bug
|
||||||
|
if (this.element.textContent.trim() == "true") return;
|
||||||
|
|
||||||
const timeoutSeconds = parseInt(this.data.get("timeout"));
|
const timeoutSeconds = parseInt(this.data.get("timeout"));
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { Controller } from "@hotwired/stimulus"
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
static targets = [ "emailField", "editEmailButton" ]
|
||||||
|
static values = { validationFailed: Boolean }
|
||||||
|
|
||||||
|
connect () {
|
||||||
|
if (this.validationFailedValue) return;
|
||||||
|
|
||||||
|
this.emailFieldTarget.disabled = true;
|
||||||
|
this.element.querySelectorAll(".initial-hidden").forEach(el => {
|
||||||
|
el.classList.add("hidden");
|
||||||
|
})
|
||||||
|
this.element.querySelectorAll(".initial-visible").forEach(el => {
|
||||||
|
el.classList.remove("hidden");
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
editEmail () {
|
||||||
|
this.emailFieldTarget.disabled = false;
|
||||||
|
this.emailFieldTarget.select();
|
||||||
|
this.editEmailButtonTarget.classList.add("hidden");
|
||||||
|
this.element.querySelectorAll(".initial-hidden").forEach(el => {
|
||||||
|
el.classList.remove("hidden");
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { Controller } from "@hotwired/stimulus"
|
||||||
|
import { bech32 } from "bech32"
|
||||||
|
|
||||||
|
function hexToBytes (hex) {
|
||||||
|
let bytes = []
|
||||||
|
for (let c = 0; c < hex.length; c += 2) {
|
||||||
|
bytes.push(parseInt(hex.substr(c, 2), 16))
|
||||||
|
}
|
||||||
|
return bytes
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connects to data-controller="settings--nostr-pubkey"
|
||||||
|
export default class extends Controller {
|
||||||
|
static targets = [ "noExtension", "setPubkey", "pubkeyBech32Input" ]
|
||||||
|
static values = { userAddress: String, pubkeyHex: String, sharedSecret: String }
|
||||||
|
|
||||||
|
connect () {
|
||||||
|
if (this.hasPubkeyHexValue && this.pubkeyHexValue.length > 0) {
|
||||||
|
this.pubkeyBech32InputTarget.value = this.pubkeyBech32
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.nostr) {
|
||||||
|
if (this.hasSetPubkeyTarget) {
|
||||||
|
this.setPubkeyTarget.disabled = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noExtensionTarget.classList.remove("hidden")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async setPubkey () {
|
||||||
|
this.setPubkeyTarget.disabled = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const signedEvent = await window.nostr.signEvent({
|
||||||
|
created_at: Math.floor(Date.now() / 1000),
|
||||||
|
kind: 1,
|
||||||
|
tags: [],
|
||||||
|
content: `Connect my public key to ${this.userAddressValue} (confirmation ${this.sharedSecretValue})`
|
||||||
|
})
|
||||||
|
|
||||||
|
const res = await fetch("/settings/set_nostr_pubkey", {
|
||||||
|
method: "POST", credentials: "include", headers: {
|
||||||
|
"Accept": "application/json", 'Content-Type': 'application/json',
|
||||||
|
"X-CSRF-Token": this.csrfToken
|
||||||
|
}, body: JSON.stringify({ signed_event: signedEvent })
|
||||||
|
});
|
||||||
|
|
||||||
|
window.location.reload()
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Unable to verify pubkey:', error.message)
|
||||||
|
this.setPubkeyTarget.disabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get pubkeyBech32 () {
|
||||||
|
const words = bech32.toWords(hexToBytes(this.pubkeyHexValue))
|
||||||
|
return bech32.encode('npub', words)
|
||||||
|
}
|
||||||
|
|
||||||
|
get csrfToken () {
|
||||||
|
const element = document.head.querySelector('meta[name="csrf-token"]')
|
||||||
|
return element.getAttribute("content")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { Controller } from "@hotwired/stimulus"
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
static targets = [ "resetButton" ]
|
||||||
|
|
||||||
|
resetField () {
|
||||||
|
const inputEl = this.element.querySelector('input')
|
||||||
|
inputEl.value = inputEl.dataset.defaultValue
|
||||||
|
}
|
||||||
|
}
|
||||||
10
app/jobs/remote_storage_expire_authorization_job.rb
Normal file
10
app/jobs/remote_storage_expire_authorization_job.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class RemoteStorageExpireAuthorizationJob < ApplicationJob
|
||||||
|
queue_as :remotestorage
|
||||||
|
|
||||||
|
def perform(rs_auth_id)
|
||||||
|
rs_auth = RemoteStorageAuthorization.find rs_auth_id
|
||||||
|
return unless rs_auth.expire_at.nil? || rs_auth.expire_at <= DateTime.now
|
||||||
|
|
||||||
|
rs_auth.destroy!
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,18 +1,22 @@
|
|||||||
class XmppExchangeContactsJob < ApplicationJob
|
class XmppExchangeContactsJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
def perform(inviter, username, domain)
|
def perform(inviter, invitee)
|
||||||
|
return unless inviter.services_enabled.include?("xmpp") &&
|
||||||
|
invitee.services_enabled.include?("xmpp") &&
|
||||||
|
inviter.preferences[:xmpp_exchange_contacts_with_invitees]
|
||||||
|
|
||||||
ejabberd = EjabberdApiClient.new
|
ejabberd = EjabberdApiClient.new
|
||||||
|
|
||||||
ejabberd.add_rosteritem({
|
ejabberd.add_rosteritem({
|
||||||
"localuser": username, "localhost": domain,
|
"localuser": invitee.cn, "localhost": invitee.ou,
|
||||||
"user": inviter.cn, "host": inviter.ou,
|
"user": inviter.cn, "host": inviter.ou,
|
||||||
"nick": inviter.cn, "group": Setting.ejabberd_buddy_roster, "subs": "both"
|
"nick": inviter.cn, "group": Setting.ejabberd_buddy_roster, "subs": "both"
|
||||||
})
|
})
|
||||||
ejabberd.add_rosteritem({
|
ejabberd.add_rosteritem({
|
||||||
"localuser": inviter.cn, "localhost": inviter.ou,
|
"localuser": inviter.cn, "localhost": inviter.ou,
|
||||||
"user": username, "host": domain,
|
"user": invitee.cn, "host": invitee.ou,
|
||||||
"nick": username, "group": Setting.ejabberd_buddy_roster, "subs": "both"
|
"nick": invitee.cn, "group": Setting.ejabberd_buddy_roster, "subs": "both"
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
26
app/jobs/xmpp_set_default_bookmarks_job.rb
Normal file
26
app/jobs/xmpp_set_default_bookmarks_job.rb
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
class XmppSetDefaultBookmarksJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(user)
|
||||||
|
return unless Setting.xmpp_default_rooms.any?
|
||||||
|
@user = user
|
||||||
|
ejabberd = EjabberdApiClient.new
|
||||||
|
ejabberd.private_set user, storage_content
|
||||||
|
end
|
||||||
|
|
||||||
|
def storage_content
|
||||||
|
bookmarks = ""
|
||||||
|
Setting.xmpp_default_rooms.each do |r|
|
||||||
|
bookmarks << conference_element(
|
||||||
|
jid: r[/<(.+)>/, 1], name: r[/^(.+)\s/, 1], nick: @user.cn,
|
||||||
|
autojoin: Setting.xmpp_autojoin_default_rooms
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
"<storage xmlns='storage:bookmarks'>#{bookmarks}</storage>"
|
||||||
|
end
|
||||||
|
|
||||||
|
def conference_element(jid:, name:, autojoin: false, nick:)
|
||||||
|
"<conference jid='#{jid}' name='#{name}' autojoin='#{autojoin.to_s}'><nick>#{nick}</nick></conference>"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# Send email via Sidekiq:
|
# Send email via Sidekiq:
|
||||||
#
|
#
|
||||||
# CustomMailer.with(user: u, subject: "Important announcement", body: body).custom_message.deliver_later
|
# CustomMailer.with(user: user, subject: "Important announcement", body: body).custom_message.deliver_later
|
||||||
#
|
#
|
||||||
class CustomMailer < ApplicationMailer
|
class CustomMailer < ApplicationMailer
|
||||||
def custom_message
|
def custom_message
|
||||||
|
|||||||
34
app/mailers/devise/mailer.rb
Normal file
34
app/mailers/devise/mailer.rb
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
if defined?(ActionMailer)
|
||||||
|
class Devise::Mailer < Devise.parent_mailer.constantize
|
||||||
|
include Devise::Mailers::Helpers
|
||||||
|
|
||||||
|
def confirmation_instructions(record, token, opts = {})
|
||||||
|
@token = token
|
||||||
|
if record.pending_reconfirmation?
|
||||||
|
devise_mail(record, :reconfirmation_instructions, opts)
|
||||||
|
else
|
||||||
|
devise_mail(record, :confirmation_instructions, opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reset_password_instructions(record, token, opts = {})
|
||||||
|
@token = token
|
||||||
|
devise_mail(record, :reset_password_instructions, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def unlock_instructions(record, token, opts = {})
|
||||||
|
@token = token
|
||||||
|
devise_mail(record, :unlock_instructions, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def email_changed(record, opts = {})
|
||||||
|
devise_mail(record, :email_changed, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def password_change(record, opts = {})
|
||||||
|
devise_mail(record, :password_change, opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
8
app/mailers/notification_mailer.rb
Normal file
8
app/mailers/notification_mailer.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class NotificationMailer < ApplicationMailer
|
||||||
|
def lightning_sats_received
|
||||||
|
@user = params[:user]
|
||||||
|
@amount_sats = params[:amount_sats]
|
||||||
|
@subject = "Sats received"
|
||||||
|
mail to: @user.email, subject: @subject
|
||||||
|
end
|
||||||
|
end
|
||||||
63
app/models/remote_storage_authorization.rb
Normal file
63
app/models/remote_storage_authorization.rb
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
class RemoteStorageAuthorization < ApplicationRecord
|
||||||
|
belongs_to :user
|
||||||
|
|
||||||
|
serialize :permissions
|
||||||
|
|
||||||
|
validates_presence_of :permissions
|
||||||
|
validates_presence_of :client_id
|
||||||
|
|
||||||
|
scope :valid, -> { where(expire_at: nil).or(where(expire_at: (DateTime.now)..)) }
|
||||||
|
scope :expired, -> { where(expire_at: ..(DateTime.now)) }
|
||||||
|
|
||||||
|
after_initialize do |a|
|
||||||
|
a.permissions = [] if a.permissions == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
before_create :generate_token
|
||||||
|
before_create :store_token_in_redis
|
||||||
|
after_create :schedule_token_expiry
|
||||||
|
before_destroy :delete_token_from_redis
|
||||||
|
after_destroy :remove_token_expiry_job
|
||||||
|
|
||||||
|
def url
|
||||||
|
if self.redirect_uri
|
||||||
|
uri = URI.parse self.redirect_uri
|
||||||
|
"#{uri.scheme}://#{client_id}"
|
||||||
|
else
|
||||||
|
"http://#{client_id}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_token_from_redis
|
||||||
|
key = "rs:authorizations:#{user.address}:#{token}"
|
||||||
|
redis.srem? key, redis.smembers(key)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def redis
|
||||||
|
@redis ||= Redis.new(url: Setting.rs_redis_url)
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_token(length=16)
|
||||||
|
self.token = SecureRandom.hex(length) if self.token.blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
def store_token_in_redis
|
||||||
|
redis.sadd "rs:authorizations:#{user.address}:#{token}", permissions
|
||||||
|
end
|
||||||
|
|
||||||
|
def schedule_token_expiry
|
||||||
|
return unless expire_at.present?
|
||||||
|
RemoteStorageExpireAuthorizationJob.set(wait_until: expire_at)
|
||||||
|
.perform_later(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_token_expiry_job
|
||||||
|
queue = Sidekiq::Queue.new(RemoteStorageExpireAuthorizationJob.queue_name)
|
||||||
|
queue.each do |job|
|
||||||
|
next unless job.display_class == "RemoteStorageExpireAuthorizationJob"
|
||||||
|
job.delete if job.display_args == [id]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -2,6 +2,19 @@
|
|||||||
class Setting < RailsSettings::Base
|
class Setting < RailsSettings::Base
|
||||||
cache_prefix { "v1" }
|
cache_prefix { "v1" }
|
||||||
|
|
||||||
|
field :primary_domain, type: :string,
|
||||||
|
default: ENV["PRIMARY_DOMAIN"].presence
|
||||||
|
|
||||||
|
field :accounts_domain, type: :string,
|
||||||
|
default: ENV["AKKOUNTS_DOMAIN"].presence
|
||||||
|
|
||||||
|
#
|
||||||
|
# Internal services
|
||||||
|
#
|
||||||
|
|
||||||
|
field :redis_url, type: :string,
|
||||||
|
default: ENV["REDIS_URL"] || "redis://localhost:6379/0"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Registrations
|
# Registrations
|
||||||
#
|
#
|
||||||
@@ -10,16 +23,44 @@ class Setting < RailsSettings::Base
|
|||||||
account accounts donations mail webmaster support
|
account accounts donations mail webmaster support
|
||||||
]
|
]
|
||||||
|
|
||||||
|
#
|
||||||
|
# XMPP
|
||||||
|
#
|
||||||
|
|
||||||
|
field :xmpp_default_rooms, type: :array, default: []
|
||||||
|
field :xmpp_autojoin_default_rooms, type: :boolean, default: false
|
||||||
|
field :xmpp_notifications_from_address, type: :string, default: primary_domain
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sentry
|
||||||
|
#
|
||||||
|
|
||||||
|
field :sentry_enabled, type: :boolean, readonly: true,
|
||||||
|
default: (ENV["SENTRY_DSN"].present?.to_s || false)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Discourse
|
# Discourse
|
||||||
#
|
#
|
||||||
|
|
||||||
field :discourse_public_url, type: :string, readonly: true,
|
field :discourse_public_url, type: :string,
|
||||||
default: ENV["DISCOURSE_PUBLIC_URL"].presence
|
default: ENV["DISCOURSE_PUBLIC_URL"].presence
|
||||||
|
|
||||||
field :discourse_enabled, type: :boolean,
|
field :discourse_enabled, type: :boolean,
|
||||||
default: (ENV["DISCOURSE_PUBLIC_URL"].present?.to_s || false)
|
default: (ENV["DISCOURSE_PUBLIC_URL"].present?.to_s || false)
|
||||||
|
|
||||||
|
field :discourse_connect_secret, type: :string,
|
||||||
|
default: ENV["DISCOURSE_CONNECT_SECRET"].presence
|
||||||
|
|
||||||
|
#
|
||||||
|
# Drone CI
|
||||||
|
#
|
||||||
|
|
||||||
|
field :droneci_public_url, type: :string,
|
||||||
|
default: ENV["DRONECI_PUBLIC_URL"].presence
|
||||||
|
|
||||||
|
field :droneci_enabled, type: :boolean,
|
||||||
|
default: (ENV["DRONECI_PUBLIC_URL"].present?.to_s || false)
|
||||||
|
|
||||||
#
|
#
|
||||||
# ejabberd
|
# ejabberd
|
||||||
#
|
#
|
||||||
@@ -27,10 +68,10 @@ class Setting < RailsSettings::Base
|
|||||||
field :ejabberd_enabled, type: :boolean,
|
field :ejabberd_enabled, type: :boolean,
|
||||||
default: (ENV["EJABBERD_API_URL"].present?.to_s || false)
|
default: (ENV["EJABBERD_API_URL"].present?.to_s || false)
|
||||||
|
|
||||||
field :ejabberd_api_url, type: :string, readonly: true,
|
field :ejabberd_api_url, type: :string,
|
||||||
default: ENV["EJABBERD_API_URL"].presence
|
default: ENV["EJABBERD_API_URL"].presence
|
||||||
|
|
||||||
field :ejabberd_admin_url, type: :string, readonly: true,
|
field :ejabberd_admin_url, type: :string,
|
||||||
default: ENV["EJABBERD_ADMIN_URL"].presence
|
default: ENV["EJABBERD_ADMIN_URL"].presence
|
||||||
|
|
||||||
field :ejabberd_buddy_roster, type: :string,
|
field :ejabberd_buddy_roster, type: :string,
|
||||||
@@ -40,7 +81,7 @@ class Setting < RailsSettings::Base
|
|||||||
# Gitea
|
# Gitea
|
||||||
#
|
#
|
||||||
|
|
||||||
field :gitea_public_url, type: :string, readonly: true,
|
field :gitea_public_url, type: :string,
|
||||||
default: ENV["GITEA_PUBLIC_URL"].presence
|
default: ENV["GITEA_PUBLIC_URL"].presence
|
||||||
|
|
||||||
field :gitea_enabled, type: :boolean,
|
field :gitea_enabled, type: :boolean,
|
||||||
@@ -50,7 +91,7 @@ class Setting < RailsSettings::Base
|
|||||||
# Lightning Network
|
# Lightning Network
|
||||||
#
|
#
|
||||||
|
|
||||||
field :lndhub_api_url, type: :string, readonly: true,
|
field :lndhub_api_url, type: :string,
|
||||||
default: ENV["LNDHUB_API_URL"].presence
|
default: ENV["LNDHUB_API_URL"].presence
|
||||||
|
|
||||||
field :lndhub_enabled, type: :boolean,
|
field :lndhub_enabled, type: :boolean,
|
||||||
@@ -59,7 +100,7 @@ class Setting < RailsSettings::Base
|
|||||||
field :lndhub_admin_enabled, type: :boolean,
|
field :lndhub_admin_enabled, type: :boolean,
|
||||||
default: (ENV["LNDHUB_ADMIN_UI"] || false)
|
default: (ENV["LNDHUB_ADMIN_UI"] || false)
|
||||||
|
|
||||||
field :lndhub_public_key, type: :string, readonly: true,
|
field :lndhub_public_key, type: :string,
|
||||||
default: (ENV["LNDHUB_PUBLIC_KEY"] || "")
|
default: (ENV["LNDHUB_PUBLIC_KEY"] || "")
|
||||||
|
|
||||||
field :lndhub_keysend_enabled, type: :boolean,
|
field :lndhub_keysend_enabled, type: :boolean,
|
||||||
@@ -69,17 +110,20 @@ class Setting < RailsSettings::Base
|
|||||||
# Mastodon
|
# Mastodon
|
||||||
#
|
#
|
||||||
|
|
||||||
field :mastodon_public_url, type: :string, readonly: true,
|
field :mastodon_public_url, type: :string,
|
||||||
default: ENV["MASTODON_PUBLIC_URL"].presence
|
default: ENV["MASTODON_PUBLIC_URL"].presence
|
||||||
|
|
||||||
field :mastodon_enabled, type: :boolean,
|
field :mastodon_enabled, type: :boolean,
|
||||||
default: (ENV["MASTODON_PUBLIC_URL"].present?.to_s || false)
|
default: (ENV["MASTODON_PUBLIC_URL"].present?.to_s || false)
|
||||||
|
|
||||||
|
field :mastodon_address_domain, type: :string,
|
||||||
|
default: ENV["MASTODON_ADDRESS_DOMAIN"].presence || self.primary_domain
|
||||||
|
|
||||||
#
|
#
|
||||||
# MediaWiki
|
# MediaWiki
|
||||||
#
|
#
|
||||||
|
|
||||||
field :mediawiki_public_url, type: :string, readonly: true,
|
field :mediawiki_public_url, type: :string,
|
||||||
default: ENV["MEDIAWIKI_PUBLIC_URL"].presence
|
default: ENV["MEDIAWIKI_PUBLIC_URL"].presence
|
||||||
|
|
||||||
field :mediawiki_enabled, type: :boolean,
|
field :mediawiki_enabled, type: :boolean,
|
||||||
@@ -90,4 +134,17 @@ class Setting < RailsSettings::Base
|
|||||||
#
|
#
|
||||||
|
|
||||||
field :nostr_enabled, type: :boolean, default: true
|
field :nostr_enabled, type: :boolean, default: true
|
||||||
|
|
||||||
|
#
|
||||||
|
# RemoteStorage
|
||||||
|
#
|
||||||
|
|
||||||
|
field :remotestorage_enabled, type: :boolean,
|
||||||
|
default: (ENV["RS_STORAGE_URL"].present?.to_s || false)
|
||||||
|
|
||||||
|
field :rs_storage_url, type: :string,
|
||||||
|
default: ENV["RS_STORAGE_URL"].presence
|
||||||
|
|
||||||
|
field :rs_redis_url, type: :string,
|
||||||
|
default: ENV["RS_REDIS_URL"] || "redis://localhost:6379/1"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
include EmailValidatable
|
include EmailValidatable
|
||||||
|
|
||||||
|
attr_accessor :display_name
|
||||||
|
|
||||||
|
serialize :preferences, UserPreferences
|
||||||
|
|
||||||
# Relations
|
# Relations
|
||||||
has_many :invitations, dependent: :destroy
|
has_many :invitations, dependent: :destroy
|
||||||
has_one :invitation, inverse_of: :invitee, foreign_key: 'invited_user_id'
|
has_one :invitation, inverse_of: :invitee, foreign_key: 'invited_user_id'
|
||||||
@@ -14,22 +18,31 @@ class User < ApplicationRecord
|
|||||||
|
|
||||||
has_many :accounts, through: :lndhub_user
|
has_many :accounts, through: :lndhub_user
|
||||||
|
|
||||||
validates_uniqueness_of :cn
|
has_many :remote_storage_authorizations
|
||||||
validates_length_of :cn, :minimum => 3
|
|
||||||
|
validates_uniqueness_of :cn, scope: :ou
|
||||||
|
validates_length_of :cn, minimum: 3
|
||||||
validates_format_of :cn, with: /\A([a-z0-9\-])*\z/,
|
validates_format_of :cn, with: /\A([a-z0-9\-])*\z/,
|
||||||
if: Proc.new{ |u| u.cn.present? },
|
if: Proc.new{ |u| u.cn.present? },
|
||||||
message: "is invalid. Please use only letters, numbers and -"
|
message: "is invalid. Please use only letters, numbers and -"
|
||||||
validates_format_of :cn, without: /\A-/,
|
validates_format_of :cn, without: /\A-/,
|
||||||
if: Proc.new{ |u| u.cn.present? },
|
if: Proc.new{ |u| u.cn.present? },
|
||||||
message: "is invalid. Usernames need to start with a letter."
|
message: "is invalid. Usernames need to start with a letter."
|
||||||
|
# FIXME This needs a server restart to apply values
|
||||||
validates_format_of :cn, without: /\A(#{Setting.reserved_usernames.join('|')})\z/i,
|
validates_format_of :cn, without: /\A(#{Setting.reserved_usernames.join('|')})\z/i,
|
||||||
message: "has already been taken"
|
message: "has already been taken"
|
||||||
|
|
||||||
validates_uniqueness_of :email
|
validates_uniqueness_of :email
|
||||||
validates :email, email: true
|
validates :email, email: true
|
||||||
|
|
||||||
scope :confirmed, -> { where.not(confirmed_at: nil) }
|
validates_length_of :display_name, minimum: 3, maximum: 35, allow_blank: true,
|
||||||
scope :pending, -> { where(confirmed_at: nil) }
|
if: -> { defined?(@display_name) }
|
||||||
|
|
||||||
|
validates_uniqueness_of :nostr_pubkey, allow_blank: true
|
||||||
|
|
||||||
|
scope :confirmed, -> { where.not(confirmed_at: nil) }
|
||||||
|
scope :pending, -> { where(confirmed_at: nil) }
|
||||||
|
scope :all_except, -> (user) { where.not(id: user) }
|
||||||
|
|
||||||
has_encrypted :ln_login, :ln_password
|
has_encrypted :ln_login, :ln_password
|
||||||
|
|
||||||
@@ -38,7 +51,9 @@ class User < ApplicationRecord
|
|||||||
devise :ldap_authenticatable,
|
devise :ldap_authenticatable,
|
||||||
:confirmable,
|
:confirmable,
|
||||||
:recoverable,
|
:recoverable,
|
||||||
:validatable
|
:validatable,
|
||||||
|
:timeoutable,
|
||||||
|
:rememberable
|
||||||
|
|
||||||
def ldap_before_save
|
def ldap_before_save
|
||||||
self.email = Devise::LDAP::Adapter.get_ldap_param(self.cn, "mail").first
|
self.email = Devise::LDAP::Adapter.get_ldap_param(self.cn, "mail").first
|
||||||
@@ -53,7 +68,24 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def devise_after_confirmation
|
def devise_after_confirmation
|
||||||
enable_service %w[discourse gitea mediawiki ejabberd]
|
if ldap_entry[:mail] != self.email
|
||||||
|
# E-Mail update confirmed
|
||||||
|
LdapManager::UpdateEmail.call(self.dn, self.email)
|
||||||
|
else
|
||||||
|
# TODO Make configurable
|
||||||
|
# E-Mail from signup confirmed (i.e. account activation)
|
||||||
|
enable_service %w[ discourse gitea mediawiki xmpp ]
|
||||||
|
|
||||||
|
#TODO enable in development when we have easy setup of ejabberd etc.
|
||||||
|
return if Rails.env.development? || !Setting.ejabberd_enabled?
|
||||||
|
|
||||||
|
XmppExchangeContactsJob.perform_later(inviter, self) if inviter.present?
|
||||||
|
XmppSetDefaultBookmarksJob.perform_later(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def send_devise_notification(notification, *args)
|
||||||
|
devise_mailer.send(notification, self, *args).deliver_later
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_password(new_password, new_password_confirmation)
|
def reset_password(new_password, new_password_confirmation)
|
||||||
@@ -78,6 +110,11 @@ class User < ApplicationRecord
|
|||||||
"#{self.cn}@#{self.ou}"
|
"#{self.cn}@#{self.ou}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mastodon_address
|
||||||
|
return nil unless Setting.mastodon_enabled?
|
||||||
|
"#{self.cn}@#{Setting.mastodon_address_domain}"
|
||||||
|
end
|
||||||
|
|
||||||
def valid_attribute?(attribute_name)
|
def valid_attribute?(attribute_name)
|
||||||
self.valid?
|
self.valid?
|
||||||
self.errors[attribute_name].blank?
|
self.errors[attribute_name].blank?
|
||||||
@@ -94,8 +131,13 @@ class User < ApplicationRecord
|
|||||||
@dn = Devise::LDAP::Adapter.get_dn(self.cn)
|
@dn = Devise::LDAP::Adapter.get_dn(self.cn)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ldap_entry
|
def ldap_entry(reload: false)
|
||||||
ldap.fetch_users(uid: self.cn, ou: self.ou).first
|
return @ldap_entry if defined?(@ldap_entry) && !reload
|
||||||
|
@ldap_entry = ldap.fetch_users(uid: self.cn, ou: self.ou).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def display_name
|
||||||
|
@display_name ||= ldap_entry[:display_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
def services_enabled
|
def services_enabled
|
||||||
|
|||||||
29
app/models/user_preferences.rb
Normal file
29
app/models/user_preferences.rb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
DEFAULT_PREFS = YAML.load_file("#{Rails.root}/config/default_preferences.yml")
|
||||||
|
|
||||||
|
class UserPreferences
|
||||||
|
def self.dump(value)
|
||||||
|
process(value).to_yaml
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.load(string)
|
||||||
|
stored_prefs = YAML.load(string || "{}")
|
||||||
|
DEFAULT_PREFS.merge(stored_prefs).with_indifferent_access
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.is_integer?(value)
|
||||||
|
value.to_i.to_s == value
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.process(hash)
|
||||||
|
hash.each do |key, value|
|
||||||
|
if value == "true"
|
||||||
|
hash[key] = true
|
||||||
|
elsif value == "false"
|
||||||
|
hash[key] = false
|
||||||
|
elsif value.is_a?(String) && is_integer?(value)
|
||||||
|
hash[key] = value.to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
hash.stringify_keys!.to_h
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateAccount < ApplicationService
|
class CreateAccount < ApplicationService
|
||||||
def initialize(args)
|
def initialize(args)
|
||||||
@username = args[:username]
|
@username = args[:username]
|
||||||
@domain = args[:ou] || "kosmos.org"
|
@domain = args[:ou] || Setting.primary_domain
|
||||||
@email = args[:email]
|
@email = args[:email]
|
||||||
@password = args[:password]
|
@password = args[:password]
|
||||||
@invitation = args[:invitation]
|
@invitation = args[:invitation]
|
||||||
@@ -11,11 +11,10 @@ class CreateAccount < ApplicationService
|
|||||||
def call
|
def call
|
||||||
user = create_user_in_database
|
user = create_user_in_database
|
||||||
add_ldap_document
|
add_ldap_document
|
||||||
create_lndhub_account(user)
|
create_lndhub_account(user) if Setting.lndhub_enabled
|
||||||
|
|
||||||
if @invitation.present?
|
if @invitation.present?
|
||||||
update_invitation(user.id)
|
update_invitation(user.id)
|
||||||
exchange_xmpp_contacts if Setting.ejabberd_enabled
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,12 +42,6 @@ class CreateAccount < ApplicationService
|
|||||||
CreateLdapUserJob.perform_later(@username, @domain, @email, hashed_pw)
|
CreateLdapUserJob.perform_later(@username, @domain, @email, hashed_pw)
|
||||||
end
|
end
|
||||||
|
|
||||||
def exchange_xmpp_contacts
|
|
||||||
#TODO enable in development when we have easy setup of ejabberd etc.
|
|
||||||
return if Rails.env.development?
|
|
||||||
XmppExchangeContactsJob.perform_later(@invitation.user, @username, @domain)
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_lndhub_account(user)
|
def create_lndhub_account(user)
|
||||||
#TODO enable in development when we have a local lndhub (mock?) API
|
#TODO enable in development when we have a local lndhub (mock?) API
|
||||||
return if Rails.env.development?
|
return if Rails.env.development?
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class EjabberdApiClient
|
class EjabberdApiClient
|
||||||
def initialize
|
def initialize
|
||||||
@base_url = ENV["EJABBERD_API_URL"]
|
@base_url = Setting.ejabberd_api_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def post(endpoint, payload)
|
def post(endpoint, payload)
|
||||||
@@ -10,7 +10,7 @@ class EjabberdApiClient
|
|||||||
if res.status != 200
|
if res.status != 200
|
||||||
Rails.logger.error "[ejabberd] API request failed:"
|
Rails.logger.error "[ejabberd] API request failed:"
|
||||||
Rails.logger.error res.body
|
Rails.logger.error res.body
|
||||||
#TODO add some kind of exception tracking/notifications
|
#TODO Send custom event to Sentry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -21,4 +21,9 @@ class EjabberdApiClient
|
|||||||
def send_message(payload)
|
def send_message(payload)
|
||||||
post "send_message", payload
|
post "send_message", payload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def private_set(user, content)
|
||||||
|
payload = { user: user.cn, host: user.ou, element: content }
|
||||||
|
post "private_set", payload
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
12
app/services/ldap_manager/update_display_name.rb
Normal file
12
app/services/ldap_manager/update_display_name.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
module LdapManager
|
||||||
|
class UpdateDisplayName < LdapManagerService
|
||||||
|
def initialize(dn, display_name)
|
||||||
|
@dn = dn
|
||||||
|
@display_name = display_name
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
replace_attribute @dn, :displayName, @display_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
12
app/services/ldap_manager/update_email.rb
Normal file
12
app/services/ldap_manager/update_email.rb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
module LdapManager
|
||||||
|
class UpdateEmail < LdapManagerService
|
||||||
|
def initialize(dn, address)
|
||||||
|
@dn = dn
|
||||||
|
@address = address
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
replace_attribute @dn, :mail, @address
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
2
app/services/ldap_manager_service.rb
Normal file
2
app/services/ldap_manager_service.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
class LdapManagerService < LdapService
|
||||||
|
end
|
||||||
@@ -50,7 +50,7 @@ class LdapService < ApplicationService
|
|||||||
treebase = ldap_config["base"]
|
treebase = ldap_config["base"]
|
||||||
end
|
end
|
||||||
|
|
||||||
attributes = %w{dn cn uid mail admin service}
|
attributes = %w{dn cn uid mail displayName admin service}
|
||||||
filter = Net::LDAP::Filter.eq("uid", args[:uid] || "*")
|
filter = Net::LDAP::Filter.eq("uid", args[:uid] || "*")
|
||||||
|
|
||||||
entries = ldap_client.search(base: treebase, filter: filter, attributes: attributes)
|
entries = ldap_client.search(base: treebase, filter: filter, attributes: attributes)
|
||||||
@@ -59,6 +59,7 @@ class LdapService < ApplicationService
|
|||||||
{
|
{
|
||||||
uid: e.uid.first,
|
uid: e.uid.first,
|
||||||
mail: e.try(:mail) ? e.mail.first : nil,
|
mail: e.try(:mail) ? e.mail.first : nil,
|
||||||
|
display_name: e.try(:displayName) ? e.displayName.first : nil,
|
||||||
admin: e.try(:admin) ? 'admin' : nil,
|
admin: e.try(:admin) ? 'admin' : nil,
|
||||||
service: e.try(:service)
|
service: e.try(:service)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,7 @@ class Lndhub
|
|||||||
end
|
end
|
||||||
|
|
||||||
res = Faraday.post "#{@base_url}/#{endpoint}", payload.to_json, headers
|
res = Faraday.post "#{@base_url}/#{endpoint}", payload.to_json, headers
|
||||||
|
log_error(res) if res.status != 200
|
||||||
if res.status != 200
|
|
||||||
Rails.logger.error "[lndhub] API request failed:"
|
|
||||||
Rails.logger.error res.body
|
|
||||||
#TODO add some kind of exception tracking/notifications
|
|
||||||
end
|
|
||||||
|
|
||||||
JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
@@ -31,7 +26,7 @@ class Lndhub
|
|||||||
data = JSON.parse(res.body)
|
data = JSON.parse(res.body)
|
||||||
|
|
||||||
if data.is_a?(Hash) && data["error"] && data["message"] == "bad auth"
|
if data.is_a?(Hash) && data["error"] && data["message"] == "bad auth"
|
||||||
raise "BAD_AUTH"
|
raise AuthError
|
||||||
else
|
else
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
@@ -68,4 +63,13 @@ class Lndhub
|
|||||||
|
|
||||||
invoice["payment_request"]
|
invoice["payment_request"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_error(res)
|
||||||
|
Rails.logger.error "[lndhub] API request failed:"
|
||||||
|
Rails.logger.error res.body
|
||||||
|
|
||||||
|
if Setting.sentry_enabled?
|
||||||
|
Sentry.capture_message("Lndhub API request failed: #{res.body}")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
class LndhubV2
|
class LndhubV2 < Lndhub
|
||||||
attr_accessor :auth_token
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
@base_url = ENV["LNDHUB_API_URL"]
|
|
||||||
end
|
|
||||||
|
|
||||||
def post(endpoint, payload, options={})
|
def post(endpoint, payload, options={})
|
||||||
headers = { "Content-Type" => "application/json" }
|
headers = { "Content-Type" => "application/json" }
|
||||||
@@ -12,64 +7,12 @@ class LndhubV2
|
|||||||
elsif options[:admin_token]
|
elsif options[:admin_token]
|
||||||
headers.merge!({ "Authorization" => "Bearer #{options[:admin_token]}" })
|
headers.merge!({ "Authorization" => "Bearer #{options[:admin_token]}" })
|
||||||
end
|
end
|
||||||
|
|
||||||
res = Faraday.post "#{@base_url}/#{endpoint}", payload.to_json, headers
|
res = Faraday.post "#{@base_url}/#{endpoint}", payload.to_json, headers
|
||||||
|
log_error(res) if res.status != 200
|
||||||
if res.status != 200
|
|
||||||
Rails.logger.error "[lndhub] API request failed:"
|
|
||||||
Rails.logger.error res.body
|
|
||||||
#TODO add some kind of exception tracking/notifications
|
|
||||||
end
|
|
||||||
|
|
||||||
JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(endpoint, auth_token)
|
|
||||||
res = Faraday.get("#{@base_url}/#{endpoint}", {}, {
|
|
||||||
"Content-Type" => "application/json",
|
|
||||||
"Accept" => "application/json",
|
|
||||||
"Authorization" => "Bearer #{auth_token}"
|
|
||||||
})
|
|
||||||
|
|
||||||
JSON.parse(res.body)
|
|
||||||
end
|
|
||||||
|
|
||||||
def create(payload)
|
|
||||||
post "create", payload
|
|
||||||
end
|
|
||||||
|
|
||||||
def authenticate(user)
|
|
||||||
credentials = post "auth?type=auth", { login: user.ln_account, password: user.ln_password }
|
|
||||||
self.auth_token = credentials["access_token"]
|
|
||||||
self.auth_token
|
|
||||||
end
|
|
||||||
|
|
||||||
def balance(user_token=nil)
|
|
||||||
get "balance", user_token || auth_token
|
|
||||||
end
|
|
||||||
|
|
||||||
def gettxs(user_token)
|
|
||||||
get "gettxs", user_token || auth_token
|
|
||||||
end
|
|
||||||
|
|
||||||
def getuserinvoices(user_token)
|
|
||||||
get "getuserinvoices", user_token || auth_token
|
|
||||||
end
|
|
||||||
|
|
||||||
def addinvoice(payload)
|
|
||||||
invoice = post "addinvoice", {
|
|
||||||
amt: payload[:amount],
|
|
||||||
memo: payload[:memo],
|
|
||||||
description_hash: payload[:description_hash]
|
|
||||||
}
|
|
||||||
|
|
||||||
invoice["payment_request"]
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# V2
|
|
||||||
#
|
|
||||||
|
|
||||||
def create_account(payload={})
|
def create_account(payload={})
|
||||||
post "v2/users", payload, admin_token: Rails.application.credentials.lndhub[:admin_token]
|
post "v2/users", payload, admin_token: Rails.application.credentials.lndhub[:admin_token]
|
||||||
end
|
end
|
||||||
@@ -78,4 +21,5 @@ class LndhubV2
|
|||||||
# Payload: { amount: 1000, description: "", description_hash: "" }
|
# Payload: { amount: 1000, description: "", description_hash: "" }
|
||||||
post "v2/invoices", payload
|
post "v2/invoices", payload
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
11
app/services/nostr_manager/validate_id.rb
Normal file
11
app/services/nostr_manager/validate_id.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
module NostrManager
|
||||||
|
class ValidateId < NostrManagerService
|
||||||
|
def initialize(event)
|
||||||
|
@event = Nostr::Event.new(**event)
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
@event.id == Digest::SHA256.hexdigest(JSON.generate(@event.serialize))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
17
app/services/nostr_manager/verify_signature.rb
Normal file
17
app/services/nostr_manager/verify_signature.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
module NostrManager
|
||||||
|
class VerifySignature < NostrManagerService
|
||||||
|
def initialize(event)
|
||||||
|
@event = Nostr::Event.new(**event)
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
Schnorr.check_sig!(
|
||||||
|
[@event.id].pack('H*'),
|
||||||
|
[@event.pubkey].pack('H*'),
|
||||||
|
[@event.sig].pack('H*')
|
||||||
|
)
|
||||||
|
rescue Schnorr::InvalidSignatureError
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
4
app/services/nostr_manager_service.rb
Normal file
4
app/services/nostr_manager_service.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
require "nostr"
|
||||||
|
|
||||||
|
class NostrManagerService < ApplicationService
|
||||||
|
end
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<section class="sm:w-1/2 grid grid-cols-2 items-center gap-y-2">
|
<section class="sm:w-1/2 grid grid-cols-2 items-center gap-y-2">
|
||||||
<%= form.label :user_id %>
|
<%= form.label :user_id %>
|
||||||
<%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn, {} %>
|
<%= form.collection_select :user_id, User.where(ou: Setting.primary_domain).order(:cn), :id, :cn, {} %>
|
||||||
|
|
||||||
<%= form.label :amount_sats, "Amount BTC (sats)" %>
|
<%= form.label :amount_sats, "Amount BTC (sats)" %>
|
||||||
<%= form.number_field :amount_sats %>
|
<%= form.number_field :amount_sats %>
|
||||||
|
|||||||
@@ -7,11 +7,45 @@
|
|||||||
title: "Enable Discourse integration",
|
title: "Enable Discourse integration",
|
||||||
description: "Discourse configuration present and features enabled"
|
description: "Discourse configuration present and features enabled"
|
||||||
) %>
|
) %>
|
||||||
<% if Setting.discourse_enabled? %>
|
<% if Setting.discourse_enabled? %>
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "Public URL") do %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= f.text_field :discourse_public_url,
|
key: :discourse_public_url,
|
||||||
value: Setting.discourse_public_url,
|
title: "Public URL"
|
||||||
class: "w-full", disabled: true %>
|
) %>
|
||||||
<% end %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<% end %>
|
key: :discourse_connect_secret,
|
||||||
|
type: :password,
|
||||||
|
title: "Connect secret"
|
||||||
|
) %>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
<% if Setting.discourse_enabled? %>
|
||||||
|
<% content_for :documentation do %>
|
||||||
|
<h3 class="mt-8">How to configure Discourse</h3>
|
||||||
|
<ol class="list-decimal list-inside">
|
||||||
|
<li class="mb-6">
|
||||||
|
Set the <strong>Discourse Connect URL</strong> to the following URL:
|
||||||
|
</li>
|
||||||
|
<li data-controller="clipboard" class="mb-6 flex gap-1">
|
||||||
|
<input type="text" class="grow" disabled="disabled"
|
||||||
|
value="https://<%= Setting.accounts_domain %>/discourse/connect"
|
||||||
|
data-clipboard-target="source" />
|
||||||
|
<button class="btn-md btn-icon btn-outline shrink-0"
|
||||||
|
data-clipboard-target="trigger" data-action="clipboard#copy"
|
||||||
|
title="Copy to clipboard">
|
||||||
|
<span class="content-initial">
|
||||||
|
<%= render partial: "icons/copy", locals: { custom_class: "text-blue-600 h-4 w-4 inline" } %>
|
||||||
|
</span>
|
||||||
|
<span class="content-active hidden">
|
||||||
|
<%= render partial: "icons/check", locals: { custom_class: "text-blue-600 h-4 w-4 inline" } %>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<li class="mb-6">
|
||||||
|
Set the <strong>Discourse Connect Secret</strong> to the value above.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Enable Discourse Connect.
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|||||||
16
app/views/admin/settings/services/_droneci.html.erb
Normal file
16
app/views/admin/settings/services/_droneci.html.erb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<h3>Drone CI</h3>
|
||||||
|
<ul role="list">
|
||||||
|
<%= render FormElements::FieldsetToggleComponent.new(
|
||||||
|
form: f,
|
||||||
|
attribute: :droneci_enabled,
|
||||||
|
enabled: Setting.droneci_enabled?,
|
||||||
|
title: "Enable Drone CI integration",
|
||||||
|
description: "Drone CI configuration present and features enabled"
|
||||||
|
) %>
|
||||||
|
<% if Setting.droneci_enabled? %>
|
||||||
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
|
key: :droneci_public_url,
|
||||||
|
title: "Public URL"
|
||||||
|
) %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
@@ -7,24 +7,53 @@
|
|||||||
title: "Enable ejabberd integration",
|
title: "Enable ejabberd integration",
|
||||||
description: "ejabberd configuration present and features enabled"
|
description: "ejabberd configuration present and features enabled"
|
||||||
) %>
|
) %>
|
||||||
<% if Setting.ejabberd_enabled? %>
|
<% if Setting.ejabberd_enabled? %>
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "API URL") do %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= f.text_field :ejabberd_api_url,
|
key: :ejabberd_api_url,
|
||||||
value: Setting.ejabberd_api_url,
|
title: "API URL"
|
||||||
class: "w-full", disabled: true %>
|
) %>
|
||||||
<% end %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "Admin URL") do %>
|
key: :ejabberd_admin_url,
|
||||||
<%= f.text_field :ejabberd_admin_url,
|
title: "Admin URL"
|
||||||
value: Setting.ejabberd_admin_url,
|
) %>
|
||||||
class: "w-full", disabled: true %>
|
</ul>
|
||||||
<% end %>
|
<h3 class="mt-10">User default settings</h3>
|
||||||
<%= render FormElements::FieldsetComponent.new(
|
<ul role="list">
|
||||||
title: "Contact roster name",
|
<%= render FormElements::FieldsetComponent.new(
|
||||||
description: "Used when exchanging contacts after signup from invitation"
|
title: "Default rooms",
|
||||||
) do %>
|
description: "Add these default rooms to new users' bookmarks"
|
||||||
<%= f.text_field :ejabberd_buddy_roster,
|
) do %>
|
||||||
value: Setting.ejabberd_buddy_roster,
|
<%= f.text_area :xmpp_default_rooms,
|
||||||
class: "w-full" %>
|
value: Setting.xmpp_default_rooms.join("\n"),
|
||||||
<% end %>
|
placeholder: "Welcome <welcome@kosmos.chat>\nKosmos <kosmos@kosmos.chat>",
|
||||||
<% end %>
|
class: "h-24 w-full" %>
|
||||||
|
<% end %>
|
||||||
|
<%= render FormElements::FieldsetToggleComponent.new(
|
||||||
|
form: f,
|
||||||
|
attribute: :xmpp_autojoin_default_rooms,
|
||||||
|
enabled: Setting.xmpp_autojoin_default_rooms?,
|
||||||
|
title: "Auto-join default rooms",
|
||||||
|
description: "Automatically join above default rooms in chat clients"
|
||||||
|
) %>
|
||||||
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
|
key: :ejabberd_buddy_roster,
|
||||||
|
title: "Contact roster name",
|
||||||
|
description: "Used when exchanging contacts after signup from invitation"
|
||||||
|
) %>
|
||||||
|
</ul>
|
||||||
|
<h3 class="mt-10">Notifications</h3>
|
||||||
|
<ul role="list">
|
||||||
|
<%= render FormElements::FieldsetComponent.new(
|
||||||
|
title: "From address",
|
||||||
|
description: "Address (JID) of the account notifications are sent from",
|
||||||
|
resettable: Setting.get_field(:xmpp_notifications_from_address)[:default] != Setting.xmpp_notifications_from_address
|
||||||
|
) do %>
|
||||||
|
<%= f.text_field :xmpp_notifications_from_address,
|
||||||
|
value: Setting.xmpp_notifications_from_address,
|
||||||
|
data: {
|
||||||
|
:'default-value' => Setting.get_field(:xmpp_notifications_from_address)[:default]
|
||||||
|
},
|
||||||
|
class: "w-full" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
description: "Gitea configuration present and features enabled"
|
description: "Gitea configuration present and features enabled"
|
||||||
) %>
|
) %>
|
||||||
<% if Setting.gitea_enabled? %>
|
<% if Setting.gitea_enabled? %>
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "Public URL") do %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= f.text_field :gitea_public_url,
|
key: :gitea_public_url,
|
||||||
value: Setting.gitea_public_url,
|
title: "Public URL"
|
||||||
class: "w-full", disabled: true %>
|
) %>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -8,11 +8,10 @@
|
|||||||
description: "LNDHub configuration present and wallet features enabled"
|
description: "LNDHub configuration present and wallet features enabled"
|
||||||
) %>
|
) %>
|
||||||
<% if Setting.lndhub_enabled? %>
|
<% if Setting.lndhub_enabled? %>
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "API URL") do %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= f.text_field :lndhub_api_url,
|
key: :lndhub_api_url,
|
||||||
value: Setting.lndhub_api_url,
|
title: "API URL"
|
||||||
class: "w-full", disabled: true %>
|
) %>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render FormElements::FieldsetToggleComponent.new(
|
<%= render FormElements::FieldsetToggleComponent.new(
|
||||||
form: f,
|
form: f,
|
||||||
@@ -29,10 +28,10 @@
|
|||||||
description: "Allow users to receive invoice-less payments to their Lightning Address"
|
description: "Allow users to receive invoice-less payments to their Lightning Address"
|
||||||
) %>
|
) %>
|
||||||
<% if Setting.lndhub_keysend_enabled? %>
|
<% if Setting.lndhub_keysend_enabled? %>
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "Public key", description: "The public key of the Lightning node used by LNDHub") do %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= f.text_field :lndhub_public_key,
|
key: :lndhub_public_key,
|
||||||
value: Setting.lndhub_public_key,
|
title: "Public key",
|
||||||
class: "w-full", disabled: true %>
|
description: "The public key of the Lightning node used by LNDHub"
|
||||||
<% end %>
|
) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -8,10 +8,13 @@
|
|||||||
description: "Mastodon configuration present and features enabled"
|
description: "Mastodon configuration present and features enabled"
|
||||||
) %>
|
) %>
|
||||||
<% if Setting.mastodon_enabled? %>
|
<% if Setting.mastodon_enabled? %>
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "Public URL") do %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= f.text_field :mastodon_public_url,
|
key: :mastodon_public_url,
|
||||||
value: Setting.mastodon_public_url,
|
title: "Public URL"
|
||||||
class: "w-full", disabled: true %>
|
) %>
|
||||||
<% end %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
|
key: :mastodon_address_domain,
|
||||||
|
title: "User address domain"
|
||||||
|
) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
description: "MediaWiki configuration present and features enabled"
|
description: "MediaWiki configuration present and features enabled"
|
||||||
) %>
|
) %>
|
||||||
<% if Setting.mediawiki_enabled? %>
|
<% if Setting.mediawiki_enabled? %>
|
||||||
<%= render FormElements::FieldsetComponent.new(title: "Public URL") do %>
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
<%= f.text_field :mediawiki_public_url,
|
key: :mediawiki_public_url,
|
||||||
value: Setting.mediawiki_public_url,
|
title: "Public URL"
|
||||||
class: "w-full", disabled: true %>
|
) %>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
21
app/views/admin/settings/services/_remotestorage.html.erb
Normal file
21
app/views/admin/settings/services/_remotestorage.html.erb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<h3>RemoteStorage</h3>
|
||||||
|
<p class="text-red-600 mb-8">Feature currently in development.</p>
|
||||||
|
<ul role="list">
|
||||||
|
<%= render FormElements::FieldsetToggleComponent.new(
|
||||||
|
form: f,
|
||||||
|
attribute: :remotestorage_enabled,
|
||||||
|
enabled: Setting.remotestorage_enabled?,
|
||||||
|
title: "Enable RemoteStorage integration",
|
||||||
|
description: "RemoteStorage configuration present and features enabled"
|
||||||
|
) %>
|
||||||
|
<% if Setting.remotestorage_enabled? %>
|
||||||
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
|
key: :rs_storage_url,
|
||||||
|
title: "Storage Base URL"
|
||||||
|
) %>
|
||||||
|
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||||
|
key: :rs_redis_url,
|
||||||
|
title: "Redis URL"
|
||||||
|
) %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
@@ -20,4 +20,10 @@
|
|||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if content_for?(:documentation) %>
|
||||||
|
<section>
|
||||||
|
<%= yield :documentation %>
|
||||||
|
</section>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
<h3>Account</h3>
|
<h3>Account</h3>
|
||||||
<table class="divided">
|
<table class="divided">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<td><%= @user.id %></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Created at</th>
|
<th>Created at</th>
|
||||||
<td><%= @user.created_at.strftime("%Y-%m-%d (%H:%M UTC)") %></td>
|
<td><%= @user.created_at.strftime("%Y-%m-%d (%H:%M UTC)") %></td>
|
||||||
@@ -135,7 +139,7 @@
|
|||||||
<td>XMPP (ejabberd)</td>
|
<td>XMPP (ejabberd)</td>
|
||||||
<td>
|
<td>
|
||||||
<%= render FormElements::ToggleComponent.new(
|
<%= render FormElements::ToggleComponent.new(
|
||||||
enabled: @services_enabled.include?("ejabberd"),
|
enabled: @services_enabled.include?("xmpp"),
|
||||||
input_enabled: false
|
input_enabled: false
|
||||||
) %>
|
) %>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -7,82 +7,108 @@
|
|||||||
services:
|
services:
|
||||||
</p>
|
</p>
|
||||||
<div class="services grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6">
|
<div class="services grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6">
|
||||||
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
<% if Setting.ejabberd_enabled? %>
|
||||||
bg-cover bg-[center_top_-50px] bg-no-repeat
|
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||||
bg-[url(/img/logos/icon_xmpp.svg)]">
|
bg-cover bg-[center_top_-50px] bg-no-repeat
|
||||||
<%= link_to "https://wiki.kosmos.org/Services:Chat",
|
bg-[url(/img/logos/icon_xmpp.svg)]">
|
||||||
class: "block h-full px-6 py-6 rounded-md" do %>
|
<%= link_to services_chat_path,
|
||||||
<h3 class="mb-3.5">Chat</h3>
|
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
<p class="text-gray-600">
|
<h3 class="mb-3.5">Chat</h3>
|
||||||
Federated chat rooms and instant messaging
|
<p class="text-gray-600">
|
||||||
</p>
|
Federated chat rooms and instant messaging
|
||||||
<% end %>
|
</p>
|
||||||
</div>
|
<% end %>
|
||||||
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
</div>
|
||||||
bg-[length:95%] bg-center bg-no-repeat
|
<% end %>
|
||||||
bg-[url(/img/logos/icon_discourse.svg)]">
|
<% if Setting.mastodon_enabled? %>
|
||||||
<%= link_to "https://community.kosmos.org",
|
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||||
class: "block h-full px-6 py-6 rounded-md" do %>
|
bg-[length:80%] bg-[right_top_-30px] bg-no-repeat
|
||||||
<h3 class="mb-3.5">Discourse</h3>
|
bg-[url(/img/logos/icon_mastodon.svg)]">
|
||||||
<p class="text-gray-600">
|
<%= link_to services_mastodon_path, class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
Kosmos community forums and user support/help site
|
<h3 class="mb-3.5">Mastodon</h3>
|
||||||
</p>
|
<p class="text-gray-600">
|
||||||
<% end %>
|
Your account on the Open Social Web
|
||||||
</div>
|
</p>
|
||||||
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
<% end %>
|
||||||
bg-cover bg-[center_top_-20px] bg-no-repeat
|
</div>
|
||||||
bg-[url(/img/logos/icon_mediawiki.svg)]">
|
<% end %>
|
||||||
<%= link_to "https://wiki.kosmos.org",
|
<% if Setting.discourse_enabled? %>
|
||||||
class: "block h-full px-6 py-6 rounded-md" do %>
|
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||||
<h3 class="mb-3.5">Wiki</h3>
|
bg-[length:95%] bg-center bg-no-repeat
|
||||||
<p class="text-gray-600">
|
bg-[url(/img/logos/icon_discourse.svg)]">
|
||||||
Kosmos documentation and knowledge base
|
<%= link_to "#{Setting.discourse_public_url}/session/sso?return_path=/",
|
||||||
</p>
|
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
<% end %>
|
<h3 class="mb-3.5">Discourse</h3>
|
||||||
</div>
|
<p class="text-gray-600">
|
||||||
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
Kosmos community forums and user support/help site
|
||||||
bg-cover bg-center sm:bg-[center_top_-140px] bg-no-repeat
|
</p>
|
||||||
bg-[url(/img/logos/icon_lightning.svg)]">
|
<% end %>
|
||||||
<%= link_to wallet_path,
|
</div>
|
||||||
class: "block h-full px-6 py-6 rounded-md" do %>
|
<% end %>
|
||||||
<h3 class="mb-3.5">Wallet</h3>
|
<% if Setting.lndhub_enabled? %>
|
||||||
<p class="text-gray-600">
|
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||||
Send and receive sats over the Bitcoin Lightning Network
|
bg-cover bg-center sm:bg-[center_top_-140px] bg-no-repeat
|
||||||
</p>
|
bg-[url(/img/logos/icon_lightning.svg)]">
|
||||||
<% end %>
|
<%= link_to services_lightning_index_path,
|
||||||
</div>
|
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
<h3 class="mb-3.5">Lightning Network</h3>
|
||||||
bg-cover bg-center bg-no-repeat
|
<p class="text-gray-600">
|
||||||
bg-[url(/img/logos/icon_gitea.png)]">
|
Send and receive sats over the Bitcoin Lightning Network
|
||||||
<%= link_to "https://gitea.kosmos.org",
|
</p>
|
||||||
class: "block h-full px-6 py-6 rounded-md" do %>
|
<% end %>
|
||||||
<h3 class="mb-3.5">Gitea</h3>
|
</div>
|
||||||
<p class="text-gray-600">
|
<% end %>
|
||||||
Code hosting and collaboration for software projects
|
<% if Setting.gitea_enabled? %>
|
||||||
</p>
|
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||||
<% end %>
|
bg-cover bg-center bg-no-repeat
|
||||||
</div>
|
bg-[url(/img/logos/icon_gitea.png)]">
|
||||||
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
<%= link_to Setting.gitea_public_url,
|
||||||
bg-cover bg-[center_top_-70px] bg-no-repeat
|
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
bg-[url(/img/logos/icon_droneci.svg)]">
|
<h3 class="mb-3.5">Gitea</h3>
|
||||||
<%= link_to "https://drone.kosmos.org",
|
<p class="text-gray-600">
|
||||||
class: "block h-full px-6 py-6 rounded-md" do %>
|
Code hosting and collaboration for software projects
|
||||||
<h3 class="mb-3.5">Drone CI</h3>
|
</p>
|
||||||
<p class="text-gray-600">
|
<% end %>
|
||||||
Continuous integration for software projects on Gitea
|
</div>
|
||||||
</p>
|
<% end %>
|
||||||
<% end %>
|
<% if Setting.droneci_enabled? %>
|
||||||
</div>
|
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||||
<!-- <div class="border border-gray-300 rounded-md hover:border-gray-400 -->
|
bg-cover bg-[center_top_-70px] bg-no-repeat
|
||||||
<!-- bg-[length:80%] bg-[right_top_-30px] bg-no-repeat -->
|
bg-[url(/img/logos/icon_droneci.svg)]">
|
||||||
<!-- bg-[url(/img/logos/icon_mastodon.svg)]"> -->
|
<%= link_to Setting.droneci_public_url,
|
||||||
<!-- <%= link_to "https://kosmos.social", class: "block h-full px-6 py-6 rounded-md" do %> -->
|
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
<!-- <h3 class="mb-3.5">Mastodon</h3> -->
|
<h3 class="mb-3.5">Drone CI</h3>
|
||||||
<!-- <p class="text-gray-400"> -->
|
<p class="text-gray-600">
|
||||||
<!-- Your account on the Open Social Web -->
|
Continuous integration for software projects on Gitea
|
||||||
<!-- </p> -->
|
</p>
|
||||||
<!-- <% end %> -->
|
<% end %>
|
||||||
<!-- </div> -->
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if Setting.remotestorage_enabled? &&
|
||||||
|
Flipper.enabled?(:remotestorage, current_user) %>
|
||||||
|
<div class="border border-gray-300 rounded-md hover:border-gray-400">
|
||||||
|
<%= link_to services_storage_path,
|
||||||
|
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
|
<h3 class="mb-3.5">Storage</h3>
|
||||||
|
<p class="text-gray-600">
|
||||||
|
Sync your data between apps and devices
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if Setting.mediawiki_enabled? %>
|
||||||
|
<div class="border border-gray-300 rounded-md hover:border-gray-400
|
||||||
|
bg-cover bg-[center_top_-20px] bg-no-repeat
|
||||||
|
bg-[url(/img/logos/icon_mediawiki.svg)]">
|
||||||
|
<%= link_to Setting.mediawiki_public_url,
|
||||||
|
class: "block h-full px-6 py-6 rounded-md" do %>
|
||||||
|
<h3 class="mb-3.5">Wiki</h3>
|
||||||
|
<p class="text-gray-600">
|
||||||
|
Kosmos documentation and knowledge base
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<p>Welcome <%= @email %>!</p>
|
<p>Welcome <%= @resource.cn %>!</p>
|
||||||
|
|
||||||
<p>You can confirm your account email through the link below:</p>
|
<p>Please confirm your email address through the link below:</p>
|
||||||
|
|
||||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
|
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<p>Hello <%= @email %>!</p>
|
<p>Hello <%= @resource.cn %>!</p>
|
||||||
|
|
||||||
<% if @resource.try(:unconfirmed_email?) %>
|
<% if @resource.try(:unconfirmed_email?) %>
|
||||||
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<p>Hello <%= @resource.email %>!</p>
|
<p>Hello <%= @resource.cn %>!</p>
|
||||||
|
|
||||||
<p>We're contacting you to notify you that your password has been changed.</p>
|
<p>We're contacting you to notify you that your password has been changed.</p>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<p>Hello <%= @resource.cn %>,</p>
|
||||||
|
|
||||||
|
<p>Please confirm your new email address through the link below:</p>
|
||||||
|
|
||||||
|
<p><%= link_to 'Confirm my address', confirmation_url(@resource, confirmation_token: @token) %></p>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<p>Hello <%= @resource.email %>!</p>
|
<p>Hello <%= @resource.cn %>!</p>
|
||||||
|
|
||||||
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<p>Hello <%= @resource.email %>!</p>
|
<p>Hello <%= @resource.cn %>!</p>
|
||||||
|
|
||||||
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<p class="flex gap-2 items-center">
|
<p class="flex gap-2 items-center">
|
||||||
<%= f.text_field :cn, autofocus: true, autocomplete: "username",
|
<%= f.text_field :cn, autofocus: true, autocomplete: "username",
|
||||||
required: true, class: "relative grow"%>
|
required: true, class: "relative grow"%>
|
||||||
<span class="relative shrink-0 text-gray-500">@ kosmos.org</span>
|
<span class="relative shrink-0 text-gray-500">@ <%= Setting.primary_domain %></span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -1,25 +1,57 @@
|
|||||||
|
<%
|
||||||
|
# TODO remove when https://github.com/hotwired/turbo/issues/203 is fixed
|
||||||
|
enable_turbo = !session[:user_return_to] || !session[:user_return_to].match?('/discourse/connect')
|
||||||
|
%>
|
||||||
|
|
||||||
<%= render HeaderCompactComponent.new(title: "Log in") %>
|
<%= render HeaderCompactComponent.new(title: "Log in") %>
|
||||||
|
|
||||||
<%= render MainCompactComponent.new do %>
|
<%= render MainCompactComponent.new do %>
|
||||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
<%= form_for(resource, as: resource_name, url: session_path(resource_name),
|
||||||
|
data: { turbo: enable_turbo.to_s }) do |f| %>
|
||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
<div class="mb-6">
|
<div class="mb-6">
|
||||||
<%= f.label :cn, 'User', class: 'block mb-2 font-bold' %>
|
<%= f.label :cn, 'User', class: 'block mb-2 font-bold' %>
|
||||||
<p class="flex gap-2 items-center">
|
<p class="flex gap-2 items-center">
|
||||||
<%= f.text_field :cn, autofocus: true, autocomplete: "username",
|
<%= f.text_field :cn, value: h(params[:cn]),
|
||||||
required: true, class: "relative grow"%>
|
autofocus: params[:cn].blank?, autocomplete: "username",
|
||||||
<span class="relative shrink-0 text-gray-500">@ kosmos.org</span>
|
required: true, class: "relative grow", tabindex: "1" %>
|
||||||
|
<span class="relative shrink-0 text-gray-500">@ <%= Setting.primary_domain %></span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p class="mb-8">
|
||||||
<%= f.label :password, class: 'block mb-2 font-bold' %>
|
<%= f.label :password, class: 'block mb-2 font-bold' %>
|
||||||
<%= f.password_field :password, autocomplete: "current-password",
|
<%= f.password_field :password, autocomplete: "current-password",
|
||||||
required: true, class: "w-full"%>
|
autofocus: params[:cn].present?, required: true,
|
||||||
|
class: "w-full", tabindex: "2" %>
|
||||||
</p>
|
</p>
|
||||||
<p class="mt-8">
|
|
||||||
<%= f.submit "Log in", class: 'btn-md btn-blue w-full' %>
|
<%= tag.div class: "flex items-center mb-8 gap-x-3", data: {
|
||||||
|
controller: "settings--toggle",
|
||||||
|
:'settings--toggle-switch-enabled-value' => "false"
|
||||||
|
} do %>
|
||||||
|
<div class="relative inline-flex flex-shrink-0">
|
||||||
|
<%= render FormElements::ToggleComponent.new(
|
||||||
|
enabled: false, input_enabled: true, class_names: "hidden",
|
||||||
|
tabindex: "3", data: {
|
||||||
|
:'settings--toggle-target' => "button",
|
||||||
|
action: "settings--toggle#toggleSwitch"
|
||||||
|
}) %>
|
||||||
|
<%= f.check_box :remember_me, {
|
||||||
|
checked: false,
|
||||||
|
data: { :'settings--toggle-target' => "checkbox" }
|
||||||
|
}, "true", "false" %>
|
||||||
|
</div>
|
||||||
|
<%= f.label :remember_me,
|
||||||
|
class: "text-gray-500 flex flex-col",
|
||||||
|
data: { action: "click->settings--toggle#toggleSwitch" } %>
|
||||||
|
<p class="grow text-sm text-right">
|
||||||
|
<%= link_to "Forgot your password?", new_password_path(resource_name),
|
||||||
|
class: "text-gray-500 underline" %><br />
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%= f.submit "Log in", class: 'btn-md btn-blue w-full', tabindex: "4" %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user