alchemy_cms 7.0.14 → 7.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f009c36ef6be6cd2543d594e6e818b899fb03105db7afa1e043ac6eff667148
4
- data.tar.gz: 39453909b852611f2b9610442cb596241037100965691fc6766b3f98fe6f1130
3
+ metadata.gz: d20bda02db92caa55198f4cc360bafb972b868e742215f1b19ab83976215b230
4
+ data.tar.gz: ab901f120f7a3c2f0878fb03a25e2d2de8e68aff1cd9240c58994b903e9781b8
5
5
  SHA512:
6
- metadata.gz: 4c675c83bd57c8514dd1983051ba4dfef7af615f41001603fd25d2c556925a87e08d67307d4b610c3c9655572092cdf06e4d07bb5891dbdb3758b6cb7dccd721
7
- data.tar.gz: 1feb5da7ff3d8bafb2aac4cc03ac52682795457d41f7a28cbd5e7eeca4816a8536149fe87a8f49470f3d6e9e7ed08eb194dc632a511639a0f259a2738ce0e06c
6
+ metadata.gz: adb1fd6328915e0648e8b94b45f91e2fb1051fbcf6b33ebf26d75a9de52fd2479991c0cb40dc8cc6d7972214291d195765d9ddda0ddc13bb69a0794941d45fcb
7
+ data.tar.gz: 2c9c34c568de4ed7492aaaa5f05959023493eba2951776fd1bedbf22a8e4bed65ce9e7480c42a2767334edba0d469d0277d8ea6ad616493c18a55f51e4135d31
@@ -3,19 +3,27 @@
3
3
 
4
4
  name: Brakeman Scan
5
5
 
6
+ concurrency:
7
+ group: brakeman-${{ github.ref_name }}
8
+ cancel-in-progress: ${{ github.ref_name != 'main' }}
9
+
10
+ permissions:
11
+ contents: read
12
+ security-events: write
13
+
6
14
  on:
7
15
  push:
8
- branches: [main]
16
+ branches:
17
+ - 7.0-stable
9
18
  pull_request:
10
19
  # The branches below must be a subset of the branches above
11
- branches: [main]
12
- schedule:
13
- - cron: "40 4 * * 2"
20
+ branches:
21
+ - 7.0-stable
14
22
 
15
23
  jobs:
16
24
  brakeman-scan:
17
25
  name: Brakeman Scan
18
- runs-on: ubuntu-latest
26
+ runs-on: ubuntu-22.04
19
27
  steps:
20
28
  # Checkout the repository to the GitHub Actions runner
21
29
  - name: Checkout
@@ -2,9 +2,16 @@ name: Lint
2
2
 
3
3
  on: [pull_request]
4
4
 
5
+ concurrency:
6
+ group: lint-${{ github.ref_name }}
7
+ cancel-in-progress: ${{ github.ref_name != 'main' }}
8
+
9
+ permissions:
10
+ contents: read
11
+
5
12
  jobs:
6
13
  Standard:
7
- runs-on: ubuntu-latest
14
+ runs-on: ubuntu-22.04
8
15
  steps:
9
16
  - name: Checkout code
10
17
  uses: actions/checkout@v3
@@ -16,7 +23,7 @@ jobs:
16
23
  - name: Lint Ruby files
17
24
  run: bundle exec standardrb
18
25
  Prettier:
19
- runs-on: ubuntu-latest
26
+ runs-on: ubuntu-22.04
20
27
  steps:
21
28
  - name: Checkout
22
29
  uses: actions/checkout@v3
@@ -4,10 +4,13 @@ on:
4
4
  schedule:
5
5
  - cron: "0 0 * * *"
6
6
 
7
+ permissions:
8
+ pull-requests: write
9
+ issues: write
10
+
7
11
  jobs:
8
12
  stale:
9
- runs-on: ubuntu-latest
10
-
13
+ runs-on: ubuntu-22.04
11
14
  steps:
12
15
  - uses: actions/stale@v5
13
16
  with:
@@ -1,10 +1,17 @@
1
1
  name: Test
2
2
 
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches:
6
+ - 7.0-stable
7
+ pull_request:
8
+
9
+ permissions:
10
+ contents: read
4
11
 
5
12
  jobs:
6
13
  RSpec:
7
- runs-on: ubuntu-latest
14
+ runs-on: ubuntu-22.04
8
15
  strategy:
9
16
  fail-fast: false
10
17
  matrix:
@@ -104,9 +111,11 @@ jobs:
104
111
  if: failure()
105
112
  with:
106
113
  name: Screenshots
107
- path: spec/dummy/tmp/screenshots
114
+ path: |
115
+ spec/dummy/tmp/capybara
116
+ spec/dummy/tmp/screenshots
108
117
  Jest:
109
- runs-on: ubuntu-latest
118
+ runs-on: ubuntu-22.04
110
119
  env:
111
120
  NODE_ENV: test
112
121
  steps:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.0.16 (2025-01-23)
4
+
5
+ - [7.0-stable] Allow redirecting to other host in site redirect [#3160](https://github.com/AlchemyCMS/alchemy_cms/pull/3160) ([alchemycms-bot](https://github.com/alchemycms-bot))
6
+ - [7.0-stable] fix missing logger issue in github actions [#3155](https://github.com/AlchemyCMS/alchemy_cms/pull/3155) ([alchemycms-bot](https://github.com/alchemycms-bot))
7
+ - [7.0-stable] CI: Set workflow permissions [#3144](https://github.com/AlchemyCMS/alchemy_cms/pull/3144) ([tvdeyen](https://github.com/tvdeyen))
8
+ - [7.0-stable] Use safe redirect paths in admin redirects [#3134](https://github.com/AlchemyCMS/alchemy_cms/pull/3134) ([tvdeyen](https://github.com/tvdeyen))
9
+ - [7.0-stable] CI: Run actions on ubuntu-22.04 [#3127](https://github.com/AlchemyCMS/alchemy_cms/pull/3127) ([tvdeyen](https://github.com/tvdeyen))
10
+ - [7.0-stable] Use alchemy_display_name for page actor names [#3028](https://github.com/AlchemyCMS/alchemy_cms/pull/3028) ([alchemycms-bot](https://github.com/alchemycms-bot))
11
+
12
+ ## 7.0.15 (2024-09-04)
13
+
14
+ - [7.0-stable] Render Datetime ingredient in local time zone [#3017](https://github.com/AlchemyCMS/alchemy_cms/pull/3017) ([tvdeyen](https://github.com/tvdeyen))
15
+ - [7.0-stable] Allow to set input_type on Datetime ingredient editor [#3014](https://github.com/AlchemyCMS/alchemy_cms/pull/3014) ([tvdeyen](https://github.com/tvdeyen))
16
+ - [7.0-stable] Fix combining search filters and pagination [#2980](https://github.com/AlchemyCMS/alchemy_cms/pull/2980) ([alchemycms-bot](https://github.com/alchemycms-bot))
17
+ - [7.0-stable] Remove call to missing content_positions task [#2961](https://github.com/AlchemyCMS/alchemy_cms/pull/2961) ([alchemycms-bot](https://github.com/alchemycms-bot))
18
+ - [7.0-stable] Fix re-render of layoutpages form if validation fails [#2952](https://github.com/AlchemyCMS/alchemy_cms/pull/2952) ([alchemycms-bot](https://github.com/alchemycms-bot))
19
+ - [7.0-stable] fix(ContactMessages): Use alchemy route proxy [#2927](https://github.com/AlchemyCMS/alchemy_cms/pull/2927) ([alchemycms-bot](https://github.com/alchemycms-bot))
20
+
3
21
  ## 7.0.14 (2024-06-04)
4
22
 
5
23
  - [7.0-stable] fix(RoutingConstraints): Allow Turbo Stream requests [#2914](https://github.com/AlchemyCMS/alchemy_cms/pull/2914) ([alchemycms-bot](https://github.com/alchemycms-bot))
data/Gemfile CHANGED
@@ -32,6 +32,13 @@ group :development, :test do
32
32
  if rails_version == "7.1"
33
33
  gem "actioncable", "~> #{rails_version}.0"
34
34
  end
35
+
36
+ # concurrent-ruby v1.3.5 has removed the dependency on logger,
37
+ # effecting Rails 6.1 up to including 7.0.
38
+ # https://github.com/rails/rails/pull/54264
39
+ if ("6.1".to_f.."7.0".to_f).cover?(rails_version.to_f)
40
+ gem "concurrent-ruby", "< 1.3.5"
41
+ end
35
42
  else
36
43
  gem "launchy"
37
44
  gem "annotate"
@@ -11,10 +11,11 @@ module Alchemy
11
11
  end
12
12
 
13
13
  def call
14
+ datetime = ingredient.value.in_time_zone(Rails.application.config.time_zone)
14
15
  if date_format == "rfc822"
15
- ingredient.value.to_s(:rfc822)
16
+ datetime.try(:to_fs, :rfc822) || datetime.to_s(:rfc822)
16
17
  else
17
- ::I18n.l(ingredient.value, format: date_format)
18
+ ::I18n.l(datetime, format: date_format)
18
19
  end.html_safe
19
20
  end
20
21
  end
@@ -31,6 +31,27 @@ module Alchemy
31
31
 
32
32
  private
33
33
 
34
+ def safe_redirect_path(path = params[:redirect_to], fallback: admin_path)
35
+ if is_safe_redirect_path?(path)
36
+ path
37
+ elsif is_safe_redirect_path?(fallback)
38
+ fallback
39
+ else
40
+ admin_path
41
+ end
42
+ end
43
+
44
+ def is_safe_redirect_path?(path)
45
+ mount_path = alchemy.root_path
46
+ path.to_s.match? %r{^#{mount_path}admin/}
47
+ end
48
+
49
+ def relative_referer_path(referer = request.referer)
50
+ return unless referer
51
+
52
+ URI(referer).path
53
+ end
54
+
34
55
  # Disable layout rendering for xhr requests.
35
56
  def set_layout
36
57
  request.xhr? ? false : "alchemy/admin"
@@ -107,13 +128,16 @@ module Alchemy
107
128
 
108
129
  # Does redirects for html and js requests
109
130
  #
131
+ # Makes sure that the redirect path is safe.
132
+ #
110
133
  def do_redirect_to(url_or_path)
134
+ redirect_path = safe_redirect_path(url_or_path)
111
135
  respond_to do |format|
112
136
  format.js {
113
- @redirect_url = url_or_path
137
+ @redirect_url = redirect_path
114
138
  render :redirect
115
139
  }
116
- format.html { redirect_to url_or_path }
140
+ format.html { redirect_to redirect_path }
117
141
  end
118
142
  end
119
143
 
@@ -40,7 +40,7 @@ module Alchemy
40
40
  def switch
41
41
  @language = set_alchemy_language(params[:language_id])
42
42
  session[:alchemy_language_id] = @language.id
43
- do_redirect_to request.referer || alchemy.admin_dashboard_path
43
+ do_redirect_to relative_referer_path || alchemy.admin_dashboard_path
44
44
  end
45
45
 
46
46
  private
@@ -17,6 +17,25 @@ module Alchemy
17
17
  def edit
18
18
  @page = Page.find(params[:id])
19
19
  end
20
+
21
+ def update
22
+ @page = Page.find(params[:id])
23
+ if @page.update(page_params)
24
+ @notice = Alchemy.t("Page saved", name: @page.name)
25
+ render "alchemy/admin/pages/update"
26
+ else
27
+ render :edit, status: :unprocessable_entity
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def page_params
34
+ params.require(:page).permit(
35
+ :name,
36
+ :tag_list
37
+ )
38
+ end
20
39
  end
21
40
  end
22
41
  end
@@ -183,14 +183,15 @@ module Alchemy
183
183
  respond_to do |format|
184
184
  format.js
185
185
  format.html do
186
- redirect_to(
187
- params[:redirect_to].presence || admin_pages_path,
188
- allow_other_host: true
189
- )
186
+ redirect_to(unlock_redirect_path, allow_other_host: true)
190
187
  end
191
188
  end
192
189
  end
193
190
 
191
+ def unlock_redirect_path
192
+ safe_redirect_path(fallback: admin_pages_path)
193
+ end
194
+
194
195
  # Sets the page public and updates the published_at attribute that is used as cache_key
195
196
  #
196
197
  def publish
@@ -78,7 +78,7 @@ module Alchemy
78
78
  flash[:error] = resource_instance_variable.errors.full_messages.join(", ")
79
79
  end
80
80
  flash_notice_for_resource_action
81
- do_redirect_to resource_url_proxy.url_for(search_filter_params.merge(action: "index"))
81
+ do_redirect_to resource_url_proxy.url_for(search_filter_params.merge(action: "index", only_path: true))
82
82
  end
83
83
 
84
84
  def resource_handler
@@ -97,7 +97,7 @@ module Alchemy
97
97
  else
98
98
  Language.current_root_page.urlname
99
99
  end
100
- redirect_to show_page_path(
100
+ redirect_to alchemy.show_page_path(
101
101
  urlname: urlname,
102
102
  locale: prefix_locale? ? Language.current.code : nil
103
103
  )
@@ -12,7 +12,7 @@ module Alchemy
12
12
  private
13
13
 
14
14
  def enforce_primary_host_for_site
15
- redirect_to url_for(host: current_alchemy_site.host), status: :moved_permanently
15
+ redirect_to url_for(host: current_alchemy_site.host), status: :moved_permanently, allow_other_host: true
16
16
  end
17
17
 
18
18
  def needs_redirect_to_primary_host?
@@ -5,7 +5,7 @@ module Alchemy
5
5
  # A datetime value
6
6
  #
7
7
  class Datetime < Alchemy::Ingredient
8
- allow_settings %i[date_format]
8
+ allow_settings %i[date_format input_type]
9
9
 
10
10
  def value
11
11
  ActiveRecord::Type::DateTime.new.cast(self[:value])
@@ -546,7 +546,7 @@ module Alchemy
546
546
  # does not respond to +#name+ it returns +'unknown'+
547
547
  #
548
548
  def creator_name
549
- creator.try(:name) || Alchemy.t("unknown")
549
+ creator.try(:alchemy_display_name) || Alchemy.t("unknown")
550
550
  end
551
551
 
552
552
  # Returns the name of the last updater of this page.
@@ -555,7 +555,7 @@ module Alchemy
555
555
  # does not respond to +#name+ it returns +'unknown'+
556
556
  #
557
557
  def updater_name
558
- updater.try(:name) || Alchemy.t("unknown")
558
+ updater.try(:alchemy_display_name) || Alchemy.t("unknown")
559
559
  end
560
560
 
561
561
  # Returns the name of the user currently editing this page.
@@ -564,7 +564,7 @@ module Alchemy
564
564
  # does not respond to +#name+ it returns +'unknown'+
565
565
  #
566
566
  def locker_name
567
- locker.try(:name) || Alchemy.t("unknown")
567
+ locker.try(:alchemy_display_name) || Alchemy.t("unknown")
568
568
  end
569
569
 
570
570
  # Key hint translations by page layout, rather than the default name.
@@ -102,11 +102,10 @@ module Alchemy
102
102
 
103
103
  # Show image cropping link for ingredient
104
104
  def allow_image_cropping?
105
- settings[:crop] && picture &&
106
- picture.can_be_cropped_to?(
107
- settings[:size],
108
- settings[:upsample]
109
- ) && !!picture.image_file
105
+ settings[:crop] && picture&.can_be_cropped_to?(
106
+ settings[:size],
107
+ settings[:upsample]
108
+ ) && !!picture.image_file
110
109
  end
111
110
 
112
111
  private
@@ -1,4 +1,4 @@
1
- <%= alchemy_form_for [:admin, @page], class: 'edit_page' do |f| %>
1
+ <%= alchemy_form_for [:admin, @page], url: alchemy.admin_layoutpage_path(@page), class: 'edit_page' do |f| %>
2
2
  <%= f.input :name, autofocus: true %>
3
3
  <div class="input string">
4
4
  <%= f.label :tag_list %>
@@ -1,6 +1,6 @@
1
1
  <%= form_tag url_for, method: :get, class: 'per-page-select-form' do |f| %>
2
2
  <% search_filter_params.reject { |k, _| k == 'page' || k == 'per_page' }.each do |key, value| %>
3
- <% if value.is_a? ActionController::Parameters %>
3
+ <% if value.respond_to?(:keys) %>
4
4
  <% value.each do |k, v| %>
5
5
  <%= hidden_field_tag "#{key}[#{k}]", v, id: nil %>
6
6
  <% end %>
@@ -7,7 +7,8 @@
7
7
  datetime_editor, :value, {
8
8
  name: datetime_editor.form_field_name,
9
9
  id: datetime_editor.form_field_id,
10
- value: datetime_editor.value
10
+ value: datetime_editor.value,
11
+ type: datetime_editor.settings[:input_type]
11
12
  }
12
13
  ) %>
13
14
  <% end %>
data/config/routes.rb CHANGED
@@ -49,7 +49,7 @@ Alchemy::Engine.routes.draw do
49
49
  end
50
50
  end
51
51
 
52
- resources :layoutpages, only: [:index, :edit]
52
+ resources :layoutpages, only: [:index, :edit, :update]
53
53
 
54
54
  resources :pictures, except: [:new] do
55
55
  collection do
@@ -96,7 +96,7 @@ module Alchemy
96
96
  can :leave, :alchemy_admin
97
97
  can [:info, :help], :alchemy_admin_dashboard
98
98
  can :manage, :alchemy_admin_clipboard
99
- can :edit, :alchemy_admin_layoutpages
99
+ can :update, :alchemy_admin_layoutpages
100
100
  can :tree, :alchemy_admin_pages
101
101
 
102
102
  # Resources
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "7.0.14"
4
+ VERSION = "7.0.16"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -7,7 +7,6 @@ namespace :alchemy do
7
7
  desc "Tidy up Alchemy database."
8
8
  task :up do
9
9
  Rake::Task["alchemy:tidy:element_positions"].invoke
10
- Rake::Task["alchemy:tidy:content_positions"].invoke
11
10
  Rake::Task["alchemy:tidy:remove_orphaned_records"].invoke
12
11
  Rake::Task["alchemy:tidy:remove_trashed_elements"].invoke
13
12
  Rake::Task["alchemy:tidy:remove_duplicate_legacy_urls"].invoke
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.14
4
+ version: 7.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -10,10 +10,9 @@ authors:
10
10
  - Hendrik Mans
11
11
  - Carsten Fregin
12
12
  - Martin Meyerhoff
13
- autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2024-06-04 00:00:00.000000000 Z
15
+ date: 2025-01-23 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: actionmailer
@@ -1456,8 +1455,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1456
1455
  version: '0'
1457
1456
  requirements:
1458
1457
  - ImageMagick (libmagick), v6.6 or greater.
1459
- rubygems_version: 3.5.9
1460
- signing_key:
1458
+ rubygems_version: 3.6.3
1461
1459
  specification_version: 4
1462
1460
  summary: A powerful, userfriendly and flexible CMS for Rails
1463
1461
  test_files: []