jekyll-admin 0.10.0 → 0.10.1
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 +5 -5
- data/LICENSE +21 -21
- data/README.md +94 -94
- data/lib/jekyll-admin.rb +47 -47
- data/lib/jekyll-admin/apiable.rb +224 -224
- data/lib/jekyll-admin/data_file.rb +106 -106
- data/lib/jekyll-admin/directory.rb +72 -72
- data/lib/jekyll-admin/file_helper.rb +91 -91
- data/lib/jekyll-admin/path_helper.rb +87 -87
- data/lib/jekyll-admin/public/asset-manifest.json +27 -0
- data/lib/jekyll-admin/public/index.html +1 -13
- data/lib/jekyll-admin/public/precache-manifest.52de67482747a1012d0d27a209b930d0.js +78 -0
- data/lib/jekyll-admin/public/service-worker.js +39 -0
- data/lib/jekyll-admin/public/static/css/2.b74256fb.chunk.css +2 -0
- data/lib/jekyll-admin/public/static/css/2.b74256fb.chunk.css.map +1 -0
- data/lib/jekyll-admin/public/static/css/main.223e267c.chunk.css +5 -0
- data/lib/jekyll-admin/public/static/css/main.223e267c.chunk.css.map +1 -0
- data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js +3 -0
- data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js.LICENSE.txt +67 -0
- data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js.map +1 -0
- data/lib/jekyll-admin/public/static/js/main.dd81e877.chunk.js +2 -0
- data/lib/jekyll-admin/public/static/js/main.dd81e877.chunk.js.map +1 -0
- data/lib/jekyll-admin/public/static/js/runtime-main.95f94e60.js +2 -0
- data/lib/jekyll-admin/public/static/js/runtime-main.95f94e60.js.map +1 -0
- data/lib/jekyll-admin/public/{1dc35d25e61d819a9c357074014867ab.ttf → static/media/fontawesome-webfont.1dc35d25.ttf} +0 -0
- data/lib/jekyll-admin/public/{25a32416abee198dd821b0b17a198a8f.eot → static/media/fontawesome-webfont.25a32416.eot} +0 -0
- data/lib/jekyll-admin/public/{c8ddf1e5e5bf3682bc7bebf30f394148.woff → static/media/fontawesome-webfont.c8ddf1e5.woff} +0 -0
- data/lib/jekyll-admin/public/{24c601e721ebd8279d38e2cfa0d01bc6.svg → static/media/fontawesome-webfont.d7c63908.svg} +684 -684
- data/lib/jekyll-admin/public/{e6cf7c6ec7c2d6f670ae9d762604cb0b.woff2 → static/media/fontawesome-webfont.e6cf7c6e.woff2} +0 -0
- data/lib/jekyll-admin/public/{55131026930a0cd4539d1e2fdb92722d.ttf → static/media/lato-bold.55131026.ttf} +0 -0
- data/lib/jekyll-admin/public/{059514c92565e4045da1a69525dd9ec0.ttf → static/media/lato-regular.059514c9.ttf} +0 -0
- data/lib/jekyll-admin/public/{a770b6797b68e3f8920e473eb824bac0.gif → static/media/loader-big.a770b679.gif} +0 -0
- data/lib/jekyll-admin/public/{12f0820c451bdc75f4d1ef97732bf6e8.woff → static/media/rw-widgets.12f0820c.woff} +0 -0
- data/lib/jekyll-admin/public/{792dcd18baf5f544aabcad1883d673c2.svg → static/media/rw-widgets.792dcd18.svg} +0 -0
- data/lib/jekyll-admin/public/{bc7c4a59f924cf037aad6e1f9edba366.eot → static/media/rw-widgets.bc7c4a59.eot} +0 -0
- data/lib/jekyll-admin/public/{eceddf474df95d8d4a7e316668c3be85.ttf → static/media/rw-widgets.eceddf47.ttf} +0 -0
- data/lib/jekyll-admin/server.rb +108 -108
- data/lib/jekyll-admin/server/collections.rb +89 -89
- data/lib/jekyll-admin/server/configuration.rb +60 -60
- data/lib/jekyll-admin/server/data.rb +84 -84
- data/lib/jekyll-admin/server/drafts.rb +114 -114
- data/lib/jekyll-admin/server/pages.rb +109 -109
- data/lib/jekyll-admin/server/site_meta.rb +25 -25
- data/lib/jekyll-admin/server/static_files.rb +83 -83
- data/lib/jekyll-admin/static_server.rb +26 -26
- data/lib/jekyll-admin/urlable.rb +75 -75
- data/lib/jekyll-admin/version.rb +5 -5
- data/lib/jekyll/commands/serve.rb +30 -30
- metadata +30 -22
- data/lib/jekyll-admin/public/33a752211d05af6684e26ec63c2ed965.gif +0 -0
- data/lib/jekyll-admin/public/8b4968b70019a0551a72940c5a2020d3.png +0 -0
- data/lib/jekyll-admin/public/8ea28ca3bfdf27145068e81dd07a34c6.png +0 -0
- data/lib/jekyll-admin/public/bundle.js +0 -64
- data/lib/jekyll-admin/public/bundle.js.map +0 -1
- data/lib/jekyll-admin/public/styles.css +0 -106
- data/lib/jekyll-admin/public/styles.css.map +0 -1
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/jekyll-admin/server.rb
CHANGED
@@ -1,108 +1,108 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
class Server < Sinatra::Base
|
5
|
-
ROUTES = %w(collections configuration data drafts pages static_files).freeze
|
6
|
-
include JekyllAdmin::PathHelper
|
7
|
-
include JekyllAdmin::FileHelper
|
8
|
-
|
9
|
-
register Sinatra::Namespace
|
10
|
-
|
11
|
-
configure :development do
|
12
|
-
register Sinatra::Reloader
|
13
|
-
enable :logging
|
14
|
-
end
|
15
|
-
|
16
|
-
configure :development, :test do
|
17
|
-
require "sinatra/cross_origin"
|
18
|
-
register Sinatra::CrossOrigin
|
19
|
-
enable :cross_origin
|
20
|
-
disable :allow_credentials
|
21
|
-
set :allow_methods, [:delete, :get, :options, :post, :put]
|
22
|
-
end
|
23
|
-
|
24
|
-
get "/" do
|
25
|
-
json ROUTES.map { |r| ["#{r}_api", URI.join(base_url, "/_api/", r)] }.to_h
|
26
|
-
end
|
27
|
-
|
28
|
-
# CORS preflight
|
29
|
-
options "*" do
|
30
|
-
render_404 unless settings.development? || settings.test?
|
31
|
-
status 204
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def json(object, options = {})
|
37
|
-
content_type :json
|
38
|
-
JSON.pretty_generate(object, options)
|
39
|
-
end
|
40
|
-
|
41
|
-
def site
|
42
|
-
JekyllAdmin.site
|
43
|
-
end
|
44
|
-
|
45
|
-
def render_404
|
46
|
-
status 404
|
47
|
-
content_type :json
|
48
|
-
halt
|
49
|
-
end
|
50
|
-
|
51
|
-
def request_payload
|
52
|
-
@request_payload ||= if request_body.to_s.empty?
|
53
|
-
{}
|
54
|
-
else
|
55
|
-
JSON.parse(request_body)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def base_url
|
60
|
-
"#{request.scheme}://#{request.host_with_port}"
|
61
|
-
end
|
62
|
-
|
63
|
-
def front_matter
|
64
|
-
request_payload["front_matter"]
|
65
|
-
end
|
66
|
-
|
67
|
-
def document_body
|
68
|
-
body = +""
|
69
|
-
body << if front_matter && !front_matter.empty?
|
70
|
-
YAML.dump(restored_front_matter).strip
|
71
|
-
.gsub(": 'null'", ": null") # restore null values
|
72
|
-
else
|
73
|
-
"---"
|
74
|
-
end
|
75
|
-
body << "\n---\n\n"
|
76
|
-
body << request_payload["raw_content"].to_s
|
77
|
-
body << "\n" unless body.end_with?("\n")
|
78
|
-
body
|
79
|
-
end
|
80
|
-
alias_method :page_body, :document_body
|
81
|
-
|
82
|
-
def request_body
|
83
|
-
@request_body ||= begin
|
84
|
-
request.body.rewind
|
85
|
-
request.body.read
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def namespace
|
90
|
-
namespace = request.path_info.split("/")[1].to_s.downcase
|
91
|
-
namespace if ROUTES.include?(namespace)
|
92
|
-
end
|
93
|
-
|
94
|
-
# verbose 'null' values in front matter
|
95
|
-
def restored_front_matter
|
96
|
-
front_matter.map do |key, value|
|
97
|
-
value = "null" if value.nil?
|
98
|
-
[key, value]
|
99
|
-
end.to_h
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# load individual route configurations
|
105
|
-
JekyllAdmin::Server::ROUTES.each { |name| require_relative File.join("server", name) }
|
106
|
-
|
107
|
-
# load namespaces outside route configurations
|
108
|
-
require_relative "server/site_meta"
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
class Server < Sinatra::Base
|
5
|
+
ROUTES = %w(collections configuration data drafts pages static_files).freeze
|
6
|
+
include JekyllAdmin::PathHelper
|
7
|
+
include JekyllAdmin::FileHelper
|
8
|
+
|
9
|
+
register Sinatra::Namespace
|
10
|
+
|
11
|
+
configure :development do
|
12
|
+
register Sinatra::Reloader
|
13
|
+
enable :logging
|
14
|
+
end
|
15
|
+
|
16
|
+
configure :development, :test do
|
17
|
+
require "sinatra/cross_origin"
|
18
|
+
register Sinatra::CrossOrigin
|
19
|
+
enable :cross_origin
|
20
|
+
disable :allow_credentials
|
21
|
+
set :allow_methods, [:delete, :get, :options, :post, :put]
|
22
|
+
end
|
23
|
+
|
24
|
+
get "/" do
|
25
|
+
json ROUTES.map { |r| ["#{r}_api", URI.join(base_url, "/_api/", r)] }.to_h
|
26
|
+
end
|
27
|
+
|
28
|
+
# CORS preflight
|
29
|
+
options "*" do
|
30
|
+
render_404 unless settings.development? || settings.test?
|
31
|
+
status 204
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def json(object, options = {})
|
37
|
+
content_type :json
|
38
|
+
JSON.pretty_generate(object, options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def site
|
42
|
+
JekyllAdmin.site
|
43
|
+
end
|
44
|
+
|
45
|
+
def render_404
|
46
|
+
status 404
|
47
|
+
content_type :json
|
48
|
+
halt
|
49
|
+
end
|
50
|
+
|
51
|
+
def request_payload
|
52
|
+
@request_payload ||= if request_body.to_s.empty?
|
53
|
+
{}
|
54
|
+
else
|
55
|
+
JSON.parse(request_body)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def base_url
|
60
|
+
"#{request.scheme}://#{request.host_with_port}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def front_matter
|
64
|
+
request_payload["front_matter"]
|
65
|
+
end
|
66
|
+
|
67
|
+
def document_body
|
68
|
+
body = +""
|
69
|
+
body << if front_matter && !front_matter.empty?
|
70
|
+
YAML.dump(restored_front_matter).strip
|
71
|
+
.gsub(": 'null'", ": null") # restore null values
|
72
|
+
else
|
73
|
+
"---"
|
74
|
+
end
|
75
|
+
body << "\n---\n\n"
|
76
|
+
body << request_payload["raw_content"].to_s
|
77
|
+
body << "\n" unless body.end_with?("\n")
|
78
|
+
body
|
79
|
+
end
|
80
|
+
alias_method :page_body, :document_body
|
81
|
+
|
82
|
+
def request_body
|
83
|
+
@request_body ||= begin
|
84
|
+
request.body.rewind
|
85
|
+
request.body.read
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def namespace
|
90
|
+
namespace = request.path_info.split("/")[1].to_s.downcase
|
91
|
+
namespace if ROUTES.include?(namespace)
|
92
|
+
end
|
93
|
+
|
94
|
+
# verbose 'null' values in front matter
|
95
|
+
def restored_front_matter
|
96
|
+
front_matter.map do |key, value|
|
97
|
+
value = "null" if value.nil?
|
98
|
+
[key, value]
|
99
|
+
end.to_h
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# load individual route configurations
|
105
|
+
JekyllAdmin::Server::ROUTES.each { |name| require_relative File.join("server", name) }
|
106
|
+
|
107
|
+
# load namespaces outside route configurations
|
108
|
+
require_relative "server/site_meta"
|
@@ -1,89 +1,89 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
class Server < Sinatra::Base
|
5
|
-
namespace "/collections" do
|
6
|
-
get do
|
7
|
-
json(site.collections.map { |c| c[1].to_api })
|
8
|
-
end
|
9
|
-
|
10
|
-
get "/:collection_id" do
|
11
|
-
ensure_collection
|
12
|
-
json collection.to_api
|
13
|
-
end
|
14
|
-
|
15
|
-
get "/:collection_id/*?/?:path.:ext" do
|
16
|
-
ensure_requested_file
|
17
|
-
json requested_file.to_api(:include_content => true)
|
18
|
-
end
|
19
|
-
|
20
|
-
get "/:collection_id/entries/?*" do
|
21
|
-
ensure_directory
|
22
|
-
json entries.map(&:to_api)
|
23
|
-
end
|
24
|
-
|
25
|
-
put "/:collection_id/*?/?:path.:ext" do
|
26
|
-
ensure_collection
|
27
|
-
|
28
|
-
if new?
|
29
|
-
ensure_not_overwriting_existing_file
|
30
|
-
elsif renamed?
|
31
|
-
ensure_requested_file
|
32
|
-
ensure_not_overwriting_existing_file
|
33
|
-
delete_file_without_process path
|
34
|
-
end
|
35
|
-
|
36
|
-
write_file write_path, document_body
|
37
|
-
json written_file.to_api(:include_content => true)
|
38
|
-
end
|
39
|
-
|
40
|
-
delete "/:collection_id/*?/?:path.:ext" do
|
41
|
-
ensure_requested_file
|
42
|
-
delete_file path
|
43
|
-
content_type :json
|
44
|
-
status 200
|
45
|
-
halt
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def collection
|
51
|
-
collection = site.collections.find { |l, _c| l == params["collection_id"] }
|
52
|
-
collection[1] if collection
|
53
|
-
end
|
54
|
-
|
55
|
-
def document_id
|
56
|
-
path = "#{params["splat"].first}/#{filename}"
|
57
|
-
path.gsub(%r!(\d{4})/(\d{2})/(\d{2})/(.*)!, '\1-\2-\3-\4')
|
58
|
-
end
|
59
|
-
|
60
|
-
def directory_docs
|
61
|
-
collection.docs.find_all { |d| File.dirname(d.path) == directory_path }
|
62
|
-
end
|
63
|
-
|
64
|
-
def ensure_collection
|
65
|
-
render_404 if collection.nil?
|
66
|
-
end
|
67
|
-
|
68
|
-
def ensure_directory
|
69
|
-
ensure_collection
|
70
|
-
render_404 unless Dir.exist?(directory_path)
|
71
|
-
end
|
72
|
-
|
73
|
-
def entries
|
74
|
-
collections_dir = site.config["collections_dir"]
|
75
|
-
collection_id, splats = params.values_at("collection_id", "splat")
|
76
|
-
args = {
|
77
|
-
:base => site.in_source_dir(collections_dir, "_#{collection_id}"),
|
78
|
-
:content_type => collection_id,
|
79
|
-
:splat => splats&.first,
|
80
|
-
}
|
81
|
-
# get the directories inside the requested directory
|
82
|
-
directory = JekyllAdmin::Directory.new(directory_path, args)
|
83
|
-
directories = directory.directories
|
84
|
-
# merge directories with the documents at the same level
|
85
|
-
directories.concat(directory_docs.sort_by(&:date).reverse)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
class Server < Sinatra::Base
|
5
|
+
namespace "/collections" do
|
6
|
+
get do
|
7
|
+
json(site.collections.map { |c| c[1].to_api })
|
8
|
+
end
|
9
|
+
|
10
|
+
get "/:collection_id" do
|
11
|
+
ensure_collection
|
12
|
+
json collection.to_api
|
13
|
+
end
|
14
|
+
|
15
|
+
get "/:collection_id/*?/?:path.:ext" do
|
16
|
+
ensure_requested_file
|
17
|
+
json requested_file.to_api(:include_content => true)
|
18
|
+
end
|
19
|
+
|
20
|
+
get "/:collection_id/entries/?*" do
|
21
|
+
ensure_directory
|
22
|
+
json entries.map(&:to_api)
|
23
|
+
end
|
24
|
+
|
25
|
+
put "/:collection_id/*?/?:path.:ext" do
|
26
|
+
ensure_collection
|
27
|
+
|
28
|
+
if new?
|
29
|
+
ensure_not_overwriting_existing_file
|
30
|
+
elsif renamed?
|
31
|
+
ensure_requested_file
|
32
|
+
ensure_not_overwriting_existing_file
|
33
|
+
delete_file_without_process path
|
34
|
+
end
|
35
|
+
|
36
|
+
write_file write_path, document_body
|
37
|
+
json written_file.to_api(:include_content => true)
|
38
|
+
end
|
39
|
+
|
40
|
+
delete "/:collection_id/*?/?:path.:ext" do
|
41
|
+
ensure_requested_file
|
42
|
+
delete_file path
|
43
|
+
content_type :json
|
44
|
+
status 200
|
45
|
+
halt
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def collection
|
51
|
+
collection = site.collections.find { |l, _c| l == params["collection_id"] }
|
52
|
+
collection[1] if collection
|
53
|
+
end
|
54
|
+
|
55
|
+
def document_id
|
56
|
+
path = "#{params["splat"].first}/#{filename}"
|
57
|
+
path.gsub(%r!(\d{4})/(\d{2})/(\d{2})/(.*)!, '\1-\2-\3-\4')
|
58
|
+
end
|
59
|
+
|
60
|
+
def directory_docs
|
61
|
+
collection.docs.find_all { |d| File.dirname(d.path) == directory_path }
|
62
|
+
end
|
63
|
+
|
64
|
+
def ensure_collection
|
65
|
+
render_404 if collection.nil?
|
66
|
+
end
|
67
|
+
|
68
|
+
def ensure_directory
|
69
|
+
ensure_collection
|
70
|
+
render_404 unless Dir.exist?(directory_path)
|
71
|
+
end
|
72
|
+
|
73
|
+
def entries
|
74
|
+
collections_dir = site.config["collections_dir"]
|
75
|
+
collection_id, splats = params.values_at("collection_id", "splat")
|
76
|
+
args = {
|
77
|
+
:base => site.in_source_dir(collections_dir, "_#{collection_id}"),
|
78
|
+
:content_type => collection_id,
|
79
|
+
:splat => splats&.first,
|
80
|
+
}
|
81
|
+
# get the directories inside the requested directory
|
82
|
+
directory = JekyllAdmin::Directory.new(directory_path, args)
|
83
|
+
directories = directory.directories
|
84
|
+
# merge directories with the documents at the same level
|
85
|
+
directories.concat(directory_docs.sort_by(&:date).reverse)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -1,60 +1,60 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JekyllAdmin
|
4
|
-
class Server < Sinatra::Base
|
5
|
-
namespace "/configuration" do
|
6
|
-
get do
|
7
|
-
json(
|
8
|
-
:content => parsed_configuration,
|
9
|
-
:raw_content => raw_configuration
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
put do
|
14
|
-
write_file(configuration_path, configuration_body)
|
15
|
-
json request_payload
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def overrides
|
21
|
-
@overrides ||= {
|
22
|
-
"source" => sanitized_path("/"),
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
# Computed configuration, with updates and defaults
|
27
|
-
# Returns an instance of Jekyll::Configuration
|
28
|
-
def configuration
|
29
|
-
@configuration ||= site.config.merge(overrides)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Configuration data, as read by Jekyll
|
33
|
-
def parsed_configuration
|
34
|
-
configuration.read_config_file(configuration_path)
|
35
|
-
end
|
36
|
-
|
37
|
-
# Raw configuration content, as it sits on disk
|
38
|
-
def raw_configuration
|
39
|
-
File.read(
|
40
|
-
configuration_path,
|
41
|
-
Jekyll::Utils.merged_file_read_opts(site, {})
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Returns the path to the *first* config file discovered
|
46
|
-
def configuration_path
|
47
|
-
sanitized_path configuration.config_files(overrides).first
|
48
|
-
end
|
49
|
-
|
50
|
-
# The user's uploaded configuration for updates
|
51
|
-
# Instead of extracting `raw_content` directly from the `request_payload`,
|
52
|
-
# assign the data to a new variable and then extract the `raw_content`
|
53
|
-
# from it to circumvent CORS violation in `development` mode.
|
54
|
-
def configuration_body
|
55
|
-
payload = request_payload
|
56
|
-
payload["raw_content"]
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllAdmin
|
4
|
+
class Server < Sinatra::Base
|
5
|
+
namespace "/configuration" do
|
6
|
+
get do
|
7
|
+
json(
|
8
|
+
:content => parsed_configuration,
|
9
|
+
:raw_content => raw_configuration
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
put do
|
14
|
+
write_file(configuration_path, configuration_body)
|
15
|
+
json request_payload
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def overrides
|
21
|
+
@overrides ||= {
|
22
|
+
"source" => sanitized_path("/"),
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Computed configuration, with updates and defaults
|
27
|
+
# Returns an instance of Jekyll::Configuration
|
28
|
+
def configuration
|
29
|
+
@configuration ||= site.config.merge(overrides)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Configuration data, as read by Jekyll
|
33
|
+
def parsed_configuration
|
34
|
+
configuration.read_config_file(configuration_path)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Raw configuration content, as it sits on disk
|
38
|
+
def raw_configuration
|
39
|
+
File.read(
|
40
|
+
configuration_path,
|
41
|
+
Jekyll::Utils.merged_file_read_opts(site, {})
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns the path to the *first* config file discovered
|
46
|
+
def configuration_path
|
47
|
+
sanitized_path configuration.config_files(overrides).first
|
48
|
+
end
|
49
|
+
|
50
|
+
# The user's uploaded configuration for updates
|
51
|
+
# Instead of extracting `raw_content` directly from the `request_payload`,
|
52
|
+
# assign the data to a new variable and then extract the `raw_content`
|
53
|
+
# from it to circumvent CORS violation in `development` mode.
|
54
|
+
def configuration_body
|
55
|
+
payload = request_payload
|
56
|
+
payload["raw_content"]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|