runlight 0.5.3 → 0.5.5
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 +5 -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/brand.rb +20 -0
- data/lib/runlight/core.rb +1 -0
- data/lib/runlight/reports.rb +3 -2
- data/lib/runlight/routes.rb +5 -1
- data/lib/runlight/server/standalone.rb +1 -1
- data/lib/runlight/version.rb +2 -2
- 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\">#{Brand.email_logo("#{origin}#{@base}")}<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\">#{Brand.email_logo("#{origin}#{@base}")}" \
|
|
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/brand.rb
CHANGED
|
@@ -8,5 +8,25 @@ module Runlight
|
|
|
8
8
|
def runlight_icon
|
|
9
9
|
Version.build["icon"].to_s
|
|
10
10
|
end
|
|
11
|
+
|
|
12
|
+
# The mark as a 96 pixel PNG, base64, the same drawing as the website's header and the Mac app's icon. Each
|
|
13
|
+
# install serves it at <base>/logo.png, without signing in, for its emails.
|
|
14
|
+
def logo_png
|
|
15
|
+
Version.build["logoPng"].to_s
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# The email logo's bytes, decoded from base64 the first time they are asked for.
|
|
19
|
+
def logo_bytes
|
|
20
|
+
@logo_bytes ||= logo_png.unpack1("m0").freeze
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# The mark for emails: the PNG at the sending install's own /logo.png, shown at 48 pixels. Opening an email
|
|
24
|
+
# fetches it from that install and from nowhere else; a client that blocks images shows the word Runlight.
|
|
25
|
+
# `home` is the install's address with its base path, such as https://example.com/runlight.
|
|
26
|
+
def email_logo(home)
|
|
27
|
+
src = "#{home.to_s.sub(%r{/+\z}, "")}/logo.png".gsub("&", "&").gsub('"', """).gsub("<", "<").gsub(">", ">")
|
|
28
|
+
"<img src=\"#{src}\" width=\"48\" height=\"48\" alt=\"Runlight\" style=\"display:block;width:48px;height:48px;margin:0 0 24px;" \
|
|
29
|
+
"border:0;outline:none;text-decoration:none;font:700 16px/48px -apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;color:#6b7280\">"
|
|
30
|
+
end
|
|
11
31
|
end
|
|
12
32
|
end
|
data/lib/runlight/core.rb
CHANGED
|
@@ -385,6 +385,7 @@ module Runlight
|
|
|
385
385
|
report = Reports.build_report(self, site, r["frequency"], period, r["lang"], {
|
|
386
386
|
"dashboard" => "#{r["origin"]}/?site=#{Js.encode_uri_component(site["id"])}",
|
|
387
387
|
"unsubscribe" => unsubscribe,
|
|
388
|
+
"home" => r["origin"],
|
|
388
389
|
})
|
|
389
390
|
send_mail({
|
|
390
391
|
"to" => r["email"],
|
data/lib/runlight/reports.rb
CHANGED
|
@@ -43,7 +43,8 @@ module Runlight
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# One site's report for a period, in a language. `links` are absolute: the
|
|
46
|
-
# dashboard ("dashboard")
|
|
46
|
+
# dashboard ("dashboard"), the recipient's unsubscribe page ("unsubscribe"), and
|
|
47
|
+
# the install's address with its base path ("home"), where the email's logo is served.
|
|
47
48
|
# Gives { "subject", "html", "text" }.
|
|
48
49
|
def build_report(runlight, site, frequency, period, lang, links)
|
|
49
50
|
translator = Messages.translator(lang)
|
|
@@ -183,7 +184,7 @@ module Runlight
|
|
|
183
184
|
u = Http::Url.parse(links["dashboard"])
|
|
184
185
|
where = u.nil? ? links["dashboard"] : u.host + u.pathname.sub(%r{/\z}, "")
|
|
185
186
|
at = t.call("email.at", { "where" => where })
|
|
186
|
-
mark = "
|
|
187
|
+
mark = Brand.email_logo(links["home"])
|
|
187
188
|
|
|
188
189
|
footer = t.call("email.footer", { "frequency" => t.call(monthly ? "email.monthly" : "email.weekly"), "site" => site["name"] })
|
|
189
190
|
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" => "#{Brand.email_logo("#{@origin || url.origin}#{@base}")}<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 }
|
|
@@ -2594,6 +2594,10 @@ module Runlight
|
|
|
2594
2594
|
rl = @rl
|
|
2595
2595
|
base = @base
|
|
2596
2596
|
method = request.method
|
|
2597
|
+
# The mark for emails, open to anyone: whoever opens a report or an invite is not signed in here.
|
|
2598
|
+
if path == "/logo.png" && method == "GET"
|
|
2599
|
+
return Http::Response.new(Brand.logo_bytes, status: 200, headers: { "content-type" => "image/png", "cache-control" => "public, max-age=86400" })
|
|
2600
|
+
end
|
|
2597
2601
|
# Checked before any route, so a connected site's pass-through to its install is held to it too.
|
|
2598
2602
|
if admin_only?(path, method) && can_read(request) == true && @members.key?(request)
|
|
2599
2603
|
return coded("Only an owner or admin can change this", "admin_only", 403)
|
|
@@ -17,7 +17,7 @@ module Runlight
|
|
|
17
17
|
class Standalone
|
|
18
18
|
# The server's own pages, which answer as the server on every name it is reached at, a link domain too.
|
|
19
19
|
SERVER_PATHS = ["/login", "/logout", "/setup", "/invite", "/healthz", "/auth.css", "/auth.js", "/api", "/mcp",
|
|
20
|
-
"/s.js", "/pick.js", "/pick-return", "/pick-return.js", "/e", "/embed"].freeze
|
|
20
|
+
"/s.js", "/pick.js", "/pick-return", "/pick-return.js", "/logo.png", "/e", "/embed"].freeze
|
|
21
21
|
|
|
22
22
|
# The most names remembered as the server's own. The first ones stay and later ones are not learned, so
|
|
23
23
|
# a server reached at more names than this needs RUNLIGHT_URL to keep the rest from becoming link domains.
|
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.5"
|
|
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
|
|
@@ -14,7 +14,7 @@ module Runlight
|
|
|
14
14
|
|
|
15
15
|
module_function
|
|
16
16
|
|
|
17
|
-
# Everything in assets/build.json: the versions, the asset hashes, and the
|
|
17
|
+
# Everything in assets/build.json: the versions, the asset hashes, the icon, and the email logo.
|
|
18
18
|
def build
|
|
19
19
|
@build ||= begin
|
|
20
20
|
JSON.parse(File.read(File.join(ASSETS, "build.json")))
|
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.5
|
|
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-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|