trek 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.node-version +1 -1
- data/AGENTS.md +12 -8
- data/CHANGELOG.md +62 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +205 -171
- data/Makefile +28 -1
- data/README.md +2 -2
- data/app/components/trek/dashboard/tile_component/tile_component.css +9 -0
- data/app/components/trek/dashboard/tile_component/tile_component.html.slim +4 -2
- data/app/components/trek/dashboard/tile_component.rb +12 -2
- data/app/components/trek/form/content_editor_component/content_editor_component.css +5 -0
- data/app/components/trek/form/content_editor_component/content_editor_component.html.slim +19 -93
- data/app/components/trek/form/content_editor_component/content_editor_component.js +94 -251
- data/app/components/trek/form/content_editor_component/extensions/block_view.js +40 -0
- data/app/components/trek/form/content_editor_component/extensions/image_block.js +28 -26
- data/app/components/trek/form/content_editor_component/extensions/prompts_block.js +15 -26
- data/app/components/trek/form/content_editor_component/extensions/table_of_contents.js +1 -3
- data/app/components/trek/form/content_editor_component.rb +15 -0
- data/app/components/trek/form/image_field_component/image_field_component.css +40 -1
- data/app/components/trek/form/image_field_component/image_field_component.html.slim +0 -9
- data/app/components/trek/form/image_field_component.rb +37 -14
- data/app/components/trek/list/item_component.rb +1 -1
- data/app/components/trek/list/tree/item_component.rb +2 -2
- data/app/components/trek/search_component/search_component.html.slim +2 -1
- data/app/components/trek/search_component.rb +9 -1
- data/app/content/trek/content/bullet_list.rb +10 -0
- data/app/content/trek/content/cleaner.rb +53 -0
- data/app/content/trek/content/document.rb +33 -0
- data/app/content/trek/content/image_block.rb +52 -0
- data/app/content/trek/content/link_resolver.rb +33 -0
- data/app/content/trek/content/list_item.rb +19 -0
- data/app/content/trek/content/ordered_list.rb +10 -0
- data/app/content/trek/content/paragraph.rb +10 -0
- data/app/content/trek/content/prompts_block.rb +21 -0
- data/app/content/trek/content.rb +38 -0
- data/app/controllers/concerns/trek/reorderable.rb +32 -3
- data/app/controllers/trek/csp_reports_controller.rb +17 -7
- data/app/controllers/trek/panels/base_controller.rb +3 -0
- data/app/controllers/trek/panels/links_controller.rb +1 -1
- data/app/controllers/trek/panels/prompts_controller.rb +2 -2
- data/app/controllers/trek/resource_controller.rb +5 -5
- data/app/helpers/trek/thumbnail_helper.rb +11 -0
- data/app/jobs/trek/purge_expired_sessions_job.rb +4 -3
- data/app/models/concerns/trek/contentable.rb +19 -10
- data/app/models/concerns/trek/pageable.rb +10 -1
- data/app/models/concerns/trek/users/sign_in_code.rb +70 -0
- data/app/models/concerns/trek/users/sign_in_lockout.rb +4 -2
- data/app/views/trek/panels/images/_form.html.slim +1 -1
- data/app/views/trek/panels/images/create.turbo_stream.slim +1 -1
- data/app/views/trek/panels/links/_form.html.slim +3 -5
- data/app/views/trek/panels/prompts/_form.html.slim +1 -1
- data/app/views/trek/panels/prompts/create.turbo_stream.slim +0 -1
- data/config/locales/trek.en.yml +40 -2
- data/config/locales/trek.fr.yml +40 -2
- data/docs/.vitepress/config.mjs +4 -1
- data/docs/background-jobs.md +69 -0
- data/docs/content-editor.md +219 -0
- data/docs/customize.md +2 -0
- data/docs/deploy.md +2 -2
- data/docs/getting-started.md +4 -4
- data/docs/index.md +1 -1
- data/docs/reference/components.md +2 -2
- data/docs/reference/concerns/contentable.md +11 -4
- data/docs/reference/concerns/formattable.md +1 -1
- data/docs/reference/controllers.md +1 -1
- data/docs/reference/environment-variables.md +1 -0
- data/docs/reference/formatters.md +4 -9
- data/docs/reference/forms.md +1 -1
- data/docs/reference/generators/audit-log.md +2 -2
- data/docs/reference/generators/install.md +3 -2
- data/docs/reference/generators/public-accounts.md +141 -0
- data/docs/reference/generators/security-headers.md +1 -1
- data/docs/reference/index.md +2 -1
- data/docs/reference/models/fragment.md +1 -0
- data/docs/reference/models/user.md +3 -1
- data/docs/what-is-trek.md +5 -5
- data/lib/generators/trek/audit_log_generator.rb +54 -0
- data/lib/generators/trek/helpers.rb +13 -5
- data/lib/generators/trek/install/admin/users_generator.rb +6 -1
- data/lib/generators/trek/install/admin_generator.rb +8 -0
- data/lib/generators/trek/install/appsignal_generator.rb +1 -1
- data/lib/generators/trek/install/audit_log_generator.rb +9 -45
- data/lib/generators/trek/install/authentication_generator.rb +1 -1
- data/lib/generators/trek/install/authorization_generator.rb +1 -1
- data/lib/generators/trek/install/good_job_generator.rb +161 -0
- data/lib/generators/trek/install/model_specs_generator.rb +3 -3
- data/lib/generators/trek/install/postmark_generator.rb +2 -2
- data/lib/generators/trek/install/ruby_generator.rb +1 -1
- data/lib/generators/trek/install/scalingo_generator.rb +7 -45
- data/lib/generators/trek/install/specs_generator.rb +11 -0
- data/lib/generators/trek/install/user_generator.rb +1 -1
- data/lib/generators/trek/install_generator.rb +15 -0
- data/lib/generators/trek/public_accounts_generator.rb +267 -0
- data/lib/generators/trek/scaffold_generator.rb +13 -5
- data/lib/generators/trek/scalingo_generator.rb +55 -0
- data/lib/generators/trek/templates/.gitlab-ci.yml +1 -1
- data/lib/generators/trek/templates/Makefile +1 -1
- data/lib/generators/trek/templates/controllers/admin/fragments_controller.rb +7 -0
- data/lib/generators/trek/templates/controllers/admin/panels/images_controller.rb +8 -0
- data/lib/generators/trek/templates/controllers/admin/panels/links_controller.rb +8 -0
- data/lib/generators/trek/templates/controllers/admin/panels/prompts_controller.rb +8 -0
- data/lib/generators/trek/templates/controllers/admin/password_renewals_controller.rb +11 -0
- data/lib/generators/trek/templates/controllers/admin/user_sessions_controller.rb +1 -1
- data/lib/generators/trek/templates/controllers/admin/users_controller.rb +0 -8
- data/lib/generators/trek/templates/initializers/content_security_policy.rb +3 -2
- data/lib/generators/trek/templates/initializers/good_job.rb.tt +38 -0
- data/lib/generators/trek/templates/jobs/mail_delivery_job.rb +6 -0
- data/lib/generators/trek/templates/layouts/admin.html.slim +5 -0
- data/lib/generators/trek/templates/mailers/admin_mailer.rb +4 -2
- data/lib/generators/trek/templates/models/fragment.rb +14 -0
- data/lib/generators/trek/templates/package.json.tt +1 -1
- data/lib/generators/trek/templates/public_accounts/api/authentication.rb.tt +76 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/accounts_controller.rb.tt +22 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/active_sessions_controller.rb.tt +21 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/base_controller.rb.tt +71 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/email_changes_controller.rb.tt +55 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/email_confirmations_controller.rb.tt +19 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/password_resets_controller.rb.tt +28 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/passwords_controller.rb.tt +17 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/registrations_controller.rb.tt +17 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/sessions_controller.rb.tt +45 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/sign_in_codes_controller.rb.tt +15 -0
- data/lib/generators/trek/templates/public_accounts/jobs/sign_in_code_job.rb.tt +13 -0
- data/lib/generators/trek/templates/public_accounts/locales/accounts.en.yml.tt +205 -0
- data/lib/generators/trek/templates/public_accounts/locales/accounts.fr.yml.tt +205 -0
- data/lib/generators/trek/templates/public_accounts/mailers/account_mailer.rb.tt +85 -0
- data/lib/generators/trek/templates/public_accounts/migrations/create_accounts.rb.tt +46 -0
- data/lib/generators/trek/templates/public_accounts/models/account/session.rb.tt +47 -0
- data/lib/generators/trek/templates/public_accounts/models/account/sign_in_code.rb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/models/account.rb.tt +73 -0
- data/lib/generators/trek/templates/public_accounts/spec/api/accounts_spec.rb.tt +90 -0
- data/lib/generators/trek/templates/public_accounts/spec/api/sign_ins_spec.rb.tt +158 -0
- data/lib/generators/trek/templates/public_accounts/spec/models/account/sign_in_code_spec.rb.tt +56 -0
- data/lib/generators/trek/templates/public_accounts/spec/models/account_spec.rb.tt +109 -0
- data/lib/generators/trek/templates/public_accounts/spec/web/accounts_spec.rb.tt +126 -0
- data/lib/generators/trek/templates/public_accounts/spec/web/authentication_spec.rb.tt +43 -0
- data/lib/generators/trek/templates/public_accounts/spec/web/sign_ins_spec.rb.tt +215 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.en.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.en.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.fr.html.slim.tt +13 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.fr.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.en.html.slim.tt +9 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.en.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.fr.html.slim.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.fr.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.en.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.en.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.fr.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.fr.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.en.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.en.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.fr.html.slim.tt +13 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.fr.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.en.html.slim.tt +9 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.en.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.fr.html.slim.tt +9 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.fr.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.en.html.slim.tt +23 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.en.text.erb.tt +14 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.fr.html.slim.tt +24 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.fr.text.erb.tt +14 -0
- data/lib/generators/trek/templates/public_accounts/web/authentication.rb.tt +97 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/accounts_controller.rb.tt +33 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/active_sessions_controller.rb.tt +15 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/base_controller.rb.tt +52 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/email_changes_controller.rb.tt +85 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/email_confirmations_controller.rb.tt +19 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/password_resets_controller.rb.tt +41 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/passwords_controller.rb.tt +23 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/registrations_controller.rb.tt +24 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/sessions_controller.rb.tt +78 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/sign_in_codes_controller.rb.tt +27 -0
- data/lib/generators/trek/templates/public_accounts/web/views/_flash.html.slim.tt +5 -0
- data/lib/generators/trek/templates/public_accounts/web/views/accounts/show.html.slim.tt +52 -0
- data/lib/generators/trek/templates/public_accounts/web/views/email_changes/edit.html.slim.tt +17 -0
- data/lib/generators/trek/templates/public_accounts/web/views/email_changes/new.html.slim.tt +15 -0
- data/lib/generators/trek/templates/public_accounts/web/views/password_resets/edit.html.slim.tt +26 -0
- data/lib/generators/trek/templates/public_accounts/web/views/password_resets/new.html.slim.tt +15 -0
- data/lib/generators/trek/templates/public_accounts/web/views/passwords/edit.html.slim.tt +25 -0
- data/lib/generators/trek/templates/public_accounts/web/views/registrations/new.html.slim.tt +28 -0
- data/lib/generators/trek/templates/public_accounts/web/views/sessions/new.html.slim.tt +38 -0
- data/lib/generators/trek/templates/public_accounts/web/views/sign_in_codes/new.html.slim.tt +17 -0
- data/lib/generators/trek/templates/spec/jobs/mail_delivery_job_spec.rb +11 -0
- data/lib/generators/trek/templates/spec/mailers/admin_mailer_spec.rb +12 -1
- data/lib/generators/trek/templates/spec/requests/admin/active_sessions_spec.rb +1 -0
- data/lib/generators/trek/templates/spec/requests/admin/fragments_spec.rb +27 -3
- data/lib/generators/trek/templates/spec/requests/admin/good_job_spec.rb +34 -0
- data/lib/generators/trek/templates/spec/requests/admin/pages_spec.rb +9 -1
- data/lib/generators/trek/templates/spec/requests/admin/panels_spec.rb +70 -0
- data/lib/generators/trek/templates/spec/requests/admin/password_renewal_spec.rb +2 -2
- data/lib/generators/trek/templates/spec/requests/admin/sign_in_lockout_spec.rb +1 -1
- data/lib/generators/trek/templates/spec/requests/admin/sign_in_notices_spec.rb +5 -3
- data/lib/generators/trek/templates/spec/requests/admin/user_sessions_spec.rb +2 -2
- data/lib/generators/trek/templates/views/admin/fragments/index.html.slim +14 -3
- data/lib/generators/trek/templates/views/admin/users/index.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.en.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.en.text.erb +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.fr.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.fr.text.erb +1 -1
- data/lib/trek/csp_reports.rb +22 -4
- data/lib/trek/engine.rb +8 -3
- data/lib/trek/saved_attachments_reload.rb +2 -1
- data/lib/trek/typography_formatter.rb +35 -4
- data/lib/trek/version.rb +1 -1
- data/lib/trek.rb +1 -1
- data/package.json +12 -8
- data/renovate.json +1 -0
- data/trek.gemspec +3 -3
- data/vitest.config.mjs +24 -0
- data/yarn.lock +1706 -1028
- metadata +116 -14
- data/app/formatters/prosemirror_to_html/global_id_to_links_formatter.rb +0 -19
- data/app/formatters/prosemirror_to_html/nodes/image_block.rb +0 -44
- data/app/formatters/prosemirror_to_html/nodes/prompts_block.rb +0 -28
- data/app/formatters/prosemirror_to_html/remove_empty_paragraphs_formatter.rb +0 -11
- data/app/models/prosemirror.rb +0 -23
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
require "rails/generators/named_base"
|
|
2
|
+
require "rails/generators/migration"
|
|
3
|
+
require "generators/trek/helpers"
|
|
4
|
+
|
|
5
|
+
module Trek
|
|
6
|
+
module Generators
|
|
7
|
+
# Accounts for the site's or the mobile app's users (customers, members…), apart from the admin's
|
|
8
|
+
# User: their own model, table, sessions and sign-in, so nothing public can reach a staff account.
|
|
9
|
+
#
|
|
10
|
+
# They sign in one way, picked with --sign-in:
|
|
11
|
+
#
|
|
12
|
+
# - `code` (default): a code emailed to them, which creates the account the first time;
|
|
13
|
+
# - `password`: a password chosen on signing up, the email confirmed by a link, and reset by one.
|
|
14
|
+
#
|
|
15
|
+
# By default for a website: pages, and sessions kept in a cookie. With --api, for a mobile app:
|
|
16
|
+
# JSON endpoints, and sessions held through a JWT instead. With --model-only, neither: the models,
|
|
17
|
+
# mails and specs, for an app whose sign-in is its own (e.g. an API ported from another app).
|
|
18
|
+
class PublicAccountsGenerator < Rails::Generators::NamedBase
|
|
19
|
+
# Taken by the admin's account and Trek's own models, or planned for Trek 3 (Staff::User).
|
|
20
|
+
RESERVED_NAMES = %w[User Staff Session Current Page PagePath PageVersion Fragment MenuNode Tag Tagging TagCategory
|
|
21
|
+
ExternalLink AuditLog Dashboard].freeze
|
|
22
|
+
SIGN_INS = %w[code password].freeze
|
|
23
|
+
JWT_VERSION = "~> 3.1".freeze
|
|
24
|
+
|
|
25
|
+
include Rails::Generators::Migration
|
|
26
|
+
include Trek::Generators::Helpers
|
|
27
|
+
|
|
28
|
+
desc "Create accounts for the site's or the app's users, apart from the admin's: " \
|
|
29
|
+
"rails g trek:public_accounts Customer [--sign-in=code|password] [--api] [--path=customers] [--model-only]"
|
|
30
|
+
|
|
31
|
+
class_option :sign_in, type: :string, default: "code", enum: SIGN_INS,
|
|
32
|
+
desc: "How accounts sign in: with a code emailed to them, or with a password"
|
|
33
|
+
class_option :api, type: :boolean, default: false,
|
|
34
|
+
desc: "JSON endpoints and JWTs for a mobile app, instead of pages and a cookie"
|
|
35
|
+
class_option :path, type: :string, default: nil,
|
|
36
|
+
desc: "A path to put the routes under, e.g. members for /members/sign-in"
|
|
37
|
+
class_option :model_only, type: :boolean, default: false,
|
|
38
|
+
desc: "Only the models, mails and specs: no controllers, pages, routes nor tokens, the app signs in its own way"
|
|
39
|
+
|
|
40
|
+
source_root File.expand_path("templates/public_accounts", __dir__)
|
|
41
|
+
|
|
42
|
+
def check_name
|
|
43
|
+
return unless class_name.include?("::") || RESERVED_NAMES.include?(class_name)
|
|
44
|
+
|
|
45
|
+
raise Thor::Error, "#{class_name} can't be a public account model: pick a top-level name of the app's domain " \
|
|
46
|
+
"(Customer, Member, Reader…), other than #{RESERVED_NAMES.to_sentence(last_word_connector: " or ")}."
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def check_options
|
|
50
|
+
return unless model_only? && (api? || options[:path].present?)
|
|
51
|
+
|
|
52
|
+
raise Thor::Error, "--model-only adds no endpoints nor routes: drop --api and --path."
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def add_jwt_gem
|
|
56
|
+
return unless api?
|
|
57
|
+
return if in_gemfile?("jwt")
|
|
58
|
+
|
|
59
|
+
gem "jwt", JWT_VERSION
|
|
60
|
+
bundle_install
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def copy_models
|
|
64
|
+
template "models/account.rb.tt", "app/models/#{file_name}.rb"
|
|
65
|
+
template "models/account/session.rb.tt", "app/models/#{file_name}/session.rb"
|
|
66
|
+
template "models/account/sign_in_code.rb.tt", "app/models/#{file_name}/sign_in_code.rb" if code?
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def copy_migration
|
|
70
|
+
return unless defined?(ActiveRecord)
|
|
71
|
+
|
|
72
|
+
migration_template "migrations/create_accounts.rb.tt", "db/migrate/trek_create_#{table_name}.rb",
|
|
73
|
+
migration_class_name:
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def add_current_attributes
|
|
77
|
+
inject_into_class "app/models/current.rb", "Current", <<-RUBY
|
|
78
|
+
# The signed-in #{human_name.downcase} (#{model_only? ? "set by the app's own sign-in" : "#{accounts_module}::Authentication"})
|
|
79
|
+
attribute :#{file_name}_session
|
|
80
|
+
delegate :#{file_name}, to: :#{file_name}_session, allow_nil: true
|
|
81
|
+
|
|
82
|
+
RUBY
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def copy_authentication_concern
|
|
86
|
+
return if model_only?
|
|
87
|
+
|
|
88
|
+
template "#{mode}/authentication.rb.tt", "app/controllers/concerns/#{accounts_path}/authentication.rb"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Every page of the site may show who is signed in. The API's controllers include it in their
|
|
92
|
+
# base controller instead.
|
|
93
|
+
def include_authentication_in_application_controller
|
|
94
|
+
return unless web?
|
|
95
|
+
|
|
96
|
+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController",
|
|
97
|
+
" include #{accounts_module}::Authentication\n"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def copy_controllers
|
|
101
|
+
return if model_only?
|
|
102
|
+
|
|
103
|
+
controllers.each do |controller|
|
|
104
|
+
template "#{mode}/controllers/#{controller}_controller.rb.tt", "app/controllers/#{controllers_path}/#{controller}_controller.rb"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def copy_views
|
|
109
|
+
return unless web?
|
|
110
|
+
|
|
111
|
+
template "web/views/_flash.html.slim.tt", "app/views/#{controllers_path}/_flash.html.slim"
|
|
112
|
+
views.each do |view|
|
|
113
|
+
template "web/views/#{view}.html.slim.tt", "app/views/#{controllers_path}/#{view}.html.slim"
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def copy_job
|
|
118
|
+
template "jobs/sign_in_code_job.rb.tt", "app/jobs/#{accounts_path}/sign_in_code_job.rb" if code?
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def copy_mailer
|
|
122
|
+
template "mailers/account_mailer.rb.tt", "app/mailers/#{file_name}_mailer.rb"
|
|
123
|
+
mails.product(%w[en fr], %w[html.slim text.erb]).each do |mail, locale, format|
|
|
124
|
+
template "views/mailer/#{mail}.#{locale}.#{format}.tt", "app/views/#{file_name}_mailer/#{mail}.#{locale}.#{format}"
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def copy_locales
|
|
129
|
+
%w[en fr].each do |locale|
|
|
130
|
+
template "locales/accounts.#{locale}.yml.tt", "config/locales/#{accounts_path}.#{locale}.yml"
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def add_routes
|
|
135
|
+
route routes unless model_only?
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def copy_specs
|
|
139
|
+
return unless File.directory?(File.join(destination_root, "spec"))
|
|
140
|
+
|
|
141
|
+
template "spec/models/account_spec.rb.tt", "spec/models/#{file_name}_spec.rb"
|
|
142
|
+
template "spec/models/account/sign_in_code_spec.rb.tt", "spec/models/#{file_name}/sign_in_code_spec.rb" if code?
|
|
143
|
+
return if model_only?
|
|
144
|
+
|
|
145
|
+
template "spec/#{mode}/sign_ins_spec.rb.tt", "spec/requests/#{controllers_path}/sign_ins_spec.rb"
|
|
146
|
+
template "spec/#{mode}/accounts_spec.rb.tt", "spec/requests/#{controllers_path}/accounts_spec.rb"
|
|
147
|
+
return if api?
|
|
148
|
+
|
|
149
|
+
template "spec/web/authentication_spec.rb.tt", "spec/controllers/application_controller_#{accounts_path}_spec.rb"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
private
|
|
153
|
+
|
|
154
|
+
def code? = options[:sign_in] == "code"
|
|
155
|
+
def password? = options[:sign_in] == "password"
|
|
156
|
+
def api? = options[:api]
|
|
157
|
+
def model_only? = options[:model_only]
|
|
158
|
+
# Pages and a cookie: neither --api nor --model-only
|
|
159
|
+
def web? = !api? && !model_only?
|
|
160
|
+
def mode = api? ? "api" : "web"
|
|
161
|
+
# With trek:install:audit_log, which the account controllers write to
|
|
162
|
+
def audit_log? = File.exist?(File.join(destination_root, "app/models/audit_log.rb"))
|
|
163
|
+
|
|
164
|
+
# Customers: the module of the authentication concern, and the folder of its files.
|
|
165
|
+
def accounts_module = class_name.pluralize
|
|
166
|
+
def accounts_path = file_name.pluralize
|
|
167
|
+
|
|
168
|
+
# The controllers' module and folder: under Api::V1:: for the API, the first version of it, so that a
|
|
169
|
+
# later version can be served next to it while older releases of the mobile app still use this one.
|
|
170
|
+
def controllers_module = api? ? "Api::V1::#{accounts_module}" : accounts_module
|
|
171
|
+
def controllers_path = api? ? "api/v1/#{accounts_path}" : accounts_path
|
|
172
|
+
|
|
173
|
+
# The route helpers' prefix: customer_sign_in_path, api_v1_customer_sign_in_path…
|
|
174
|
+
def route_prefix = api? ? "api_v1_#{file_name}" : file_name
|
|
175
|
+
|
|
176
|
+
# Where the routes go: /sign-in, /members/sign-in, /api/v1/sign-in…
|
|
177
|
+
def routes_path = [("api/v1" if api?), options[:path].presence].compact.join("/").presence
|
|
178
|
+
|
|
179
|
+
def controllers
|
|
180
|
+
names = code? ? %w[sign_in_codes sessions] : %w[registrations sessions password_resets email_confirmations passwords]
|
|
181
|
+
%w[base] + names + %w[accounts email_changes active_sessions]
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def views
|
|
185
|
+
shared = %w[sessions/new accounts/show email_changes/new]
|
|
186
|
+
if code?
|
|
187
|
+
shared + %w[sign_in_codes/new email_changes/edit]
|
|
188
|
+
else
|
|
189
|
+
shared + %w[registrations/new password_resets/new password_resets/edit passwords/edit]
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def mails
|
|
194
|
+
code? ? %w[sign_in_code email_change_code] : %w[email_confirmation password_reset email_change sign_in_locked]
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# On paths of their own rather than the model's name, so renaming the model keeps them.
|
|
198
|
+
def routes
|
|
199
|
+
scope = [(%("#{routes_path}") if routes_path), "module: \"#{controllers_path}\"", "as: :#{route_prefix}"].compact
|
|
200
|
+
scope << "defaults: { format: :json }" if api?
|
|
201
|
+
|
|
202
|
+
<<~RUBY
|
|
203
|
+
# #{human_name.pluralize}' accounts (#{accounts_module}::Authentication)
|
|
204
|
+
scope #{scope.join(", ")} do
|
|
205
|
+
#{(api? ? api_routes : web_routes).gsub(/^/, " ")}end
|
|
206
|
+
RUBY
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def web_routes
|
|
210
|
+
sign_in = if code?
|
|
211
|
+
<<~RUBY
|
|
212
|
+
get "sign-in", to: "sign_in_codes#new", as: :sign_in
|
|
213
|
+
post "sign-in", to: "sign_in_codes#create"
|
|
214
|
+
get "sign-in/code", to: "sessions#new", as: :sign_in_code
|
|
215
|
+
post "sign-in/code", to: "sessions#create"
|
|
216
|
+
RUBY
|
|
217
|
+
else
|
|
218
|
+
<<~RUBY
|
|
219
|
+
get "sign-in", to: "sessions#new", as: :sign_in
|
|
220
|
+
post "sign-in", to: "sessions#create"
|
|
221
|
+
get "sign-up", to: "registrations#new", as: :sign_up
|
|
222
|
+
post "sign-up", to: "registrations#create"
|
|
223
|
+
resource :password_reset, only: %i[new create edit update], path: "password-reset"
|
|
224
|
+
get "account/confirm", to: "email_confirmations#show", as: :email_confirmation
|
|
225
|
+
post "account/confirm", to: "email_confirmations#create"
|
|
226
|
+
resource :password, only: %i[edit update], path: "account/password"
|
|
227
|
+
RUBY
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
sign_in + <<~RUBY
|
|
231
|
+
delete "sign-out", to: "sessions#destroy", as: :sign_out
|
|
232
|
+
resource :account, only: %i[show update destroy]
|
|
233
|
+
resource :email_change, only: %i[new create #{code? ? "edit update" : "show"}], path: "account/email"
|
|
234
|
+
resources :active_sessions, only: :destroy, path: "account/sessions" do
|
|
235
|
+
delete :others, action: :destroy_others, on: :collection
|
|
236
|
+
end
|
|
237
|
+
RUBY
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def api_routes
|
|
241
|
+
sign_in = if code?
|
|
242
|
+
<<~RUBY
|
|
243
|
+
post "sign-in", to: "sign_in_codes#create", as: :sign_in
|
|
244
|
+
post "sign-in/code", to: "sessions#create", as: :sign_in_code
|
|
245
|
+
RUBY
|
|
246
|
+
else
|
|
247
|
+
<<~RUBY
|
|
248
|
+
post "sign-in", to: "sessions#create", as: :sign_in
|
|
249
|
+
post "sign-up", to: "registrations#create", as: :sign_up
|
|
250
|
+
resource :password_reset, only: %i[create update], path: "password-reset"
|
|
251
|
+
resource :email_confirmation, only: %i[create update], path: "account/confirmation"
|
|
252
|
+
resource :password, only: :update, path: "account/password"
|
|
253
|
+
RUBY
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
sign_in + <<~RUBY
|
|
257
|
+
delete "session", to: "sessions#destroy", as: :session
|
|
258
|
+
resource :account, only: %i[show update destroy]
|
|
259
|
+
resource :email_change, only: %i[create update], path: "account/email"
|
|
260
|
+
resources :active_sessions, only: %i[index destroy], path: "account/sessions" do
|
|
261
|
+
delete :others, action: :destroy_others, on: :collection
|
|
262
|
+
end
|
|
263
|
+
RUBY
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "shellwords"
|
|
1
2
|
require "rails/generators/actions"
|
|
2
3
|
require "rails/generators/migration"
|
|
3
4
|
require "rails/generators/resource_helpers"
|
|
@@ -15,6 +16,13 @@ module Trek
|
|
|
15
16
|
|
|
16
17
|
source_root File.expand_path("templates", __dir__)
|
|
17
18
|
|
|
19
|
+
def initialize(args, *)
|
|
20
|
+
# The attributes as given, for the model generator: once parsed, `attributes` loses their indexes,
|
|
21
|
+
# references' options or decimals' precision
|
|
22
|
+
@given_attributes = args.drop(1)
|
|
23
|
+
super
|
|
24
|
+
end
|
|
25
|
+
|
|
18
26
|
# `rails g model Shop::Product` writes app/models/shop.rb as a `module Shop`
|
|
19
27
|
# namespace file; if a `Shop` model already lives there, it gets replaced.
|
|
20
28
|
def warn_about_shadowed_models
|
|
@@ -28,14 +36,15 @@ module Trek
|
|
|
28
36
|
end
|
|
29
37
|
|
|
30
38
|
def create_model
|
|
31
|
-
generate :
|
|
39
|
+
# Escaped for the shell `generate` runs: it would expand `price:decimal{10,2}`'s braces
|
|
40
|
+
generate :model, class_name, @given_attributes.map { Shellwords.escape(it) }
|
|
32
41
|
end
|
|
33
42
|
|
|
34
43
|
def inject_trek_to_model
|
|
35
44
|
inject_into_class model_file_path,
|
|
36
45
|
class_name,
|
|
37
46
|
model_injection
|
|
38
|
-
|
|
47
|
+
rubocop_autocorrect model_file_path
|
|
39
48
|
end
|
|
40
49
|
|
|
41
50
|
def add_model_message
|
|
@@ -61,7 +70,7 @@ module Trek
|
|
|
61
70
|
inject_into_file dashboard_file_path,
|
|
62
71
|
"\n::#{class_name},",
|
|
63
72
|
after: "MODELS_IN_MENU = ["
|
|
64
|
-
|
|
73
|
+
rubocop_autocorrect dashboard_file_path
|
|
65
74
|
end
|
|
66
75
|
|
|
67
76
|
def add_routes
|
|
@@ -134,8 +143,7 @@ module Trek
|
|
|
134
143
|
# without re-indenting the body; the indentation cops are forced with
|
|
135
144
|
# --only because rubocop-rails-omakase leaves them disabled.
|
|
136
145
|
def reindent(path)
|
|
137
|
-
|
|
138
|
-
abort_on_failure: true
|
|
146
|
+
rubocop_autocorrect path, only: "Layout/IndentationWidth,Layout/IndentationConsistency"
|
|
139
147
|
end
|
|
140
148
|
|
|
141
149
|
def controller_file_path
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require "rails/generators/actions"
|
|
2
|
+
require "generators/trek/helpers"
|
|
3
|
+
|
|
4
|
+
module Trek
|
|
5
|
+
module Generators
|
|
6
|
+
class ScalingoGenerator < Rails::Generators::Base
|
|
7
|
+
BUILDPACK_URL = "https://github.com/etaminstudio/trek-buildpack/archive/refs/tags/v0.1.0.tar.gz".freeze
|
|
8
|
+
|
|
9
|
+
include Trek::Generators::Helpers
|
|
10
|
+
|
|
11
|
+
desc "Create Scalingo files."
|
|
12
|
+
|
|
13
|
+
# The trek-buildpack replaces the apt + ruby buildpack combination. It
|
|
14
|
+
# pins Node from the .node-version that `rails new` already generates.
|
|
15
|
+
def remove_buildpacks
|
|
16
|
+
remove_file ".buildpacks"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create_aptfile
|
|
20
|
+
create_file "Aptfile" do
|
|
21
|
+
<<~TEXT
|
|
22
|
+
libjemalloc2
|
|
23
|
+
libvips-tools --no-install-recommends
|
|
24
|
+
libwebp-dev
|
|
25
|
+
TEXT
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def create_procfile
|
|
30
|
+
create_file "Procfile" do
|
|
31
|
+
<<~TEXT
|
|
32
|
+
web: bundle exec rails server -p $PORT -e $RAILS_ENV -b 0.0.0.0
|
|
33
|
+
# A worker is only needed once jobs outgrow the web container
|
|
34
|
+
# (config.good_job.execution_mode = :async):
|
|
35
|
+
# worker: bundle exec good_job start
|
|
36
|
+
postdeploy: bundle exec rails db:migrate
|
|
37
|
+
TEXT
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def final_instructions
|
|
42
|
+
say ""
|
|
43
|
+
say "Configure the Scalingo app environment:"
|
|
44
|
+
say ""
|
|
45
|
+
say " scalingo --app <app> env-set BUILDPACK_URL=#{BUILDPACK_URL}"
|
|
46
|
+
say " scalingo --app <app> env-set 'DATABASE_URL=$SCALINGO_POSTGRESQL_URL'"
|
|
47
|
+
say ""
|
|
48
|
+
say "and make sure config/database.yml reads DATABASE_URL in production."
|
|
49
|
+
say ""
|
|
50
|
+
say "See https://trek.etamin.studio/deploy for details."
|
|
51
|
+
say ""
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
module Panels
|
|
3
|
+
# The content editor's image panel, served under the app's routes: Trek's isolated engine only gives
|
|
4
|
+
# its own controllers the engine's routes, which can't reach the admin's.
|
|
5
|
+
class ImagesController < Trek::Panels::ImagesController
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
module Panels
|
|
3
|
+
# The content editor's link panel, served under the app's routes: Trek's isolated engine only gives
|
|
4
|
+
# its own controllers the engine's routes, which can't reach the admin's.
|
|
5
|
+
class LinksController < Trek::Panels::LinksController
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
module Panels
|
|
3
|
+
# The content editor's prompt panel, served under the app's routes: Trek's isolated engine only gives
|
|
4
|
+
# its own controllers the engine's routes, which can't reach the admin's.
|
|
5
|
+
class PromptsController < Trek::Panels::PromptsController
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
# After a suspected compromise: every user, this admin included, must choose a new password at
|
|
3
|
+
# their next request (User.require_password_renewal!).
|
|
4
|
+
class PasswordRenewalsController < Admin::BaseController
|
|
5
|
+
def create
|
|
6
|
+
authorize! User, to: :require_password_renewal?
|
|
7
|
+
User.require_password_renewal!
|
|
8
|
+
redirect_to admin_users_path, notice: t(".success")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -24,14 +24,6 @@ module Admin
|
|
|
24
24
|
@object.password = SecureRandom.alphanumeric(24) if @object.password.blank?
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# After a suspected compromise: every user, this admin included, must choose a new password at
|
|
28
|
-
# their next request.
|
|
29
|
-
def require_password_renewal
|
|
30
|
-
authorize! User, to: :require_password_renewal?
|
|
31
|
-
User.require_password_renewal!
|
|
32
|
-
redirect_to admin_users_path, notice: t(".success")
|
|
33
|
-
end
|
|
34
|
-
|
|
35
27
|
def theme
|
|
36
28
|
value = params[:theme].to_s
|
|
37
29
|
Current.user.update!(theme: value) if User.themes.key?(value)
|
|
@@ -22,8 +22,9 @@ Rails.application.configure do
|
|
|
22
22
|
# Framed by its own pages only (Lookbook's previews), against clickjacking
|
|
23
23
|
policy.frame_ancestors :self
|
|
24
24
|
policy.object_src :none
|
|
25
|
-
# No inline script: the app's own files, and the scripts given the request's nonce
|
|
26
|
-
|
|
25
|
+
# No inline script: the app's own files, and the scripts given the request's nonce. A blocked
|
|
26
|
+
# inline script's first 40 characters go with the report (`'report-sample'`), to tell what it was
|
|
27
|
+
policy.script_src :self, :report_sample
|
|
27
28
|
# Inline `style` attributes stay allowed: Trek's components and Backpack's set some (colors,
|
|
28
29
|
# custom properties)
|
|
29
30
|
policy.style_src :self, :unsafe_inline
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Rails.application.configure do
|
|
2
|
+
# One scheduler for every queue. Give a queue its own lane when it must not wait behind the
|
|
3
|
+
# others, e.g. "mailers:2;*:3" — the thread counts have to stay within GOOD_JOB_MAX_THREADS,
|
|
4
|
+
# which config/database.yml turns into database connections.
|
|
5
|
+
config.good_job.queues = "*"
|
|
6
|
+
|
|
7
|
+
# Cron runs wherever a scheduler runs, which in :async mode means every web container. Keep it
|
|
8
|
+
# to production so a development machine never fires a scheduled job.
|
|
9
|
+
config.good_job.enable_cron = Rails.env.production?
|
|
10
|
+
config.good_job.cron = {
|
|
11
|
+
# purge_old_sessions: {
|
|
12
|
+
# cron: "0 3 * * *", # every day at 3am
|
|
13
|
+
# class: "PurgeOldSessionsJob",
|
|
14
|
+
# description: "Delete the user sessions that expired more than a month ago"
|
|
15
|
+
# }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# An error raised outside a job's own execution (in the scheduler thread) has no retry handler
|
|
19
|
+
# to catch it. Report it through Rails.error, like the rest of the app.
|
|
20
|
+
config.good_job.on_thread_error = ->(error) { Rails.error.report(error, handled: false) }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# The dashboard is mounted at /admin/good_job, outside Admin::BaseController and therefore outside
|
|
24
|
+
# Trek's authentication. Guard it with the same signed session cookie, and answer 404 rather than
|
|
25
|
+
# redirecting: the route stays invisible to anyone who is not an administrator.
|
|
26
|
+
ActiveSupport.on_load(:good_job_application_controller) do
|
|
27
|
+
before_action do
|
|
28
|
+
raise ActionController::RoutingError, "Not Found" unless good_job_dashboard_user&.admin?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def good_job_dashboard_user
|
|
34
|
+
return unless cookies.signed[:session_id]
|
|
35
|
+
|
|
36
|
+
<%= session_model %>.find_by(id: cookies.signed[:session_id])&.user
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Delivers every `deliver_later` email (config.action_mailer.delivery_job).
|
|
2
|
+
# GoodJob discards a failed job rather than retrying it, so a transient error from the delivery
|
|
3
|
+
# service would lose the email: retry with a growing delay instead.
|
|
4
|
+
class MailDeliveryJob < ActionMailer::MailDeliveryJob
|
|
5
|
+
retry_on StandardError, wait: :polynomially_longer, attempts: 5
|
|
6
|
+
end
|
|
@@ -56,6 +56,11 @@ html(lang=I18n.locale class=class_for_theme)
|
|
|
56
56
|
href: %i[admin users],
|
|
57
57
|
allowed_to: allowed_to?(:index?, User),
|
|
58
58
|
)
|
|
59
|
+
s.with_item(
|
|
60
|
+
text: t("admin.jobs"),
|
|
61
|
+
href: "/admin/good_job",
|
|
62
|
+
allowed_to: Current.user.admin?,
|
|
63
|
+
)
|
|
59
64
|
end
|
|
60
65
|
end
|
|
61
66
|
= render Trek::ToasterComponent.new
|
|
@@ -13,11 +13,13 @@ class AdminMailer < ApplicationMailer
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# A sign-in from a browser that never signed in as the user, so they can react if it wasn't them
|
|
16
|
+
# A sign-in from a browser that never signed in as the user, so they can react if it wasn't them.
|
|
17
|
+
# The IP address comes with its host name, as on the active sessions: sent later, the email can
|
|
18
|
+
# wait for the lookup.
|
|
17
19
|
def new_sign_in(user, at:, ip:, user_agent:)
|
|
18
20
|
@user = user
|
|
19
21
|
@at = at
|
|
20
|
-
@
|
|
22
|
+
@address = [ip, Trek::ReverseDns.hostname(ip)&.then { |hostname| "(#{hostname})" }].compact.join(" ")
|
|
21
23
|
@user_agent = user_agent
|
|
22
24
|
@sessions_url = admin_user_url(user, anchor: "sessions")
|
|
23
25
|
@reset_url = new_admin_user_password_reset_url
|
|
@@ -18,6 +18,20 @@ class Fragment < ApplicationRecord
|
|
|
18
18
|
|
|
19
19
|
scope :ordered, -> { order(:position) }
|
|
20
20
|
|
|
21
|
+
# Matches the key (namespace.key), the title, or the text of the content, in the current locale.
|
|
22
|
+
scope :search, ->(query) do
|
|
23
|
+
next all if query.blank?
|
|
24
|
+
|
|
25
|
+
where(<<~SQL, pattern: "%#{sanitize_sql_like(query)}%", locale: Mobility.locale.to_s)
|
|
26
|
+
concat_ws('.', namespace, key) ILIKE :pattern
|
|
27
|
+
OR title ->> :locale ILIKE :pattern
|
|
28
|
+
OR EXISTS (
|
|
29
|
+
SELECT 1 FROM jsonb_path_query(content -> :locale, '$.**.text') AS text
|
|
30
|
+
WHERE text #>> '{}' ILIKE :pattern
|
|
31
|
+
)
|
|
32
|
+
SQL
|
|
33
|
+
end
|
|
34
|
+
|
|
21
35
|
def to_s
|
|
22
36
|
[namespace, key].join(".")
|
|
23
37
|
end
|