Commit 919f853
feat: add OG image generation for feature gate pages (#913)
## Description
- Add Open Graph image generation for feature gate pages so shared links
display a rich preview with the feature title and SIMD number(s). Works
for `/address/<address>/feature-gate`
[example](https://explorer.solana.com/address/5xXZc66h4UdB6Yq7FzdBxBiRAFMMScMLwHxk2QZDaNZL/feature-gate?cluster=testnet)
and `/address/<address>`
[example](https://explorer.solana.com/address/5xXZc66h4UdB6Yq7FzdBxBiRAFMMScMLwHxk2QZDaNZL?cluster=testnet)
- Refactor `app/features/feature-gate/` into FSD-aligned sub-modules
(`api/`, `lib/`, `ui/`, `env.ts`, `server.ts`) and narrow the
client-facing `index.ts` export
- Extract `SolanaLogo` from receipt feature into
`app/shared/components/` with `variant` (`gradient` | `green`) and
unique SVG `id` props to support reuse across OG images
## Type of change
<!-- Check the appropriate options that apply to this PR -->
- [x] New feature
## Screenshots
<img width="2184" height="755"
alt="localhost_3000_og_feature-gate_5xXZc66h4UdB6Yq7FzdBxBiRAFMMScMLwHxk2QZDaNZL"
src="https://github.com/user-attachments/assets/1739f84e-76ef-41c3-9a8f-aefdbd06f49e"
/>
## Testing
### Environment
- FEATURE_GATE_OG_ENABLED — set to "true" to enable OG images on feature
gate pages (default: disabled)
- FEATURE_GATE_BASE_URL — set to https://explorer.solana.com
### Vercel Firewall Configuration
If Attack Challenge Mode is enabled, add bypass rules so social media
crawlers can fetch preview images and visit feature gate pages:
Name: Allow bots for feature gate OG images
Rule:
If `Request Path` `Starts with` `/og/feature-gate/`
Then `Bypass`
Name: Allow bots to visit feature gate address pages
Rule:
If `Request Path` `Starts with` `/address/`
Then `Bypass`
## Test plan
- [ ] Set `FEATURE_GATE_OG_ENABLED=true` and visit
`/og/feature-gate/<known-feature-address>` — should return a PNG
- [ ] Visit `/og/feature-gate/<unknown-address>` — should return 404
- [ ] Visit `/og/feature-gate/invalid!!!` — should return 400
- [ ] With `FEATURE_GATE_OG_ENABLED=false`, all OG routes return 404 and
pages have no `og:image` meta
- [ ] Existing receipt OG images still work (Logo import path changed)
## Related Issues
Closes
[HOO-384](https://linear.app/solana-fndn/issue/HOO-384/add-share-preview-images-for-explorer-features)
## Checklist
<!-- Verify that you have completed the following before requesting
review -->
- [x] My code follows the project's style guidelines
- [x] I have added tests that prove my fix/feature works
- [x] All tests pass locally and in CI
- [x] I have updated documentation as needed
- [x] I have run `build:info` script to update build information
- [x] CI/CD checks pass
- [x] I have included screenshots for protocol screens (if applicable)
---------
Co-authored-by: Sergo <rogaldh@radsh.red>1 parent 6fc2569 commit 919f853
File tree
20 files changed
+577
-98
lines changed- app
- address/[address]
- feature-gate
- features
- feature-gate
- __tests__
- api
- lib
- ui
- stories
- receipt/ui
- og/feature-gate/[address]
- __tests__
- bench
20 files changed
+577
-98
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments