Compare commits
25 Commits
e1e7d8f87d
...
v0.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f08bb56a7a
|
||
| c1f275463e | |||
| 324809f77e | |||
|
|
f9b07bcb01
|
||
|
|
986eb5387c
|
||
| f76e2c2f14 | |||
|
|
22a7bbe6eb
|
||
| 18f4deb30f | |||
|
|
9f9bf6fd80
|
||
|
|
d2987da70a
|
||
|
|
6b7a80e23a
|
||
|
|
42b9b27561
|
||
|
|
c17c980b69
|
||
|
|
f199d5d12a
|
||
|
|
4b17afa93d
|
||
|
|
6d52af53ae
|
||
|
|
4c5ad67652
|
||
|
|
3437a756eb
|
||
| 0d9fc4aa74 | |||
| 82475161a9 | |||
|
|
fb3b9af3e5
|
||
|
|
b1a0268e6b
|
||
|
|
a8a8fba14c
|
||
|
|
8a7016a30b
|
||
|
|
e2618de7c6
|
12
.env.example
12
.env.example
@@ -1,3 +1,14 @@
|
|||||||
|
SMTP_SERVER=smtp.example.com
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_LOGIN=accounts
|
||||||
|
SMTP_PASSWORD=123abc
|
||||||
|
SMTP_FROM_ADDRESS=accounts@example.com
|
||||||
|
SMTP_DOMAIN=example.com
|
||||||
|
SMTP_AUTH_METHOD=plain
|
||||||
|
SMTP_ENABLE_STARTTLS=auto
|
||||||
|
|
||||||
|
REDIS_URL='redis://localhost:6379/1'
|
||||||
|
|
||||||
LDAP_HOST=localhost
|
LDAP_HOST=localhost
|
||||||
LDAP_PORT=389
|
LDAP_PORT=389
|
||||||
LDAP_ADMIN_PASSWORD=passthebutter
|
LDAP_ADMIN_PASSWORD=passthebutter
|
||||||
@@ -24,4 +35,3 @@ LNDHUB_PG_PORT=5432
|
|||||||
LNDHUB_PG_DATABASE=lndhub
|
LNDHUB_PG_DATABASE=lndhub
|
||||||
LNDHUB_PG_USERNAME=lndhub
|
LNDHUB_PG_USERNAME=lndhub
|
||||||
LNDHUB_PG_PASSWORD=''
|
LNDHUB_PG_PASSWORD=''
|
||||||
|
|
||||||
|
|||||||
13
.gitea/release-drafter.yml
Normal file
13
.gitea/release-drafter.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
name-template: 'v$RESOLVED_VERSION'
|
||||||
|
tag-template: 'v$RESOLVED_VERSION'
|
||||||
|
version-resolver:
|
||||||
|
major:
|
||||||
|
labels:
|
||||||
|
- 'release/major'
|
||||||
|
minor:
|
||||||
|
labels:
|
||||||
|
- 'release/minor'
|
||||||
|
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
|
||||||
15
Dockerfile
15
Dockerfile
@@ -1,8 +1,13 @@
|
|||||||
# 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 /akkounts/Gemfile
|
||||||
COPY Gemfile.lock /akkounts/Gemfile.lock
|
COPY Gemfile.lock /akkounts/Gemfile.lock
|
||||||
@@ -12,11 +17,5 @@ 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"]
|
|
||||||
|
|||||||
4
Gemfile
4
Gemfile
@@ -48,6 +48,10 @@ gem 'faraday'
|
|||||||
gem 'sidekiq', '< 7'
|
gem 'sidekiq', '< 7'
|
||||||
gem 'sidekiq-scheduler'
|
gem 'sidekiq-scheduler'
|
||||||
|
|
||||||
|
# Monitoring
|
||||||
|
gem "sentry-ruby"
|
||||||
|
gem "sentry-rails"
|
||||||
|
|
||||||
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'
|
||||||
|
|||||||
@@ -254,6 +254,11 @@ GEM
|
|||||||
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)
|
||||||
|
sentry-rails (5.8.0)
|
||||||
|
railties (>= 5.0)
|
||||||
|
sentry-ruby (~> 5.8.0)
|
||||||
|
sentry-ruby (5.8.0)
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
sidekiq (6.5.5)
|
sidekiq (6.5.5)
|
||||||
connection_pool (>= 2.2.2)
|
connection_pool (>= 2.2.2)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
@@ -335,6 +340,8 @@ DEPENDENCIES
|
|||||||
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
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ 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`
|
2. Uncomment the `redis`, `web`, and `sidekiq` sections 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"`
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
class ApplicationMailer < ActionMailer::Base
|
class ApplicationMailer < ActionMailer::Base
|
||||||
default from: 'from@example.com'
|
|
||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
end
|
end
|
||||||
|
|||||||
23
app/mailers/custom_mailer.rb
Normal file
23
app/mailers/custom_mailer.rb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# A custom mailer that can be used from the Rails console for one-off emails
|
||||||
|
# today, and later connected from an admin panel mailing page.
|
||||||
|
#
|
||||||
|
# Assign any template variables you want to use:
|
||||||
|
#
|
||||||
|
# user = User.first
|
||||||
|
#
|
||||||
|
# Create the email body from a custom email template file:
|
||||||
|
#
|
||||||
|
# body = ERB.new(File.read('./tmp/mailer-1.txt.erb')).result binding
|
||||||
|
#
|
||||||
|
# Send email via Sidekiq:
|
||||||
|
#
|
||||||
|
# CustomMailer.with(user: user, subject: "Important announcement", body: body).custom_message.deliver_later
|
||||||
|
#
|
||||||
|
class CustomMailer < ApplicationMailer
|
||||||
|
def custom_message
|
||||||
|
@user = params[:user]
|
||||||
|
@subject = params[:subject]
|
||||||
|
@body = params[:body]
|
||||||
|
mail(to: @user.email, subject: @subject)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -2,6 +2,13 @@
|
|||||||
class Setting < RailsSettings::Base
|
class Setting < RailsSettings::Base
|
||||||
cache_prefix { "v1" }
|
cache_prefix { "v1" }
|
||||||
|
|
||||||
|
#
|
||||||
|
# Internal services
|
||||||
|
#
|
||||||
|
|
||||||
|
field :redis_url, type: :string, readonly: true,
|
||||||
|
default: ENV["REDIS_URL"] || "redis://localhost:6379/0"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Registrations
|
# Registrations
|
||||||
#
|
#
|
||||||
@@ -10,6 +17,13 @@ class Setting < RailsSettings::Base
|
|||||||
account accounts donations mail webmaster support
|
account accounts donations mail webmaster support
|
||||||
]
|
]
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sentry
|
||||||
|
#
|
||||||
|
|
||||||
|
field :sentry_enabled, type: :boolean, readonly: true,
|
||||||
|
default: (ENV["SENTRY_DSN"].present?.to_s || false)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Discourse
|
# Discourse
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -38,7 +38,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
|
||||||
@@ -63,6 +65,10 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_devise_notification(notification, *args)
|
||||||
|
devise_mailer.send(notification, self, *args).deliver_later
|
||||||
|
end
|
||||||
|
|
||||||
def reset_password(new_password, new_password_confirmation)
|
def reset_password(new_password, new_password_confirmation)
|
||||||
self.password = new_password
|
self.password = new_password
|
||||||
self.password_confirmation = new_password_confirmation
|
self.password_confirmation = new_password_confirmation
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ 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)
|
||||||
|
|||||||
1
app/views/custom_mailer/custom_message.text.erb
Normal file
1
app/views/custom_mailer/custom_message.text.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<%= @body %>
|
||||||
@@ -7,19 +7,43 @@
|
|||||||
<%= 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, autofocus: true, autocomplete: "username",
|
||||||
required: true, class: "relative grow"%>
|
required: true, class: "relative grow", tabindex: "1" %>
|
||||||
<span class="relative shrink-0 text-gray-500">@ kosmos.org</span>
|
<span class="relative shrink-0 text-gray-500">@ kosmos.org</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"%>
|
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 %>
|
||||||
|
|||||||
@@ -1,25 +1,29 @@
|
|||||||
<div class="devise-links mt-8 text-sm">
|
<div class="devise-links mt-8 text-sm">
|
||||||
<%- if controller_name != 'sessions' %>
|
<%- if controller_name != 'sessions' %>
|
||||||
<p class="mb-1.5">
|
<p class="mb-2">
|
||||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
<%= link_to "Log in", new_session_path(resource_name),
|
||||||
|
class: "text-gray-500 underline" %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||||
<p class="mb-1.5">
|
<p class="mb-2">
|
||||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
<%= link_to "Forgot your password?", new_password_path(resource_name),
|
||||||
|
class: "text-gray-500 underline" %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
<%- if devise_mapping.confirmable? && !controller_name.match(/^(confirmations|sessions)$/) %>
|
||||||
<p class="mb-1.5">
|
<p class="mb-2">
|
||||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name),
|
||||||
|
class: "text-gray-500 underline" %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||||
<p class="mb-1.5">
|
<p class="mb-2">
|
||||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name),
|
||||||
|
class: "text-gray-500 underline" %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<style>
|
<style></style>
|
||||||
/* Email styles need to be inline */
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ require "active_record/railtie"
|
|||||||
# require "active_storage/engine"
|
# require "active_storage/engine"
|
||||||
require "action_controller/railtie"
|
require "action_controller/railtie"
|
||||||
require "action_mailer/railtie"
|
require "action_mailer/railtie"
|
||||||
# require "action_mailbox/engine"
|
require "action_mailbox/engine"
|
||||||
# require "action_text/engine"
|
# require "action_text/engine"
|
||||||
require "action_view/railtie"
|
require "action_view/railtie"
|
||||||
require "action_cable/engine"
|
require "action_cable/engine"
|
||||||
|
|||||||
@@ -57,10 +57,14 @@ Rails.application.configure do
|
|||||||
# routes, locales, etc. This feature depends on the listen gem.
|
# routes, locales, etc. This feature depends on the listen gem.
|
||||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||||
|
|
||||||
|
config.action_mailer.default_options = {
|
||||||
|
from: "accounts@localhost"
|
||||||
|
}
|
||||||
|
|
||||||
# Don't actually send emails, cache them for viewing via letter opener
|
# Don't actually send emails, cache them for viewing via letter opener
|
||||||
config.action_mailer.delivery_method = :letter_opener
|
config.action_mailer.delivery_method = :letter_opener
|
||||||
# Don't care if the mailer can't send
|
# Don't care if the mailer can't send
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = true
|
||||||
# Base URL to be used by email template link helpers
|
# Base URL to be used by email template link helpers
|
||||||
config.action_mailer.default_url_options = { host: "localhost:3000", protocol: "http" }
|
config.action_mailer.default_url_options = { host: "localhost:3000", protocol: "http" }
|
||||||
|
|
||||||
|
|||||||
@@ -57,28 +57,53 @@ Rails.application.configure do
|
|||||||
# config.active_job.queue_adapter = :resque
|
# config.active_job.queue_adapter = :resque
|
||||||
# config.active_job.queue_name_prefix = "akkounts_production"
|
# config.active_job.queue_name_prefix = "akkounts_production"
|
||||||
|
|
||||||
config.action_mailer.perform_caching = false
|
# E-mail settings, adapted from https://github.com/mastodon/mastodon
|
||||||
|
|
||||||
config.action_mailer.delivery_method = :smtp
|
outgoing_email_address = ENV.fetch('SMTP_FROM_ADDRESS', 'accounts@localhost')
|
||||||
|
outgoing_email_domain = Mail::Address.new(outgoing_email_address).domain
|
||||||
|
|
||||||
|
config.action_mailer.default_options = {
|
||||||
|
from: outgoing_email_address,
|
||||||
|
message_id: -> { "<#{Mail.random_tag}@#{outgoing_email_domain}>" },
|
||||||
|
}
|
||||||
|
|
||||||
|
config.action_mailer.default_options[:reply_to] = ENV['SMTP_REPLY_TO'] if ENV['SMTP_REPLY_TO'].present?
|
||||||
|
config.action_mailer.default_options[:return_path] = ENV['SMTP_RETURN_PATH'] if ENV['SMTP_RETURN_PATH'].present?
|
||||||
|
|
||||||
|
enable_starttls = nil
|
||||||
|
enable_starttls_auto = nil
|
||||||
|
|
||||||
|
case ENV['SMTP_ENABLE_STARTTLS']
|
||||||
|
when 'always'
|
||||||
|
enable_starttls = true
|
||||||
|
when 'never'
|
||||||
|
enable_starttls = false
|
||||||
|
when 'auto'
|
||||||
|
enable_starttls_auto = true
|
||||||
|
else
|
||||||
|
enable_starttls_auto = ENV['SMTP_ENABLE_STARTTLS_AUTO'] != 'false'
|
||||||
|
end
|
||||||
|
|
||||||
config.action_mailer.smtp_settings = {
|
config.action_mailer.smtp_settings = {
|
||||||
address: "mail.gandi.net",
|
port: ENV['SMTP_PORT'],
|
||||||
port: "587",
|
address: ENV['SMTP_SERVER'],
|
||||||
authentication: "plain",
|
user_name: ENV['SMTP_LOGIN'].presence,
|
||||||
enable_starttls_auto: true,
|
password: ENV['SMTP_PASSWORD'].presence,
|
||||||
user_name: Rails.application.credentials.smtp[:username],
|
domain: ENV['SMTP_DOMAIN'] || ENV['LOCAL_DOMAIN'],
|
||||||
password: Rails.application.credentials.smtp[:password]
|
authentication: ENV['SMTP_AUTH_METHOD'] == 'none' ? nil : ENV['SMTP_AUTH_METHOD'] || :plain,
|
||||||
|
ca_file: ENV['SMTP_CA_FILE'].presence || '/etc/ssl/certs/ca-certificates.crt',
|
||||||
|
openssl_verify_mode: ENV['SMTP_OPENSSL_VERIFY_MODE'],
|
||||||
|
enable_starttls: enable_starttls,
|
||||||
|
enable_starttls_auto: enable_starttls_auto,
|
||||||
|
tls: ENV['SMTP_TLS'].presence && ENV['SMTP_TLS'] == 'true',
|
||||||
|
ssl: ENV['SMTP_SSL'].presence && ENV['SMTP_SSL'] == 'true',
|
||||||
}
|
}
|
||||||
|
|
||||||
config.action_mailer.default_url_options = {
|
config.action_mailer.delivery_method = ENV.fetch('SMTP_DELIVERY_METHOD', 'smtp').to_sym
|
||||||
host: "accounts.kosmos.org",
|
|
||||||
protocol: "https",
|
|
||||||
from: "accounts@kosmos.org"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ignore bad email addresses and do not raise email delivery errors.
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
# config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = true
|
||||||
|
|
||||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
# the I18n.default_locale when a translation cannot be found).
|
# the I18n.default_locale when a translation cannot be found).
|
||||||
|
|||||||
@@ -186,13 +186,13 @@ Devise.setup do |config|
|
|||||||
|
|
||||||
# ==> Configuration for :rememberable
|
# ==> Configuration for :rememberable
|
||||||
# The time the user will be remembered without asking for credentials again.
|
# The time the user will be remembered without asking for credentials again.
|
||||||
# config.remember_for = 2.weeks
|
config.remember_for = 2.weeks
|
||||||
|
|
||||||
# Invalidates all the remember me tokens when the user signs out.
|
# Invalidates all the remember me tokens when the user signs out.
|
||||||
config.expire_all_remember_me_on_sign_out = true
|
config.expire_all_remember_me_on_sign_out = true
|
||||||
|
|
||||||
# If true, extends the user's remember period when remembered via cookie.
|
# If true, extends the user's remember period when remembered via cookie.
|
||||||
# config.extend_remember_period = false
|
config.extend_remember_period = true
|
||||||
|
|
||||||
# Options to be passed to the created cookie. For instance, you can set
|
# Options to be passed to the created cookie. For instance, you can set
|
||||||
# secure: true in order to force SSL only cookies.
|
# secure: true in order to force SSL only cookies.
|
||||||
@@ -210,7 +210,7 @@ Devise.setup do |config|
|
|||||||
# ==> Configuration for :timeoutable
|
# ==> Configuration for :timeoutable
|
||||||
# The time you want to timeout the user session without activity. After this
|
# The time you want to timeout the user session without activity. After this
|
||||||
# time the user will be asked for credentials again. Default is 30 minutes.
|
# time the user will be asked for credentials again. Default is 30 minutes.
|
||||||
# config.timeout_in = 30.minutes
|
config.timeout_in = 30.minutes
|
||||||
|
|
||||||
# ==> Configuration for :lockable
|
# ==> Configuration for :lockable
|
||||||
# Defines which strategy will be used to lock an account.
|
# Defines which strategy will be used to lock an account.
|
||||||
|
|||||||
9
config/initializers/sentry.rb
Normal file
9
config/initializers/sentry.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
if ENV["SENTRY_DSN"].present?
|
||||||
|
Sentry.init do |config|
|
||||||
|
config.dsn = ENV["SENTRY_DSN"]
|
||||||
|
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
|
||||||
|
config.traces_sampler = lambda do |context|
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
5
config/initializers/sidekiq.rb
Normal file
5
config/initializers/sidekiq.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require_relative "../../app/models/setting"
|
||||||
|
|
||||||
|
Sidekiq.configure_server do |config|
|
||||||
|
config.redis = { url: Setting.redis_url }
|
||||||
|
end
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
require 'sidekiq/web'
|
require 'sidekiq/web'
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
devise_for :users, :controllers => { :confirmations => "users/confirmations" }
|
devise_for :users, controllers: { confirmations: "users/confirmations" }
|
||||||
|
|
||||||
get 'welcome', to: 'welcome#index'
|
get 'welcome', to: 'welcome#index'
|
||||||
get 'check_your_email', to: 'welcome#check_your_email'
|
get 'check_your_email', to: 'welcome#check_your_email'
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
:concurrency: 2
|
:concurrency: 2
|
||||||
:queues:
|
:queues:
|
||||||
- default
|
- default
|
||||||
|
- mailers
|
||||||
|
|||||||
7
config/storage.yml
Normal file
7
config/storage.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
test:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("tmp/storage") %>
|
||||||
|
|
||||||
|
local:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("storage") %>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class AddRememberCreatedAtToUsers < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
add_column :users, :remember_created_at, :datetime
|
||||||
|
add_column :users, :remember_token, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_02_23_115536) do
|
ActiveRecord::Schema[7.0].define(version: 2023_03_19_101128) do
|
||||||
create_table "donations", force: :cascade do |t|
|
create_table "donations", force: :cascade do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.integer "amount_sats"
|
t.integer "amount_sats"
|
||||||
@@ -57,6 +57,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_23_115536) do
|
|||||||
t.text "ln_login_ciphertext"
|
t.text "ln_login_ciphertext"
|
||||||
t.text "ln_password_ciphertext"
|
t.text "ln_password_ciphertext"
|
||||||
t.string "ln_account"
|
t.string "ln_account"
|
||||||
|
t.datetime "remember_created_at"
|
||||||
|
t.string "remember_token"
|
||||||
t.index ["email"], name: "index_users_on_email", unique: true
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,11 +3,67 @@ services:
|
|||||||
image: 4teamwork/389ds:latest
|
image: 4teamwork/389ds:latest
|
||||||
volumes:
|
volumes:
|
||||||
- ./tmp/389ds:/data
|
- ./tmp/389ds:/data
|
||||||
|
networks:
|
||||||
|
- external_network
|
||||||
|
- internal_network
|
||||||
ports:
|
ports:
|
||||||
- "389:3389"
|
- "389:3389"
|
||||||
environment:
|
environment:
|
||||||
DS_DM_PASSWORD: passthebutter
|
DS_DM_PASSWORD: passthebutter
|
||||||
SUFFIX_NAME: "dc=kosmos,dc=org"
|
SUFFIX_NAME: "dc=kosmos,dc=org"
|
||||||
|
|
||||||
|
# redis:
|
||||||
|
# restart: always
|
||||||
|
# image: redis:7-alpine
|
||||||
|
# networks:
|
||||||
|
# - internal_network
|
||||||
|
# healthcheck:
|
||||||
|
# test: ['CMD', 'redis-cli', 'ping']
|
||||||
|
# volumes:
|
||||||
|
# - ./tmp/redis:/data
|
||||||
|
|
||||||
|
# web:
|
||||||
|
# build: .
|
||||||
|
# tty: true
|
||||||
|
# command: bash -c "rm -f /akkounts/tmp/pids/server.pid; bin/dev"
|
||||||
|
# volumes:
|
||||||
|
# - .:/akkounts
|
||||||
|
# networks:
|
||||||
|
# - external_network
|
||||||
|
# - internal_network
|
||||||
|
# ports:
|
||||||
|
# - "3000:3000"
|
||||||
|
# environment:
|
||||||
|
# RAILS_ENV: development
|
||||||
|
# REDIS_URL: redis://redis:6379/0
|
||||||
|
# LDAP_HOST: ldap
|
||||||
|
# LDAP_PORT: 3389
|
||||||
|
# LDAP_ADMIN_PASSWORD: passthebutter
|
||||||
|
# LDAP_USE_TLS: "false"
|
||||||
|
# depends_on:
|
||||||
|
# - ldap
|
||||||
|
# - redis
|
||||||
|
|
||||||
|
# sidekiq:
|
||||||
|
# build: .
|
||||||
|
# command: bash -c "bundle exec sidekiq -C config/sidekiq.yml"
|
||||||
|
# volumes:
|
||||||
|
# - .:/akkounts
|
||||||
|
# networks:
|
||||||
|
# - internal_network
|
||||||
|
# environment:
|
||||||
|
# RAILS_ENV: development
|
||||||
|
# REDIS_URL: redis://redis:6379/0
|
||||||
|
# LDAP_HOST: ldap
|
||||||
|
# LDAP_PORT: 3389
|
||||||
|
# LDAP_ADMIN_PASSWORD: passthebutter
|
||||||
|
# LDAP_USE_TLS: "false"
|
||||||
|
# LAUNCHY_DRY_RUN: true
|
||||||
|
# BROWSER: /dev/null
|
||||||
|
# depends_on:
|
||||||
|
# - ldap
|
||||||
|
# - redis
|
||||||
|
|
||||||
# phpldapadmin:
|
# phpldapadmin:
|
||||||
# image: osixia/phpldapadmin:0.9.0
|
# image: osixia/phpldapadmin:0.9.0
|
||||||
# ports:
|
# ports:
|
||||||
@@ -16,19 +72,8 @@ services:
|
|||||||
# PHPLDAPADMIN_HTTPS: false
|
# PHPLDAPADMIN_HTTPS: false
|
||||||
# PHPLDAPADMIN_LDAP_HOSTS: "#PYTHON2BASH:[{'ldap': [{'server': [{'tls': False}, {'port': 3389}]}, {'login': [{'bind_id': 'cn=Directory Manager'}, {'bind_pass': 'passthebutter'}]}]}]"
|
# PHPLDAPADMIN_LDAP_HOSTS: "#PYTHON2BASH:[{'ldap': [{'server': [{'tls': False}, {'port': 3389}]}, {'login': [{'bind_id': 'cn=Directory Manager'}, {'bind_pass': 'passthebutter'}]}]}]"
|
||||||
# PHPLDAPADMIN_LDAP_CLIENT_TLS: false
|
# PHPLDAPADMIN_LDAP_CLIENT_TLS: false
|
||||||
# web:
|
|
||||||
# build: .
|
networks:
|
||||||
# tty: true
|
external_network:
|
||||||
# command: bash -c "sleep 5 && rm -f tmp/pids/server.pid && bin/dev"
|
internal_network:
|
||||||
# volumes:
|
internal: true
|
||||||
# - .:/akkounts
|
|
||||||
# ports:
|
|
||||||
# - "3000:3000"
|
|
||||||
# environment:
|
|
||||||
# RAILS_ENV: development
|
|
||||||
# LDAP_HOST: ldap
|
|
||||||
# LDAP_PORT: 3389
|
|
||||||
# LDAP_ADMIN_PASSWORD: passthebutter
|
|
||||||
# LDAP_USE_TLS: "false"
|
|
||||||
# depends_on:
|
|
||||||
# - ldap
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Remove a potentially pre-existing server.pid for Rails.
|
|
||||||
rm -f /myapp/tmp/pids/server.pid
|
|
||||||
|
|
||||||
# Then exec the container's main process (what's set as CMD in the Dockerfile).
|
|
||||||
exec "$@"
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"postcss-preset-env": "^7.8.3",
|
"postcss-preset-env": "^7.8.3",
|
||||||
"tailwindcss": "^3.2.4"
|
"tailwindcss": "^3.2.4"
|
||||||
},
|
},
|
||||||
"version": "0.4.0",
|
"version": "0.5.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:css:tailwind": "tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css",
|
"build:css:tailwind": "tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css",
|
||||||
"build:css": "yarn run build:css:tailwind"
|
"build:css": "yarn run build:css:tailwind"
|
||||||
|
|||||||
Reference in New Issue
Block a user