studio-engine 0.57.3 → 0.58.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40225b29271d0e2651ab08ae5047e76ccc4672f4e0a85ac385a0133d013ccaa5
4
- data.tar.gz: 35b1f3c01da3a105f80135e94984dd461bdb0f4092e90ec436ec9c9f8300f3aa
3
+ metadata.gz: 959ea13f16e5896058a274b521d6ebf70ba3b272c5a520f27cae6685c2329cf1
4
+ data.tar.gz: 90d82b6ea11fc10c66b401b98f62f8675ad1f99037f7f122af97b8e7d86d73e6
5
5
  SHA512:
6
- metadata.gz: 51eb9be89732de3f038218e3177d279e4f9d5988577fcb6f657e460820ed5da82693604e3c03ee2a305b9a7a75b2ce62f7e0baae2d5614013f980f4dd446b097
7
- data.tar.gz: 0aa3fc2ea31cc63129ff6e5592fd303b7826b6aa50a0b2dc100ee0b26cb0e8b34049baeede0440d6e2c301099586d9cef2e4226cdeacb3050a81a1f9a5482983
6
+ metadata.gz: cb9b85f346c35cfc234751aa79eeec3c22ebac83b0acc40d586b74f28591a063cdefaa05673f4c0844347f7c0e2d11e41606b5058adf15c9c3fa74da9f6b8be8
7
+ data.tar.gz: 7c974094a1ea66a113f0d93a6a02e7c781bee50d3138026a8431b8127d866090297cd6d526e8957c2a962a637acd39cc9cab27bc14b779ebf05002299e3c0f44
data/CHANGELOG.md CHANGED
@@ -6,6 +6,20 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
6
6
 
7
7
  ### Added
8
8
 
9
+ - **A Geo row in the shared admin dropdown, with signage when it is off.** Every
10
+ app's gear menu now carries **Geo** beside Theme and Error Logs. It links
11
+ `/admin/geo` when `ENABLE_GEO_BLOCKING` is truthy and the geo routes are drawn;
12
+ otherwise it renders DISABLED and names the missing prerequisite — "Set
13
+ ENABLE_GEO_BLOCKING=true" or "Draw the geo routes first".
14
+
15
+ Disabled rather than hidden on purpose: an app that has not turned geo on still
16
+ learns the feature exists and what to set.
17
+
18
+ **The variable governs the LINK, never the gate.** An app with it unset still
19
+ detects, still blocks, still enforces — a default-off variable that switched
20
+ enforcement would silently stop a live legal blocklist on the next deploy. An
21
+ app that would rather decide in code sets `config.geo_blocking_enabled`.
22
+
9
23
  - **Geo — validation for every app, locking for the apps that need it.**
10
24
  Turf Monster's geo stack, lifted into the engine and generalised from
11
25
  US-states-only to country + subdivision. Full guide:
@@ -13,6 +13,29 @@
13
13
  <div x-show="open" x-cloak @click.outside="open = false" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-95" class="absolute right-0 mt-2 w-44 bg-surface border border-subtle rounded-lg shadow-lg z-50 py-1">
14
14
  <a href="/admin/theme" class="block px-4 py-2 text-sm text-body hover:text-heading hover:bg-surface-alt transition">Theme</a>
15
15
  <a href="/admin/navbar" class="block px-4 py-2 text-sm text-body hover:text-heading hover:bg-surface-alt transition">Navbar</a>
16
+ <%# GEO — shown in every app, LIVE only where it can actually be used.
17
+ A disabled row rather than a hidden one is the whole point: an app that has
18
+ not turned geo on still learns the feature exists and what to set, instead
19
+ of it being invisible until someone reads the gem's docs.
20
+
21
+ Two prerequisites, and the row says WHICH is missing, because they are
22
+ fixed in different places — an env var on the dyno, a line in the app's
23
+ initializer. The route check is not decoration: where draw_geo_routes is
24
+ false, `admin_geo_path` does not exist and calling it RAISES, so the
25
+ disabled branch must never reach for the helper. %>
26
+ <% geo_routes = respond_to?(:admin_geo_path) %>
27
+ <% if Studio.geo_blocking_enabled? && geo_routes %>
28
+ <a href="<%= admin_geo_path %>" class="block px-4 py-2 text-sm text-body hover:text-heading hover:bg-surface-alt transition">Geo</a>
29
+ <% else %>
30
+ <span class="block px-4 py-2 text-sm text-muted cursor-not-allowed select-none"
31
+ data-test="admin-dropdown-geo-disabled"
32
+ title="<%= geo_routes ? "Set ENABLE_GEO_BLOCKING=true to manage geo blocking" : "Set config.draw_geo_routes = true in config/initializers/studio.rb, then ENABLE_GEO_BLOCKING=true" %>">
33
+ Geo
34
+ <span class="block text-xs text-muted">
35
+ <%= geo_routes ? "Set ENABLE_GEO_BLOCKING=true" : "Draw the geo routes first" %>
36
+ </span>
37
+ </span>
38
+ <% end %>
16
39
  <a href="/error_logs" class="block px-4 py-2 text-sm text-body hover:text-heading hover:bg-surface-alt transition">Error Logs</a>
17
40
  </div>
18
41
  </div>
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.57.3"
2
+ VERSION = "0.58.0"
3
3
  end
data/lib/studio.rb CHANGED
@@ -298,6 +298,29 @@ module Studio
298
298
  }
299
299
  mattr_accessor :geo_blocked_redirect, default: nil
300
300
 
301
+ # THE OPERATOR-FACING SWITCH for the geo manager's place in the admin chrome:
302
+ # ENABLE_GEO_BLOCKING, a plain true/false environment variable in the house
303
+ # ENABLE_* family (ENABLE_COINFLOW, ENABLE_AGE_GATE).
304
+ #
305
+ # It governs the LINK AND ITS SIGNAGE, nothing else. An app with it unset still
306
+ # detects, still blocks, still enforces — this deliberately does NOT gate the
307
+ # gate. A default-off variable that switched enforcement would silently stop a
308
+ # live legal blocklist on the next deploy, which is the opposite of what a
309
+ # signpost is for.
310
+ #
311
+ # What it changes: the shared admin dropdown shows Geo as a DISABLED item naming
312
+ # the variable to set, so an app that has not turned the feature on still learns
313
+ # it exists and how to reach it — instead of the feature being invisible.
314
+ mattr_accessor :geo_blocking_enabled, default: nil
315
+
316
+ # nil (the default) means "read the environment"; an app that wants to decide in
317
+ # code sets true/false in its initializer and the variable is ignored.
318
+ def self.geo_blocking_enabled?
319
+ return !!geo_blocking_enabled unless geo_blocking_enabled.nil?
320
+
321
+ env_truthy?(ENV["ENABLE_GEO_BLOCKING"])
322
+ end
323
+
301
324
  # Draw /admin/geo + /geo/check from Studio.routes. OFF by default, for the same
302
325
  # hard reason as draw_admin_emails_routes: turf-monster already owns
303
326
  # admin_geo_path, admin_geo_update_path, admin_geo_toggle_path and
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: studio-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.57.3
4
+ version: 0.58.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McRitchie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-20 00:00:00.000000000 Z
11
+ date: 2026-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails