Commit 19a4223
authored
* fix: security improvements, bug fixes, and i18n consistency
Security improvements:
- Add URL validation to prevent open redirect vulnerabilities in checkout routes
- Use generic error messages for 500 responses to avoid exposing sensitive details
- Add JSON parsing validation with proper 400 responses for malformed requests
- Validate item existence before recording views to prevent data pollution
- Add customer ID validation for Polar checkout (consistent with Stripe)
Bug fixes:
- Fix pagination issues (restore standard pagination UI, fix page reset on search)
- Fix webhook handlers to properly detect sponsor ad renewals (check subscription metadata)
- Fix admin stats to show global counts instead of page-scoped counts
- Fix modal closing logic to check operation success before closing
- Fix collection card spinner to only show on regular left-click navigation
- Fix item view recording to validate item existence for all users
- Fix limit parameter validation to handle NaN and invalid values properly
- Fix isActive consistency in admin collections page
i18n improvements:
- Replace hardcoded strings with translation keys in collection components
- Add missing translations for aria-labels and status messages
Code quality:
- Remove unused props and imports
- Improve error handling consistency across API routes
- Add proper existence checks before database operations
- Fix cache revalidation to use correct identifiers (slug vs id)
Affected areas:
- API routes (sponsor ads, collections, items, payments, webhooks)
- Admin pages (collections, sponsorships)
- UI components (collections, categories, billing)
- Webhook handlers (Stripe, Polar)
* fix: improve error handling and internationalization
- Add missing 404 handling in cancel sponsor ad route
- Complete internationalization of assign items modal
- Refactor categories-grid to use exported totalPages function
* fix: resolve API errors and missing translation
- Increase max limit for collections endpoint (100 -> 1000)
- Add missing 'EDIT' translation key in common section
- Improve pagination parameter validation for collections
1 parent 3f4d9d8 commit 19a4223
File tree
25 files changed
+1474
-1321
lines changed- app
- [locale]
- admin
- collections
- sponsorships
- categories
- api
- admin
- clients/dashboard
- collections
- [id]
- sponsor-ads
- [id]
- reject
- extract
- items/[slug]/views
- payment/[subscriptionId]
- polar/webhook
- sponsor-ads
- checkout
- user
- [id]/cancel
- stripe/webhook
- components
- admin/collections
- billing
- collections
- messages
25 files changed
+1474
-1321
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 66 | + | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
| |||
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
134 | 143 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
143 | 155 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
147 | 162 | | |
148 | 163 | | |
149 | 164 | | |
| |||
185 | 200 | | |
186 | 201 | | |
187 | 202 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 203 | + | |
193 | 204 | | |
194 | 205 | | |
195 | 206 | | |
| |||
205 | 216 | | |
206 | 217 | | |
207 | 218 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 219 | + | |
213 | 220 | | |
214 | 221 | | |
215 | 222 | | |
216 | 223 | | |
217 | 224 | | |
218 | 225 | | |
219 | | - | |
220 | | - | |
221 | | - | |
| 226 | + | |
222 | 227 | | |
223 | 228 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 229 | + | |
228 | 230 | | |
229 | 231 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 232 | + | |
235 | 233 | | |
236 | 234 | | |
237 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
16 | | - | |
17 | 13 | | |
18 | 14 | | |
19 | 15 | | |
20 | | - | |
21 | | - | |
22 | 16 | | |
23 | 17 | | |
24 | 18 | | |
| |||
41 | 35 | | |
42 | 36 | | |
43 | 37 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 38 | | |
54 | 39 | | |
55 | 40 | | |
| |||
123 | 108 | | |
124 | 109 | | |
125 | 110 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 111 | + | |
131 | 112 | | |
132 | 113 | | |
133 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
26 | 22 | | |
27 | | - | |
28 | | - | |
| 23 | + | |
| 24 | + | |
29 | 25 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
35 | 29 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 30 | + | |
47 | 31 | | |
0 commit comments