Compare commits
9 Commits
v0.5.0
...
ef2d2b6422
| Author | SHA1 | Date | |
|---|---|---|---|
| ef2d2b6422 | |||
|
a47e4fc16b
|
|||
|
9b89101afc
|
|||
|
|
83e418cdee
|
||
|
|
7a193d6647
|
||
|
|
bb82b6b462
|
||
|
|
a1b238e86b
|
||
| 6f2160b479 | |||
|
|
fe1dfd8ec8
|
@@ -1,3 +1,5 @@
|
|||||||
|
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
|
||||||
@@ -20,6 +22,7 @@ DISCOURSE_PUBLIC_URL='https://community.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'
|
||||||
|
|
||||||
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'
|
||||||
|
|||||||
@@ -6,4 +6,6 @@ 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'
|
||||||
|
|
||||||
WEBHOOKS_ALLOWED_IPS='10.1.1.23'
|
WEBHOOKS_ALLOWED_IPS='10.1.1.23'
|
||||||
|
|||||||
1
Gemfile
1
Gemfile
@@ -66,6 +66,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
|
||||||
|
|||||||
49
Gemfile.lock
49
Gemfile.lock
@@ -68,7 +68,10 @@ GEM
|
|||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0)
|
||||||
addressable (2.8.1)
|
addressable (2.8.1)
|
||||||
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)
|
||||||
|
benchmark (0.2.1)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
byebug (11.1.3)
|
byebug (11.1.3)
|
||||||
@@ -109,6 +112,7 @@ GEM
|
|||||||
dotenv-rails (2.8.1)
|
dotenv-rails (2.8.1)
|
||||||
dotenv (= 2.8.1)
|
dotenv (= 2.8.1)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
|
e2mmap (0.1.0)
|
||||||
erubi (1.11.0)
|
erubi (1.11.0)
|
||||||
et-orbi (1.2.7)
|
et-orbi (1.2.7)
|
||||||
tzinfo
|
tzinfo
|
||||||
@@ -135,9 +139,15 @@ GEM
|
|||||||
importmap-rails (1.1.5)
|
importmap-rails (1.1.5)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
|
jaro_winkler (1.5.4)
|
||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
|
json (2.6.3)
|
||||||
|
kramdown (2.4.0)
|
||||||
|
rexml
|
||||||
|
kramdown-parser-gfm (1.1.0)
|
||||||
|
kramdown (~> 2.0)
|
||||||
launchy (2.5.0)
|
launchy (2.5.0)
|
||||||
addressable (~> 2.7)
|
addressable (~> 2.7)
|
||||||
letter_opener (1.8.1)
|
letter_opener (1.8.1)
|
||||||
@@ -179,6 +189,9 @@ GEM
|
|||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
pagy (6.0.2)
|
pagy (6.0.2)
|
||||||
|
parallel (1.22.1)
|
||||||
|
parser (3.2.1.1)
|
||||||
|
ast (~> 2.4.1)
|
||||||
pg (1.2.3)
|
pg (1.2.3)
|
||||||
public_suffix (5.0.0)
|
public_suffix (5.0.0)
|
||||||
puma (4.3.12)
|
puma (4.3.12)
|
||||||
@@ -217,6 +230,7 @@ GEM
|
|||||||
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)
|
||||||
@@ -229,6 +243,8 @@ GEM
|
|||||||
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.1.2)
|
||||||
chunky_png (~> 1.0)
|
chunky_png (~> 1.0)
|
||||||
@@ -251,6 +267,19 @@ GEM
|
|||||||
rspec-mocks (~> 3.11)
|
rspec-mocks (~> 3.11)
|
||||||
rspec-support (~> 3.11)
|
rspec-support (~> 3.11)
|
||||||
rspec-support (3.12.0)
|
rspec-support (3.12.0)
|
||||||
|
rubocop (1.48.1)
|
||||||
|
json (~> 2.3)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.2.0.0)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
|
rexml (>= 3.2.5, < 4.0)
|
||||||
|
rubocop-ast (>= 1.26.0, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
|
rubocop-ast (1.28.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.8.2)
|
||||||
fugit (~> 1.1, >= 1.1.6)
|
fugit (~> 1.1, >= 1.1.6)
|
||||||
@@ -268,6 +297,21 @@ GEM
|
|||||||
rufus-scheduler (~> 3.2)
|
rufus-scheduler (~> 3.2)
|
||||||
sidekiq (>= 4, < 7)
|
sidekiq (>= 4, < 7)
|
||||||
tilt (>= 1.4.0)
|
tilt (>= 1.4.0)
|
||||||
|
solargraph (0.48.0)
|
||||||
|
backport (~> 1.2)
|
||||||
|
benchmark
|
||||||
|
bundler (>= 1.17.2)
|
||||||
|
diff-lcs (~> 1.4)
|
||||||
|
e2mmap
|
||||||
|
jaro_winkler (~> 1.5)
|
||||||
|
kramdown (~> 2.3)
|
||||||
|
kramdown-parser-gfm (~> 1.1)
|
||||||
|
parser (~> 3.0)
|
||||||
|
reverse_markdown (>= 1.0.5, < 3)
|
||||||
|
rubocop (>= 0.52)
|
||||||
|
thor (~> 1.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
|
yard (~> 0.9, >= 0.9.24)
|
||||||
sprockets (4.1.1)
|
sprockets (4.1.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
@@ -289,6 +333,7 @@ GEM
|
|||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
tzinfo (2.0.5)
|
tzinfo (2.0.5)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
unicode-display_width (2.4.2)
|
||||||
view_component (2.78.0)
|
view_component (2.78.0)
|
||||||
activesupport (>= 5.0.0, < 8.0)
|
activesupport (>= 5.0.0, < 8.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
@@ -304,11 +349,14 @@ GEM
|
|||||||
addressable (>= 2.8.0)
|
addressable (>= 2.8.0)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff (>= 0.4.0, < 2.0.0)
|
hashdiff (>= 0.4.0, < 2.0.0)
|
||||||
|
webrick (1.7.0)
|
||||||
websocket-driver (0.7.5)
|
websocket-driver (0.7.5)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
|
yard (0.9.28)
|
||||||
|
webrick (~> 1.7.0)
|
||||||
zeitwerk (2.6.6)
|
zeitwerk (2.6.6)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
@@ -344,6 +392,7 @@ DEPENDENCIES
|
|||||||
sentry-ruby
|
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
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -23,9 +23,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
|
||||||
@@ -79,6 +78,15 @@ 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.
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|||||||
@@ -104,4 +104,14 @@ 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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class User < ApplicationRecord
|
|||||||
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"
|
||||||
|
|
||||||
|
|||||||
17
app/views/admin/settings/services/_remotestorage.html.erb
Normal file
17
app/views/admin/settings/services/_remotestorage.html.erb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<h3>RemoteStorage</h3>
|
||||||
|
<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::FieldsetComponent.new(title: "Storage URL") do %>
|
||||||
|
<%= f.text_field :rs_storage_url,
|
||||||
|
value: Setting.rs_storage_url,
|
||||||
|
class: "w-full", disabled: true %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
@@ -47,3 +47,10 @@
|
|||||||
icon: Setting.nostr_enabled? ? "check" : "x",
|
icon: Setting.nostr_enabled? ? "check" : "x",
|
||||||
active: current_page?(admin_settings_services_path(params: { s: "nostr" })),
|
active: current_page?(admin_settings_services_path(params: { s: "nostr" })),
|
||||||
) %>
|
) %>
|
||||||
|
<%= render SidenavLinkComponent.new(
|
||||||
|
level: 2,
|
||||||
|
name: "RemoteStorage",
|
||||||
|
path: admin_settings_services_path(params: { s: "remotestorage" }),
|
||||||
|
icon: Setting.remotestorage_enabled? ? "check" : "x",
|
||||||
|
active: current_page?(admin_settings_services_path(params: { s: "remotestorage" })),
|
||||||
|
) %>
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ Rails.application.configure do
|
|||||||
outgoing_email_address = ENV.fetch('SMTP_FROM_ADDRESS', 'accounts@localhost')
|
outgoing_email_address = ENV.fetch('SMTP_FROM_ADDRESS', 'accounts@localhost')
|
||||||
outgoing_email_domain = Mail::Address.new(outgoing_email_address).domain
|
outgoing_email_domain = Mail::Address.new(outgoing_email_address).domain
|
||||||
|
|
||||||
|
config.action_mailer.default_url_options = {
|
||||||
|
host: ENV['AKKOUNTS_DOMAIN'],
|
||||||
|
protocol: "https",
|
||||||
|
}
|
||||||
|
|
||||||
config.action_mailer.default_options = {
|
config.action_mailer.default_options = {
|
||||||
from: outgoing_email_address,
|
from: outgoing_email_address,
|
||||||
message_id: -> { "<#{Mail.random_tag}@#{outgoing_email_domain}>" },
|
message_id: -> { "<#{Mail.random_tag}@#{outgoing_email_domain}>" },
|
||||||
|
|||||||
@@ -46,5 +46,26 @@ RSpec.describe 'Admin/global settings', type: :feature do
|
|||||||
expect(page).to_not have_checked_field("setting[ejabberd_enabled]")
|
expect(page).to_not have_checked_field("setting[ejabberd_enabled]")
|
||||||
expect(page).to_not have_field("API URL", disabled: true)
|
expect(page).to_not have_field("API URL", disabled: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "View remoteStorage settings" do
|
||||||
|
visit admin_settings_services_path(params: { s: "remotestorage" })
|
||||||
|
|
||||||
|
expect(page).to have_content("Enable RemoteStorage integration")
|
||||||
|
expect(page).to have_field("Storage URL",
|
||||||
|
with: "https://storage.kosmos.org",
|
||||||
|
disabled: true)
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Disable remoteStorage integration" do
|
||||||
|
visit admin_settings_services_path(params: { s: "remotestorage" })
|
||||||
|
expect(page).to have_checked_field("setting[remotestorage_enabled]")
|
||||||
|
|
||||||
|
uncheck "setting[remotestorage_enabled]"
|
||||||
|
click_button "Save"
|
||||||
|
|
||||||
|
expect(current_url).to eq(admin_settings_services_url(params: { s: "remotestorage" }))
|
||||||
|
expect(page).to_not have_checked_field("setting[remotestorage_enabled]")
|
||||||
|
expect(page).to_not have_field("Storage URL", disabled: true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user