runlight 0.5.2 → 0.5.4
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/assets/build.json +4 -4
- data/assets/dashboard.css +1 -1
- data/assets/dashboard.js +10 -10
- data/assets/locales.json +5 -5
- data/lib/runlight/accounts/pages.rb +30 -6
- data/lib/runlight/accounts/web.rb +2 -2
- data/lib/runlight/oauth.rb +9 -4
- data/lib/runlight/reports.rb +1 -1
- data/lib/runlight/routes.rb +2 -2
- data/lib/runlight/version.rb +1 -1
- metadata +2 -2
|
@@ -5,8 +5,35 @@ module Runlight
|
|
|
5
5
|
# The account pages: sign in, the code step, invites, and first-run setup. Everything else is the dashboard.
|
|
6
6
|
# Each takes the base path the routes answer under: "" on the standalone server, and "/runlight" in an app.
|
|
7
7
|
module Pages
|
|
8
|
-
MARK = '<svg
|
|
9
|
-
'<
|
|
8
|
+
MARK = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" class="mark" aria-hidden="true"><defs>' \
|
|
9
|
+
'<clipPath id="rlm-b"><rect x="100" y="100" width="824" height="824" rx="185"/></clipPath>' \
|
|
10
|
+
'<linearGradient id="rlm-t" x1="0" y1="100" x2="0" y2="924" gradientUnits="userSpaceOnUse">' \
|
|
11
|
+
'<stop offset="0" stop-color="#2e2e33"/><stop offset="1" stop-color="#111113"/></linearGradient>' \
|
|
12
|
+
'<radialGradient id="rlm-s" cx="709.6" cy="322.4" r="439.4" gradientUnits="userSpaceOnUse">' \
|
|
13
|
+
'<stop offset="0" stop-color="#22c55e" stop-opacity=".38"/>' \
|
|
14
|
+
'<stop offset="1" stop-color="#22c55e" stop-opacity="0"/></radialGradient>' \
|
|
15
|
+
'<linearGradient id="rlm-rim" x1="0" y1="100" x2="0" y2="924" gradientUnits="userSpaceOnUse">' \
|
|
16
|
+
'<stop offset="0" stop-color="#fff" stop-opacity=".28"/>' \
|
|
17
|
+
'<stop offset=".5" stop-color="#fff" stop-opacity=".02"/></linearGradient>' \
|
|
18
|
+
'<linearGradient id="rlm-r" x1="0" y1="5.6" x2="0" y2="26" gradientUnits="userSpaceOnUse">' \
|
|
19
|
+
'<stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#d4d4d8"/></linearGradient>' \
|
|
20
|
+
'<radialGradient id="rlm-l" cx="23.6" cy="8.4" r="2.6" fx="22.69" fy="7.36" gradientUnits="userSpaceOnUse">' \
|
|
21
|
+
'<stop offset="0" stop-color="#86efac"/><stop offset=".55" stop-color="#22c55e"/>' \
|
|
22
|
+
'<stop offset="1" stop-color="#16a34a"/></radialGradient>' \
|
|
23
|
+
'<filter id="rlm-d" x="-20%" y="-20%" width="140%" height="140%">' \
|
|
24
|
+
'<feDropShadow dx="0" dy=".23" stdDeviation=".27" flood-color="#000" flood-opacity=".45"/></filter>' \
|
|
25
|
+
'<filter id="rlm-g" x="-200%" y="-200%" width="500%" height="500%"><feGaussianBlur stdDeviation="1.15"/>' \
|
|
26
|
+
'</filter><mask id="rlm-n" maskUnits="userSpaceOnUse" x="0" y="0" width="1024" height="1024">' \
|
|
27
|
+
'<rect width="1024" height="1024" fill="#fff"/>' \
|
|
28
|
+
'<circle cx="23.6" cy="8.4" r="3.432" fill="#000" transform="translate(96 104) scale(26)"/></mask></defs>' \
|
|
29
|
+
'<g clip-path="url(#rlm-b)"><rect x="100" y="100" width="824" height="824" fill="url(#rlm-t)"/>' \
|
|
30
|
+
'<rect x="100" y="100" width="824" height="824" fill="url(#rlm-s)"/>' \
|
|
31
|
+
'<rect x="101.5" y="101.5" width="821" height="821" rx="184" fill="none" stroke="url(#rlm-rim)" stroke-width="3"/>' \
|
|
32
|
+
'</g><g mask="url(#rlm-n)"><g transform="translate(96 104) scale(26)" filter="url(#rlm-d)">' \
|
|
33
|
+
'<path d="M11 23V9h6.2a4.3 4.3 0 0 1 0 8.6H11M17 17.6l5 5.4" fill="none" stroke="url(#rlm-r)" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>' \
|
|
34
|
+
'</g></g><g transform="translate(96 104) scale(26)">' \
|
|
35
|
+
'<circle cx="23.6" cy="8.4" r="2.6" fill="#4ade80" fill-opacity=".9" filter="url(#rlm-g)"/>' \
|
|
36
|
+
'<circle cx="23.6" cy="8.4" r="2.6" fill="url(#rlm-l)"/></g></svg>'
|
|
10
37
|
|
|
11
38
|
# Light until someone picks otherwise, as in the dashboard, which shares the choice through localStorage.
|
|
12
39
|
DARK = "color-scheme: dark; --page: #09090b; --card: #141417; --ink: #fafafa; --muted: #a1a1aa; --line: #27272a; --field: #0c0c0e; --bad: #f87171;"
|
|
@@ -20,10 +47,7 @@ module Runlight
|
|
|
20
47
|
body { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--page); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
|
|
21
48
|
main { width: min(400px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
|
|
22
49
|
.brand { display: flex; align-items: center; gap: 9px; margin: 0 0 22px; color: var(--ink); font-weight: 700; font-size: 16px; }
|
|
23
|
-
.mark { width:
|
|
24
|
-
.mark rect { fill: var(--ink); }
|
|
25
|
-
.mark path { fill: none; stroke: var(--card); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
26
|
-
.mark circle { fill: #22c55e; }
|
|
50
|
+
.mark { width: 27px; height: 27px; }
|
|
27
51
|
h1 { margin: 0 0 6px; font-size: 21px; }
|
|
28
52
|
p { margin: 0 0 18px; color: var(--muted); }
|
|
29
53
|
label { display: block; margin: 0 0 14px; font-size: 13px; font-weight: 600; }
|
|
@@ -338,7 +338,7 @@ module Runlight
|
|
|
338
338
|
"to" => invite["email"],
|
|
339
339
|
"subject" => "#{invite["invitedBy"]} invited you to Runlight",
|
|
340
340
|
"text" => "#{invite["invitedBy"]} invited you to the Runlight at #{host} as #{what}.\n\nChoose a password to join:\n#{link}\n\nThe link works for seven days.\n",
|
|
341
|
-
"html" => "<div style=\"font:15px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;color:#111827;max-width:480px\"><
|
|
341
|
+
"html" => "<div style=\"font:15px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;color:#111827;max-width:480px\"><table role=\"img\" aria-label=\"Runlight\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:24px;border-collapse:separate\"><tr><td width=\"45\" height=\"48\" align=\"center\" bgcolor=\"#1c1c1f\" style=\"width:45px;height:48px;padding:0 0 0 3px;border-radius:11px;background:#1c1c1f;background-image:linear-gradient(#2e2e33,#111113);color:#fafafa;font:700 34px/48px -apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;letter-spacing:-6px;text-align:center;white-space:nowrap\">R<span style=\"display:inline-block;width:8px;height:8px;margin-top:8px;border:1px solid #29292d;border-radius:5px;background:#22c55e;vertical-align:top\"></span></td></tr></table><p>" \
|
|
342
342
|
"#{esc(invite["invitedBy"])} invited you to the Runlight at #{esc(host)} as #{esc(what)}.</p><p><a href=\"#{esc(link)}\" " \
|
|
343
343
|
"style=\"display:inline-block;padding:10px 18px;border-radius:8px;background:#111827;color:#ffffff;text-decoration:none;font-weight:600\">" \
|
|
344
344
|
"Choose a password and join</a></p><p style=\"color:#6b7280;font-size:13px\">The link works for seven days. If you were not expecting this, " \
|
|
@@ -376,7 +376,7 @@ module Runlight
|
|
|
376
376
|
"subject" => "Sign in to Runlight",
|
|
377
377
|
"text" => "Someone, most likely you, signed in to Runlight at #{host} with your password while your account was held up by too many failed tries.\n\n" \
|
|
378
378
|
"Sign in with this link within fifteen minutes:\n#{link}\n\nIf this was not you, change your password, since someone knows it.\n",
|
|
379
|
-
"html" => "<div style=\"font:15px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;color:#111827;max-width:480px\"><
|
|
379
|
+
"html" => "<div style=\"font:15px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;color:#111827;max-width:480px\"><table role=\"img\" aria-label=\"Runlight\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:24px;border-collapse:separate\"><tr><td width=\"45\" height=\"48\" align=\"center\" bgcolor=\"#1c1c1f\" style=\"width:45px;height:48px;padding:0 0 0 3px;border-radius:11px;background:#1c1c1f;background-image:linear-gradient(#2e2e33,#111113);color:#fafafa;font:700 34px/48px -apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;letter-spacing:-6px;text-align:center;white-space:nowrap\">R<span style=\"display:inline-block;width:8px;height:8px;margin-top:8px;border:1px solid #29292d;border-radius:5px;background:#22c55e;vertical-align:top\"></span></td></tr></table>" \
|
|
380
380
|
"<p>Someone, most likely you, signed in to Runlight at #{esc(host)} with your password while your account was held up by too many failed tries.</p>" \
|
|
381
381
|
"<p><a href=\"#{esc(link)}\" style=\"display:inline-block;padding:10px 18px;border-radius:8px;background:#111827;color:#ffffff;" \
|
|
382
382
|
"text-decoration:none;font-weight:600\">Sign in</a></p><p style=\"color:#6b7280;font-size:13px\">The link works for fifteen minutes. " \
|
data/lib/runlight/oauth.rb
CHANGED
|
@@ -34,6 +34,9 @@ module Runlight
|
|
|
34
34
|
# The longest client id, which carries the app's name and redirect addresses.
|
|
35
35
|
MAX_CLIENT_ID = 2048
|
|
36
36
|
SCOPES = %w[read manage cms].freeze
|
|
37
|
+
# The scope the MCP endpoint offers. An MCP client asks for every scope it is offered, so it is offered
|
|
38
|
+
# only read: manage and cms are for a hub and the CMS plugins, which ask for them by name.
|
|
39
|
+
MCP_SCOPE = "read"
|
|
37
40
|
# The most an OAuth request's body may be: a registration, a consent form, or a code swap is far smaller.
|
|
38
41
|
MAX_BODY_BYTES = 64 * 1024
|
|
39
42
|
|
|
@@ -110,7 +113,7 @@ module Runlight
|
|
|
110
113
|
end
|
|
111
114
|
|
|
112
115
|
if known.start_with?("/.well-known/oauth-protected-resource")
|
|
113
|
-
return json({ "resource" => "#{issuer}/mcp", "authorization_servers" => [issuer], "scopes_supported" =>
|
|
116
|
+
return json({ "resource" => "#{issuer}/mcp", "authorization_servers" => [issuer], "scopes_supported" => [MCP_SCOPE], "bearer_methods_supported" => ["header"] })
|
|
114
117
|
end
|
|
115
118
|
if known.start_with?("/.well-known/oauth-authorization-server") || known.start_with?("/.well-known/openid-configuration")
|
|
116
119
|
return json({
|
|
@@ -187,9 +190,11 @@ module Runlight
|
|
|
187
190
|
return refuse.call({ "error" => "invalid_request", "error_description" => "PKCE with S256 is required" })
|
|
188
191
|
end
|
|
189
192
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
# A hub asks for manage and a CMS plugin for cms, each on its own. An app asking for more than one
|
|
194
|
+
# is a generic client asking for everything it was offered, and gets read, the least of them.
|
|
195
|
+
scopes = (form.get("scope") || "").split(/[#{Js::SPACE}]+/o).select { |s| SCOPES.include?(s) }.uniq
|
|
196
|
+
cms = scopes == ["cms"]
|
|
197
|
+
manage = scopes == ["manage"]
|
|
193
198
|
name = client["name"].to_s
|
|
194
199
|
# A CMS plugin is for the site it runs on: one of the sites counting its admin's domain, or a new one for it.
|
|
195
200
|
host = site_host(redirect)
|
data/lib/runlight/reports.rb
CHANGED
|
@@ -183,7 +183,7 @@ module Runlight
|
|
|
183
183
|
u = Http::Url.parse(links["dashboard"])
|
|
184
184
|
where = u.nil? ? links["dashboard"] : u.host + u.pathname.sub(%r{/\z}, "")
|
|
185
185
|
at = t.call("email.at", { "where" => where })
|
|
186
|
-
mark = "<
|
|
186
|
+
mark = "<table role=\"img\" aria-label=\"Runlight\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:24px;border-collapse:separate\"><tr><td width=\"45\" height=\"48\" align=\"center\" bgcolor=\"#1c1c1f\" style=\"width:45px;height:48px;padding:0 0 0 3px;border-radius:11px;background:#1c1c1f;background-image:linear-gradient(#2e2e33,#111113);color:#fafafa;font:700 34px/48px -apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;letter-spacing:-6px;text-align:center;white-space:nowrap\">R<span style=\"display:inline-block;width:8px;height:8px;margin-top:8px;border:1px solid #29292d;border-radius:5px;background:#22c55e;vertical-align:top\"></span></td></tr></table>"
|
|
187
187
|
|
|
188
188
|
footer = t.call("email.footer", { "frequency" => t.call(monthly ? "email.monthly" : "email.weekly"), "site" => site["name"] })
|
|
189
189
|
at_line = esc(t.call("email.at", { "where" => "\0" }))
|
data/lib/runlight/routes.rb
CHANGED
|
@@ -1289,7 +1289,7 @@ module Runlight
|
|
|
1289
1289
|
"to" => to,
|
|
1290
1290
|
"subject" => t.call("email.test.subject"),
|
|
1291
1291
|
"text" => t.call("email.test.body", { "service" => name }),
|
|
1292
|
-
"html" => "<
|
|
1292
|
+
"html" => "<table role=\"img\" aria-label=\"Runlight\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-bottom:24px;border-collapse:separate\"><tr><td width=\"45\" height=\"48\" align=\"center\" bgcolor=\"#1c1c1f\" style=\"width:45px;height:48px;padding:0 0 0 3px;border-radius:11px;background:#1c1c1f;background-image:linear-gradient(#2e2e33,#111113);color:#fafafa;font:700 34px/48px -apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;letter-spacing:-6px;text-align:center;white-space:nowrap\">R<span style=\"display:inline-block;width:8px;height:8px;margin-top:8px;border:1px solid #29292d;border-radius:5px;background:#22c55e;vertical-align:top\"></span></td></tr></table><p style=\"font-family:sans-serif;font-size:15px\">#{escape_html(t.call("email.test.body", { "service" => name }))}</p>",
|
|
1293
1293
|
})
|
|
1294
1294
|
# Counted once it went out, so a test that failed can be tried again as soon as the setting is fixed.
|
|
1295
1295
|
@lock.synchronize { @sample_sent[tested] = @rl.now }
|
|
@@ -2703,7 +2703,7 @@ module Runlight
|
|
|
2703
2703
|
if access == false || access == "unconfigured"
|
|
2704
2704
|
refused = denied(access)
|
|
2705
2705
|
# Points an OAuth client at the metadata that starts the sign-in.
|
|
2706
|
-
refused.headers.set("www-authenticate", "Bearer realm=\"runlight\", resource_metadata=\"#{OAuth.resource_metadata_url(url.origin, base)}\"")
|
|
2706
|
+
refused.headers.set("www-authenticate", "Bearer realm=\"runlight\", resource_metadata=\"#{OAuth.resource_metadata_url(url.origin, base)}\", scope=\"#{OAuth::MCP_SCOPE}\"")
|
|
2707
2707
|
return refused
|
|
2708
2708
|
end
|
|
2709
2709
|
# Each tool reads the HTTP API with the caller's own headers, so it sees what they may.
|
data/lib/runlight/version.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "json"
|
|
|
4
4
|
|
|
5
5
|
module Runlight
|
|
6
6
|
# The gem's own version, which the release keeps equal to the npm package's.
|
|
7
|
-
GEM_VERSION = "0.5.
|
|
7
|
+
GEM_VERSION = "0.5.4"
|
|
8
8
|
|
|
9
9
|
# The SDK's version and the HTTP API's, read from assets/build.json, which
|
|
10
10
|
# scripts/ruby-assets.mts writes from the TypeScript SDK, so the two always
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runlight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon C. Phillips
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|