scrivito_sdk 1.17.0.rc2 → 1.18.0.rc1
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/README.md +1 -1
- data/app/cms/scrivito/application_error.rb +13 -0
- data/app/cms/scrivito/backend/base_index.rb +49 -0
- data/app/cms/scrivito/backend/index.rb +0 -41
- data/app/cms/scrivito/backend/parent_path_index.rb +1 -1
- data/app/cms/scrivito/backend/path_index.rb +1 -1
- data/app/cms/scrivito/backend/permalink_index.rb +1 -1
- data/app/cms/scrivito/basic_obj.rb +18 -3
- data/app/cms/scrivito/cms_rest_api.rb +8 -3
- data/app/cms/scrivito/controller_actions.rb +1 -1
- data/app/cms/scrivito/generator_helper.rb +5 -3
- data/app/cms/scrivito/internal_error.rb +8 -0
- data/app/cms/scrivito/layout_tags.rb +1 -1
- data/app/cms/scrivito/model_library.rb +1 -1
- data/app/cms/scrivito/obj_class_not_found.rb +7 -0
- data/app/cms/scrivito/resource_not_found.rb +14 -0
- data/app/cms/scrivito/scrivito_error.rb +7 -0
- data/app/cms/scrivito/sdk_engine.rb +1 -1
- data/app/cms/scrivito/transformation_definition_error.rb +7 -0
- data/app/cms/scrivito/transformation_error.rb +13 -0
- data/app/cms/scrivito/transformation_source_error.rb +7 -0
- data/app/controllers/scrivito/binary_redirect_controller.rb +2 -2
- data/app/controllers/scrivito/ui_controller.rb +1 -1
- data/config/ca-bundle.crt +665 -820
- data/lib/assets/javascripts/scrivito.js +1 -1
- data/lib/assets/javascripts/scrivito_ui_redirect.js +1 -1
- data/lib/assets/javascripts/scrivito_with_js_sdk.js +1 -1
- data/lib/assets/stylesheets/scrivito_editing.css +3 -4
- data/lib/generators/scrivito/page/page_generator.rb +1 -1
- data/lib/generators/scrivito/page/templates/model.erb +1 -1
- data/lib/generators/scrivito/widget/templates/model.erb +1 -1
- data/lib/generators/scrivito/widget/widget_generator.rb +1 -1
- metadata +32 -10
- data/app/cms/scrivito/errors.rb +0 -55
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 856c448a586b8d9fa46e5646c6f7032ea565d7655241986324b69ad307047d74
|
|
4
|
+
data.tar.gz: 1d340bc1501d4aa4377e6ab3e58897a5d44ce309400126cd31c007f111f67d16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb162b76792cda107d884e95d014c709bd01900983333e7210b13adbd7dd9aff754327ef462d70fd8344e3be9a8cf676dcf97930306f6ff0fc0561103229c3b7
|
|
7
|
+
data.tar.gz: 470df0ee44eb1237666078fd0c8b2d5891966183233097662ec8d8219895862a41c892e5fb561f18abde1423bb00ed3993606dbe196fe53121b75b1cce180ab2
|
data/README.md
CHANGED
|
@@ -12,7 +12,7 @@ of concepts and APIs, tutorials, and release notes.
|
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
14
|
|
|
15
|
-
Copyright (c) 2009 -
|
|
15
|
+
Copyright (c) 2009 - 2021 JustRelate Group GmbH (https://www.justrelate.com)
|
|
16
16
|
|
|
17
17
|
This software can be used and modified under the LGPL-3.0. Please refer to
|
|
18
18
|
http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Scrivito
|
|
2
|
+
module Backend
|
|
3
|
+
|
|
4
|
+
# Abstract Base for Index Implementations
|
|
5
|
+
module BaseIndex
|
|
6
|
+
def id
|
|
7
|
+
abstract_base_method
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def update(key, cached_result, change_index)
|
|
11
|
+
updated = Set.new(cached_result)
|
|
12
|
+
|
|
13
|
+
change_index.each do |id, data|
|
|
14
|
+
value = extract_update_value_from_data(data)
|
|
15
|
+
|
|
16
|
+
if value == key
|
|
17
|
+
updated.add(id)
|
|
18
|
+
else
|
|
19
|
+
updated.delete(id)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
updated.to_a
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def extract_update_value_from_data(data)
|
|
27
|
+
abstract_base_method
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def group_by(keys, obj_datas)
|
|
31
|
+
return [obj_datas] if keys.length == 1
|
|
32
|
+
|
|
33
|
+
group_by_multiple(keys, obj_datas)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def group_by_multiple(parent_paths, obj_datas)
|
|
37
|
+
abstract_base_method
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def abstract_base_method
|
|
43
|
+
raise Scrivito::InternalError, "not implemented"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module Scrivito
|
|
2
2
|
module Backend
|
|
3
3
|
|
|
4
|
-
# Abstract Base for Index Implementations
|
|
5
4
|
module Index
|
|
6
5
|
|
|
7
6
|
IMPLEMENTATIONS = [
|
|
@@ -19,46 +18,6 @@ module Index
|
|
|
19
18
|
raise Scrivito::InternalError, "unknown index #{name}"
|
|
20
19
|
end
|
|
21
20
|
|
|
22
|
-
def id
|
|
23
|
-
abstract_base_method
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def update(key, cached_result, change_index)
|
|
27
|
-
updated = Set.new(cached_result)
|
|
28
|
-
|
|
29
|
-
change_index.each do |id, data|
|
|
30
|
-
value = extract_update_value_from_data(data)
|
|
31
|
-
|
|
32
|
-
if value == key
|
|
33
|
-
updated.add(id)
|
|
34
|
-
else
|
|
35
|
-
updated.delete(id)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
updated.to_a
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def extract_update_value_from_data(data)
|
|
43
|
-
abstract_base_method
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def group_by(keys, obj_datas)
|
|
47
|
-
return [obj_datas] if keys.length == 1
|
|
48
|
-
|
|
49
|
-
group_by_multiple(keys, obj_datas)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def group_by_multiple(parent_paths, obj_datas)
|
|
53
|
-
abstract_base_method
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
private
|
|
57
|
-
|
|
58
|
-
def abstract_base_method
|
|
59
|
-
raise Scrivito::InternalError, "not implemented"
|
|
60
|
-
end
|
|
61
|
-
|
|
62
21
|
end
|
|
63
22
|
|
|
64
23
|
end
|
|
@@ -719,10 +719,13 @@ module Scrivito
|
|
|
719
719
|
}
|
|
720
720
|
end
|
|
721
721
|
|
|
722
|
+
# @note If the custom attribute +created_at+ is defined, this value will be returned
|
|
723
|
+
# instead of the system attribute +_created_at+. To access the system attribute
|
|
724
|
+
# regardless of a custom attribute, call {#[] <code>obj[:_created_at]</code>}.
|
|
722
725
|
# @return [nil, ActiveSupport::TimeWithZone]
|
|
723
726
|
# @api public
|
|
724
727
|
def created_at
|
|
725
|
-
|
|
728
|
+
read_custom_or_system_attribute('created_at')
|
|
726
729
|
end
|
|
727
730
|
|
|
728
731
|
# @return [ActiveSupport::TimeWithZone]
|
|
@@ -731,16 +734,22 @@ module Scrivito
|
|
|
731
734
|
read_attribute('_last_changed')
|
|
732
735
|
end
|
|
733
736
|
|
|
737
|
+
# @note If the custom attribute +first_published_at+ is defined, this value will be returned
|
|
738
|
+
# instead of the system attribute +_first_published_at+. To access the system attribute
|
|
739
|
+
# regardless of a custom attribute, call {#[] <code>obj[:_first_published_at]</code>}.
|
|
734
740
|
# @return [nil, ActiveSupport::TimeWithZone]
|
|
735
741
|
# @api public
|
|
736
742
|
def first_published_at
|
|
737
|
-
|
|
743
|
+
read_custom_or_system_attribute('first_published_at')
|
|
738
744
|
end
|
|
739
745
|
|
|
746
|
+
# @note If the custom attribute +published_at+ is defined, this value will be returned
|
|
747
|
+
# instead of the system attribute +_published_at+. To access the system attribute
|
|
748
|
+
# regardless of a custom attribute, call {#[] <code>obj[:_published_at]</code>}.
|
|
740
749
|
# @return [nil, ActiveSupport::TimeWithZone]
|
|
741
750
|
# @api public
|
|
742
751
|
def published_at
|
|
743
|
-
|
|
752
|
+
read_custom_or_system_attribute('published_at')
|
|
744
753
|
end
|
|
745
754
|
|
|
746
755
|
def new?(revision=workspace.base_revision)
|
|
@@ -1072,6 +1081,12 @@ module Scrivito
|
|
|
1072
1081
|
|
|
1073
1082
|
private
|
|
1074
1083
|
|
|
1084
|
+
def read_custom_or_system_attribute(attribute_name)
|
|
1085
|
+
return read_attribute(attribute_name) if has_custom_attribute?(attribute_name)
|
|
1086
|
+
|
|
1087
|
+
read_attribute("_#{attribute_name}")
|
|
1088
|
+
end
|
|
1089
|
+
|
|
1075
1090
|
def children_including_deleted
|
|
1076
1091
|
workspace.objs.find_by_parent_path_including_deleted(path)
|
|
1077
1092
|
end
|
|
@@ -136,21 +136,26 @@ module Scrivito
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
private_class_method def self.handle_response(resource_path, response)
|
|
139
|
-
http_code = response.code.to_i
|
|
140
139
|
if response.code.start_with?('2')
|
|
141
140
|
JSON.parse(response.body)
|
|
142
141
|
elsif response.code == '403'
|
|
143
142
|
raise AccessDenied.new(response.body)
|
|
144
143
|
else
|
|
144
|
+
http_code = response.code.to_i
|
|
145
145
|
begin
|
|
146
|
-
error_body =
|
|
146
|
+
error_body =
|
|
147
|
+
if http_code == 404 && response.body == "Not Found"
|
|
148
|
+
{'error' => response.body}
|
|
149
|
+
else
|
|
150
|
+
JSON.parse(response.body)
|
|
151
|
+
end
|
|
147
152
|
specific_output = error_body['error']
|
|
148
153
|
|
|
149
154
|
if response.code.start_with?('4')
|
|
150
155
|
backend_code = error_body['code']
|
|
151
156
|
raise ClientError.new(specific_output,
|
|
152
157
|
http_code: http_code, backend_code: backend_code)
|
|
153
|
-
elsif
|
|
158
|
+
elsif http_code == 500 && specific_output
|
|
154
159
|
raise BackendError.new(specific_output, http_code)
|
|
155
160
|
else # 3xx and >500 are treated as NetworkErrors
|
|
156
161
|
raise NetworkError.new(response.body, http_code)
|
|
@@ -164,7 +164,7 @@ module ControllerActions
|
|
|
164
164
|
def deliver_file
|
|
165
165
|
if binary = @obj.binary
|
|
166
166
|
binary_routing = BinaryRouting.new(request, scrivito_engine)
|
|
167
|
-
redirect_to binary_routing.resolved_binary_url(binary)
|
|
167
|
+
redirect_to binary_routing.resolved_binary_url(binary), allow_other_host: true
|
|
168
168
|
else
|
|
169
169
|
render plain: 'Empty Blob', status: 404
|
|
170
170
|
end
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
module Scrivito
|
|
2
2
|
module GeneratorHelper
|
|
3
3
|
def self.attribute_definition(arg)
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
name, type = arg.to_s.split(":")
|
|
5
|
+
|
|
6
|
+
if %w(enum multienum).include?(type)
|
|
7
|
+
"attribute :#{name}, :#{type}, values: []"
|
|
6
8
|
else
|
|
7
|
-
"attribute :#{
|
|
9
|
+
"attribute :#{name}, :#{type}"
|
|
8
10
|
end
|
|
9
11
|
end
|
|
10
12
|
end
|
|
@@ -17,7 +17,7 @@ class LayoutTags < Struct.new(:view)
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def generator_meta_tag
|
|
20
|
-
content = 'Scrivito by
|
|
20
|
+
content = 'Scrivito by JustRelate Group GmbH (scrivito.com)'
|
|
21
21
|
content << "; Version #{GemInfo.version}" if view.scrivito_user
|
|
22
22
|
view.tag(:meta, name: 'generator', content: content)
|
|
23
23
|
end
|
|
@@ -114,7 +114,7 @@ class ModelLibrary
|
|
|
114
114
|
Dir["#{path}/**/*.rb"].sort.each do |file_path|
|
|
115
115
|
begin
|
|
116
116
|
require_dependency(file_path)
|
|
117
|
-
rescue TypeError => e
|
|
117
|
+
rescue TypeError, Zeitwerk::NameError => e
|
|
118
118
|
raise e if file_path.starts_with?(Rails.root.to_s)
|
|
119
119
|
end
|
|
120
120
|
end
|
|
@@ -2,7 +2,7 @@ module Scrivito
|
|
|
2
2
|
class BinaryRedirectController < ActionController::Base
|
|
3
3
|
def to_binary
|
|
4
4
|
binary = BinaryParamVerifier.verify(params[:encrypted_params])
|
|
5
|
-
redirect_to BinaryRewrite.call(request, binary.url), status: 301
|
|
5
|
+
redirect_to BinaryRewrite.call(request, binary.url), status: 301, allow_other_host: true
|
|
6
6
|
rescue BinaryParamVerifier::InvalidSignature
|
|
7
7
|
head :precondition_failed
|
|
8
8
|
rescue TransformationSourceError => error
|
|
@@ -15,7 +15,7 @@ module Scrivito
|
|
|
15
15
|
private
|
|
16
16
|
|
|
17
17
|
def render_error(error_name)
|
|
18
|
-
redirect_to view_context.image_path("scrivito/#{error_name}.png")
|
|
18
|
+
redirect_to view_context.image_path("scrivito/#{error_name}.png"), allow_other_host: true
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|