studio-engine 0.144.1 → 0.145.0
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/CHANGELOG.md +6 -0
- data/app/controllers/studio/local_reviews_controller.rb +37 -0
- data/lib/studio/version.rb +1 -1
- data/lib/studio.rb +9 -0
- 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: fcd5103975b372a755ab0a9c62d8915e9854271354a51b1549056080ef6c8046
|
|
4
|
+
data.tar.gz: d154629954b9c7ea8d3355a2f6a34d36edbfa5924226bee9e96e54c748222ef4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce022131694e41f489478bc09f57b9c7921f517af7107349d75ac0f42f7ebb115f0acf7834ab9b2553e7f93dce003d7a3397c4409f9a313d7bf9f19a293b5e92
|
|
7
|
+
data.tar.gz: 7e5436be99e866b904422765adc5d1c4a43c210c0b18f51389cfcfab2a0addf7d78567f2bf1d424850316f14570e0b2e24fcc4e334e6c54954f56afe4040101c
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.145.0 — 2026-11-28
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`GET /_studio/local_review.json` answers the minted magic link as data.** The same single-use mint as the redirect, returned as `{ url, expires_at }`, so the task board's Magic Link card can show the link it minted. Only an origin in `Studio.local_review_board_origins` (default `https://mcritchie.studio`) or a loopback origin gets a CORS grant to read it; the endpoint stays non-production and loopback-only. Consumers need do nothing.
|
|
12
|
+
|
|
7
13
|
## 0.144.1 — 2026-11-27
|
|
8
14
|
|
|
9
15
|
### Fixed
|
|
@@ -49,6 +49,8 @@ module Studio
|
|
|
49
49
|
# spelling of a rule that already has one owner — and a mutation run
|
|
50
50
|
# confirmed it guards nothing the store does not already guard.
|
|
51
51
|
token = issue_magic_link(email, params[:return_to])
|
|
52
|
+
return render_minted_json(token) if request.format.json?
|
|
53
|
+
|
|
52
54
|
redirect_to magic_link_url_for(token), allow_other_host: false
|
|
53
55
|
end
|
|
54
56
|
|
|
@@ -56,6 +58,41 @@ module Studio
|
|
|
56
58
|
|
|
57
59
|
MISSING_EMAIL = "Add ?email=<your address> to mint a local review link."
|
|
58
60
|
|
|
61
|
+
# GET /_studio/local_review.json — the SAME mint, answered as data instead of
|
|
62
|
+
# a redirect, so the task board's Magic Link card can SHOW the link it minted
|
|
63
|
+
# (the operator asked to see the token, not only to be sent through it).
|
|
64
|
+
#
|
|
65
|
+
# The board is another origin (the production hub, or another desk's port),
|
|
66
|
+
# so its page can read this answer only through CORS. The allow-list is
|
|
67
|
+
# Studio.local_review_board_origins plus any loopback origin; every other
|
|
68
|
+
# origin gets no Access-Control-Allow-Origin, so a stranger's page that
|
|
69
|
+
# fires this GET mints a row it can never read. The floor above still holds:
|
|
70
|
+
# never in production, loopback requests only.
|
|
71
|
+
#
|
|
72
|
+
# Access-Control-Allow-Private-Network answers Chrome's local-network check
|
|
73
|
+
# for a public page reading a loopback server.
|
|
74
|
+
def render_minted_json(token)
|
|
75
|
+
origin = request.headers["Origin"].to_s
|
|
76
|
+
if board_origin_allowed?(origin)
|
|
77
|
+
response.set_header("Access-Control-Allow-Origin", origin)
|
|
78
|
+
response.set_header("Access-Control-Allow-Private-Network", "true")
|
|
79
|
+
end
|
|
80
|
+
response.set_header("Vary", "Origin")
|
|
81
|
+
response.set_header("Cache-Control", "no-store")
|
|
82
|
+
link = Studio::Link.find_by(token: token)
|
|
83
|
+
render json: { url: magic_link_url_for(token), expires_at: link&.expires_at&.utc&.iso8601 }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def board_origin_allowed?(origin)
|
|
87
|
+
return false if origin.empty?
|
|
88
|
+
return true if Array(Studio.local_review_board_origins).include?(origin)
|
|
89
|
+
|
|
90
|
+
uri = URI.parse(origin)
|
|
91
|
+
%w[http https].include?(uri.scheme) && Studio::LOOPBACK_ORIGIN_HOSTS.include?(uri.host)
|
|
92
|
+
rescue URI::InvalidURIError
|
|
93
|
+
false
|
|
94
|
+
end
|
|
95
|
+
|
|
59
96
|
# WHO to sign in, in priority order:
|
|
60
97
|
#
|
|
61
98
|
# 1. `?email=` — an explicit caller still wins.
|
data/lib/studio/version.rb
CHANGED
data/lib/studio.rb
CHANGED
|
@@ -1565,6 +1565,15 @@ module Studio
|
|
|
1565
1565
|
# whose operator is not the first seeded account at that role.
|
|
1566
1566
|
mattr_accessor :local_review_email, default: nil
|
|
1567
1567
|
|
|
1568
|
+
# The ORIGINS whose pages may READ a local-review mint answered as JSON
|
|
1569
|
+
# (GET /_studio/local_review.json): the task board's Magic Link card mints
|
|
1570
|
+
# from the operator's local server and shows the link it got back. Any loopback
|
|
1571
|
+
# origin is allowed besides these (LOOPBACK_ORIGIN_HOSTS: a board on another
|
|
1572
|
+
# desk's port). Every other origin gets no CORS header, so its page cannot read
|
|
1573
|
+
# the token. The endpoint's floor is unchanged: non-production, loopback only.
|
|
1574
|
+
mattr_accessor :local_review_board_origins, default: [ "https://mcritchie.studio" ]
|
|
1575
|
+
LOOPBACK_ORIGIN_HOSTS = %w[localhost 127.0.0.1 [::1] ::1].freeze
|
|
1576
|
+
|
|
1568
1577
|
# Theme role colors (7 roles)
|
|
1569
1578
|
mattr_accessor :theme_primary, default: "#8E82FE"
|
|
1570
1579
|
mattr_accessor :theme_dark, default: "#1A1535"
|