maglevcms 1.6.0 → 1.6.1

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: 45b336e791f110d5c7c1982631955c14664c2a66184b44b83a31f5689800d1d0
4
- data.tar.gz: 65ea43f9f7006d128a21adad2c832f896d314715d83bc47283070ae60fb41dff
3
+ metadata.gz: 2a35a72786acd44915a401d53a74083908efa9c65d444095b644c2c90f1fb845
4
+ data.tar.gz: 9dc69364e99fb0ea74ee46d4c4b838072ea559fa183a624874e1af9bcd4e447f
5
5
  SHA512:
6
- metadata.gz: 17be0c14ba106d648cf9fa13953adff4e63f342a6d7d6acaa215cc6200f41c8d710e2d0b3c14d803f92ee4521c977f03b8c8389cd5351eb60bd87c23fbe50d73
7
- data.tar.gz: 0adbc6d304a7b46cf1f4b1b6640fde924bad6d456931f0527adba2b01bcf3f06211f2cbe14f80c0fa93950f05d64eb01c7fb67cd136988d756103b2346b7c177
6
+ metadata.gz: 2b0c05384244019fe6b8e816d1be6361eddbe10a87681c15bf4ea0fe15dffa938cc07520ef03def22a3ea338aa69165c898b10a1667d0583f1338a9ff5c9057b
7
+ data.tar.gz: c451bc95b1405150fafb5c80c12604263c26a00ce87080adb82f513df99d46dc367956d0a827ca41c59385fbc53340c74ec1de803fd8ceaa32a5182ed083bbb4
@@ -16,9 +16,13 @@ module Maglev
16
16
  end
17
17
 
18
18
  def maglev_services
19
- @maglev_services ||= ::Maglev.services(
19
+ @maglev_services ||= ::Maglev.services(maglev_services_overrides)
20
+ end
21
+
22
+ def maglev_services_overrides
23
+ {
20
24
  context: build_maglev_service_context
21
- )
25
+ }
22
26
  end
23
27
 
24
28
  def build_maglev_service_context
@@ -6,13 +6,17 @@ module Maglev
6
6
  include Injectable
7
7
 
8
8
  def call
9
- @site ||= Maglev::Site.first.tap do |site|
9
+ site.tap do |site|
10
10
  change_default_locales(site)
11
11
  end
12
12
  end
13
13
 
14
14
  private
15
15
 
16
+ def site
17
+ @site ||= Maglev::Site.first
18
+ end
19
+
16
20
  def change_default_locales(site)
17
21
  Maglev::I18n.available_locales = site.locale_prefixes
18
22
  end
@@ -79,5 +79,5 @@ Maglev.configure do |config|
79
79
 
80
80
  # Prevent the content editors to create pages sharing the same path with other
81
81
  # existing pages of the application.
82
- # config.reserved_paths = %w(products sign-in search)
82
+ # config.reserved_paths = %w(products sign-in search posts/*)
83
83
  end
@@ -4,7 +4,7 @@ require 'uri'
4
4
 
5
5
  module Maglev
6
6
  class PreviewConstraint
7
- CRAWLER_USER_AGENTS = /Googlebot|Twitterbot|facebookexternalhit/o.freeze
7
+ CRAWLER_USER_AGENTS = /Googlebot|Twitterbot|facebookexternalhit|LinkedInBot/o.freeze
8
8
 
9
9
  attr_reader :preview_host
10
10
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maglev
4
+ class ReservedPaths < ::Array
5
+ def include?(value)
6
+ each do |path|
7
+ return true if path == value ||
8
+ (path.include?('*') && value && File.fnmatch(path, value))
9
+ end
10
+ false
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Maglev
4
- VERSION = '1.6.0'
4
+ VERSION = '1.6.1'
5
5
  end
data/lib/maglev.rb CHANGED
@@ -6,6 +6,7 @@ require_relative 'maglev/config'
6
6
  require_relative 'maglev/errors'
7
7
  require_relative 'maglev/i18n'
8
8
  require_relative 'maglev/preview_constraint'
9
+ require_relative 'maglev/reserved_paths'
9
10
 
10
11
  require 'injectable'
11
12
  require 'jbuilder'
@@ -20,7 +21,7 @@ module Maglev
20
21
 
21
22
  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
22
23
  def config
23
- @config ||= Config.new.tap do |c|
24
+ @config ||= config_klass.new.tap do |c|
24
25
  c.title = 'Maglev - EDITOR'
25
26
  c.favicon = nil
26
27
  c.logo = nil
@@ -43,7 +44,10 @@ module Maglev
43
44
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
44
45
 
45
46
  def configure
46
- yield config
47
+ config.tap do
48
+ yield(config)
49
+ config.reserved_paths = Maglev::ReservedPaths.new(config.reserved_paths)
50
+ end
47
51
  end
48
52
 
49
53
  def uploader
@@ -61,5 +65,9 @@ module Maglev
61
65
  config = Rails.configuration.generators
62
66
  @uuid_as_primary_key = config.options[config.orm][:primary_key_type] == :uuid
63
67
  end
68
+
69
+ def config_klass
70
+ ::Maglev::Config
71
+ end
64
72
  end
65
73
  end