iron-cms 0.19.0 → 0.19.2
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/app/mcp/iron/mcp/tool_context.rb +27 -12
- data/app/mcp/iron/mcp/tools/create_entry.rb +4 -3
- data/app/mcp/iron/mcp/tools/get_entry.rb +4 -3
- data/app/mcp/iron/mcp/tools/list_content_types.rb +1 -1
- data/app/mcp/iron/mcp/tools/list_entries.rb +4 -3
- data/app/mcp/iron/mcp/tools/search.rb +4 -3
- data/app/mcp/iron/mcp/tools/update_entry.rb +4 -3
- data/app/views/iron/oauth/authorizations/new.html.erb +4 -1
- data/lib/iron/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b64848f45fc9968698463777fbb21553494f23617a5d62845ddeab0366a3189
|
|
4
|
+
data.tar.gz: 7bcd0c0bba9590c71e7bbe41e5ab3039243ee28e8fb474a72a92065b54e3a29e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d07fe3d0a1483bf16bcc133d16e301a1a49f52e166411d4f6dbf69f0edd8188ee2377159ebe824607fd1fdcfb6671dafd688d6a4058b6aae6cde58bbd649fe1b
|
|
7
|
+
data.tar.gz: 0ad8938846376926d3bad8bbca677474c70eb10806726cb518212d837adc0f05183ee50571dbb2efb3ef08c43a0af8516feb92a5ecbd3e39ebdd6e4a7705a988
|
|
@@ -20,32 +20,34 @@ module Iron
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def list_entries(handle:, route: nil, after: nil, per_page: nil)
|
|
24
|
-
return Iron::Content.get(handle, route:, locale:
|
|
23
|
+
def list_entries(handle:, route: nil, after: nil, per_page: nil, locale: nil)
|
|
24
|
+
return Iron::Content.get(handle, route:, locale: effective_locale(locale)) if route.present?
|
|
25
25
|
|
|
26
26
|
content_type = ContentType.find_by!(handle:)
|
|
27
|
-
serialize_collection(Paginator.new(after:, per_page:).call(content_type.entries))
|
|
27
|
+
in_locale(locale) { serialize_collection(Paginator.new(after:, per_page:).call(content_type.entries)) }
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def get_entry(handle:, id: nil, route: nil)
|
|
31
|
-
Iron::Content.get(handle, id:, route:, locale:
|
|
30
|
+
def get_entry(handle:, id: nil, route: nil, locale: nil)
|
|
31
|
+
Iron::Content.get(handle, id:, route:, locale: effective_locale(locale))
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def search(query:, after: nil, per_page: nil)
|
|
34
|
+
def search(query:, after: nil, per_page: nil, locale: nil)
|
|
35
35
|
raise InvalidRequest, "query is required" if query.blank?
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
in_locale(locale) do
|
|
38
|
+
scope = Entry.search(query, locale: Current.locale)
|
|
39
|
+
serialize_collection(Paginator.new(after:, per_page:).call(scope))
|
|
40
|
+
end
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
def create_entry(handle:, content:, route: nil)
|
|
43
|
+
def create_entry(handle:, content:, route: nil, locale: nil)
|
|
42
44
|
authorize_write!
|
|
43
|
-
Iron::Content.create(handle, content, route:, locale:
|
|
45
|
+
Iron::Content.create(handle, content, route:, locale: effective_locale(locale), actor: Current.user, allow_local_files: false)
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
def update_entry(handle:, content:, id: nil, route: nil)
|
|
48
|
+
def update_entry(handle:, content:, id: nil, route: nil, locale: nil)
|
|
47
49
|
authorize_write!
|
|
48
|
-
Iron::Content.update(handle, content, id:, route:, locale:
|
|
50
|
+
Iron::Content.update(handle, content, id:, route:, locale: effective_locale(locale), actor: Current.user, allow_local_files: false)
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
def delete_entry(handle:, id: nil, route: nil)
|
|
@@ -75,6 +77,19 @@ module Iron
|
|
|
75
77
|
Current.locale&.code
|
|
76
78
|
end
|
|
77
79
|
|
|
80
|
+
# An explicit tool `locale` overrides the locale the connector URL
|
|
81
|
+
# resolved into Current.locale, so one connector can reach every locale.
|
|
82
|
+
def effective_locale(locale)
|
|
83
|
+
locale.presence || locale_code
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def in_locale(locale)
|
|
87
|
+
code = effective_locale(locale)
|
|
88
|
+
return yield if code.blank?
|
|
89
|
+
|
|
90
|
+
Current.set(locale: Locale.find_by!(code:)) { yield }
|
|
91
|
+
end
|
|
92
|
+
|
|
78
93
|
def serialize_collection(page)
|
|
79
94
|
{
|
|
80
95
|
"data" => page.records.map { |entry| Iron::Content.serialize(entry) },
|
|
@@ -14,13 +14,14 @@ module Iron
|
|
|
14
14
|
properties: {
|
|
15
15
|
handle: { type: "string", description: "Collection content type handle" },
|
|
16
16
|
content: { type: "object", description: "Field handles to values (see describe_schema)" },
|
|
17
|
-
route: { type: "string", description: "Optional route for web-published types" }
|
|
17
|
+
route: { type: "string", description: "Optional route for web-published types" },
|
|
18
|
+
locale: { type: "string", description: "Locale code to write, e.g. \"en\". Defaults to the connector's locale." }
|
|
18
19
|
},
|
|
19
20
|
required: [ "handle", "content" ]
|
|
20
21
|
)
|
|
21
22
|
|
|
22
|
-
def self.perform(context, handle:, content:, route: nil)
|
|
23
|
-
context.create_entry(handle:, content:, route:)
|
|
23
|
+
def self.perform(context, handle:, content:, route: nil, locale: nil)
|
|
24
|
+
context.create_entry(handle:, content:, route:, locale:)
|
|
24
25
|
end
|
|
25
26
|
end
|
|
26
27
|
end
|
|
@@ -11,13 +11,14 @@ module Iron
|
|
|
11
11
|
properties: {
|
|
12
12
|
handle: { type: "string", description: "Content type handle" },
|
|
13
13
|
id: { type: "integer", description: "Entry id (collection types)" },
|
|
14
|
-
route: { type: "string", description: "Entry route (web-published types)" }
|
|
14
|
+
route: { type: "string", description: "Entry route (web-published types)" },
|
|
15
|
+
locale: { type: "string", description: "Locale code to read, e.g. \"en\". Defaults to the connector's locale." }
|
|
15
16
|
},
|
|
16
17
|
required: [ "handle" ]
|
|
17
18
|
)
|
|
18
19
|
|
|
19
|
-
def self.perform(context, handle:, id: nil, route: nil)
|
|
20
|
-
context.get_entry(handle:, id:, route:)
|
|
20
|
+
def self.perform(context, handle:, id: nil, route: nil, locale: nil)
|
|
21
|
+
context.get_entry(handle:, id:, route:, locale:)
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
end
|
|
@@ -13,13 +13,14 @@ module Iron
|
|
|
13
13
|
handle: { type: "string", description: "Content type handle, e.g. \"post\"" },
|
|
14
14
|
route: { type: "string", description: "Fetch one entry by route instead of listing" },
|
|
15
15
|
after: { type: "string", description: "Pagination cursor from a previous response" },
|
|
16
|
-
per_page: { type: "integer", description: "Entries per page (1-100, default 25)" }
|
|
16
|
+
per_page: { type: "integer", description: "Entries per page (1-100, default 25)" },
|
|
17
|
+
locale: { type: "string", description: "Locale code to read, e.g. \"en\". Defaults to the connector's locale." }
|
|
17
18
|
},
|
|
18
19
|
required: [ "handle" ]
|
|
19
20
|
)
|
|
20
21
|
|
|
21
|
-
def self.perform(context, handle:, route: nil, after: nil, per_page: nil)
|
|
22
|
-
context.list_entries(handle:, route:, after:, per_page:)
|
|
22
|
+
def self.perform(context, handle:, route: nil, after: nil, per_page: nil, locale: nil)
|
|
23
|
+
context.list_entries(handle:, route:, after:, per_page:, locale:)
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
end
|
|
@@ -11,13 +11,14 @@ module Iron
|
|
|
11
11
|
properties: {
|
|
12
12
|
query: { type: "string", description: "Text to search for" },
|
|
13
13
|
after: { type: "string", description: "Pagination cursor from a previous response" },
|
|
14
|
-
per_page: { type: "integer", description: "Results per page (1-100, default 25)" }
|
|
14
|
+
per_page: { type: "integer", description: "Results per page (1-100, default 25)" },
|
|
15
|
+
locale: { type: "string", description: "Locale code to read, e.g. \"en\". Defaults to the connector's locale." }
|
|
15
16
|
},
|
|
16
17
|
required: [ "query" ]
|
|
17
18
|
)
|
|
18
19
|
|
|
19
|
-
def self.perform(context, query:, after: nil, per_page: nil)
|
|
20
|
-
context.search(query:, after:, per_page:)
|
|
20
|
+
def self.perform(context, query:, after: nil, per_page: nil, locale: nil)
|
|
21
|
+
context.search(query:, after:, per_page:, locale:)
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
end
|
|
@@ -14,13 +14,14 @@ module Iron
|
|
|
14
14
|
handle: { type: "string", description: "Content type handle" },
|
|
15
15
|
content: { type: "object", description: "Field handles to new values" },
|
|
16
16
|
id: { type: "integer", description: "Entry id (collection types)" },
|
|
17
|
-
route: { type: "string", description: "Entry route (web-published types)" }
|
|
17
|
+
route: { type: "string", description: "Entry route (web-published types)" },
|
|
18
|
+
locale: { type: "string", description: "Locale code to write, e.g. \"en\". Defaults to the connector's locale." }
|
|
18
19
|
},
|
|
19
20
|
required: [ "handle", "content" ]
|
|
20
21
|
)
|
|
21
22
|
|
|
22
|
-
def self.perform(context, handle:, content:, id: nil, route: nil)
|
|
23
|
-
context.update_entry(handle:, content:, id:, route:)
|
|
23
|
+
def self.perform(context, handle:, content:, id: nil, route: nil, locale: nil)
|
|
24
|
+
context.update_entry(handle:, content:, id:, route:, locale:)
|
|
24
25
|
end
|
|
25
26
|
end
|
|
26
27
|
end
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
<p class="mt-1 text-sm break-all text-stone-700 dark:text-stone-200"><%= @redirect_uri %></p>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
<%# Turbo is disabled: approving redirects to the client's callback on another
|
|
19
|
+
origin (e.g. claude.ai), and a Turbo fetch can't follow a cross-origin
|
|
20
|
+
redirect — the browser blocks it under CORS. A full navigation follows it. %>
|
|
21
|
+
<%= form_with url: "/oauth/authorize", method: :post, data: { turbo: false }, class: "mt-6 grid grid-cols-2 gap-3" do |form| %>
|
|
19
22
|
<%= form.hidden_field :client_id, value: params[:client_id] %>
|
|
20
23
|
<%= form.hidden_field :redirect_uri, value: @redirect_uri %>
|
|
21
24
|
<%= form.hidden_field :response_type, value: params[:response_type] %>
|
data/lib/iron/version.rb
CHANGED