@sonicjs-cms/core 2.12.1 → 2.14.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.
- package/dist/{chunk-3V2CQFIR.js → chunk-23DP6TO5.js} +89 -49
- package/dist/chunk-23DP6TO5.js.map +1 -0
- package/dist/{chunk-RBXFXT7H.cjs → chunk-3QCEYJLK.cjs} +9 -9
- package/dist/{chunk-RBXFXT7H.cjs.map → chunk-3QCEYJLK.cjs.map} +1 -1
- package/dist/{chunk-UFWE3MEJ.js → chunk-AFGOH2F6.js} +3 -3
- package/dist/{chunk-UFWE3MEJ.js.map → chunk-AFGOH2F6.js.map} +1 -1
- package/dist/{chunk-BWZBKLOC.js → chunk-CB7ONLGB.js} +3 -3
- package/dist/{chunk-BWZBKLOC.js.map → chunk-CB7ONLGB.js.map} +1 -1
- package/dist/{chunk-DHTCZZUB.cjs → chunk-DRWSHIFG.cjs} +252 -212
- package/dist/chunk-DRWSHIFG.cjs.map +1 -0
- package/dist/{chunk-673VROB3.js → chunk-GAVTTYMC.js} +5 -5
- package/dist/{chunk-673VROB3.js.map → chunk-GAVTTYMC.js.map} +1 -1
- package/dist/{chunk-6C6W54QP.js → chunk-JKNKO6LA.js} +22 -5
- package/dist/chunk-JKNKO6LA.js.map +1 -0
- package/dist/{chunk-76TX6XND.js → chunk-JTUCC6WZ.js} +18 -10
- package/dist/chunk-JTUCC6WZ.js.map +1 -0
- package/dist/{chunk-XK3TKOLQ.cjs → chunk-KZ2MFGET.cjs} +22 -5
- package/dist/chunk-KZ2MFGET.cjs.map +1 -0
- package/dist/{chunk-H4NHRZ6Y.cjs → chunk-QP3OHHON.cjs} +18 -10
- package/dist/chunk-QP3OHHON.cjs.map +1 -0
- package/dist/{chunk-IKBAY2M2.cjs → chunk-YULUPQZV.cjs} +5 -5
- package/dist/{chunk-IKBAY2M2.cjs.map → chunk-YULUPQZV.cjs.map} +1 -1
- package/dist/{chunk-HBUFGLEX.cjs → chunk-YYMPHM3I.cjs} +4 -4
- package/dist/{chunk-HBUFGLEX.cjs.map → chunk-YYMPHM3I.cjs.map} +1 -1
- package/dist/index.cjs +887 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +779 -13
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +28 -28
- package/dist/middleware.js +2 -2
- package/dist/migrations-F7KVA74T.cjs +13 -0
- package/dist/{migrations-MIZFGFNS.cjs.map → migrations-F7KVA74T.cjs.map} +1 -1
- package/dist/migrations-WKONKRN7.js +4 -0
- package/dist/{migrations-AH2XIFSA.js.map → migrations-WKONKRN7.js.map} +1 -1
- package/dist/{plugin-bootstrap-DVGLQrcO.d.cts → plugin-bootstrap-BGwBraaN.d.cts} +1 -0
- package/dist/{plugin-bootstrap-CZ1GDum7.d.ts → plugin-bootstrap-Drns7X9w.d.ts} +1 -0
- package/dist/routes.cjs +28 -28
- package/dist/routes.js +5 -5
- package/dist/services.cjs +2 -2
- package/dist/services.d.cts +1 -1
- package/dist/services.d.ts +1 -1
- package/dist/services.js +1 -1
- package/dist/templates.cjs +19 -19
- package/dist/templates.js +2 -2
- package/dist/utils.cjs +11 -11
- package/dist/utils.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-3V2CQFIR.js.map +0 -1
- package/dist/chunk-6C6W54QP.js.map +0 -1
- package/dist/chunk-76TX6XND.js.map +0 -1
- package/dist/chunk-DHTCZZUB.cjs.map +0 -1
- package/dist/chunk-H4NHRZ6Y.cjs.map +0 -1
- package/dist/chunk-XK3TKOLQ.cjs.map +0 -1
- package/dist/migrations-AH2XIFSA.js +0 -4
- package/dist/migrations-MIZFGFNS.cjs +0 -13
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkNZWFCUDA_cjs = require('./chunk-NZWFCUDA.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkYYMPHM3I_cjs = require('./chunk-YYMPHM3I.cjs');
|
|
5
5
|
var chunkI6FFGQIT_cjs = require('./chunk-I6FFGQIT.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkKZ2MFGET_cjs = require('./chunk-KZ2MFGET.cjs');
|
|
7
|
+
var chunkQP3OHHON_cjs = require('./chunk-QP3OHHON.cjs');
|
|
8
8
|
var chunk6FHNRRJ3_cjs = require('./chunk-6FHNRRJ3.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkYULUPQZV_cjs = require('./chunk-YULUPQZV.cjs');
|
|
10
10
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
11
11
|
var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
|
|
12
12
|
var hono = require('hono');
|
|
@@ -188,7 +188,7 @@ apiContentCrudRoutes.get("/:id", async (c) => {
|
|
|
188
188
|
}, 500);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
apiContentCrudRoutes.post("/",
|
|
191
|
+
apiContentCrudRoutes.post("/", chunkYYMPHM3I_cjs.requireAuth(), chunkYYMPHM3I_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
192
192
|
try {
|
|
193
193
|
const db = c.env.DB;
|
|
194
194
|
const user = c.get("user");
|
|
@@ -254,7 +254,7 @@ apiContentCrudRoutes.post("/", chunkHBUFGLEX_cjs.requireAuth(), chunkHBUFGLEX_cj
|
|
|
254
254
|
}, 500);
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
|
-
apiContentCrudRoutes.put("/:id",
|
|
257
|
+
apiContentCrudRoutes.put("/:id", chunkYYMPHM3I_cjs.requireAuth(), chunkYYMPHM3I_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
258
258
|
try {
|
|
259
259
|
const id = c.req.param("id");
|
|
260
260
|
const db = c.env.DB;
|
|
@@ -318,7 +318,7 @@ apiContentCrudRoutes.put("/:id", chunkHBUFGLEX_cjs.requireAuth(), chunkHBUFGLEX_
|
|
|
318
318
|
}, 500);
|
|
319
319
|
}
|
|
320
320
|
});
|
|
321
|
-
apiContentCrudRoutes.delete("/:id",
|
|
321
|
+
apiContentCrudRoutes.delete("/:id", chunkYYMPHM3I_cjs.requireAuth(), chunkYYMPHM3I_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
322
322
|
try {
|
|
323
323
|
const id = c.req.param("id");
|
|
324
324
|
const db = c.env.DB;
|
|
@@ -354,7 +354,7 @@ apiRoutes.use("*", async (c, next) => {
|
|
|
354
354
|
c.header("X-Response-Time", `${totalTime}ms`);
|
|
355
355
|
});
|
|
356
356
|
apiRoutes.use("*", async (c, next) => {
|
|
357
|
-
const cacheEnabled = await
|
|
357
|
+
const cacheEnabled = await chunkYYMPHM3I_cjs.isPluginActive(c.env.DB, "core-cache");
|
|
358
358
|
c.set("cacheEnabled", cacheEnabled);
|
|
359
359
|
await next();
|
|
360
360
|
});
|
|
@@ -845,7 +845,7 @@ apiRoutes.get("/collections", async (c) => {
|
|
|
845
845
|
return c.json({ error: "Failed to fetch collections" }, 500);
|
|
846
846
|
}
|
|
847
847
|
});
|
|
848
|
-
apiRoutes.get("/content",
|
|
848
|
+
apiRoutes.get("/content", chunkYYMPHM3I_cjs.optionalAuth(), async (c) => {
|
|
849
849
|
const executionStart = Date.now();
|
|
850
850
|
try {
|
|
851
851
|
const db = c.env.DB;
|
|
@@ -868,13 +868,13 @@ apiRoutes.get("/content", chunkHBUFGLEX_cjs.optionalAuth(), async (c) => {
|
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
|
-
const filter =
|
|
871
|
+
const filter = chunkYULUPQZV_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
872
872
|
const normalizedFilter = normalizePublicContentFilter(filter, c.get("user")?.role);
|
|
873
873
|
if (!normalizedFilter.limit) {
|
|
874
874
|
normalizedFilter.limit = 50;
|
|
875
875
|
}
|
|
876
876
|
normalizedFilter.limit = Math.min(normalizedFilter.limit, 1e3);
|
|
877
|
-
const builder3 = new
|
|
877
|
+
const builder3 = new chunkYULUPQZV_cjs.QueryFilterBuilder();
|
|
878
878
|
const queryResult = builder3.build("content", normalizedFilter);
|
|
879
879
|
if (queryResult.errors.length > 0) {
|
|
880
880
|
return c.json({
|
|
@@ -946,7 +946,7 @@ apiRoutes.get("/content", chunkHBUFGLEX_cjs.optionalAuth(), async (c) => {
|
|
|
946
946
|
}, 500);
|
|
947
947
|
}
|
|
948
948
|
});
|
|
949
|
-
apiRoutes.get("/collections/:collection/content",
|
|
949
|
+
apiRoutes.get("/collections/:collection/content", chunkYYMPHM3I_cjs.optionalAuth(), async (c) => {
|
|
950
950
|
const executionStart = Date.now();
|
|
951
951
|
try {
|
|
952
952
|
const collection = c.req.param("collection");
|
|
@@ -957,7 +957,7 @@ apiRoutes.get("/collections/:collection/content", chunkHBUFGLEX_cjs.optionalAuth
|
|
|
957
957
|
if (!collectionResult) {
|
|
958
958
|
return c.json({ error: "Collection not found" }, 404);
|
|
959
959
|
}
|
|
960
|
-
const filter =
|
|
960
|
+
const filter = chunkYULUPQZV_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
961
961
|
const normalizedFilter = normalizePublicContentFilter(filter, c.get("user")?.role);
|
|
962
962
|
if (!normalizedFilter.where) {
|
|
963
963
|
normalizedFilter.where = { and: [] };
|
|
@@ -974,7 +974,7 @@ apiRoutes.get("/collections/:collection/content", chunkHBUFGLEX_cjs.optionalAuth
|
|
|
974
974
|
normalizedFilter.limit = 50;
|
|
975
975
|
}
|
|
976
976
|
normalizedFilter.limit = Math.min(normalizedFilter.limit, 1e3);
|
|
977
|
-
const builder3 = new
|
|
977
|
+
const builder3 = new chunkYULUPQZV_cjs.QueryFilterBuilder();
|
|
978
978
|
const queryResult = builder3.build("content", normalizedFilter);
|
|
979
979
|
if (queryResult.errors.length > 0) {
|
|
980
980
|
return c.json({
|
|
@@ -1095,7 +1095,7 @@ var fileValidationSchema = zod.z.object({
|
|
|
1095
1095
|
// 50MB max
|
|
1096
1096
|
});
|
|
1097
1097
|
var apiMediaRoutes = new hono.Hono();
|
|
1098
|
-
apiMediaRoutes.use("*",
|
|
1098
|
+
apiMediaRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
1099
1099
|
apiMediaRoutes.post("/upload", async (c) => {
|
|
1100
1100
|
try {
|
|
1101
1101
|
const user = c.get("user");
|
|
@@ -1138,8 +1138,8 @@ apiMediaRoutes.post("/upload", async (c) => {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
const bucketName = c.env.BUCKET_NAME || "sonicjs-media-dev";
|
|
1140
1140
|
const publicUrl = `https://pub-${bucketName}.r2.dev/${r2Key}`;
|
|
1141
|
-
let width;
|
|
1142
|
-
let height;
|
|
1141
|
+
let width = null;
|
|
1142
|
+
let height = null;
|
|
1143
1143
|
if (file.type.startsWith("image/") && !file.type.includes("svg")) {
|
|
1144
1144
|
try {
|
|
1145
1145
|
const dimensions = await getImageDimensions(arrayBuffer);
|
|
@@ -1149,7 +1149,7 @@ apiMediaRoutes.post("/upload", async (c) => {
|
|
|
1149
1149
|
console.warn("Failed to extract image dimensions:", error);
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
|
-
let thumbnailUrl;
|
|
1152
|
+
let thumbnailUrl = null;
|
|
1153
1153
|
if (file.type.startsWith("image/") && c.env.IMAGES_ACCOUNT_ID) {
|
|
1154
1154
|
thumbnailUrl = `https://imagedelivery.net/${c.env.IMAGES_ACCOUNT_ID}/${r2Key}/thumbnail`;
|
|
1155
1155
|
}
|
|
@@ -1181,12 +1181,12 @@ apiMediaRoutes.post("/upload", async (c) => {
|
|
|
1181
1181
|
mediaRecord.original_name,
|
|
1182
1182
|
mediaRecord.mime_type,
|
|
1183
1183
|
mediaRecord.size,
|
|
1184
|
-
mediaRecord.width
|
|
1185
|
-
mediaRecord.height
|
|
1184
|
+
mediaRecord.width,
|
|
1185
|
+
mediaRecord.height,
|
|
1186
1186
|
mediaRecord.folder,
|
|
1187
1187
|
mediaRecord.r2_key,
|
|
1188
1188
|
mediaRecord.public_url,
|
|
1189
|
-
mediaRecord.thumbnail_url
|
|
1189
|
+
mediaRecord.thumbnail_url,
|
|
1190
1190
|
mediaRecord.uploaded_by,
|
|
1191
1191
|
mediaRecord.uploaded_at
|
|
1192
1192
|
).run();
|
|
@@ -1269,8 +1269,8 @@ apiMediaRoutes.post("/upload-multiple", async (c) => {
|
|
|
1269
1269
|
}
|
|
1270
1270
|
const bucketName = c.env.BUCKET_NAME || "sonicjs-media-dev";
|
|
1271
1271
|
const publicUrl = `https://pub-${bucketName}.r2.dev/${r2Key}`;
|
|
1272
|
-
let width;
|
|
1273
|
-
let height;
|
|
1272
|
+
let width = null;
|
|
1273
|
+
let height = null;
|
|
1274
1274
|
if (file.type.startsWith("image/") && !file.type.includes("svg")) {
|
|
1275
1275
|
try {
|
|
1276
1276
|
const dimensions = await getImageDimensions(arrayBuffer);
|
|
@@ -1280,7 +1280,7 @@ apiMediaRoutes.post("/upload-multiple", async (c) => {
|
|
|
1280
1280
|
console.warn("Failed to extract image dimensions:", error);
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
|
-
let thumbnailUrl;
|
|
1283
|
+
let thumbnailUrl = null;
|
|
1284
1284
|
if (file.type.startsWith("image/") && c.env.IMAGES_ACCOUNT_ID) {
|
|
1285
1285
|
thumbnailUrl = `https://imagedelivery.net/${c.env.IMAGES_ACCOUNT_ID}/${r2Key}/thumbnail`;
|
|
1286
1286
|
}
|
|
@@ -1311,12 +1311,12 @@ apiMediaRoutes.post("/upload-multiple", async (c) => {
|
|
|
1311
1311
|
mediaRecord.original_name,
|
|
1312
1312
|
mediaRecord.mime_type,
|
|
1313
1313
|
mediaRecord.size,
|
|
1314
|
-
mediaRecord.width
|
|
1315
|
-
mediaRecord.height
|
|
1314
|
+
mediaRecord.width,
|
|
1315
|
+
mediaRecord.height,
|
|
1316
1316
|
mediaRecord.folder,
|
|
1317
1317
|
mediaRecord.r2_key,
|
|
1318
1318
|
mediaRecord.public_url,
|
|
1319
|
-
mediaRecord.thumbnail_url
|
|
1319
|
+
mediaRecord.thumbnail_url,
|
|
1320
1320
|
mediaRecord.uploaded_by,
|
|
1321
1321
|
mediaRecord.uploaded_at
|
|
1322
1322
|
).run();
|
|
@@ -1839,8 +1839,8 @@ apiSystemRoutes.get("/env", (c) => {
|
|
|
1839
1839
|
});
|
|
1840
1840
|
var api_system_default = apiSystemRoutes;
|
|
1841
1841
|
var adminApiRoutes = new hono.Hono();
|
|
1842
|
-
adminApiRoutes.use("*",
|
|
1843
|
-
adminApiRoutes.use("*",
|
|
1842
|
+
adminApiRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
1843
|
+
adminApiRoutes.use("*", chunkYYMPHM3I_cjs.requireRole(["admin", "editor"]));
|
|
1844
1844
|
adminApiRoutes.get("/stats", async (c) => {
|
|
1845
1845
|
try {
|
|
1846
1846
|
const db = c.env.DB;
|
|
@@ -2352,7 +2352,7 @@ adminApiRoutes.delete("/collections/:id", async (c) => {
|
|
|
2352
2352
|
});
|
|
2353
2353
|
adminApiRoutes.get("/migrations/status", async (c) => {
|
|
2354
2354
|
try {
|
|
2355
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2355
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-F7KVA74T.cjs');
|
|
2356
2356
|
const db = c.env.DB;
|
|
2357
2357
|
const migrationService = new MigrationService2(db);
|
|
2358
2358
|
const status = await migrationService.getMigrationStatus();
|
|
@@ -2377,26 +2377,29 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
2377
2377
|
error: "Unauthorized. Admin access required."
|
|
2378
2378
|
}, 403);
|
|
2379
2379
|
}
|
|
2380
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2380
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-F7KVA74T.cjs');
|
|
2381
2381
|
const db = c.env.DB;
|
|
2382
2382
|
const migrationService = new MigrationService2(db);
|
|
2383
2383
|
const result = await migrationService.runPendingMigrations();
|
|
2384
2384
|
return c.json({
|
|
2385
2385
|
success: result.success,
|
|
2386
2386
|
message: result.message,
|
|
2387
|
-
applied: result.applied
|
|
2387
|
+
applied: result.applied,
|
|
2388
|
+
errors: result.errors
|
|
2388
2389
|
});
|
|
2389
2390
|
} catch (error) {
|
|
2390
2391
|
console.error("Error running migrations:", error);
|
|
2392
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2391
2393
|
return c.json({
|
|
2392
2394
|
success: false,
|
|
2393
|
-
error:
|
|
2395
|
+
error: `Failed to run migrations: ${errorMessage}`,
|
|
2396
|
+
errors: [errorMessage]
|
|
2394
2397
|
}, 500);
|
|
2395
2398
|
}
|
|
2396
2399
|
});
|
|
2397
2400
|
adminApiRoutes.get("/migrations/validate", async (c) => {
|
|
2398
2401
|
try {
|
|
2399
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2402
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-F7KVA74T.cjs');
|
|
2400
2403
|
const db = c.env.DB;
|
|
2401
2404
|
const migrationService = new MigrationService2(db);
|
|
2402
2405
|
const validation = await migrationService.validateSchema();
|
|
@@ -2471,8 +2474,8 @@ function renderLoginPage(data, demoLoginActive = false) {
|
|
|
2471
2474
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2472
2475
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2473
2476
|
<!-- Alerts -->
|
|
2474
|
-
${data.error ? `<div class="mb-6">${
|
|
2475
|
-
${data.message ? `<div class="mb-6">${
|
|
2477
|
+
${data.error ? `<div class="mb-6">${chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2478
|
+
${data.message ? `<div class="mb-6">${chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
|
|
2476
2479
|
|
|
2477
2480
|
<!-- Form Response (HTMX target) -->
|
|
2478
2481
|
<div id="form-response" class="mb-6"></div>
|
|
@@ -2636,7 +2639,7 @@ function renderRegisterPage(data) {
|
|
|
2636
2639
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2637
2640
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2638
2641
|
<!-- Alerts -->
|
|
2639
|
-
${data.error ? `<div class="mb-6">${
|
|
2642
|
+
${data.error ? `<div class="mb-6">${chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2640
2643
|
|
|
2641
2644
|
<!-- Form -->
|
|
2642
2645
|
<form
|
|
@@ -3624,7 +3627,10 @@ function renderDynamicField(field, options = {}) {
|
|
|
3624
3627
|
`;
|
|
3625
3628
|
break;
|
|
3626
3629
|
case "select":
|
|
3627
|
-
const selectOptions = opts.options ||
|
|
3630
|
+
const selectOptions = opts.options || (Array.isArray(opts.enum) ? opts.enum.map((optionValue, index) => ({
|
|
3631
|
+
value: optionValue,
|
|
3632
|
+
label: opts.enumLabels?.[index] || optionValue
|
|
3633
|
+
})) : []);
|
|
3628
3634
|
const multiple = opts.multiple ? "multiple" : "";
|
|
3629
3635
|
const selectedValues = Array.isArray(value) ? value : [value];
|
|
3630
3636
|
fieldHTML = `
|
|
@@ -5055,7 +5061,7 @@ function renderCustomProfileSection(config, customData) {
|
|
|
5055
5061
|
}).join("\n");
|
|
5056
5062
|
return `
|
|
5057
5063
|
<!-- Custom Profile Fields -->
|
|
5058
|
-
<div class="
|
|
5064
|
+
<div class="py-6 border-t border-b border-zinc-950/5 dark:border-white/5">
|
|
5059
5065
|
<h3 class="text-base font-semibold text-zinc-950 dark:text-white mb-4">Custom Profile Fields</h3>
|
|
5060
5066
|
<div class="space-y-4">
|
|
5061
5067
|
${fieldsHtml}
|
|
@@ -5146,7 +5152,7 @@ var JWT_SECRET_FALLBACK = "your-super-secret-jwt-key-change-in-production";
|
|
|
5146
5152
|
async function setCsrfCookie(c) {
|
|
5147
5153
|
const secret = c.env?.JWT_SECRET || JWT_SECRET_FALLBACK;
|
|
5148
5154
|
const isDev = c.env?.ENVIRONMENT === "development" || !c.env?.ENVIRONMENT;
|
|
5149
|
-
const csrfToken = await
|
|
5155
|
+
const csrfToken = await chunkYYMPHM3I_cjs.generateCsrfToken(secret);
|
|
5150
5156
|
cookie.setCookie(c, "csrf_token", csrfToken, {
|
|
5151
5157
|
httpOnly: false,
|
|
5152
5158
|
secure: !isDev,
|
|
@@ -5203,7 +5209,7 @@ var loginSchema = zod.z.object({
|
|
|
5203
5209
|
});
|
|
5204
5210
|
authRoutes.post(
|
|
5205
5211
|
"/register",
|
|
5206
|
-
|
|
5212
|
+
chunkYYMPHM3I_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5207
5213
|
async (c) => {
|
|
5208
5214
|
try {
|
|
5209
5215
|
const db = c.env.DB;
|
|
@@ -5240,7 +5246,7 @@ authRoutes.post(
|
|
|
5240
5246
|
if (existingUser) {
|
|
5241
5247
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
5242
5248
|
}
|
|
5243
|
-
const passwordHash = await
|
|
5249
|
+
const passwordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(password);
|
|
5244
5250
|
const userId = crypto.randomUUID();
|
|
5245
5251
|
const now = /* @__PURE__ */ new Date();
|
|
5246
5252
|
await db.prepare(`
|
|
@@ -5274,7 +5280,7 @@ authRoutes.post(
|
|
|
5274
5280
|
await saveCustomData(db, userId, sanitized);
|
|
5275
5281
|
}
|
|
5276
5282
|
}
|
|
5277
|
-
const token = await
|
|
5283
|
+
const token = await chunkYYMPHM3I_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET);
|
|
5278
5284
|
cookie.setCookie(c, "auth_token", token, {
|
|
5279
5285
|
httpOnly: true,
|
|
5280
5286
|
secure: true,
|
|
@@ -5308,7 +5314,7 @@ authRoutes.post(
|
|
|
5308
5314
|
);
|
|
5309
5315
|
authRoutes.post(
|
|
5310
5316
|
"/login",
|
|
5311
|
-
|
|
5317
|
+
chunkYYMPHM3I_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5312
5318
|
async (c) => {
|
|
5313
5319
|
try {
|
|
5314
5320
|
const body = await c.req.json();
|
|
@@ -5331,19 +5337,19 @@ authRoutes.post(
|
|
|
5331
5337
|
if (!user) {
|
|
5332
5338
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5333
5339
|
}
|
|
5334
|
-
const isValidPassword = await
|
|
5340
|
+
const isValidPassword = await chunkYYMPHM3I_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5335
5341
|
if (!isValidPassword) {
|
|
5336
5342
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5337
5343
|
}
|
|
5338
|
-
if (
|
|
5344
|
+
if (chunkYYMPHM3I_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5339
5345
|
try {
|
|
5340
|
-
const newHash = await
|
|
5346
|
+
const newHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(password);
|
|
5341
5347
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5342
5348
|
} catch (rehashError) {
|
|
5343
5349
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5344
5350
|
}
|
|
5345
5351
|
}
|
|
5346
|
-
const token = await
|
|
5352
|
+
const token = await chunkYYMPHM3I_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5347
5353
|
cookie.setCookie(c, "auth_token", token, {
|
|
5348
5354
|
httpOnly: true,
|
|
5349
5355
|
secure: true,
|
|
@@ -5396,7 +5402,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
5396
5402
|
clearCsrfCookie(c);
|
|
5397
5403
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
5398
5404
|
});
|
|
5399
|
-
authRoutes.get("/me",
|
|
5405
|
+
authRoutes.get("/me", chunkYYMPHM3I_cjs.requireAuth(), async (c) => {
|
|
5400
5406
|
try {
|
|
5401
5407
|
const user = c.get("user");
|
|
5402
5408
|
if (!user) {
|
|
@@ -5413,13 +5419,13 @@ authRoutes.get("/me", chunkHBUFGLEX_cjs.requireAuth(), async (c) => {
|
|
|
5413
5419
|
return c.json({ error: "Failed to get user" }, 500);
|
|
5414
5420
|
}
|
|
5415
5421
|
});
|
|
5416
|
-
authRoutes.post("/refresh",
|
|
5422
|
+
authRoutes.post("/refresh", chunkYYMPHM3I_cjs.requireAuth(), async (c) => {
|
|
5417
5423
|
try {
|
|
5418
5424
|
const user = c.get("user");
|
|
5419
5425
|
if (!user) {
|
|
5420
5426
|
return c.json({ error: "Not authenticated" }, 401);
|
|
5421
5427
|
}
|
|
5422
|
-
const token = await
|
|
5428
|
+
const token = await chunkYYMPHM3I_cjs.AuthManager.generateToken(user.userId, user.email, user.role, c.env.JWT_SECRET);
|
|
5423
5429
|
cookie.setCookie(c, "auth_token", token, {
|
|
5424
5430
|
httpOnly: true,
|
|
5425
5431
|
secure: true,
|
|
@@ -5436,7 +5442,7 @@ authRoutes.post("/refresh", chunkHBUFGLEX_cjs.requireAuth(), async (c) => {
|
|
|
5436
5442
|
});
|
|
5437
5443
|
authRoutes.post(
|
|
5438
5444
|
"/register/form",
|
|
5439
|
-
|
|
5445
|
+
chunkYYMPHM3I_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5440
5446
|
async (c) => {
|
|
5441
5447
|
try {
|
|
5442
5448
|
const db = c.env.DB;
|
|
@@ -5483,7 +5489,7 @@ authRoutes.post(
|
|
|
5483
5489
|
</div>
|
|
5484
5490
|
`);
|
|
5485
5491
|
}
|
|
5486
|
-
const passwordHash = await
|
|
5492
|
+
const passwordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(password);
|
|
5487
5493
|
const role = isFirstUser ? "admin" : "viewer";
|
|
5488
5494
|
const userId = crypto.randomUUID();
|
|
5489
5495
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -5518,7 +5524,7 @@ authRoutes.post(
|
|
|
5518
5524
|
await saveCustomData(db, userId, sanitized);
|
|
5519
5525
|
}
|
|
5520
5526
|
}
|
|
5521
|
-
const token = await
|
|
5527
|
+
const token = await chunkYYMPHM3I_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET);
|
|
5522
5528
|
cookie.setCookie(c, "auth_token", token, {
|
|
5523
5529
|
httpOnly: true,
|
|
5524
5530
|
secure: false,
|
|
@@ -5551,7 +5557,7 @@ authRoutes.post(
|
|
|
5551
5557
|
);
|
|
5552
5558
|
authRoutes.post(
|
|
5553
5559
|
"/login/form",
|
|
5554
|
-
|
|
5560
|
+
chunkYYMPHM3I_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5555
5561
|
async (c) => {
|
|
5556
5562
|
try {
|
|
5557
5563
|
const formData = await c.req.formData();
|
|
@@ -5575,7 +5581,7 @@ authRoutes.post(
|
|
|
5575
5581
|
</div>
|
|
5576
5582
|
`);
|
|
5577
5583
|
}
|
|
5578
|
-
const isValidPassword = await
|
|
5584
|
+
const isValidPassword = await chunkYYMPHM3I_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5579
5585
|
if (!isValidPassword) {
|
|
5580
5586
|
return c.html(html.html`
|
|
5581
5587
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -5583,15 +5589,15 @@ authRoutes.post(
|
|
|
5583
5589
|
</div>
|
|
5584
5590
|
`);
|
|
5585
5591
|
}
|
|
5586
|
-
if (
|
|
5592
|
+
if (chunkYYMPHM3I_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5587
5593
|
try {
|
|
5588
|
-
const newHash = await
|
|
5594
|
+
const newHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(password);
|
|
5589
5595
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5590
5596
|
} catch (rehashError) {
|
|
5591
5597
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5592
5598
|
}
|
|
5593
5599
|
}
|
|
5594
|
-
const token = await
|
|
5600
|
+
const token = await chunkYYMPHM3I_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5595
5601
|
cookie.setCookie(c, "auth_token", token, {
|
|
5596
5602
|
httpOnly: true,
|
|
5597
5603
|
secure: false,
|
|
@@ -5633,7 +5639,7 @@ authRoutes.post(
|
|
|
5633
5639
|
);
|
|
5634
5640
|
authRoutes.post(
|
|
5635
5641
|
"/seed-admin",
|
|
5636
|
-
|
|
5642
|
+
chunkYYMPHM3I_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
|
|
5637
5643
|
async (c) => {
|
|
5638
5644
|
try {
|
|
5639
5645
|
const db = c.env.DB;
|
|
@@ -5655,7 +5661,7 @@ authRoutes.post(
|
|
|
5655
5661
|
`).run();
|
|
5656
5662
|
const existingAdmin = await db.prepare("SELECT id FROM users WHERE email = ? OR username = ?").bind("admin@sonicjs.com", "admin").first();
|
|
5657
5663
|
if (existingAdmin) {
|
|
5658
|
-
const passwordHash2 = await
|
|
5664
|
+
const passwordHash2 = await chunkYYMPHM3I_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5659
5665
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(passwordHash2, Date.now(), existingAdmin.id).run();
|
|
5660
5666
|
return c.json({
|
|
5661
5667
|
message: "Admin user already exists (password updated)",
|
|
@@ -5667,7 +5673,7 @@ authRoutes.post(
|
|
|
5667
5673
|
}
|
|
5668
5674
|
});
|
|
5669
5675
|
}
|
|
5670
|
-
const passwordHash = await
|
|
5676
|
+
const passwordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5671
5677
|
const userId = "admin-user-id";
|
|
5672
5678
|
const now = Date.now();
|
|
5673
5679
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -5888,7 +5894,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5888
5894
|
if (existingUsername) {
|
|
5889
5895
|
return c.json({ error: "Username is already taken" }, 400);
|
|
5890
5896
|
}
|
|
5891
|
-
const passwordHash = await
|
|
5897
|
+
const passwordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(password);
|
|
5892
5898
|
const updateStmt = db.prepare(`
|
|
5893
5899
|
UPDATE users SET
|
|
5894
5900
|
username = ?,
|
|
@@ -5907,7 +5913,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5907
5913
|
Date.now(),
|
|
5908
5914
|
invitedUser.id
|
|
5909
5915
|
).run();
|
|
5910
|
-
const authToken = await
|
|
5916
|
+
const authToken = await chunkYYMPHM3I_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET);
|
|
5911
5917
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
5912
5918
|
httpOnly: true,
|
|
5913
5919
|
secure: true,
|
|
@@ -5924,7 +5930,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5924
5930
|
});
|
|
5925
5931
|
authRoutes.post(
|
|
5926
5932
|
"/request-password-reset",
|
|
5927
|
-
|
|
5933
|
+
chunkYYMPHM3I_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
|
|
5928
5934
|
async (c) => {
|
|
5929
5935
|
try {
|
|
5930
5936
|
const formData = await c.req.formData();
|
|
@@ -6142,7 +6148,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
6142
6148
|
if (Date.now() > user.password_reset_expires) {
|
|
6143
6149
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
6144
6150
|
}
|
|
6145
|
-
const newPasswordHash = await
|
|
6151
|
+
const newPasswordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(password);
|
|
6146
6152
|
try {
|
|
6147
6153
|
const historyStmt = db.prepare(`
|
|
6148
6154
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -7110,7 +7116,7 @@ function createQuillEditorPlugin() {
|
|
|
7110
7116
|
createQuillEditorPlugin();
|
|
7111
7117
|
|
|
7112
7118
|
// src/templates/pages/admin-content-form.template.ts
|
|
7113
|
-
|
|
7119
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
7114
7120
|
function renderContentFormPage(data) {
|
|
7115
7121
|
const isEdit = data.isEdit || !!data.id;
|
|
7116
7122
|
const title = isEdit ? `Edit: ${data.title || "Content"}` : `New ${data.collection.display_name}`;
|
|
@@ -7191,8 +7197,8 @@ function renderContentFormPage(data) {
|
|
|
7191
7197
|
<!-- Form Content -->
|
|
7192
7198
|
<div class="px-6 py-6">
|
|
7193
7199
|
<div id="form-messages">
|
|
7194
|
-
${data.error ?
|
|
7195
|
-
${data.success ?
|
|
7200
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7201
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7196
7202
|
</div>
|
|
7197
7203
|
|
|
7198
7204
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -7428,7 +7434,7 @@ function renderContentFormPage(data) {
|
|
|
7428
7434
|
</div>
|
|
7429
7435
|
|
|
7430
7436
|
<!-- Confirmation Dialogs -->
|
|
7431
|
-
${
|
|
7437
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7432
7438
|
id: "duplicate-content-confirm",
|
|
7433
7439
|
title: "Duplicate Content",
|
|
7434
7440
|
message: "Create a copy of this content?",
|
|
@@ -7439,7 +7445,7 @@ function renderContentFormPage(data) {
|
|
|
7439
7445
|
onConfirm: "performDuplicateContent()"
|
|
7440
7446
|
})}
|
|
7441
7447
|
|
|
7442
|
-
${
|
|
7448
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7443
7449
|
id: "delete-content-confirm",
|
|
7444
7450
|
title: "Delete Content",
|
|
7445
7451
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -7450,7 +7456,7 @@ function renderContentFormPage(data) {
|
|
|
7450
7456
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
7451
7457
|
})}
|
|
7452
7458
|
|
|
7453
|
-
${
|
|
7459
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7454
7460
|
id: "delete-repeater-item-confirm",
|
|
7455
7461
|
title: "Delete Item",
|
|
7456
7462
|
message: "Are you sure you want to delete this item? This action cannot be undone.",
|
|
@@ -7461,7 +7467,7 @@ function renderContentFormPage(data) {
|
|
|
7461
7467
|
onConfirm: "performRepeaterDelete()"
|
|
7462
7468
|
})}
|
|
7463
7469
|
|
|
7464
|
-
${
|
|
7470
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7465
7471
|
id: "delete-block-confirm",
|
|
7466
7472
|
title: "Delete Block",
|
|
7467
7473
|
message: "Are you sure you want to delete this block? This action cannot be undone.",
|
|
@@ -7472,7 +7478,7 @@ function renderContentFormPage(data) {
|
|
|
7472
7478
|
onConfirm: "performRepeaterDelete()"
|
|
7473
7479
|
})}
|
|
7474
7480
|
|
|
7475
|
-
${
|
|
7481
|
+
${chunkQP3OHHON_cjs.getConfirmationDialogScript()}
|
|
7476
7482
|
|
|
7477
7483
|
${data.tinymceEnabled ? getTinyMCEScript(data.tinymceSettings?.apiKey) : "<!-- TinyMCE plugin not active -->"}
|
|
7478
7484
|
|
|
@@ -8547,11 +8553,11 @@ function renderContentFormPage(data) {
|
|
|
8547
8553
|
content: pageContent,
|
|
8548
8554
|
version: data.version
|
|
8549
8555
|
};
|
|
8550
|
-
return
|
|
8556
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8551
8557
|
}
|
|
8552
8558
|
|
|
8553
8559
|
// src/templates/pages/admin-content-list.template.ts
|
|
8554
|
-
|
|
8560
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
8555
8561
|
function renderContentListPage(data) {
|
|
8556
8562
|
const urlParams = new URLSearchParams();
|
|
8557
8563
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -8955,8 +8961,8 @@ function renderContentListPage(data) {
|
|
|
8955
8961
|
|
|
8956
8962
|
<!-- Content List -->
|
|
8957
8963
|
<div id="content-list">
|
|
8958
|
-
${
|
|
8959
|
-
${
|
|
8964
|
+
${chunkQP3OHHON_cjs.renderTable(tableData)}
|
|
8965
|
+
${chunkQP3OHHON_cjs.renderPagination(paginationData)}
|
|
8960
8966
|
</div>
|
|
8961
8967
|
|
|
8962
8968
|
</div>
|
|
@@ -9166,7 +9172,7 @@ function renderContentListPage(data) {
|
|
|
9166
9172
|
</script>
|
|
9167
9173
|
|
|
9168
9174
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
9169
|
-
${
|
|
9175
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
9170
9176
|
id: "bulk-action-confirm",
|
|
9171
9177
|
title: "Confirm Bulk Action",
|
|
9172
9178
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -9178,7 +9184,7 @@ function renderContentListPage(data) {
|
|
|
9178
9184
|
})}
|
|
9179
9185
|
|
|
9180
9186
|
<!-- Confirmation Dialog Script -->
|
|
9181
|
-
${
|
|
9187
|
+
${chunkQP3OHHON_cjs.getConfirmationDialogScript()}
|
|
9182
9188
|
|
|
9183
9189
|
<!-- Advanced Search Modal -->
|
|
9184
9190
|
<div id="advancedSearchModal" class="hidden fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
|
@@ -9475,7 +9481,7 @@ function renderContentListPage(data) {
|
|
|
9475
9481
|
version: data.version,
|
|
9476
9482
|
content: pageContent
|
|
9477
9483
|
};
|
|
9478
|
-
return
|
|
9484
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
9479
9485
|
}
|
|
9480
9486
|
|
|
9481
9487
|
// src/routes/admin-content-field-types.ts
|
|
@@ -9518,9 +9524,9 @@ function parseFieldValue(field, formData, options = {}) {
|
|
|
9518
9524
|
const { skipValidation = false } = options;
|
|
9519
9525
|
const value = formData.get(field.field_name);
|
|
9520
9526
|
const errors = [];
|
|
9521
|
-
const blocksConfig =
|
|
9527
|
+
const blocksConfig = chunkYULUPQZV_cjs.getBlocksFieldConfig(field.field_options);
|
|
9522
9528
|
if (blocksConfig) {
|
|
9523
|
-
const parsed =
|
|
9529
|
+
const parsed = chunkYULUPQZV_cjs.parseBlocksValue(value, blocksConfig);
|
|
9524
9530
|
if (!skipValidation && field.is_required && parsed.value.length === 0) {
|
|
9525
9531
|
parsed.errors.push(`${field.field_label} is required`);
|
|
9526
9532
|
}
|
|
@@ -9630,7 +9636,7 @@ function extractFieldData(fields, formData, options = {}) {
|
|
|
9630
9636
|
}
|
|
9631
9637
|
return { data, errors };
|
|
9632
9638
|
}
|
|
9633
|
-
adminContentRoutes.use("*",
|
|
9639
|
+
adminContentRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
9634
9640
|
async function getCollectionFields(db, collectionId) {
|
|
9635
9641
|
const cache = chunkNZWFCUDA_cjs.getCacheService(chunkNZWFCUDA_cjs.CACHE_CONFIGS.collection);
|
|
9636
9642
|
return cache.getOrSet(
|
|
@@ -10321,7 +10327,7 @@ adminContentRoutes.put("/:id", async (c) => {
|
|
|
10321
10327
|
`);
|
|
10322
10328
|
}
|
|
10323
10329
|
});
|
|
10324
|
-
adminContentRoutes.post("/preview",
|
|
10330
|
+
adminContentRoutes.post("/preview", chunkYYMPHM3I_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10325
10331
|
try {
|
|
10326
10332
|
const formData = await c.req.formData();
|
|
10327
10333
|
const collectionId = formData.get("collection_id");
|
|
@@ -10699,7 +10705,7 @@ adminContentRoutes.post("/:id/restore/:version", async (c) => {
|
|
|
10699
10705
|
return c.json({ success: false, error: "Failed to restore version" });
|
|
10700
10706
|
}
|
|
10701
10707
|
});
|
|
10702
|
-
adminContentRoutes.get("/:id/version/:version/preview",
|
|
10708
|
+
adminContentRoutes.get("/:id/version/:version/preview", chunkYYMPHM3I_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10703
10709
|
try {
|
|
10704
10710
|
const id = c.req.param("id");
|
|
10705
10711
|
const version = parseInt(c.req.param("version") || "0");
|
|
@@ -10767,7 +10773,7 @@ ${chunkMNWKYY5E_cjs.escapeHtml(JSON.stringify(data, null, 2))}
|
|
|
10767
10773
|
var admin_content_default = adminContentRoutes;
|
|
10768
10774
|
|
|
10769
10775
|
// src/templates/pages/admin-profile.template.ts
|
|
10770
|
-
|
|
10776
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
10771
10777
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
10772
10778
|
return `<div id="avatar-image-container" class="w-24 h-24 rounded-full mx-auto mb-4 overflow-hidden bg-gradient-to-br from-cyan-400 to-purple-400 flex items-center justify-center ring-4 ring-zinc-950/5 dark:ring-white/10">
|
|
10773
10779
|
${avatarUrl ? `<img src="${avatarUrl}" alt="Profile picture" class="w-full h-full object-cover">` : `<span class="text-2xl font-bold text-white">${firstName.charAt(0)}${lastName.charAt(0)}</span>`}
|
|
@@ -10787,8 +10793,8 @@ function renderProfilePage(data) {
|
|
|
10787
10793
|
</div>
|
|
10788
10794
|
|
|
10789
10795
|
<!-- Alert Messages -->
|
|
10790
|
-
${data.error ?
|
|
10791
|
-
${data.success ?
|
|
10796
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
10797
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
10792
10798
|
|
|
10793
10799
|
<!-- Profile Form -->
|
|
10794
10800
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -11177,7 +11183,7 @@ function renderProfilePage(data) {
|
|
|
11177
11183
|
version: data.version,
|
|
11178
11184
|
content: pageContent
|
|
11179
11185
|
};
|
|
11180
|
-
return
|
|
11186
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
11181
11187
|
}
|
|
11182
11188
|
|
|
11183
11189
|
// src/templates/components/alert.template.ts
|
|
@@ -11460,7 +11466,7 @@ function renderActivityLogsPage(data) {
|
|
|
11460
11466
|
user: data.user,
|
|
11461
11467
|
content: pageContent
|
|
11462
11468
|
};
|
|
11463
|
-
return
|
|
11469
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
11464
11470
|
}
|
|
11465
11471
|
function getActionBadgeClass(action) {
|
|
11466
11472
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -11480,7 +11486,7 @@ function formatAction(action) {
|
|
|
11480
11486
|
}
|
|
11481
11487
|
|
|
11482
11488
|
// src/templates/pages/admin-user-edit.template.ts
|
|
11483
|
-
|
|
11489
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
11484
11490
|
|
|
11485
11491
|
// src/templates/components/confirmation-dialog.template.ts
|
|
11486
11492
|
function renderConfirmationDialog2(options) {
|
|
@@ -11601,8 +11607,8 @@ function renderUserEditPage(data) {
|
|
|
11601
11607
|
|
|
11602
11608
|
<!-- Alert Messages -->
|
|
11603
11609
|
<div id="form-messages">
|
|
11604
|
-
${data.error ?
|
|
11605
|
-
${data.success ?
|
|
11610
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
11611
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
11606
11612
|
</div>
|
|
11607
11613
|
|
|
11608
11614
|
<!-- User Edit Form -->
|
|
@@ -12000,11 +12006,11 @@ function renderUserEditPage(data) {
|
|
|
12000
12006
|
user: data.user,
|
|
12001
12007
|
content: pageContent
|
|
12002
12008
|
};
|
|
12003
|
-
return
|
|
12009
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12004
12010
|
}
|
|
12005
12011
|
|
|
12006
12012
|
// src/templates/pages/admin-user-new.template.ts
|
|
12007
|
-
|
|
12013
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
12008
12014
|
function renderUserNewPage(data) {
|
|
12009
12015
|
const pageContent = `
|
|
12010
12016
|
<div>
|
|
@@ -12043,8 +12049,8 @@ function renderUserNewPage(data) {
|
|
|
12043
12049
|
|
|
12044
12050
|
<!-- Alert Messages -->
|
|
12045
12051
|
<div id="form-messages">
|
|
12046
|
-
${data.error ?
|
|
12047
|
-
${data.success ?
|
|
12052
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
12053
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
12048
12054
|
</div>
|
|
12049
12055
|
|
|
12050
12056
|
<!-- User New Form -->
|
|
@@ -12288,11 +12294,11 @@ function renderUserNewPage(data) {
|
|
|
12288
12294
|
user: data.user,
|
|
12289
12295
|
content: pageContent
|
|
12290
12296
|
};
|
|
12291
|
-
return
|
|
12297
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12292
12298
|
}
|
|
12293
12299
|
|
|
12294
12300
|
// src/templates/pages/admin-users-list.template.ts
|
|
12295
|
-
|
|
12301
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
12296
12302
|
function renderUsersListPage(data) {
|
|
12297
12303
|
const columns = [
|
|
12298
12304
|
{
|
|
@@ -12443,8 +12449,8 @@ function renderUsersListPage(data) {
|
|
|
12443
12449
|
</div>
|
|
12444
12450
|
|
|
12445
12451
|
<!-- Alert Messages -->
|
|
12446
|
-
${data.error ?
|
|
12447
|
-
${data.success ?
|
|
12452
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
12453
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
12448
12454
|
|
|
12449
12455
|
<!-- Stats -->
|
|
12450
12456
|
<div class="mb-6">
|
|
@@ -12621,10 +12627,10 @@ function renderUsersListPage(data) {
|
|
|
12621
12627
|
</div>
|
|
12622
12628
|
|
|
12623
12629
|
<!-- Users Table -->
|
|
12624
|
-
${
|
|
12630
|
+
${chunkQP3OHHON_cjs.renderTable(tableData)}
|
|
12625
12631
|
|
|
12626
12632
|
<!-- Pagination -->
|
|
12627
|
-
${data.pagination ?
|
|
12633
|
+
${data.pagination ? chunkQP3OHHON_cjs.renderPagination(data.pagination) : ""}
|
|
12628
12634
|
</div>
|
|
12629
12635
|
|
|
12630
12636
|
<script>
|
|
@@ -12695,19 +12701,19 @@ function renderUsersListPage(data) {
|
|
|
12695
12701
|
version: data.version,
|
|
12696
12702
|
content: pageContent
|
|
12697
12703
|
};
|
|
12698
|
-
return
|
|
12704
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12699
12705
|
}
|
|
12700
12706
|
|
|
12701
12707
|
// src/routes/admin-users.ts
|
|
12702
12708
|
var userRoutes = new hono.Hono();
|
|
12703
|
-
userRoutes.use("*",
|
|
12704
|
-
userRoutes.use("/users/*",
|
|
12705
|
-
userRoutes.use("/users",
|
|
12706
|
-
userRoutes.use("/invite-user",
|
|
12707
|
-
userRoutes.use("/resend-invitation/*",
|
|
12708
|
-
userRoutes.use("/cancel-invitation/*",
|
|
12709
|
-
userRoutes.use("/activity-logs",
|
|
12710
|
-
userRoutes.use("/activity-logs/*",
|
|
12709
|
+
userRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
12710
|
+
userRoutes.use("/users/*", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
12711
|
+
userRoutes.use("/users", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
12712
|
+
userRoutes.use("/invite-user", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
12713
|
+
userRoutes.use("/resend-invitation/*", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
12714
|
+
userRoutes.use("/cancel-invitation/*", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
12715
|
+
userRoutes.use("/activity-logs", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
12716
|
+
userRoutes.use("/activity-logs/*", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
12711
12717
|
userRoutes.get("/", (c) => {
|
|
12712
12718
|
return c.redirect("/admin/dashboard");
|
|
12713
12719
|
});
|
|
@@ -12877,7 +12883,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
12877
12883
|
}
|
|
12878
12884
|
await saveCustomData(db, user.userId, sanitized);
|
|
12879
12885
|
}
|
|
12880
|
-
await
|
|
12886
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
12881
12887
|
db,
|
|
12882
12888
|
user.userId,
|
|
12883
12889
|
"profile.update",
|
|
@@ -12940,7 +12946,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
12940
12946
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
12941
12947
|
`);
|
|
12942
12948
|
const userData = await userStmt.bind(user.userId).first();
|
|
12943
|
-
await
|
|
12949
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
12944
12950
|
db,
|
|
12945
12951
|
user.userId,
|
|
12946
12952
|
"profile.avatar_update",
|
|
@@ -13011,7 +13017,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13011
13017
|
dismissible: true
|
|
13012
13018
|
}));
|
|
13013
13019
|
}
|
|
13014
|
-
const validPassword = await
|
|
13020
|
+
const validPassword = await chunkYYMPHM3I_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
13015
13021
|
if (!validPassword) {
|
|
13016
13022
|
return c.html(renderAlert2({
|
|
13017
13023
|
type: "error",
|
|
@@ -13019,7 +13025,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13019
13025
|
dismissible: true
|
|
13020
13026
|
}));
|
|
13021
13027
|
}
|
|
13022
|
-
const newPasswordHash = await
|
|
13028
|
+
const newPasswordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(newPassword);
|
|
13023
13029
|
const historyStmt = db.prepare(`
|
|
13024
13030
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
13025
13031
|
VALUES (?, ?, ?, ?)
|
|
@@ -13035,7 +13041,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13035
13041
|
WHERE id = ?
|
|
13036
13042
|
`);
|
|
13037
13043
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
13038
|
-
await
|
|
13044
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13039
13045
|
db,
|
|
13040
13046
|
user.userId,
|
|
13041
13047
|
"profile.password_change",
|
|
@@ -13102,7 +13108,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
13102
13108
|
`);
|
|
13103
13109
|
const countResult = await countStmt.bind(...params).first();
|
|
13104
13110
|
const totalUsers = countResult?.total || 0;
|
|
13105
|
-
await
|
|
13111
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13106
13112
|
db,
|
|
13107
13113
|
user.userId,
|
|
13108
13114
|
"users.list_view",
|
|
@@ -13260,7 +13266,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13260
13266
|
dismissible: true
|
|
13261
13267
|
}));
|
|
13262
13268
|
}
|
|
13263
|
-
const passwordHash = await
|
|
13269
|
+
const passwordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(password);
|
|
13264
13270
|
const userId = crypto.randomUUID();
|
|
13265
13271
|
const createStmt = db.prepare(`
|
|
13266
13272
|
INSERT INTO users (
|
|
@@ -13283,7 +13289,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13283
13289
|
Date.now(),
|
|
13284
13290
|
Date.now()
|
|
13285
13291
|
).run();
|
|
13286
|
-
await
|
|
13292
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13287
13293
|
db,
|
|
13288
13294
|
user.userId,
|
|
13289
13295
|
"user!.create",
|
|
@@ -13322,7 +13328,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
13322
13328
|
if (!userRecord) {
|
|
13323
13329
|
return c.json({ error: "User not found" }, 404);
|
|
13324
13330
|
}
|
|
13325
|
-
await
|
|
13331
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13326
13332
|
db,
|
|
13327
13333
|
user.userId,
|
|
13328
13334
|
"user!.view",
|
|
@@ -13548,14 +13554,14 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13548
13554
|
userId
|
|
13549
13555
|
).run();
|
|
13550
13556
|
if (newPassword) {
|
|
13551
|
-
const passwordHash = await
|
|
13557
|
+
const passwordHash = await chunkYYMPHM3I_cjs.AuthManager.hashPassword(newPassword);
|
|
13552
13558
|
const updatePasswordStmt = db.prepare(`
|
|
13553
13559
|
UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?
|
|
13554
13560
|
`);
|
|
13555
13561
|
await updatePasswordStmt.bind(passwordHash, Date.now(), userId).run();
|
|
13556
13562
|
}
|
|
13557
13563
|
const hasProfileData = profileDisplayName || profileBio || profileCompany || profileJobTitle || profileWebsite || profileLocation || profileDateOfBirth;
|
|
13558
|
-
if (hasProfileData) {
|
|
13564
|
+
if (hasProfileData || customDataJson !== null) {
|
|
13559
13565
|
const now = Date.now();
|
|
13560
13566
|
const profileCheckStmt = db.prepare(`SELECT id FROM user_profiles WHERE user_id = ?`);
|
|
13561
13567
|
const existingProfile = await profileCheckStmt.bind(userId).first();
|
|
@@ -13602,7 +13608,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13602
13608
|
).run();
|
|
13603
13609
|
}
|
|
13604
13610
|
}
|
|
13605
|
-
await
|
|
13611
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13606
13612
|
db,
|
|
13607
13613
|
user.userId,
|
|
13608
13614
|
"user.update",
|
|
@@ -13647,7 +13653,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
|
|
|
13647
13653
|
UPDATE users SET is_active = ?, updated_at = ? WHERE id = ?
|
|
13648
13654
|
`);
|
|
13649
13655
|
await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
|
|
13650
|
-
await
|
|
13656
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13651
13657
|
db,
|
|
13652
13658
|
user.userId,
|
|
13653
13659
|
active ? "user.activate" : "user.deactivate",
|
|
@@ -13688,7 +13694,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13688
13694
|
DELETE FROM users WHERE id = ?
|
|
13689
13695
|
`);
|
|
13690
13696
|
await deleteStmt.bind(userId).run();
|
|
13691
|
-
await
|
|
13697
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13692
13698
|
db,
|
|
13693
13699
|
user.userId,
|
|
13694
13700
|
"user!.hard_delete",
|
|
@@ -13707,7 +13713,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13707
13713
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
13708
13714
|
`);
|
|
13709
13715
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
13710
|
-
await
|
|
13716
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13711
13717
|
db,
|
|
13712
13718
|
user.userId,
|
|
13713
13719
|
"user!.soft_delete",
|
|
@@ -13773,7 +13779,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
13773
13779
|
Date.now(),
|
|
13774
13780
|
Date.now()
|
|
13775
13781
|
).run();
|
|
13776
|
-
await
|
|
13782
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13777
13783
|
db,
|
|
13778
13784
|
user.userId,
|
|
13779
13785
|
"user!.invite_sent",
|
|
@@ -13830,7 +13836,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
13830
13836
|
Date.now(),
|
|
13831
13837
|
userId
|
|
13832
13838
|
).run();
|
|
13833
|
-
await
|
|
13839
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13834
13840
|
db,
|
|
13835
13841
|
user.userId,
|
|
13836
13842
|
"user!.invitation_resent",
|
|
@@ -13866,7 +13872,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
13866
13872
|
}
|
|
13867
13873
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
13868
13874
|
await deleteStmt.bind(userId).run();
|
|
13869
|
-
await
|
|
13875
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13870
13876
|
db,
|
|
13871
13877
|
user.userId,
|
|
13872
13878
|
"user!.invitation_cancelled",
|
|
@@ -13949,7 +13955,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
13949
13955
|
...log,
|
|
13950
13956
|
details: log.details ? JSON.parse(log.details) : null
|
|
13951
13957
|
}));
|
|
13952
|
-
await
|
|
13958
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
13953
13959
|
db,
|
|
13954
13960
|
user.userId,
|
|
13955
13961
|
"activity.logs_viewed",
|
|
@@ -14056,7 +14062,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
14056
14062
|
csvRows.push(row.join(","));
|
|
14057
14063
|
}
|
|
14058
14064
|
const csvContent = csvRows.join("\n");
|
|
14059
|
-
await
|
|
14065
|
+
await chunkYYMPHM3I_cjs.logActivity(
|
|
14060
14066
|
db,
|
|
14061
14067
|
user.userId,
|
|
14062
14068
|
"activity.logs_exported",
|
|
@@ -14274,7 +14280,7 @@ function getFileIcon(mimeType) {
|
|
|
14274
14280
|
}
|
|
14275
14281
|
|
|
14276
14282
|
// src/templates/pages/admin-media-library.template.ts
|
|
14277
|
-
|
|
14283
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
14278
14284
|
function renderMediaLibraryPage(data) {
|
|
14279
14285
|
const pageContent = `
|
|
14280
14286
|
<div>
|
|
@@ -15209,7 +15215,7 @@ function renderMediaLibraryPage(data) {
|
|
|
15209
15215
|
version: data.version,
|
|
15210
15216
|
content: pageContent
|
|
15211
15217
|
};
|
|
15212
|
-
return
|
|
15218
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
15213
15219
|
}
|
|
15214
15220
|
|
|
15215
15221
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -15395,7 +15401,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
15395
15401
|
// 50MB max
|
|
15396
15402
|
});
|
|
15397
15403
|
var adminMediaRoutes = new hono.Hono();
|
|
15398
|
-
adminMediaRoutes.use("*",
|
|
15404
|
+
adminMediaRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
15399
15405
|
adminMediaRoutes.get("/", async (c) => {
|
|
15400
15406
|
try {
|
|
15401
15407
|
const user = c.get("user");
|
|
@@ -15981,7 +15987,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
15981
15987
|
`);
|
|
15982
15988
|
}
|
|
15983
15989
|
});
|
|
15984
|
-
adminMediaRoutes.delete("/cleanup",
|
|
15990
|
+
adminMediaRoutes.delete("/cleanup", chunkYYMPHM3I_cjs.requireRole("admin"), async (c) => {
|
|
15985
15991
|
try {
|
|
15986
15992
|
const db = c.env.DB;
|
|
15987
15993
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -16231,7 +16237,7 @@ function formatFileSize(bytes) {
|
|
|
16231
16237
|
}
|
|
16232
16238
|
|
|
16233
16239
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
16234
|
-
|
|
16240
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
16235
16241
|
function renderPluginsListPage(data) {
|
|
16236
16242
|
const categories = [
|
|
16237
16243
|
{ value: "content", label: "Content Management" },
|
|
@@ -16701,7 +16707,7 @@ function renderPluginsListPage(data) {
|
|
|
16701
16707
|
version: data.version,
|
|
16702
16708
|
content: pageContent
|
|
16703
16709
|
};
|
|
16704
|
-
return
|
|
16710
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
16705
16711
|
}
|
|
16706
16712
|
function renderPluginCard(plugin) {
|
|
16707
16713
|
const statusColors = {
|
|
@@ -17338,7 +17344,7 @@ function renderPluginSettingsPage(data) {
|
|
|
17338
17344
|
user,
|
|
17339
17345
|
content: pageContent
|
|
17340
17346
|
};
|
|
17341
|
-
return
|
|
17347
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
17342
17348
|
}
|
|
17343
17349
|
function renderStatusBadge(status) {
|
|
17344
17350
|
const statusColors = {
|
|
@@ -18206,7 +18212,7 @@ function renderEmailSettingsContent(plugin, settings) {
|
|
|
18206
18212
|
|
|
18207
18213
|
// src/routes/admin-plugins.ts
|
|
18208
18214
|
var adminPluginRoutes = new hono.Hono();
|
|
18209
|
-
adminPluginRoutes.use("*",
|
|
18215
|
+
adminPluginRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
18210
18216
|
var AVAILABLE_PLUGINS = [
|
|
18211
18217
|
{
|
|
18212
18218
|
id: "third-party-faq",
|
|
@@ -18216,7 +18222,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18216
18222
|
version: "2.0.0",
|
|
18217
18223
|
author: "Community Developer",
|
|
18218
18224
|
category: "content",
|
|
18219
|
-
icon: "\
|
|
18225
|
+
icon: "\xE2\x9D\x93",
|
|
18220
18226
|
permissions: ["manage:faqs"],
|
|
18221
18227
|
dependencies: [],
|
|
18222
18228
|
is_core: false
|
|
@@ -18229,7 +18235,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18229
18235
|
version: "1.0.0-beta.1",
|
|
18230
18236
|
author: "SonicJS",
|
|
18231
18237
|
category: "demo",
|
|
18232
|
-
icon: "\
|
|
18238
|
+
icon: "\xF0\x9F\x8E\xAF",
|
|
18233
18239
|
permissions: [],
|
|
18234
18240
|
dependencies: [],
|
|
18235
18241
|
is_core: false
|
|
@@ -18242,7 +18248,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18242
18248
|
version: "1.0.0-beta.1",
|
|
18243
18249
|
author: "SonicJS Team",
|
|
18244
18250
|
category: "system",
|
|
18245
|
-
icon: "\
|
|
18251
|
+
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18246
18252
|
permissions: ["manage:database", "admin"],
|
|
18247
18253
|
dependencies: [],
|
|
18248
18254
|
is_core: false
|
|
@@ -18255,7 +18261,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18255
18261
|
version: "1.0.0-beta.1",
|
|
18256
18262
|
author: "SonicJS Team",
|
|
18257
18263
|
category: "development",
|
|
18258
|
-
icon: "\
|
|
18264
|
+
icon: "\xF0\x9F\x8C\xB1",
|
|
18259
18265
|
permissions: ["admin"],
|
|
18260
18266
|
dependencies: [],
|
|
18261
18267
|
is_core: false
|
|
@@ -18268,7 +18274,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18268
18274
|
version: "1.0.0",
|
|
18269
18275
|
author: "SonicJS Team",
|
|
18270
18276
|
category: "editor",
|
|
18271
|
-
icon: "\
|
|
18277
|
+
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18272
18278
|
permissions: [],
|
|
18273
18279
|
dependencies: [],
|
|
18274
18280
|
is_core: true
|
|
@@ -18281,7 +18287,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18281
18287
|
version: "1.0.0",
|
|
18282
18288
|
author: "SonicJS Team",
|
|
18283
18289
|
category: "editor",
|
|
18284
|
-
icon: "\
|
|
18290
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18285
18291
|
permissions: [],
|
|
18286
18292
|
dependencies: [],
|
|
18287
18293
|
is_core: false
|
|
@@ -18294,7 +18300,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18294
18300
|
version: "1.0.0",
|
|
18295
18301
|
author: "SonicJS Team",
|
|
18296
18302
|
category: "editor",
|
|
18297
|
-
icon: "\
|
|
18303
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18298
18304
|
permissions: [],
|
|
18299
18305
|
dependencies: [],
|
|
18300
18306
|
is_core: false
|
|
@@ -18307,7 +18313,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18307
18313
|
version: "1.0.0",
|
|
18308
18314
|
author: "SonicJS Team",
|
|
18309
18315
|
category: "security",
|
|
18310
|
-
icon: "\
|
|
18316
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18311
18317
|
permissions: [],
|
|
18312
18318
|
dependencies: [],
|
|
18313
18319
|
is_core: true
|
|
@@ -18320,7 +18326,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18320
18326
|
version: "1.0.0-beta.1",
|
|
18321
18327
|
author: "SonicJS Team",
|
|
18322
18328
|
category: "security",
|
|
18323
|
-
icon: "\
|
|
18329
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18324
18330
|
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18325
18331
|
dependencies: [],
|
|
18326
18332
|
is_core: false
|
|
@@ -18333,10 +18339,23 @@ var AVAILABLE_PLUGINS = [
|
|
|
18333
18339
|
version: "1.0.0",
|
|
18334
18340
|
author: "SonicJS Team",
|
|
18335
18341
|
category: "search",
|
|
18336
|
-
icon: "\
|
|
18342
|
+
icon: "\xF0\x9F\x94\x8D",
|
|
18337
18343
|
permissions: [],
|
|
18338
18344
|
dependencies: [],
|
|
18339
18345
|
is_core: true
|
|
18346
|
+
},
|
|
18347
|
+
{
|
|
18348
|
+
id: "form-builder",
|
|
18349
|
+
name: "form-builder",
|
|
18350
|
+
display_name: "Form Builder",
|
|
18351
|
+
description: "Drag-and-drop form builder with conditional logic, file uploads, and email notifications. Create contact forms, surveys, and data collection forms.",
|
|
18352
|
+
version: "1.0.0",
|
|
18353
|
+
author: "SonicJS Team",
|
|
18354
|
+
category: "content",
|
|
18355
|
+
icon: "\u{1F4DD}",
|
|
18356
|
+
permissions: ["forms:create", "forms:manage", "forms:submissions"],
|
|
18357
|
+
dependencies: [],
|
|
18358
|
+
is_core: false
|
|
18340
18359
|
}
|
|
18341
18360
|
];
|
|
18342
18361
|
adminPluginRoutes.get("/", async (c) => {
|
|
@@ -18542,7 +18561,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18542
18561
|
version: "2.0.0",
|
|
18543
18562
|
author: "Community Developer",
|
|
18544
18563
|
category: "content",
|
|
18545
|
-
icon: "\
|
|
18564
|
+
icon: "\xE2\x9D\x93",
|
|
18546
18565
|
permissions: ["manage:faqs"],
|
|
18547
18566
|
dependencies: [],
|
|
18548
18567
|
settings: {
|
|
@@ -18562,7 +18581,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18562
18581
|
version: "1.0.0-beta.1",
|
|
18563
18582
|
author: "SonicJS",
|
|
18564
18583
|
category: "demo",
|
|
18565
|
-
icon: "\
|
|
18584
|
+
icon: "\xF0\x9F\x8E\xAF",
|
|
18566
18585
|
permissions: [],
|
|
18567
18586
|
dependencies: [],
|
|
18568
18587
|
settings: {
|
|
@@ -18582,7 +18601,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18582
18601
|
version: "1.0.0-beta.1",
|
|
18583
18602
|
author: "SonicJS Team",
|
|
18584
18603
|
category: "security",
|
|
18585
|
-
icon: "\
|
|
18604
|
+
icon: "\xF0\x9F\x94\x90",
|
|
18586
18605
|
permissions: ["manage:users", "manage:roles", "manage:permissions"],
|
|
18587
18606
|
dependencies: [],
|
|
18588
18607
|
is_core: true,
|
|
@@ -18599,7 +18618,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18599
18618
|
version: "1.0.0-beta.1",
|
|
18600
18619
|
author: "SonicJS Team",
|
|
18601
18620
|
category: "media",
|
|
18602
|
-
icon: "\
|
|
18621
|
+
icon: "\xF0\x9F\x93\xB8",
|
|
18603
18622
|
permissions: ["manage:media", "upload:files"],
|
|
18604
18623
|
dependencies: [],
|
|
18605
18624
|
is_core: true,
|
|
@@ -18616,7 +18635,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18616
18635
|
version: "1.0.0-beta.1",
|
|
18617
18636
|
author: "SonicJS Team",
|
|
18618
18637
|
category: "content",
|
|
18619
|
-
icon: "\
|
|
18638
|
+
icon: "\xF0\x9F\x94\x84",
|
|
18620
18639
|
permissions: ["manage:workflows", "approve:content"],
|
|
18621
18640
|
dependencies: [],
|
|
18622
18641
|
is_core: true,
|
|
@@ -18633,7 +18652,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18633
18652
|
version: "1.0.0-beta.1",
|
|
18634
18653
|
author: "SonicJS Team",
|
|
18635
18654
|
category: "system",
|
|
18636
|
-
icon: "\
|
|
18655
|
+
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18637
18656
|
permissions: ["manage:database", "admin"],
|
|
18638
18657
|
dependencies: [],
|
|
18639
18658
|
is_core: false,
|
|
@@ -18655,7 +18674,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18655
18674
|
version: "1.0.0-beta.1",
|
|
18656
18675
|
author: "SonicJS Team",
|
|
18657
18676
|
category: "development",
|
|
18658
|
-
icon: "\
|
|
18677
|
+
icon: "\xF0\x9F\x8C\xB1",
|
|
18659
18678
|
permissions: ["admin"],
|
|
18660
18679
|
dependencies: [],
|
|
18661
18680
|
is_core: false,
|
|
@@ -18676,7 +18695,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18676
18695
|
version: "1.0.0",
|
|
18677
18696
|
author: "SonicJS Team",
|
|
18678
18697
|
category: "editor",
|
|
18679
|
-
icon: "\
|
|
18698
|
+
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18680
18699
|
permissions: [],
|
|
18681
18700
|
dependencies: [],
|
|
18682
18701
|
is_core: true,
|
|
@@ -18698,7 +18717,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18698
18717
|
version: "1.0.0",
|
|
18699
18718
|
author: "SonicJS Team",
|
|
18700
18719
|
category: "editor",
|
|
18701
|
-
icon: "\
|
|
18720
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18702
18721
|
permissions: [],
|
|
18703
18722
|
dependencies: [],
|
|
18704
18723
|
is_core: false,
|
|
@@ -18720,7 +18739,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18720
18739
|
version: "1.0.0",
|
|
18721
18740
|
author: "SonicJS Team",
|
|
18722
18741
|
category: "editor",
|
|
18723
|
-
icon: "\
|
|
18742
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18724
18743
|
permissions: [],
|
|
18725
18744
|
dependencies: [],
|
|
18726
18745
|
is_core: false,
|
|
@@ -18742,7 +18761,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18742
18761
|
version: "1.0.0-beta.1",
|
|
18743
18762
|
author: "SonicJS Team",
|
|
18744
18763
|
category: "security",
|
|
18745
|
-
icon: "\
|
|
18764
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18746
18765
|
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18747
18766
|
dependencies: [],
|
|
18748
18767
|
is_core: false,
|
|
@@ -18790,7 +18809,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18790
18809
|
version: "1.0.0",
|
|
18791
18810
|
author: "SonicJS Team",
|
|
18792
18811
|
category: "search",
|
|
18793
|
-
icon: "\
|
|
18812
|
+
icon: "\xF0\x9F\x94\x8D",
|
|
18794
18813
|
permissions: [],
|
|
18795
18814
|
dependencies: [],
|
|
18796
18815
|
is_core: true,
|
|
@@ -18807,7 +18826,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18807
18826
|
version: "1.0.0",
|
|
18808
18827
|
author: "SonicJS Team",
|
|
18809
18828
|
category: "security",
|
|
18810
|
-
icon: "\
|
|
18829
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18811
18830
|
permissions: [],
|
|
18812
18831
|
dependencies: [],
|
|
18813
18832
|
is_core: true,
|
|
@@ -18825,6 +18844,27 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18825
18844
|
});
|
|
18826
18845
|
return c.json({ success: true, plugin: turnstilePlugin });
|
|
18827
18846
|
}
|
|
18847
|
+
if (body.name === "form-builder") {
|
|
18848
|
+
const formBuilderPlugin = await pluginService.installPlugin({
|
|
18849
|
+
id: "form-builder",
|
|
18850
|
+
name: "form-builder",
|
|
18851
|
+
display_name: "Form Builder",
|
|
18852
|
+
description: "Drag-and-drop form builder with conditional logic, file uploads, and email notifications. Create contact forms, surveys, and data collection forms.",
|
|
18853
|
+
version: "1.0.0",
|
|
18854
|
+
author: "SonicJS Team",
|
|
18855
|
+
category: "content",
|
|
18856
|
+
icon: "\u{1F4DD}",
|
|
18857
|
+
permissions: ["forms:create", "forms:manage", "forms:submissions"],
|
|
18858
|
+
dependencies: [],
|
|
18859
|
+
settings: {
|
|
18860
|
+
enableNotifications: true,
|
|
18861
|
+
enableFileUploads: true,
|
|
18862
|
+
maxSubmissionsPerForm: 0,
|
|
18863
|
+
submissionRetentionDays: 90
|
|
18864
|
+
}
|
|
18865
|
+
});
|
|
18866
|
+
return c.json({ success: true, plugin: formBuilderPlugin });
|
|
18867
|
+
}
|
|
18828
18868
|
return c.json({ error: "Plugin not found in registry" }, 404);
|
|
18829
18869
|
} catch (error) {
|
|
18830
18870
|
console.error("Error installing plugin:", error);
|
|
@@ -18891,7 +18931,7 @@ function formatLastUpdated(timestamp) {
|
|
|
18891
18931
|
}
|
|
18892
18932
|
|
|
18893
18933
|
// src/templates/pages/admin-logs-list.template.ts
|
|
18894
|
-
|
|
18934
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
18895
18935
|
function renderLogsListPage(data) {
|
|
18896
18936
|
const { logs, pagination, filters, user } = data;
|
|
18897
18937
|
const content = `
|
|
@@ -19202,7 +19242,7 @@ function renderLogsListPage(data) {
|
|
|
19202
19242
|
user,
|
|
19203
19243
|
content
|
|
19204
19244
|
};
|
|
19205
|
-
return
|
|
19245
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
19206
19246
|
}
|
|
19207
19247
|
function renderLogDetailsPage(data) {
|
|
19208
19248
|
const { log, user } = data;
|
|
@@ -19414,7 +19454,7 @@ function renderLogDetailsPage(data) {
|
|
|
19414
19454
|
</div>
|
|
19415
19455
|
</div>
|
|
19416
19456
|
`;
|
|
19417
|
-
return
|
|
19457
|
+
return chunkQP3OHHON_cjs.adminLayoutV2({
|
|
19418
19458
|
title: `Log Details - ${log.id}`,
|
|
19419
19459
|
user,
|
|
19420
19460
|
content
|
|
@@ -19657,7 +19697,7 @@ function renderLogConfigPage(data) {
|
|
|
19657
19697
|
|
|
19658
19698
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
19659
19699
|
`;
|
|
19660
|
-
return
|
|
19700
|
+
return chunkQP3OHHON_cjs.adminLayoutV2({
|
|
19661
19701
|
title: "Log Configuration",
|
|
19662
19702
|
user,
|
|
19663
19703
|
content
|
|
@@ -19666,7 +19706,7 @@ function renderLogConfigPage(data) {
|
|
|
19666
19706
|
|
|
19667
19707
|
// src/routes/admin-logs.ts
|
|
19668
19708
|
var adminLogsRoutes = new hono.Hono();
|
|
19669
|
-
adminLogsRoutes.use("*",
|
|
19709
|
+
adminLogsRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
19670
19710
|
adminLogsRoutes.get("/", async (c) => {
|
|
19671
19711
|
try {
|
|
19672
19712
|
const user = c.get("user");
|
|
@@ -20038,7 +20078,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
20038
20078
|
role: user.role
|
|
20039
20079
|
} : void 0
|
|
20040
20080
|
};
|
|
20041
|
-
return c.html(
|
|
20081
|
+
return c.html(chunkQP3OHHON_cjs.renderDesignPage(pageData));
|
|
20042
20082
|
});
|
|
20043
20083
|
var adminCheckboxRoutes = new hono.Hono();
|
|
20044
20084
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -20050,7 +20090,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
20050
20090
|
role: user.role
|
|
20051
20091
|
} : void 0
|
|
20052
20092
|
};
|
|
20053
|
-
return c.html(
|
|
20093
|
+
return c.html(chunkQP3OHHON_cjs.renderCheckboxPage(pageData));
|
|
20054
20094
|
});
|
|
20055
20095
|
|
|
20056
20096
|
// src/templates/pages/admin-testimonials-form.template.ts
|
|
@@ -20078,7 +20118,7 @@ function renderTestimonialsForm(data) {
|
|
|
20078
20118
|
</div>
|
|
20079
20119
|
</div>
|
|
20080
20120
|
|
|
20081
|
-
${message ?
|
|
20121
|
+
${message ? chunkQP3OHHON_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20082
20122
|
|
|
20083
20123
|
<!-- Form -->
|
|
20084
20124
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -20307,7 +20347,7 @@ function renderTestimonialsForm(data) {
|
|
|
20307
20347
|
user: data.user,
|
|
20308
20348
|
content: pageContent
|
|
20309
20349
|
};
|
|
20310
|
-
return
|
|
20350
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
20311
20351
|
}
|
|
20312
20352
|
function escapeHtml4(unsafe) {
|
|
20313
20353
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -20333,7 +20373,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20333
20373
|
const offset = (currentPage - 1) * limit;
|
|
20334
20374
|
const db = c.env?.DB;
|
|
20335
20375
|
if (!db) {
|
|
20336
|
-
return c.html(
|
|
20376
|
+
return c.html(chunkQP3OHHON_cjs.renderTestimonialsList({
|
|
20337
20377
|
testimonials: [],
|
|
20338
20378
|
totalCount: 0,
|
|
20339
20379
|
currentPage: 1,
|
|
@@ -20373,7 +20413,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20373
20413
|
`;
|
|
20374
20414
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
20375
20415
|
const totalPages = Math.ceil(totalCount / limit);
|
|
20376
|
-
return c.html(
|
|
20416
|
+
return c.html(chunkQP3OHHON_cjs.renderTestimonialsList({
|
|
20377
20417
|
testimonials: testimonials || [],
|
|
20378
20418
|
totalCount,
|
|
20379
20419
|
currentPage,
|
|
@@ -20387,7 +20427,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20387
20427
|
} catch (error) {
|
|
20388
20428
|
console.error("Error fetching testimonials:", error);
|
|
20389
20429
|
const user = c.get("user");
|
|
20390
|
-
return c.html(
|
|
20430
|
+
return c.html(chunkQP3OHHON_cjs.renderTestimonialsList({
|
|
20391
20431
|
testimonials: [],
|
|
20392
20432
|
totalCount: 0,
|
|
20393
20433
|
currentPage: 1,
|
|
@@ -20706,7 +20746,7 @@ function renderCodeExamplesForm(data) {
|
|
|
20706
20746
|
</div>
|
|
20707
20747
|
</div>
|
|
20708
20748
|
|
|
20709
|
-
${message ?
|
|
20749
|
+
${message ? chunkQP3OHHON_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20710
20750
|
|
|
20711
20751
|
<!-- Form -->
|
|
20712
20752
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -20976,7 +21016,7 @@ function renderCodeExamplesForm(data) {
|
|
|
20976
21016
|
user: data.user,
|
|
20977
21017
|
content: pageContent
|
|
20978
21018
|
};
|
|
20979
|
-
return
|
|
21019
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
20980
21020
|
}
|
|
20981
21021
|
function escapeHtml5(unsafe) {
|
|
20982
21022
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -21003,7 +21043,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21003
21043
|
const offset = (currentPage - 1) * limit;
|
|
21004
21044
|
const db = c.env?.DB;
|
|
21005
21045
|
if (!db) {
|
|
21006
|
-
return c.html(
|
|
21046
|
+
return c.html(chunkQP3OHHON_cjs.renderCodeExamplesList({
|
|
21007
21047
|
codeExamples: [],
|
|
21008
21048
|
totalCount: 0,
|
|
21009
21049
|
currentPage: 1,
|
|
@@ -21043,7 +21083,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21043
21083
|
`;
|
|
21044
21084
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
21045
21085
|
const totalPages = Math.ceil(totalCount / limit);
|
|
21046
|
-
return c.html(
|
|
21086
|
+
return c.html(chunkQP3OHHON_cjs.renderCodeExamplesList({
|
|
21047
21087
|
codeExamples: codeExamples || [],
|
|
21048
21088
|
totalCount,
|
|
21049
21089
|
currentPage,
|
|
@@ -21057,7 +21097,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21057
21097
|
} catch (error) {
|
|
21058
21098
|
console.error("Error fetching code examples:", error);
|
|
21059
21099
|
const user = c.get("user");
|
|
21060
|
-
return c.html(
|
|
21100
|
+
return c.html(chunkQP3OHHON_cjs.renderCodeExamplesList({
|
|
21061
21101
|
codeExamples: [],
|
|
21062
21102
|
totalCount: 0,
|
|
21063
21103
|
currentPage: 1,
|
|
@@ -21446,7 +21486,7 @@ function renderDashboardPage(data) {
|
|
|
21446
21486
|
version: data.version,
|
|
21447
21487
|
content: pageContent
|
|
21448
21488
|
};
|
|
21449
|
-
return
|
|
21489
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
21450
21490
|
}
|
|
21451
21491
|
function renderStatsCards(stats) {
|
|
21452
21492
|
const cards = [
|
|
@@ -21994,9 +22034,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
21994
22034
|
}
|
|
21995
22035
|
|
|
21996
22036
|
// src/routes/admin-dashboard.ts
|
|
21997
|
-
var VERSION =
|
|
22037
|
+
var VERSION = chunkYULUPQZV_cjs.getCoreVersion();
|
|
21998
22038
|
var router = new hono.Hono();
|
|
21999
|
-
router.use("*",
|
|
22039
|
+
router.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
22000
22040
|
router.get("/", async (c) => {
|
|
22001
22041
|
const user = c.get("user");
|
|
22002
22042
|
try {
|
|
@@ -22235,7 +22275,7 @@ function normalizeFieldType(fieldType) {
|
|
|
22235
22275
|
}
|
|
22236
22276
|
|
|
22237
22277
|
// src/templates/pages/admin-collections-list.template.ts
|
|
22238
|
-
|
|
22278
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
22239
22279
|
|
|
22240
22280
|
// src/templates/components/table.template.ts
|
|
22241
22281
|
function renderTable2(data) {
|
|
@@ -22709,11 +22749,11 @@ function renderCollectionsListPage(data) {
|
|
|
22709
22749
|
version: data.version,
|
|
22710
22750
|
content: pageContent
|
|
22711
22751
|
};
|
|
22712
|
-
return
|
|
22752
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
22713
22753
|
}
|
|
22714
22754
|
|
|
22715
22755
|
// src/templates/pages/admin-collections-form.template.ts
|
|
22716
|
-
|
|
22756
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
22717
22757
|
function getFieldTypeBadge(fieldType) {
|
|
22718
22758
|
const typeLabels = {
|
|
22719
22759
|
"text": "Text",
|
|
@@ -22982,7 +23022,7 @@ function renderCollectionFormPage(data) {
|
|
|
22982
23022
|
}
|
|
22983
23023
|
</style>
|
|
22984
23024
|
|
|
22985
|
-
${
|
|
23025
|
+
${chunkQP3OHHON_cjs.renderForm(formData)}
|
|
22986
23026
|
|
|
22987
23027
|
${isEdit && data.managed ? `
|
|
22988
23028
|
<!-- Read-Only Fields Display for Managed Collections -->
|
|
@@ -23810,15 +23850,15 @@ function renderCollectionFormPage(data) {
|
|
|
23810
23850
|
version: data.version,
|
|
23811
23851
|
content: pageContent
|
|
23812
23852
|
};
|
|
23813
|
-
return
|
|
23853
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
23814
23854
|
}
|
|
23815
23855
|
|
|
23816
23856
|
// src/routes/admin-collections.ts
|
|
23817
23857
|
var adminCollectionsRoutes = new hono.Hono();
|
|
23818
|
-
adminCollectionsRoutes.use("*",
|
|
23819
|
-
adminCollectionsRoutes.post("*",
|
|
23820
|
-
adminCollectionsRoutes.put("*",
|
|
23821
|
-
adminCollectionsRoutes.delete("*",
|
|
23858
|
+
adminCollectionsRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
23859
|
+
adminCollectionsRoutes.post("*", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
23860
|
+
adminCollectionsRoutes.put("*", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
23861
|
+
adminCollectionsRoutes.delete("*", chunkYYMPHM3I_cjs.requireRole(["admin"]));
|
|
23822
23862
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
23823
23863
|
try {
|
|
23824
23864
|
const user = c.get("user");
|
|
@@ -24550,7 +24590,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
24550
24590
|
});
|
|
24551
24591
|
|
|
24552
24592
|
// src/templates/pages/admin-settings.template.ts
|
|
24553
|
-
|
|
24593
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
24554
24594
|
function renderSettingsPage(data) {
|
|
24555
24595
|
const activeTab = data.activeTab || "general";
|
|
24556
24596
|
const pageContent = `
|
|
@@ -24932,7 +24972,7 @@ function renderSettingsPage(data) {
|
|
|
24932
24972
|
version: data.version,
|
|
24933
24973
|
content: pageContent
|
|
24934
24974
|
};
|
|
24935
|
-
return
|
|
24975
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
24936
24976
|
}
|
|
24937
24977
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
24938
24978
|
const isActive = activeTab === tabId;
|
|
@@ -26014,7 +26054,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
26014
26054
|
|
|
26015
26055
|
// src/routes/admin-settings.ts
|
|
26016
26056
|
var adminSettingsRoutes = new hono.Hono();
|
|
26017
|
-
adminSettingsRoutes.use("*",
|
|
26057
|
+
adminSettingsRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
26018
26058
|
function getMockSettings(user) {
|
|
26019
26059
|
return {
|
|
26020
26060
|
general: {
|
|
@@ -26182,7 +26222,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
26182
26222
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
26183
26223
|
try {
|
|
26184
26224
|
const db = c.env.DB;
|
|
26185
|
-
const migrationService = new
|
|
26225
|
+
const migrationService = new chunkKZ2MFGET_cjs.MigrationService(db);
|
|
26186
26226
|
const status = await migrationService.getMigrationStatus();
|
|
26187
26227
|
return c.json({
|
|
26188
26228
|
success: true,
|
|
@@ -26206,7 +26246,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26206
26246
|
}, 403);
|
|
26207
26247
|
}
|
|
26208
26248
|
const db = c.env.DB;
|
|
26209
|
-
const migrationService = new
|
|
26249
|
+
const migrationService = new chunkKZ2MFGET_cjs.MigrationService(db);
|
|
26210
26250
|
const result = await migrationService.runPendingMigrations();
|
|
26211
26251
|
return c.json({
|
|
26212
26252
|
success: result.success,
|
|
@@ -26224,7 +26264,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26224
26264
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
26225
26265
|
try {
|
|
26226
26266
|
const db = c.env.DB;
|
|
26227
|
-
const migrationService = new
|
|
26267
|
+
const migrationService = new chunkKZ2MFGET_cjs.MigrationService(db);
|
|
26228
26268
|
const validation = await migrationService.validateSchema();
|
|
26229
26269
|
return c.json({
|
|
26230
26270
|
success: true,
|
|
@@ -26433,7 +26473,7 @@ adminSettingsRoutes.post("/", async (c) => {
|
|
|
26433
26473
|
});
|
|
26434
26474
|
|
|
26435
26475
|
// src/templates/pages/admin-forms-list.template.ts
|
|
26436
|
-
|
|
26476
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
26437
26477
|
function renderFormsListPage(data) {
|
|
26438
26478
|
const tableData = {
|
|
26439
26479
|
tableId: "forms-table",
|
|
@@ -26695,11 +26735,11 @@ function renderFormsListPage(data) {
|
|
|
26695
26735
|
user: data.user,
|
|
26696
26736
|
version: data.version
|
|
26697
26737
|
};
|
|
26698
|
-
return
|
|
26738
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
26699
26739
|
}
|
|
26700
26740
|
|
|
26701
26741
|
// src/templates/pages/admin-forms-builder.template.ts
|
|
26702
|
-
|
|
26742
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
26703
26743
|
function getTurnstileComponentScript() {
|
|
26704
26744
|
return `
|
|
26705
26745
|
(function() {
|
|
@@ -27912,11 +27952,11 @@ ${getTurnstileComponentScript()}
|
|
|
27912
27952
|
user: data.user,
|
|
27913
27953
|
version: data.version
|
|
27914
27954
|
};
|
|
27915
|
-
return
|
|
27955
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
27916
27956
|
}
|
|
27917
27957
|
|
|
27918
27958
|
// src/templates/pages/admin-forms-create.template.ts
|
|
27919
|
-
|
|
27959
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
27920
27960
|
function renderFormCreatePage(data) {
|
|
27921
27961
|
const pageContent = `
|
|
27922
27962
|
<div class="max-w-3xl mx-auto">
|
|
@@ -28109,12 +28149,12 @@ function renderFormCreatePage(data) {
|
|
|
28109
28149
|
user: data.user,
|
|
28110
28150
|
version: data.version
|
|
28111
28151
|
};
|
|
28112
|
-
return
|
|
28152
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
28113
28153
|
}
|
|
28114
28154
|
|
|
28115
28155
|
// src/routes/admin-forms.ts
|
|
28116
28156
|
var adminFormsRoutes = new hono.Hono();
|
|
28117
|
-
adminFormsRoutes.use("*",
|
|
28157
|
+
adminFormsRoutes.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
28118
28158
|
adminFormsRoutes.get("/", async (c) => {
|
|
28119
28159
|
try {
|
|
28120
28160
|
const user = c.get("user");
|
|
@@ -28952,7 +28992,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28952
28992
|
var public_forms_default = publicFormsRoutes;
|
|
28953
28993
|
|
|
28954
28994
|
// src/templates/pages/admin-api-reference.template.ts
|
|
28955
|
-
|
|
28995
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
28956
28996
|
function renderAuthBadge(auth) {
|
|
28957
28997
|
if (auth === true) {
|
|
28958
28998
|
return `
|
|
@@ -29283,13 +29323,13 @@ function renderAPIReferencePage(data) {
|
|
|
29283
29323
|
version: data.version,
|
|
29284
29324
|
content: pageContent
|
|
29285
29325
|
};
|
|
29286
|
-
return
|
|
29326
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
29287
29327
|
}
|
|
29288
29328
|
|
|
29289
29329
|
// src/routes/admin-api-reference.ts
|
|
29290
|
-
var VERSION2 =
|
|
29330
|
+
var VERSION2 = chunkYULUPQZV_cjs.getCoreVersion();
|
|
29291
29331
|
var router2 = new hono.Hono();
|
|
29292
|
-
router2.use("*",
|
|
29332
|
+
router2.use("*", chunkYYMPHM3I_cjs.requireAuth());
|
|
29293
29333
|
router2.get("/", async (c) => {
|
|
29294
29334
|
const user = c.get("user");
|
|
29295
29335
|
try {
|
|
@@ -29380,5 +29420,5 @@ exports.router2 = router2;
|
|
|
29380
29420
|
exports.test_cleanup_default = test_cleanup_default;
|
|
29381
29421
|
exports.userProfilesPlugin = userProfilesPlugin;
|
|
29382
29422
|
exports.userRoutes = userRoutes;
|
|
29383
|
-
//# sourceMappingURL=chunk-
|
|
29384
|
-
//# sourceMappingURL=chunk-
|
|
29423
|
+
//# sourceMappingURL=chunk-DRWSHIFG.cjs.map
|
|
29424
|
+
//# sourceMappingURL=chunk-DRWSHIFG.cjs.map
|