@jant/core 0.3.25 → 0.3.27

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.
Files changed (133) hide show
  1. package/dist/app.js +70 -563
  2. package/dist/auth.js +3 -0
  3. package/dist/client.js +1 -0
  4. package/dist/i18n/locales/en.js +1 -1
  5. package/dist/i18n/locales/zh-Hans.js +1 -1
  6. package/dist/i18n/locales/zh-Hant.js +1 -1
  7. package/dist/lib/avatar-upload.js +134 -0
  8. package/dist/lib/config.js +39 -0
  9. package/dist/lib/constants.js +10 -10
  10. package/dist/lib/favicon.js +102 -0
  11. package/dist/lib/image.js +13 -17
  12. package/dist/lib/media-helpers.js +2 -2
  13. package/dist/lib/navigation.js +23 -3
  14. package/dist/lib/render.js +10 -1
  15. package/dist/lib/schemas.js +31 -0
  16. package/dist/lib/timezones.js +388 -0
  17. package/dist/lib/view.js +1 -1
  18. package/dist/routes/api/posts.js +1 -1
  19. package/dist/routes/api/upload.js +3 -3
  20. package/dist/routes/auth/reset.js +221 -0
  21. package/dist/routes/auth/setup.js +194 -0
  22. package/dist/routes/auth/signin.js +176 -0
  23. package/dist/routes/dash/collections.js +23 -415
  24. package/dist/routes/dash/media.js +12 -392
  25. package/dist/routes/dash/pages.js +7 -330
  26. package/dist/routes/dash/redirects.js +18 -12
  27. package/dist/routes/dash/settings.js +198 -577
  28. package/dist/routes/feed/rss.js +2 -1
  29. package/dist/routes/feed/sitemap.js +4 -2
  30. package/dist/routes/pages/featured.js +5 -1
  31. package/dist/routes/pages/home.js +26 -1
  32. package/dist/routes/pages/latest.js +45 -0
  33. package/dist/services/post.js +30 -50
  34. package/dist/types/bindings.js +3 -0
  35. package/dist/types/config.js +147 -0
  36. package/dist/types/constants.js +27 -0
  37. package/dist/types/entities.js +3 -0
  38. package/dist/types/operations.js +3 -0
  39. package/dist/types/props.js +3 -0
  40. package/dist/types/views.js +5 -0
  41. package/dist/types.js +8 -111
  42. package/dist/ui/color-themes.js +33 -33
  43. package/dist/ui/compose/ComposeDialog.js +36 -21
  44. package/dist/ui/dash/PageForm.js +21 -15
  45. package/dist/ui/dash/PostForm.js +22 -16
  46. package/dist/ui/dash/collections/CollectionForm.js +152 -0
  47. package/dist/ui/dash/collections/CollectionsListContent.js +68 -0
  48. package/dist/ui/dash/collections/ViewCollectionContent.js +96 -0
  49. package/dist/ui/dash/media/MediaListContent.js +166 -0
  50. package/dist/ui/dash/media/ViewMediaContent.js +212 -0
  51. package/dist/ui/dash/pages/LinkFormContent.js +130 -0
  52. package/dist/ui/dash/pages/UnifiedPagesContent.js +193 -0
  53. package/dist/ui/dash/settings/AccountContent.js +209 -0
  54. package/dist/ui/dash/settings/AppearanceContent.js +259 -0
  55. package/dist/ui/dash/settings/GeneralContent.js +536 -0
  56. package/dist/ui/dash/settings/SettingsNav.js +41 -0
  57. package/dist/ui/font-themes.js +36 -0
  58. package/dist/ui/layouts/BaseLayout.js +24 -2
  59. package/dist/ui/layouts/SiteLayout.js +47 -19
  60. package/package.json +1 -1
  61. package/src/app.tsx +95 -553
  62. package/src/auth.ts +4 -1
  63. package/src/client.ts +1 -0
  64. package/src/i18n/locales/en.po +240 -175
  65. package/src/i18n/locales/en.ts +1 -1
  66. package/src/i18n/locales/zh-Hans.po +240 -175
  67. package/src/i18n/locales/zh-Hans.ts +1 -1
  68. package/src/i18n/locales/zh-Hant.po +240 -175
  69. package/src/i18n/locales/zh-Hant.ts +1 -1
  70. package/src/lib/__tests__/config.test.ts +192 -0
  71. package/src/lib/__tests__/favicon.test.ts +151 -0
  72. package/src/lib/__tests__/image.test.ts +2 -6
  73. package/src/lib/__tests__/timezones.test.ts +61 -0
  74. package/src/lib/__tests__/view.test.ts +2 -2
  75. package/src/lib/avatar-upload.ts +165 -0
  76. package/src/lib/config.ts +47 -0
  77. package/src/lib/constants.ts +19 -11
  78. package/src/lib/favicon.ts +115 -0
  79. package/src/lib/image.ts +13 -21
  80. package/src/lib/media-helpers.ts +2 -2
  81. package/src/lib/navigation.ts +33 -2
  82. package/src/lib/render.tsx +15 -1
  83. package/src/lib/schemas.ts +39 -0
  84. package/src/lib/timezones.ts +325 -0
  85. package/src/lib/view.ts +1 -1
  86. package/src/routes/api/posts.ts +1 -1
  87. package/src/routes/api/upload.ts +2 -3
  88. package/src/routes/auth/reset.tsx +239 -0
  89. package/src/routes/auth/setup.tsx +189 -0
  90. package/src/routes/auth/signin.tsx +163 -0
  91. package/src/routes/dash/__tests__/settings-avatar.test.ts +89 -0
  92. package/src/routes/dash/collections.tsx +17 -366
  93. package/src/routes/dash/media.tsx +12 -414
  94. package/src/routes/dash/pages.tsx +8 -348
  95. package/src/routes/dash/redirects.tsx +20 -14
  96. package/src/routes/dash/settings.tsx +243 -534
  97. package/src/routes/feed/__tests__/rss.test.ts +141 -0
  98. package/src/routes/feed/rss.ts +3 -1
  99. package/src/routes/feed/sitemap.ts +4 -2
  100. package/src/routes/pages/featured.tsx +7 -1
  101. package/src/routes/pages/home.tsx +25 -2
  102. package/src/routes/pages/latest.tsx +59 -0
  103. package/src/services/post.ts +34 -66
  104. package/src/styles/components.css +0 -65
  105. package/src/styles/tokens.css +1 -1
  106. package/src/styles/ui.css +24 -40
  107. package/src/types/bindings.ts +30 -0
  108. package/src/types/config.ts +183 -0
  109. package/src/types/constants.ts +26 -0
  110. package/src/types/entities.ts +109 -0
  111. package/src/types/operations.ts +88 -0
  112. package/src/types/props.ts +115 -0
  113. package/src/types/views.ts +172 -0
  114. package/src/types.ts +8 -644
  115. package/src/ui/__tests__/font-themes.test.ts +34 -0
  116. package/src/ui/color-themes.ts +34 -34
  117. package/src/ui/compose/ComposeDialog.tsx +40 -21
  118. package/src/ui/dash/PageForm.tsx +25 -19
  119. package/src/ui/dash/PostForm.tsx +26 -20
  120. package/src/ui/dash/collections/CollectionForm.tsx +153 -0
  121. package/src/ui/dash/collections/CollectionsListContent.tsx +85 -0
  122. package/src/ui/dash/collections/ViewCollectionContent.tsx +92 -0
  123. package/src/ui/dash/media/MediaListContent.tsx +201 -0
  124. package/src/ui/dash/media/ViewMediaContent.tsx +208 -0
  125. package/src/ui/dash/pages/LinkFormContent.tsx +119 -0
  126. package/src/ui/dash/pages/UnifiedPagesContent.tsx +203 -0
  127. package/src/ui/dash/settings/AccountContent.tsx +176 -0
  128. package/src/ui/dash/settings/AppearanceContent.tsx +254 -0
  129. package/src/ui/dash/settings/GeneralContent.tsx +533 -0
  130. package/src/ui/dash/settings/SettingsNav.tsx +56 -0
  131. package/src/ui/font-themes.ts +54 -0
  132. package/src/ui/layouts/BaseLayout.tsx +17 -0
  133. package/src/ui/layouts/SiteLayout.tsx +45 -31
@@ -1,395 +1,18 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-runtime";
2
- import { getSiteName } from "../../lib/config.js";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "hono/jsx/jsx-runtime";
3
2
  /**
4
3
  * Dashboard Media Routes
5
- *
6
- * Media management with Datastar-powered uploads.
7
- * Uses SSE for real-time UI updates without page reloads.
8
4
  */ import { Hono } from "hono";
9
- import { useLingui as $_useLingui } from "@jant/core/i18n";
10
5
  import { DashLayout } from "../../ui/layouts/DashLayout.js";
11
- import { EmptyState, DangerZone } from "../../ui/dash/index.js";
12
- import * as time from "../../lib/time.js";
13
- import { getMediaUrl, getImageUrl, getPublicUrlForProvider } from "../../lib/image.js";
14
6
  import { dsRedirect } from "../../lib/sse.js";
7
+ import { getSiteName } from "../../lib/config.js";
8
+ import { getMediaUrl, getImageUrl, getPublicUrlForProvider } from "../../lib/image.js";
9
+ import { MediaListContent } from "../../ui/dash/media/MediaListContent.js";
10
+ import { ViewMediaContent } from "../../ui/dash/media/ViewMediaContent.js";
15
11
  export const mediaRoutes = new Hono();
16
- /**
17
- * Format file size for display
18
- */ function formatSize(bytes) {
19
- if (bytes < 1024) return `${bytes} B`;
20
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
21
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
22
- }
23
- /**
24
- * Media card component for the grid
25
- */ function MediaCard({ media, r2PublicUrl, imageTransformUrl, s3PublicUrl }) {
26
- const publicUrl = getPublicUrlForProvider(media.provider, r2PublicUrl, s3PublicUrl);
27
- const fullUrl = getMediaUrl(media.id, media.storageKey, publicUrl);
28
- const thumbnailUrl = getImageUrl(fullUrl, imageTransformUrl, {
29
- width: 300,
30
- quality: 80,
31
- format: "auto",
32
- fit: "cover"
33
- });
34
- const isImage = media.mimeType.startsWith("image/");
35
- return /*#__PURE__*/ _jsxs("div", {
36
- class: "group relative",
37
- "data-media-id": media.id,
38
- children: [
39
- isImage ? /*#__PURE__*/ _jsx("button", {
40
- type: "button",
41
- class: "block w-full aspect-square bg-muted rounded-lg overflow-hidden border hover:border-primary cursor-pointer",
42
- onclick: `document.getElementById('lightbox-img').src = '${fullUrl}'; document.getElementById('lightbox').showModal()`,
43
- children: /*#__PURE__*/ _jsx("img", {
44
- src: thumbnailUrl,
45
- alt: media.alt || media.originalName,
46
- class: "w-full h-full object-cover",
47
- loading: "lazy"
48
- })
49
- }) : /*#__PURE__*/ _jsx("a", {
50
- href: `/dash/media/${media.id}`,
51
- class: "block aspect-square bg-muted rounded-lg overflow-hidden border hover:border-primary",
52
- children: /*#__PURE__*/ _jsx("div", {
53
- class: "w-full h-full flex items-center justify-center text-muted-foreground",
54
- children: /*#__PURE__*/ _jsx("span", {
55
- class: "text-xs",
56
- children: media.mimeType
57
- })
58
- })
59
- }),
60
- /*#__PURE__*/ _jsx("a", {
61
- href: `/dash/media/${media.id}`,
62
- class: "block mt-2 text-xs truncate hover:underline",
63
- title: media.originalName,
64
- children: media.originalName
65
- }),
66
- /*#__PURE__*/ _jsx("div", {
67
- class: "text-xs text-muted-foreground",
68
- children: formatSize(media.size)
69
- })
70
- ]
71
- });
72
- }
73
- /**
74
- * Media list page content
75
- *
76
- * Upload is handled by media-upload.ts (client module) + Datastar @post for SSE.
77
- */ function MediaListContent({ mediaList, r2PublicUrl, imageTransformUrl, s3PublicUrl }) {
78
- const { i18n: $__i18n, _: $__ } = $_useLingui();
79
- const processingText = $__i18n._({
80
- id: "k1ifdL",
81
- message: "Processing..."
82
- });
83
- const uploadingText = $__i18n._({
84
- id: "GxkJXS",
85
- message: "Uploading..."
86
- });
87
- const uploadText = $__i18n._({
88
- id: "ONWvwQ",
89
- message: "Upload"
90
- });
91
- const errorText = $__i18n._({
92
- id: "pZq3aX",
93
- message: "Upload failed. Please try again."
94
- });
95
- return /*#__PURE__*/ _jsxs(_Fragment, {
96
- children: [
97
- /*#__PURE__*/ _jsx("form", {
98
- id: "upload-form",
99
- class: "hidden",
100
- enctype: "multipart/form-data",
101
- "data-on:submit__prevent": "@post('/api/upload', {contentType: 'form'})",
102
- children: /*#__PURE__*/ _jsx("input", {
103
- id: "upload-file-input",
104
- type: "file",
105
- name: "file"
106
- })
107
- }),
108
- /*#__PURE__*/ _jsxs("div", {
109
- class: "flex items-center justify-between mb-6",
110
- children: [
111
- /*#__PURE__*/ _jsx("h1", {
112
- class: "text-2xl font-semibold",
113
- children: $__i18n._({
114
- id: "xYilR2",
115
- message: "Media"
116
- })
117
- }),
118
- /*#__PURE__*/ _jsxs("label", {
119
- class: "btn cursor-pointer",
120
- children: [
121
- /*#__PURE__*/ _jsx("span", {
122
- children: uploadText
123
- }),
124
- /*#__PURE__*/ _jsx("input", {
125
- type: "file",
126
- class: "hidden",
127
- accept: "image/*",
128
- "data-media-upload": true,
129
- "data-text-processing": processingText,
130
- "data-text-uploading": uploadingText,
131
- "data-text-error": errorText
132
- })
133
- ]
134
- })
135
- ]
136
- }),
137
- /*#__PURE__*/ _jsx("div", {
138
- class: "card mb-6",
139
- children: /*#__PURE__*/ _jsx("section", {
140
- class: "text-sm text-muted-foreground",
141
- children: /*#__PURE__*/ _jsx("p", {
142
- children: $__i18n._({
143
- id: "x+doid",
144
- message: "Images are automatically optimized: resized to max 1920px, converted to WebP, and metadata stripped."
145
- })
146
- })
147
- })
148
- }),
149
- /*#__PURE__*/ _jsx("div", {
150
- id: "media-content",
151
- children: mediaList.length === 0 ? /*#__PURE__*/ _jsx("div", {
152
- id: "empty-state",
153
- children: /*#__PURE__*/ _jsx(EmptyState, {
154
- message: $__i18n._({
155
- id: "ST+lN2",
156
- message: "No media uploaded yet."
157
- })
158
- })
159
- }) : /*#__PURE__*/ _jsx("div", {
160
- id: "media-grid",
161
- class: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",
162
- children: mediaList.map((m)=>/*#__PURE__*/ _jsx(MediaCard, {
163
- media: m,
164
- r2PublicUrl: r2PublicUrl,
165
- imageTransformUrl: imageTransformUrl,
166
- s3PublicUrl: s3PublicUrl
167
- }, m.id))
168
- })
169
- }),
170
- /*#__PURE__*/ _jsx("dialog", {
171
- id: "lightbox",
172
- class: "p-0 m-auto bg-transparent backdrop:bg-black/80",
173
- onclick: "event.target === this && this.close()",
174
- children: /*#__PURE__*/ _jsx("img", {
175
- id: "lightbox-img",
176
- src: "",
177
- alt: "",
178
- class: "max-w-[90vw] max-h-[90vh] object-contain rounded-lg"
179
- })
180
- })
181
- ]
182
- });
183
- }
184
- /**
185
- * View single media content
186
- */ function ViewMediaContent({ media, r2PublicUrl, imageTransformUrl, s3PublicUrl }) {
187
- const { i18n: $__i18n, _: $__ } = $_useLingui();
188
- const publicUrl = getPublicUrlForProvider(media.provider, r2PublicUrl, s3PublicUrl);
189
- const url = getMediaUrl(media.id, media.storageKey, publicUrl);
190
- const thumbnailUrl = getImageUrl(url, imageTransformUrl, {
191
- width: 600,
192
- quality: 85,
193
- format: "auto"
194
- });
195
- const isImage = media.mimeType.startsWith("image/");
196
- return /*#__PURE__*/ _jsxs(_Fragment, {
197
- children: [
198
- /*#__PURE__*/ _jsxs("div", {
199
- class: "flex items-center justify-between mb-6",
200
- children: [
201
- /*#__PURE__*/ _jsxs("div", {
202
- children: [
203
- /*#__PURE__*/ _jsx("h1", {
204
- class: "text-2xl font-semibold",
205
- children: media.originalName
206
- }),
207
- /*#__PURE__*/ _jsxs("p", {
208
- class: "text-muted-foreground mt-1",
209
- children: [
210
- formatSize(media.size),
211
- " · ",
212
- media.mimeType,
213
- " ·",
214
- " ",
215
- time.formatDate(media.createdAt)
216
- ]
217
- })
218
- ]
219
- }),
220
- /*#__PURE__*/ _jsx("a", {
221
- href: "/dash/media",
222
- class: "btn-outline",
223
- children: $__i18n._({
224
- id: "iH8pgl",
225
- message: "Back"
226
- })
227
- })
228
- ]
229
- }),
230
- /*#__PURE__*/ _jsxs("div", {
231
- class: "grid gap-6 md:grid-cols-2",
232
- children: [
233
- /*#__PURE__*/ _jsxs("div", {
234
- class: "card",
235
- children: [
236
- /*#__PURE__*/ _jsx("header", {
237
- children: /*#__PURE__*/ _jsx("h2", {
238
- children: $__i18n._({
239
- id: "rdUucN",
240
- message: "Preview"
241
- })
242
- })
243
- }),
244
- /*#__PURE__*/ _jsx("section", {
245
- children: isImage ? /*#__PURE__*/ _jsxs(_Fragment, {
246
- children: [
247
- /*#__PURE__*/ _jsx("button", {
248
- type: "button",
249
- class: "cursor-pointer",
250
- onclick: `document.getElementById('lightbox-img').src = '${url}'; document.getElementById('lightbox').showModal()`,
251
- children: /*#__PURE__*/ _jsx("img", {
252
- src: thumbnailUrl,
253
- alt: media.alt || media.originalName,
254
- class: "max-w-full rounded-lg hover:opacity-90 transition-opacity"
255
- })
256
- }),
257
- /*#__PURE__*/ _jsx("p", {
258
- class: "text-xs text-muted-foreground mt-2",
259
- children: $__i18n._({
260
- id: "M1RvTd",
261
- message: "Click image to view full size"
262
- })
263
- })
264
- ]
265
- }) : /*#__PURE__*/ _jsx("div", {
266
- class: "aspect-video bg-muted rounded-lg flex items-center justify-center text-muted-foreground",
267
- children: /*#__PURE__*/ _jsx("span", {
268
- children: media.mimeType
269
- })
270
- })
271
- })
272
- ]
273
- }),
274
- /*#__PURE__*/ _jsxs("div", {
275
- class: "space-y-6",
276
- children: [
277
- /*#__PURE__*/ _jsxs("div", {
278
- class: "card",
279
- children: [
280
- /*#__PURE__*/ _jsx("header", {
281
- children: /*#__PURE__*/ _jsx("h2", {
282
- children: $__i18n._({
283
- id: "IagCbF",
284
- message: "URL"
285
- })
286
- })
287
- }),
288
- /*#__PURE__*/ _jsxs("section", {
289
- children: [
290
- /*#__PURE__*/ _jsxs("div", {
291
- class: "flex items-center gap-2",
292
- children: [
293
- /*#__PURE__*/ _jsx("input", {
294
- type: "text",
295
- class: "input flex-1 font-mono text-sm",
296
- value: url,
297
- readonly: true
298
- }),
299
- /*#__PURE__*/ _jsx("button", {
300
- type: "button",
301
- class: "btn-outline",
302
- onclick: `navigator.clipboard.writeText('${url}')`,
303
- children: $__i18n._({
304
- id: "he3ygx",
305
- message: "Copy"
306
- })
307
- })
308
- ]
309
- }),
310
- /*#__PURE__*/ _jsx("p", {
311
- class: "text-xs text-muted-foreground mt-2",
312
- children: $__i18n._({
313
- id: "K9NcLu",
314
- message: "Use this URL to embed the media in your posts."
315
- })
316
- })
317
- ]
318
- })
319
- ]
320
- }),
321
- /*#__PURE__*/ _jsxs("div", {
322
- class: "card",
323
- children: [
324
- /*#__PURE__*/ _jsx("header", {
325
- children: /*#__PURE__*/ _jsx("h2", {
326
- children: $__i18n._({
327
- id: "u6Hp4N",
328
- message: "Markdown"
329
- })
330
- })
331
- }),
332
- /*#__PURE__*/ _jsx("section", {
333
- children: /*#__PURE__*/ _jsxs("div", {
334
- class: "flex items-center gap-2",
335
- children: [
336
- /*#__PURE__*/ _jsx("input", {
337
- type: "text",
338
- class: "input flex-1 font-mono text-sm",
339
- value: `![${media.alt || media.originalName}](${url})`,
340
- readonly: true
341
- }),
342
- /*#__PURE__*/ _jsx("button", {
343
- type: "button",
344
- class: "btn-outline",
345
- onclick: `navigator.clipboard.writeText('![${media.alt || media.originalName}](${url})')`,
346
- children: $__i18n._({
347
- id: "he3ygx",
348
- message: "Copy"
349
- })
350
- })
351
- ]
352
- })
353
- })
354
- ]
355
- }),
356
- /*#__PURE__*/ _jsx(DangerZone, {
357
- actionLabel: $__i18n._({
358
- id: "wM5UXj",
359
- message: "Delete Media"
360
- }),
361
- formAction: `/dash/media/${media.id}/delete`,
362
- confirmMessage: "Are you sure you want to delete this media?",
363
- description: $__i18n._({
364
- id: "E80cJw",
365
- message: "Deleting this media will remove it permanently from storage."
366
- })
367
- })
368
- ]
369
- })
370
- ]
371
- }),
372
- isImage && /*#__PURE__*/ _jsx("dialog", {
373
- id: "lightbox",
374
- class: "p-0 m-auto bg-transparent backdrop:bg-black/80",
375
- onclick: "event.target === this && this.close()",
376
- children: /*#__PURE__*/ _jsx("img", {
377
- id: "lightbox-img",
378
- src: "",
379
- alt: "",
380
- class: "max-w-[90vw] max-h-[90vh] object-contain rounded-lg"
381
- })
382
- })
383
- ]
384
- });
385
- }
386
12
  // List media
387
13
  mediaRoutes.get("/", async (c)=>{
388
14
  const mediaList = await c.var.services.media.list(100);
389
15
  const siteName = await getSiteName(c);
390
- const r2PublicUrl = c.env.R2_PUBLIC_URL;
391
- const imageTransformUrl = c.env.IMAGE_TRANSFORM_URL;
392
- const s3PublicUrl = c.env.S3_PUBLIC_URL;
393
16
  return c.html(/*#__PURE__*/ _jsx(DashLayout, {
394
17
  c: c,
395
18
  title: "Media",
@@ -397,9 +20,9 @@ mediaRoutes.get("/", async (c)=>{
397
20
  currentPath: "/dash/media",
398
21
  children: /*#__PURE__*/ _jsx(MediaListContent, {
399
22
  mediaList: mediaList,
400
- r2PublicUrl: r2PublicUrl,
401
- imageTransformUrl: imageTransformUrl,
402
- s3PublicUrl: s3PublicUrl
23
+ r2PublicUrl: c.env.R2_PUBLIC_URL,
24
+ imageTransformUrl: c.env.IMAGE_TRANSFORM_URL,
25
+ s3PublicUrl: c.env.S3_PUBLIC_URL
403
26
  })
404
27
  }));
405
28
  });
@@ -419,7 +42,7 @@ mediaRoutes.get("/picker", async (c)=>{
419
42
  return c.html(/*#__PURE__*/ _jsx(_Fragment, {
420
43
  children: mediaList.filter((m)=>m.mimeType.startsWith("image/")).map((m)=>{
421
44
  const pUrl = getPublicUrlForProvider(m.provider, r2PublicUrl, s3PublicUrl);
422
- const url = getMediaUrl(m.id, m.storageKey, pUrl);
45
+ const url = getMediaUrl(m.storageKey, pUrl);
423
46
  const thumbUrl = getImageUrl(url, imageTransformUrl, {
424
47
  width: 150,
425
48
  quality: 80,
@@ -449,9 +72,6 @@ mediaRoutes.get("/:id", async (c)=>{
449
72
  const media = await c.var.services.media.getById(id);
450
73
  if (!media) return c.notFound();
451
74
  const siteName = await getSiteName(c);
452
- const r2PublicUrl = c.env.R2_PUBLIC_URL;
453
- const imageTransformUrl = c.env.IMAGE_TRANSFORM_URL;
454
- const s3PublicUrl = c.env.S3_PUBLIC_URL;
455
75
  return c.html(/*#__PURE__*/ _jsx(DashLayout, {
456
76
  c: c,
457
77
  title: media.originalName,
@@ -459,9 +79,9 @@ mediaRoutes.get("/:id", async (c)=>{
459
79
  currentPath: "/dash/media",
460
80
  children: /*#__PURE__*/ _jsx(ViewMediaContent, {
461
81
  media: media,
462
- r2PublicUrl: r2PublicUrl,
463
- imageTransformUrl: imageTransformUrl,
464
- s3PublicUrl: s3PublicUrl
82
+ r2PublicUrl: c.env.R2_PUBLIC_URL,
83
+ imageTransformUrl: c.env.IMAGE_TRANSFORM_URL,
84
+ s3PublicUrl: c.env.S3_PUBLIC_URL
465
85
  })
466
86
  }));
467
87
  });