@sonicjs-cms/core 2.12.1 → 2.13.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-RBXFXT7H.cjs → chunk-3QCEYJLK.cjs} +9 -9
- package/dist/{chunk-RBXFXT7H.cjs.map → chunk-3QCEYJLK.cjs.map} +1 -1
- package/dist/{chunk-6C6W54QP.js → chunk-3VAKUFNQ.js} +2 -2
- package/dist/{chunk-6C6W54QP.js.map → chunk-3VAKUFNQ.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-673VROB3.js → chunk-CO4B5EYF.js} +5 -5
- package/dist/{chunk-673VROB3.js.map → chunk-CO4B5EYF.js.map} +1 -1
- package/dist/{chunk-UFWE3MEJ.js → chunk-DB2GJJTM.js} +3 -3
- package/dist/{chunk-UFWE3MEJ.js.map → chunk-DB2GJJTM.js.map} +1 -1
- package/dist/{chunk-HBUFGLEX.cjs → chunk-EGUDIX6Q.cjs} +4 -4
- package/dist/{chunk-HBUFGLEX.cjs.map → chunk-EGUDIX6Q.cjs.map} +1 -1
- package/dist/{chunk-DHTCZZUB.cjs → chunk-HVTSE2SF.cjs} +247 -210
- package/dist/chunk-HVTSE2SF.cjs.map +1 -0
- package/dist/{chunk-3V2CQFIR.js → chunk-IYFSNRZN.js} +84 -47
- package/dist/chunk-IYFSNRZN.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-H4NHRZ6Y.cjs → chunk-QP3OHHON.cjs} +18 -10
- package/dist/chunk-QP3OHHON.cjs.map +1 -0
- package/dist/{chunk-XK3TKOLQ.cjs → chunk-SER23XI4.cjs} +2 -2
- package/dist/{chunk-XK3TKOLQ.cjs.map → chunk-SER23XI4.cjs.map} +1 -1
- package/dist/{chunk-IKBAY2M2.cjs → chunk-XCP5GCBE.cjs} +5 -5
- package/dist/{chunk-IKBAY2M2.cjs.map → chunk-XCP5GCBE.cjs.map} +1 -1
- package/dist/index.cjs +131 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +28 -28
- package/dist/middleware.js +2 -2
- package/dist/migrations-GMHTJI7D.cjs +13 -0
- package/dist/{migrations-MIZFGFNS.cjs.map → migrations-GMHTJI7D.cjs.map} +1 -1
- package/dist/migrations-IVFIDOSO.js +4 -0
- package/dist/{migrations-AH2XIFSA.js.map → migrations-IVFIDOSO.js.map} +1 -1
- package/dist/routes.cjs +28 -28
- package/dist/routes.js +5 -5
- package/dist/services.cjs +2 -2
- 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-76TX6XND.js.map +0 -1
- package/dist/chunk-DHTCZZUB.cjs.map +0 -1
- package/dist/chunk-H4NHRZ6Y.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 chunkEGUDIX6Q_cjs = require('./chunk-EGUDIX6Q.cjs');
|
|
5
5
|
var chunkI6FFGQIT_cjs = require('./chunk-I6FFGQIT.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkSER23XI4_cjs = require('./chunk-SER23XI4.cjs');
|
|
7
|
+
var chunkQP3OHHON_cjs = require('./chunk-QP3OHHON.cjs');
|
|
8
8
|
var chunk6FHNRRJ3_cjs = require('./chunk-6FHNRRJ3.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkXCP5GCBE_cjs = require('./chunk-XCP5GCBE.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("/", chunkEGUDIX6Q_cjs.requireAuth(), chunkEGUDIX6Q_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", chunkEGUDIX6Q_cjs.requireAuth(), chunkEGUDIX6Q_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", chunkEGUDIX6Q_cjs.requireAuth(), chunkEGUDIX6Q_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 chunkEGUDIX6Q_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", chunkEGUDIX6Q_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 = chunkXCP5GCBE_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 chunkXCP5GCBE_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", chunkEGUDIX6Q_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 = chunkXCP5GCBE_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 chunkXCP5GCBE_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("*", chunkEGUDIX6Q_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("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
1843
|
+
adminApiRoutes.use("*", chunkEGUDIX6Q_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-GMHTJI7D.cjs');
|
|
2356
2356
|
const db = c.env.DB;
|
|
2357
2357
|
const migrationService = new MigrationService2(db);
|
|
2358
2358
|
const status = await migrationService.getMigrationStatus();
|
|
@@ -2377,7 +2377,7 @@ 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-GMHTJI7D.cjs');
|
|
2381
2381
|
const db = c.env.DB;
|
|
2382
2382
|
const migrationService = new MigrationService2(db);
|
|
2383
2383
|
const result = await migrationService.runPendingMigrations();
|
|
@@ -2396,7 +2396,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
2396
2396
|
});
|
|
2397
2397
|
adminApiRoutes.get("/migrations/validate", async (c) => {
|
|
2398
2398
|
try {
|
|
2399
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2399
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-GMHTJI7D.cjs');
|
|
2400
2400
|
const db = c.env.DB;
|
|
2401
2401
|
const migrationService = new MigrationService2(db);
|
|
2402
2402
|
const validation = await migrationService.validateSchema();
|
|
@@ -2471,8 +2471,8 @@ function renderLoginPage(data, demoLoginActive = false) {
|
|
|
2471
2471
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2472
2472
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2473
2473
|
<!-- Alerts -->
|
|
2474
|
-
${data.error ? `<div class="mb-6">${
|
|
2475
|
-
${data.message ? `<div class="mb-6">${
|
|
2474
|
+
${data.error ? `<div class="mb-6">${chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2475
|
+
${data.message ? `<div class="mb-6">${chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
|
|
2476
2476
|
|
|
2477
2477
|
<!-- Form Response (HTMX target) -->
|
|
2478
2478
|
<div id="form-response" class="mb-6"></div>
|
|
@@ -2636,7 +2636,7 @@ function renderRegisterPage(data) {
|
|
|
2636
2636
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2637
2637
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2638
2638
|
<!-- Alerts -->
|
|
2639
|
-
${data.error ? `<div class="mb-6">${
|
|
2639
|
+
${data.error ? `<div class="mb-6">${chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2640
2640
|
|
|
2641
2641
|
<!-- Form -->
|
|
2642
2642
|
<form
|
|
@@ -3624,7 +3624,10 @@ function renderDynamicField(field, options = {}) {
|
|
|
3624
3624
|
`;
|
|
3625
3625
|
break;
|
|
3626
3626
|
case "select":
|
|
3627
|
-
const selectOptions = opts.options ||
|
|
3627
|
+
const selectOptions = opts.options || (Array.isArray(opts.enum) ? opts.enum.map((optionValue, index) => ({
|
|
3628
|
+
value: optionValue,
|
|
3629
|
+
label: opts.enumLabels?.[index] || optionValue
|
|
3630
|
+
})) : []);
|
|
3628
3631
|
const multiple = opts.multiple ? "multiple" : "";
|
|
3629
3632
|
const selectedValues = Array.isArray(value) ? value : [value];
|
|
3630
3633
|
fieldHTML = `
|
|
@@ -5055,7 +5058,7 @@ function renderCustomProfileSection(config, customData) {
|
|
|
5055
5058
|
}).join("\n");
|
|
5056
5059
|
return `
|
|
5057
5060
|
<!-- Custom Profile Fields -->
|
|
5058
|
-
<div class="
|
|
5061
|
+
<div class="py-6 border-t border-b border-zinc-950/5 dark:border-white/5">
|
|
5059
5062
|
<h3 class="text-base font-semibold text-zinc-950 dark:text-white mb-4">Custom Profile Fields</h3>
|
|
5060
5063
|
<div class="space-y-4">
|
|
5061
5064
|
${fieldsHtml}
|
|
@@ -5146,7 +5149,7 @@ var JWT_SECRET_FALLBACK = "your-super-secret-jwt-key-change-in-production";
|
|
|
5146
5149
|
async function setCsrfCookie(c) {
|
|
5147
5150
|
const secret = c.env?.JWT_SECRET || JWT_SECRET_FALLBACK;
|
|
5148
5151
|
const isDev = c.env?.ENVIRONMENT === "development" || !c.env?.ENVIRONMENT;
|
|
5149
|
-
const csrfToken = await
|
|
5152
|
+
const csrfToken = await chunkEGUDIX6Q_cjs.generateCsrfToken(secret);
|
|
5150
5153
|
cookie.setCookie(c, "csrf_token", csrfToken, {
|
|
5151
5154
|
httpOnly: false,
|
|
5152
5155
|
secure: !isDev,
|
|
@@ -5203,7 +5206,7 @@ var loginSchema = zod.z.object({
|
|
|
5203
5206
|
});
|
|
5204
5207
|
authRoutes.post(
|
|
5205
5208
|
"/register",
|
|
5206
|
-
|
|
5209
|
+
chunkEGUDIX6Q_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5207
5210
|
async (c) => {
|
|
5208
5211
|
try {
|
|
5209
5212
|
const db = c.env.DB;
|
|
@@ -5240,7 +5243,7 @@ authRoutes.post(
|
|
|
5240
5243
|
if (existingUser) {
|
|
5241
5244
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
5242
5245
|
}
|
|
5243
|
-
const passwordHash = await
|
|
5246
|
+
const passwordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(password);
|
|
5244
5247
|
const userId = crypto.randomUUID();
|
|
5245
5248
|
const now = /* @__PURE__ */ new Date();
|
|
5246
5249
|
await db.prepare(`
|
|
@@ -5274,7 +5277,7 @@ authRoutes.post(
|
|
|
5274
5277
|
await saveCustomData(db, userId, sanitized);
|
|
5275
5278
|
}
|
|
5276
5279
|
}
|
|
5277
|
-
const token = await
|
|
5280
|
+
const token = await chunkEGUDIX6Q_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET);
|
|
5278
5281
|
cookie.setCookie(c, "auth_token", token, {
|
|
5279
5282
|
httpOnly: true,
|
|
5280
5283
|
secure: true,
|
|
@@ -5308,7 +5311,7 @@ authRoutes.post(
|
|
|
5308
5311
|
);
|
|
5309
5312
|
authRoutes.post(
|
|
5310
5313
|
"/login",
|
|
5311
|
-
|
|
5314
|
+
chunkEGUDIX6Q_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5312
5315
|
async (c) => {
|
|
5313
5316
|
try {
|
|
5314
5317
|
const body = await c.req.json();
|
|
@@ -5331,19 +5334,19 @@ authRoutes.post(
|
|
|
5331
5334
|
if (!user) {
|
|
5332
5335
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5333
5336
|
}
|
|
5334
|
-
const isValidPassword = await
|
|
5337
|
+
const isValidPassword = await chunkEGUDIX6Q_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5335
5338
|
if (!isValidPassword) {
|
|
5336
5339
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5337
5340
|
}
|
|
5338
|
-
if (
|
|
5341
|
+
if (chunkEGUDIX6Q_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5339
5342
|
try {
|
|
5340
|
-
const newHash = await
|
|
5343
|
+
const newHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(password);
|
|
5341
5344
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5342
5345
|
} catch (rehashError) {
|
|
5343
5346
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5344
5347
|
}
|
|
5345
5348
|
}
|
|
5346
|
-
const token = await
|
|
5349
|
+
const token = await chunkEGUDIX6Q_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5347
5350
|
cookie.setCookie(c, "auth_token", token, {
|
|
5348
5351
|
httpOnly: true,
|
|
5349
5352
|
secure: true,
|
|
@@ -5396,7 +5399,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
5396
5399
|
clearCsrfCookie(c);
|
|
5397
5400
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
5398
5401
|
});
|
|
5399
|
-
authRoutes.get("/me",
|
|
5402
|
+
authRoutes.get("/me", chunkEGUDIX6Q_cjs.requireAuth(), async (c) => {
|
|
5400
5403
|
try {
|
|
5401
5404
|
const user = c.get("user");
|
|
5402
5405
|
if (!user) {
|
|
@@ -5413,13 +5416,13 @@ authRoutes.get("/me", chunkHBUFGLEX_cjs.requireAuth(), async (c) => {
|
|
|
5413
5416
|
return c.json({ error: "Failed to get user" }, 500);
|
|
5414
5417
|
}
|
|
5415
5418
|
});
|
|
5416
|
-
authRoutes.post("/refresh",
|
|
5419
|
+
authRoutes.post("/refresh", chunkEGUDIX6Q_cjs.requireAuth(), async (c) => {
|
|
5417
5420
|
try {
|
|
5418
5421
|
const user = c.get("user");
|
|
5419
5422
|
if (!user) {
|
|
5420
5423
|
return c.json({ error: "Not authenticated" }, 401);
|
|
5421
5424
|
}
|
|
5422
|
-
const token = await
|
|
5425
|
+
const token = await chunkEGUDIX6Q_cjs.AuthManager.generateToken(user.userId, user.email, user.role, c.env.JWT_SECRET);
|
|
5423
5426
|
cookie.setCookie(c, "auth_token", token, {
|
|
5424
5427
|
httpOnly: true,
|
|
5425
5428
|
secure: true,
|
|
@@ -5436,7 +5439,7 @@ authRoutes.post("/refresh", chunkHBUFGLEX_cjs.requireAuth(), async (c) => {
|
|
|
5436
5439
|
});
|
|
5437
5440
|
authRoutes.post(
|
|
5438
5441
|
"/register/form",
|
|
5439
|
-
|
|
5442
|
+
chunkEGUDIX6Q_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5440
5443
|
async (c) => {
|
|
5441
5444
|
try {
|
|
5442
5445
|
const db = c.env.DB;
|
|
@@ -5483,7 +5486,7 @@ authRoutes.post(
|
|
|
5483
5486
|
</div>
|
|
5484
5487
|
`);
|
|
5485
5488
|
}
|
|
5486
|
-
const passwordHash = await
|
|
5489
|
+
const passwordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(password);
|
|
5487
5490
|
const role = isFirstUser ? "admin" : "viewer";
|
|
5488
5491
|
const userId = crypto.randomUUID();
|
|
5489
5492
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -5518,7 +5521,7 @@ authRoutes.post(
|
|
|
5518
5521
|
await saveCustomData(db, userId, sanitized);
|
|
5519
5522
|
}
|
|
5520
5523
|
}
|
|
5521
|
-
const token = await
|
|
5524
|
+
const token = await chunkEGUDIX6Q_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET);
|
|
5522
5525
|
cookie.setCookie(c, "auth_token", token, {
|
|
5523
5526
|
httpOnly: true,
|
|
5524
5527
|
secure: false,
|
|
@@ -5551,7 +5554,7 @@ authRoutes.post(
|
|
|
5551
5554
|
);
|
|
5552
5555
|
authRoutes.post(
|
|
5553
5556
|
"/login/form",
|
|
5554
|
-
|
|
5557
|
+
chunkEGUDIX6Q_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5555
5558
|
async (c) => {
|
|
5556
5559
|
try {
|
|
5557
5560
|
const formData = await c.req.formData();
|
|
@@ -5575,7 +5578,7 @@ authRoutes.post(
|
|
|
5575
5578
|
</div>
|
|
5576
5579
|
`);
|
|
5577
5580
|
}
|
|
5578
|
-
const isValidPassword = await
|
|
5581
|
+
const isValidPassword = await chunkEGUDIX6Q_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5579
5582
|
if (!isValidPassword) {
|
|
5580
5583
|
return c.html(html.html`
|
|
5581
5584
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -5583,15 +5586,15 @@ authRoutes.post(
|
|
|
5583
5586
|
</div>
|
|
5584
5587
|
`);
|
|
5585
5588
|
}
|
|
5586
|
-
if (
|
|
5589
|
+
if (chunkEGUDIX6Q_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5587
5590
|
try {
|
|
5588
|
-
const newHash = await
|
|
5591
|
+
const newHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(password);
|
|
5589
5592
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5590
5593
|
} catch (rehashError) {
|
|
5591
5594
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5592
5595
|
}
|
|
5593
5596
|
}
|
|
5594
|
-
const token = await
|
|
5597
|
+
const token = await chunkEGUDIX6Q_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5595
5598
|
cookie.setCookie(c, "auth_token", token, {
|
|
5596
5599
|
httpOnly: true,
|
|
5597
5600
|
secure: false,
|
|
@@ -5633,7 +5636,7 @@ authRoutes.post(
|
|
|
5633
5636
|
);
|
|
5634
5637
|
authRoutes.post(
|
|
5635
5638
|
"/seed-admin",
|
|
5636
|
-
|
|
5639
|
+
chunkEGUDIX6Q_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
|
|
5637
5640
|
async (c) => {
|
|
5638
5641
|
try {
|
|
5639
5642
|
const db = c.env.DB;
|
|
@@ -5655,7 +5658,7 @@ authRoutes.post(
|
|
|
5655
5658
|
`).run();
|
|
5656
5659
|
const existingAdmin = await db.prepare("SELECT id FROM users WHERE email = ? OR username = ?").bind("admin@sonicjs.com", "admin").first();
|
|
5657
5660
|
if (existingAdmin) {
|
|
5658
|
-
const passwordHash2 = await
|
|
5661
|
+
const passwordHash2 = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5659
5662
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(passwordHash2, Date.now(), existingAdmin.id).run();
|
|
5660
5663
|
return c.json({
|
|
5661
5664
|
message: "Admin user already exists (password updated)",
|
|
@@ -5667,7 +5670,7 @@ authRoutes.post(
|
|
|
5667
5670
|
}
|
|
5668
5671
|
});
|
|
5669
5672
|
}
|
|
5670
|
-
const passwordHash = await
|
|
5673
|
+
const passwordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5671
5674
|
const userId = "admin-user-id";
|
|
5672
5675
|
const now = Date.now();
|
|
5673
5676
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -5888,7 +5891,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5888
5891
|
if (existingUsername) {
|
|
5889
5892
|
return c.json({ error: "Username is already taken" }, 400);
|
|
5890
5893
|
}
|
|
5891
|
-
const passwordHash = await
|
|
5894
|
+
const passwordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(password);
|
|
5892
5895
|
const updateStmt = db.prepare(`
|
|
5893
5896
|
UPDATE users SET
|
|
5894
5897
|
username = ?,
|
|
@@ -5907,7 +5910,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5907
5910
|
Date.now(),
|
|
5908
5911
|
invitedUser.id
|
|
5909
5912
|
).run();
|
|
5910
|
-
const authToken = await
|
|
5913
|
+
const authToken = await chunkEGUDIX6Q_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET);
|
|
5911
5914
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
5912
5915
|
httpOnly: true,
|
|
5913
5916
|
secure: true,
|
|
@@ -5924,7 +5927,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5924
5927
|
});
|
|
5925
5928
|
authRoutes.post(
|
|
5926
5929
|
"/request-password-reset",
|
|
5927
|
-
|
|
5930
|
+
chunkEGUDIX6Q_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
|
|
5928
5931
|
async (c) => {
|
|
5929
5932
|
try {
|
|
5930
5933
|
const formData = await c.req.formData();
|
|
@@ -6142,7 +6145,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
6142
6145
|
if (Date.now() > user.password_reset_expires) {
|
|
6143
6146
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
6144
6147
|
}
|
|
6145
|
-
const newPasswordHash = await
|
|
6148
|
+
const newPasswordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(password);
|
|
6146
6149
|
try {
|
|
6147
6150
|
const historyStmt = db.prepare(`
|
|
6148
6151
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -7110,7 +7113,7 @@ function createQuillEditorPlugin() {
|
|
|
7110
7113
|
createQuillEditorPlugin();
|
|
7111
7114
|
|
|
7112
7115
|
// src/templates/pages/admin-content-form.template.ts
|
|
7113
|
-
|
|
7116
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
7114
7117
|
function renderContentFormPage(data) {
|
|
7115
7118
|
const isEdit = data.isEdit || !!data.id;
|
|
7116
7119
|
const title = isEdit ? `Edit: ${data.title || "Content"}` : `New ${data.collection.display_name}`;
|
|
@@ -7191,8 +7194,8 @@ function renderContentFormPage(data) {
|
|
|
7191
7194
|
<!-- Form Content -->
|
|
7192
7195
|
<div class="px-6 py-6">
|
|
7193
7196
|
<div id="form-messages">
|
|
7194
|
-
${data.error ?
|
|
7195
|
-
${data.success ?
|
|
7197
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7198
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7196
7199
|
</div>
|
|
7197
7200
|
|
|
7198
7201
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -7428,7 +7431,7 @@ function renderContentFormPage(data) {
|
|
|
7428
7431
|
</div>
|
|
7429
7432
|
|
|
7430
7433
|
<!-- Confirmation Dialogs -->
|
|
7431
|
-
${
|
|
7434
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7432
7435
|
id: "duplicate-content-confirm",
|
|
7433
7436
|
title: "Duplicate Content",
|
|
7434
7437
|
message: "Create a copy of this content?",
|
|
@@ -7439,7 +7442,7 @@ function renderContentFormPage(data) {
|
|
|
7439
7442
|
onConfirm: "performDuplicateContent()"
|
|
7440
7443
|
})}
|
|
7441
7444
|
|
|
7442
|
-
${
|
|
7445
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7443
7446
|
id: "delete-content-confirm",
|
|
7444
7447
|
title: "Delete Content",
|
|
7445
7448
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -7450,7 +7453,7 @@ function renderContentFormPage(data) {
|
|
|
7450
7453
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
7451
7454
|
})}
|
|
7452
7455
|
|
|
7453
|
-
${
|
|
7456
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7454
7457
|
id: "delete-repeater-item-confirm",
|
|
7455
7458
|
title: "Delete Item",
|
|
7456
7459
|
message: "Are you sure you want to delete this item? This action cannot be undone.",
|
|
@@ -7461,7 +7464,7 @@ function renderContentFormPage(data) {
|
|
|
7461
7464
|
onConfirm: "performRepeaterDelete()"
|
|
7462
7465
|
})}
|
|
7463
7466
|
|
|
7464
|
-
${
|
|
7467
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
7465
7468
|
id: "delete-block-confirm",
|
|
7466
7469
|
title: "Delete Block",
|
|
7467
7470
|
message: "Are you sure you want to delete this block? This action cannot be undone.",
|
|
@@ -7472,7 +7475,7 @@ function renderContentFormPage(data) {
|
|
|
7472
7475
|
onConfirm: "performRepeaterDelete()"
|
|
7473
7476
|
})}
|
|
7474
7477
|
|
|
7475
|
-
${
|
|
7478
|
+
${chunkQP3OHHON_cjs.getConfirmationDialogScript()}
|
|
7476
7479
|
|
|
7477
7480
|
${data.tinymceEnabled ? getTinyMCEScript(data.tinymceSettings?.apiKey) : "<!-- TinyMCE plugin not active -->"}
|
|
7478
7481
|
|
|
@@ -8547,11 +8550,11 @@ function renderContentFormPage(data) {
|
|
|
8547
8550
|
content: pageContent,
|
|
8548
8551
|
version: data.version
|
|
8549
8552
|
};
|
|
8550
|
-
return
|
|
8553
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8551
8554
|
}
|
|
8552
8555
|
|
|
8553
8556
|
// src/templates/pages/admin-content-list.template.ts
|
|
8554
|
-
|
|
8557
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
8555
8558
|
function renderContentListPage(data) {
|
|
8556
8559
|
const urlParams = new URLSearchParams();
|
|
8557
8560
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -8955,8 +8958,8 @@ function renderContentListPage(data) {
|
|
|
8955
8958
|
|
|
8956
8959
|
<!-- Content List -->
|
|
8957
8960
|
<div id="content-list">
|
|
8958
|
-
${
|
|
8959
|
-
${
|
|
8961
|
+
${chunkQP3OHHON_cjs.renderTable(tableData)}
|
|
8962
|
+
${chunkQP3OHHON_cjs.renderPagination(paginationData)}
|
|
8960
8963
|
</div>
|
|
8961
8964
|
|
|
8962
8965
|
</div>
|
|
@@ -9166,7 +9169,7 @@ function renderContentListPage(data) {
|
|
|
9166
9169
|
</script>
|
|
9167
9170
|
|
|
9168
9171
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
9169
|
-
${
|
|
9172
|
+
${chunkQP3OHHON_cjs.renderConfirmationDialog({
|
|
9170
9173
|
id: "bulk-action-confirm",
|
|
9171
9174
|
title: "Confirm Bulk Action",
|
|
9172
9175
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -9178,7 +9181,7 @@ function renderContentListPage(data) {
|
|
|
9178
9181
|
})}
|
|
9179
9182
|
|
|
9180
9183
|
<!-- Confirmation Dialog Script -->
|
|
9181
|
-
${
|
|
9184
|
+
${chunkQP3OHHON_cjs.getConfirmationDialogScript()}
|
|
9182
9185
|
|
|
9183
9186
|
<!-- Advanced Search Modal -->
|
|
9184
9187
|
<div id="advancedSearchModal" class="hidden fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
|
@@ -9475,7 +9478,7 @@ function renderContentListPage(data) {
|
|
|
9475
9478
|
version: data.version,
|
|
9476
9479
|
content: pageContent
|
|
9477
9480
|
};
|
|
9478
|
-
return
|
|
9481
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
9479
9482
|
}
|
|
9480
9483
|
|
|
9481
9484
|
// src/routes/admin-content-field-types.ts
|
|
@@ -9518,9 +9521,9 @@ function parseFieldValue(field, formData, options = {}) {
|
|
|
9518
9521
|
const { skipValidation = false } = options;
|
|
9519
9522
|
const value = formData.get(field.field_name);
|
|
9520
9523
|
const errors = [];
|
|
9521
|
-
const blocksConfig =
|
|
9524
|
+
const blocksConfig = chunkXCP5GCBE_cjs.getBlocksFieldConfig(field.field_options);
|
|
9522
9525
|
if (blocksConfig) {
|
|
9523
|
-
const parsed =
|
|
9526
|
+
const parsed = chunkXCP5GCBE_cjs.parseBlocksValue(value, blocksConfig);
|
|
9524
9527
|
if (!skipValidation && field.is_required && parsed.value.length === 0) {
|
|
9525
9528
|
parsed.errors.push(`${field.field_label} is required`);
|
|
9526
9529
|
}
|
|
@@ -9630,7 +9633,7 @@ function extractFieldData(fields, formData, options = {}) {
|
|
|
9630
9633
|
}
|
|
9631
9634
|
return { data, errors };
|
|
9632
9635
|
}
|
|
9633
|
-
adminContentRoutes.use("*",
|
|
9636
|
+
adminContentRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
9634
9637
|
async function getCollectionFields(db, collectionId) {
|
|
9635
9638
|
const cache = chunkNZWFCUDA_cjs.getCacheService(chunkNZWFCUDA_cjs.CACHE_CONFIGS.collection);
|
|
9636
9639
|
return cache.getOrSet(
|
|
@@ -10321,7 +10324,7 @@ adminContentRoutes.put("/:id", async (c) => {
|
|
|
10321
10324
|
`);
|
|
10322
10325
|
}
|
|
10323
10326
|
});
|
|
10324
|
-
adminContentRoutes.post("/preview",
|
|
10327
|
+
adminContentRoutes.post("/preview", chunkEGUDIX6Q_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10325
10328
|
try {
|
|
10326
10329
|
const formData = await c.req.formData();
|
|
10327
10330
|
const collectionId = formData.get("collection_id");
|
|
@@ -10699,7 +10702,7 @@ adminContentRoutes.post("/:id/restore/:version", async (c) => {
|
|
|
10699
10702
|
return c.json({ success: false, error: "Failed to restore version" });
|
|
10700
10703
|
}
|
|
10701
10704
|
});
|
|
10702
|
-
adminContentRoutes.get("/:id/version/:version/preview",
|
|
10705
|
+
adminContentRoutes.get("/:id/version/:version/preview", chunkEGUDIX6Q_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10703
10706
|
try {
|
|
10704
10707
|
const id = c.req.param("id");
|
|
10705
10708
|
const version = parseInt(c.req.param("version") || "0");
|
|
@@ -10767,7 +10770,7 @@ ${chunkMNWKYY5E_cjs.escapeHtml(JSON.stringify(data, null, 2))}
|
|
|
10767
10770
|
var admin_content_default = adminContentRoutes;
|
|
10768
10771
|
|
|
10769
10772
|
// src/templates/pages/admin-profile.template.ts
|
|
10770
|
-
|
|
10773
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
10771
10774
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
10772
10775
|
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
10776
|
${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 +10790,8 @@ function renderProfilePage(data) {
|
|
|
10787
10790
|
</div>
|
|
10788
10791
|
|
|
10789
10792
|
<!-- Alert Messages -->
|
|
10790
|
-
${data.error ?
|
|
10791
|
-
${data.success ?
|
|
10793
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
10794
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
10792
10795
|
|
|
10793
10796
|
<!-- Profile Form -->
|
|
10794
10797
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -11177,7 +11180,7 @@ function renderProfilePage(data) {
|
|
|
11177
11180
|
version: data.version,
|
|
11178
11181
|
content: pageContent
|
|
11179
11182
|
};
|
|
11180
|
-
return
|
|
11183
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
11181
11184
|
}
|
|
11182
11185
|
|
|
11183
11186
|
// src/templates/components/alert.template.ts
|
|
@@ -11460,7 +11463,7 @@ function renderActivityLogsPage(data) {
|
|
|
11460
11463
|
user: data.user,
|
|
11461
11464
|
content: pageContent
|
|
11462
11465
|
};
|
|
11463
|
-
return
|
|
11466
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
11464
11467
|
}
|
|
11465
11468
|
function getActionBadgeClass(action) {
|
|
11466
11469
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -11480,7 +11483,7 @@ function formatAction(action) {
|
|
|
11480
11483
|
}
|
|
11481
11484
|
|
|
11482
11485
|
// src/templates/pages/admin-user-edit.template.ts
|
|
11483
|
-
|
|
11486
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
11484
11487
|
|
|
11485
11488
|
// src/templates/components/confirmation-dialog.template.ts
|
|
11486
11489
|
function renderConfirmationDialog2(options) {
|
|
@@ -11601,8 +11604,8 @@ function renderUserEditPage(data) {
|
|
|
11601
11604
|
|
|
11602
11605
|
<!-- Alert Messages -->
|
|
11603
11606
|
<div id="form-messages">
|
|
11604
|
-
${data.error ?
|
|
11605
|
-
${data.success ?
|
|
11607
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
11608
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
11606
11609
|
</div>
|
|
11607
11610
|
|
|
11608
11611
|
<!-- User Edit Form -->
|
|
@@ -12000,11 +12003,11 @@ function renderUserEditPage(data) {
|
|
|
12000
12003
|
user: data.user,
|
|
12001
12004
|
content: pageContent
|
|
12002
12005
|
};
|
|
12003
|
-
return
|
|
12006
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12004
12007
|
}
|
|
12005
12008
|
|
|
12006
12009
|
// src/templates/pages/admin-user-new.template.ts
|
|
12007
|
-
|
|
12010
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
12008
12011
|
function renderUserNewPage(data) {
|
|
12009
12012
|
const pageContent = `
|
|
12010
12013
|
<div>
|
|
@@ -12043,8 +12046,8 @@ function renderUserNewPage(data) {
|
|
|
12043
12046
|
|
|
12044
12047
|
<!-- Alert Messages -->
|
|
12045
12048
|
<div id="form-messages">
|
|
12046
|
-
${data.error ?
|
|
12047
|
-
${data.success ?
|
|
12049
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
12050
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
12048
12051
|
</div>
|
|
12049
12052
|
|
|
12050
12053
|
<!-- User New Form -->
|
|
@@ -12288,11 +12291,11 @@ function renderUserNewPage(data) {
|
|
|
12288
12291
|
user: data.user,
|
|
12289
12292
|
content: pageContent
|
|
12290
12293
|
};
|
|
12291
|
-
return
|
|
12294
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12292
12295
|
}
|
|
12293
12296
|
|
|
12294
12297
|
// src/templates/pages/admin-users-list.template.ts
|
|
12295
|
-
|
|
12298
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
12296
12299
|
function renderUsersListPage(data) {
|
|
12297
12300
|
const columns = [
|
|
12298
12301
|
{
|
|
@@ -12443,8 +12446,8 @@ function renderUsersListPage(data) {
|
|
|
12443
12446
|
</div>
|
|
12444
12447
|
|
|
12445
12448
|
<!-- Alert Messages -->
|
|
12446
|
-
${data.error ?
|
|
12447
|
-
${data.success ?
|
|
12449
|
+
${data.error ? chunkQP3OHHON_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
12450
|
+
${data.success ? chunkQP3OHHON_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
12448
12451
|
|
|
12449
12452
|
<!-- Stats -->
|
|
12450
12453
|
<div class="mb-6">
|
|
@@ -12621,10 +12624,10 @@ function renderUsersListPage(data) {
|
|
|
12621
12624
|
</div>
|
|
12622
12625
|
|
|
12623
12626
|
<!-- Users Table -->
|
|
12624
|
-
${
|
|
12627
|
+
${chunkQP3OHHON_cjs.renderTable(tableData)}
|
|
12625
12628
|
|
|
12626
12629
|
<!-- Pagination -->
|
|
12627
|
-
${data.pagination ?
|
|
12630
|
+
${data.pagination ? chunkQP3OHHON_cjs.renderPagination(data.pagination) : ""}
|
|
12628
12631
|
</div>
|
|
12629
12632
|
|
|
12630
12633
|
<script>
|
|
@@ -12695,19 +12698,19 @@ function renderUsersListPage(data) {
|
|
|
12695
12698
|
version: data.version,
|
|
12696
12699
|
content: pageContent
|
|
12697
12700
|
};
|
|
12698
|
-
return
|
|
12701
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12699
12702
|
}
|
|
12700
12703
|
|
|
12701
12704
|
// src/routes/admin-users.ts
|
|
12702
12705
|
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/*",
|
|
12706
|
+
userRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
12707
|
+
userRoutes.use("/users/*", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
12708
|
+
userRoutes.use("/users", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
12709
|
+
userRoutes.use("/invite-user", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
12710
|
+
userRoutes.use("/resend-invitation/*", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
12711
|
+
userRoutes.use("/cancel-invitation/*", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
12712
|
+
userRoutes.use("/activity-logs", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
12713
|
+
userRoutes.use("/activity-logs/*", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
12711
12714
|
userRoutes.get("/", (c) => {
|
|
12712
12715
|
return c.redirect("/admin/dashboard");
|
|
12713
12716
|
});
|
|
@@ -12877,7 +12880,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
12877
12880
|
}
|
|
12878
12881
|
await saveCustomData(db, user.userId, sanitized);
|
|
12879
12882
|
}
|
|
12880
|
-
await
|
|
12883
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
12881
12884
|
db,
|
|
12882
12885
|
user.userId,
|
|
12883
12886
|
"profile.update",
|
|
@@ -12940,7 +12943,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
12940
12943
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
12941
12944
|
`);
|
|
12942
12945
|
const userData = await userStmt.bind(user.userId).first();
|
|
12943
|
-
await
|
|
12946
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
12944
12947
|
db,
|
|
12945
12948
|
user.userId,
|
|
12946
12949
|
"profile.avatar_update",
|
|
@@ -13011,7 +13014,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13011
13014
|
dismissible: true
|
|
13012
13015
|
}));
|
|
13013
13016
|
}
|
|
13014
|
-
const validPassword = await
|
|
13017
|
+
const validPassword = await chunkEGUDIX6Q_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
13015
13018
|
if (!validPassword) {
|
|
13016
13019
|
return c.html(renderAlert2({
|
|
13017
13020
|
type: "error",
|
|
@@ -13019,7 +13022,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13019
13022
|
dismissible: true
|
|
13020
13023
|
}));
|
|
13021
13024
|
}
|
|
13022
|
-
const newPasswordHash = await
|
|
13025
|
+
const newPasswordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(newPassword);
|
|
13023
13026
|
const historyStmt = db.prepare(`
|
|
13024
13027
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
13025
13028
|
VALUES (?, ?, ?, ?)
|
|
@@ -13035,7 +13038,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13035
13038
|
WHERE id = ?
|
|
13036
13039
|
`);
|
|
13037
13040
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
13038
|
-
await
|
|
13041
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13039
13042
|
db,
|
|
13040
13043
|
user.userId,
|
|
13041
13044
|
"profile.password_change",
|
|
@@ -13102,7 +13105,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
13102
13105
|
`);
|
|
13103
13106
|
const countResult = await countStmt.bind(...params).first();
|
|
13104
13107
|
const totalUsers = countResult?.total || 0;
|
|
13105
|
-
await
|
|
13108
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13106
13109
|
db,
|
|
13107
13110
|
user.userId,
|
|
13108
13111
|
"users.list_view",
|
|
@@ -13260,7 +13263,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13260
13263
|
dismissible: true
|
|
13261
13264
|
}));
|
|
13262
13265
|
}
|
|
13263
|
-
const passwordHash = await
|
|
13266
|
+
const passwordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(password);
|
|
13264
13267
|
const userId = crypto.randomUUID();
|
|
13265
13268
|
const createStmt = db.prepare(`
|
|
13266
13269
|
INSERT INTO users (
|
|
@@ -13283,7 +13286,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13283
13286
|
Date.now(),
|
|
13284
13287
|
Date.now()
|
|
13285
13288
|
).run();
|
|
13286
|
-
await
|
|
13289
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13287
13290
|
db,
|
|
13288
13291
|
user.userId,
|
|
13289
13292
|
"user!.create",
|
|
@@ -13322,7 +13325,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
13322
13325
|
if (!userRecord) {
|
|
13323
13326
|
return c.json({ error: "User not found" }, 404);
|
|
13324
13327
|
}
|
|
13325
|
-
await
|
|
13328
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13326
13329
|
db,
|
|
13327
13330
|
user.userId,
|
|
13328
13331
|
"user!.view",
|
|
@@ -13548,14 +13551,14 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13548
13551
|
userId
|
|
13549
13552
|
).run();
|
|
13550
13553
|
if (newPassword) {
|
|
13551
|
-
const passwordHash = await
|
|
13554
|
+
const passwordHash = await chunkEGUDIX6Q_cjs.AuthManager.hashPassword(newPassword);
|
|
13552
13555
|
const updatePasswordStmt = db.prepare(`
|
|
13553
13556
|
UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?
|
|
13554
13557
|
`);
|
|
13555
13558
|
await updatePasswordStmt.bind(passwordHash, Date.now(), userId).run();
|
|
13556
13559
|
}
|
|
13557
13560
|
const hasProfileData = profileDisplayName || profileBio || profileCompany || profileJobTitle || profileWebsite || profileLocation || profileDateOfBirth;
|
|
13558
|
-
if (hasProfileData) {
|
|
13561
|
+
if (hasProfileData || customDataJson !== null) {
|
|
13559
13562
|
const now = Date.now();
|
|
13560
13563
|
const profileCheckStmt = db.prepare(`SELECT id FROM user_profiles WHERE user_id = ?`);
|
|
13561
13564
|
const existingProfile = await profileCheckStmt.bind(userId).first();
|
|
@@ -13602,7 +13605,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13602
13605
|
).run();
|
|
13603
13606
|
}
|
|
13604
13607
|
}
|
|
13605
|
-
await
|
|
13608
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13606
13609
|
db,
|
|
13607
13610
|
user.userId,
|
|
13608
13611
|
"user.update",
|
|
@@ -13647,7 +13650,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
|
|
|
13647
13650
|
UPDATE users SET is_active = ?, updated_at = ? WHERE id = ?
|
|
13648
13651
|
`);
|
|
13649
13652
|
await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
|
|
13650
|
-
await
|
|
13653
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13651
13654
|
db,
|
|
13652
13655
|
user.userId,
|
|
13653
13656
|
active ? "user.activate" : "user.deactivate",
|
|
@@ -13688,7 +13691,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13688
13691
|
DELETE FROM users WHERE id = ?
|
|
13689
13692
|
`);
|
|
13690
13693
|
await deleteStmt.bind(userId).run();
|
|
13691
|
-
await
|
|
13694
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13692
13695
|
db,
|
|
13693
13696
|
user.userId,
|
|
13694
13697
|
"user!.hard_delete",
|
|
@@ -13707,7 +13710,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13707
13710
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
13708
13711
|
`);
|
|
13709
13712
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
13710
|
-
await
|
|
13713
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13711
13714
|
db,
|
|
13712
13715
|
user.userId,
|
|
13713
13716
|
"user!.soft_delete",
|
|
@@ -13773,7 +13776,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
13773
13776
|
Date.now(),
|
|
13774
13777
|
Date.now()
|
|
13775
13778
|
).run();
|
|
13776
|
-
await
|
|
13779
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13777
13780
|
db,
|
|
13778
13781
|
user.userId,
|
|
13779
13782
|
"user!.invite_sent",
|
|
@@ -13830,7 +13833,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
13830
13833
|
Date.now(),
|
|
13831
13834
|
userId
|
|
13832
13835
|
).run();
|
|
13833
|
-
await
|
|
13836
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13834
13837
|
db,
|
|
13835
13838
|
user.userId,
|
|
13836
13839
|
"user!.invitation_resent",
|
|
@@ -13866,7 +13869,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
13866
13869
|
}
|
|
13867
13870
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
13868
13871
|
await deleteStmt.bind(userId).run();
|
|
13869
|
-
await
|
|
13872
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13870
13873
|
db,
|
|
13871
13874
|
user.userId,
|
|
13872
13875
|
"user!.invitation_cancelled",
|
|
@@ -13949,7 +13952,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
13949
13952
|
...log,
|
|
13950
13953
|
details: log.details ? JSON.parse(log.details) : null
|
|
13951
13954
|
}));
|
|
13952
|
-
await
|
|
13955
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
13953
13956
|
db,
|
|
13954
13957
|
user.userId,
|
|
13955
13958
|
"activity.logs_viewed",
|
|
@@ -14056,7 +14059,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
14056
14059
|
csvRows.push(row.join(","));
|
|
14057
14060
|
}
|
|
14058
14061
|
const csvContent = csvRows.join("\n");
|
|
14059
|
-
await
|
|
14062
|
+
await chunkEGUDIX6Q_cjs.logActivity(
|
|
14060
14063
|
db,
|
|
14061
14064
|
user.userId,
|
|
14062
14065
|
"activity.logs_exported",
|
|
@@ -14274,7 +14277,7 @@ function getFileIcon(mimeType) {
|
|
|
14274
14277
|
}
|
|
14275
14278
|
|
|
14276
14279
|
// src/templates/pages/admin-media-library.template.ts
|
|
14277
|
-
|
|
14280
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
14278
14281
|
function renderMediaLibraryPage(data) {
|
|
14279
14282
|
const pageContent = `
|
|
14280
14283
|
<div>
|
|
@@ -15209,7 +15212,7 @@ function renderMediaLibraryPage(data) {
|
|
|
15209
15212
|
version: data.version,
|
|
15210
15213
|
content: pageContent
|
|
15211
15214
|
};
|
|
15212
|
-
return
|
|
15215
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
15213
15216
|
}
|
|
15214
15217
|
|
|
15215
15218
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -15395,7 +15398,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
15395
15398
|
// 50MB max
|
|
15396
15399
|
});
|
|
15397
15400
|
var adminMediaRoutes = new hono.Hono();
|
|
15398
|
-
adminMediaRoutes.use("*",
|
|
15401
|
+
adminMediaRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
15399
15402
|
adminMediaRoutes.get("/", async (c) => {
|
|
15400
15403
|
try {
|
|
15401
15404
|
const user = c.get("user");
|
|
@@ -15981,7 +15984,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
15981
15984
|
`);
|
|
15982
15985
|
}
|
|
15983
15986
|
});
|
|
15984
|
-
adminMediaRoutes.delete("/cleanup",
|
|
15987
|
+
adminMediaRoutes.delete("/cleanup", chunkEGUDIX6Q_cjs.requireRole("admin"), async (c) => {
|
|
15985
15988
|
try {
|
|
15986
15989
|
const db = c.env.DB;
|
|
15987
15990
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -16231,7 +16234,7 @@ function formatFileSize(bytes) {
|
|
|
16231
16234
|
}
|
|
16232
16235
|
|
|
16233
16236
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
16234
|
-
|
|
16237
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
16235
16238
|
function renderPluginsListPage(data) {
|
|
16236
16239
|
const categories = [
|
|
16237
16240
|
{ value: "content", label: "Content Management" },
|
|
@@ -16701,7 +16704,7 @@ function renderPluginsListPage(data) {
|
|
|
16701
16704
|
version: data.version,
|
|
16702
16705
|
content: pageContent
|
|
16703
16706
|
};
|
|
16704
|
-
return
|
|
16707
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
16705
16708
|
}
|
|
16706
16709
|
function renderPluginCard(plugin) {
|
|
16707
16710
|
const statusColors = {
|
|
@@ -17338,7 +17341,7 @@ function renderPluginSettingsPage(data) {
|
|
|
17338
17341
|
user,
|
|
17339
17342
|
content: pageContent
|
|
17340
17343
|
};
|
|
17341
|
-
return
|
|
17344
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
17342
17345
|
}
|
|
17343
17346
|
function renderStatusBadge(status) {
|
|
17344
17347
|
const statusColors = {
|
|
@@ -18206,7 +18209,7 @@ function renderEmailSettingsContent(plugin, settings) {
|
|
|
18206
18209
|
|
|
18207
18210
|
// src/routes/admin-plugins.ts
|
|
18208
18211
|
var adminPluginRoutes = new hono.Hono();
|
|
18209
|
-
adminPluginRoutes.use("*",
|
|
18212
|
+
adminPluginRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
18210
18213
|
var AVAILABLE_PLUGINS = [
|
|
18211
18214
|
{
|
|
18212
18215
|
id: "third-party-faq",
|
|
@@ -18216,7 +18219,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18216
18219
|
version: "2.0.0",
|
|
18217
18220
|
author: "Community Developer",
|
|
18218
18221
|
category: "content",
|
|
18219
|
-
icon: "\
|
|
18222
|
+
icon: "\xE2\x9D\x93",
|
|
18220
18223
|
permissions: ["manage:faqs"],
|
|
18221
18224
|
dependencies: [],
|
|
18222
18225
|
is_core: false
|
|
@@ -18229,7 +18232,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18229
18232
|
version: "1.0.0-beta.1",
|
|
18230
18233
|
author: "SonicJS",
|
|
18231
18234
|
category: "demo",
|
|
18232
|
-
icon: "\
|
|
18235
|
+
icon: "\xF0\x9F\x8E\xAF",
|
|
18233
18236
|
permissions: [],
|
|
18234
18237
|
dependencies: [],
|
|
18235
18238
|
is_core: false
|
|
@@ -18242,7 +18245,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18242
18245
|
version: "1.0.0-beta.1",
|
|
18243
18246
|
author: "SonicJS Team",
|
|
18244
18247
|
category: "system",
|
|
18245
|
-
icon: "\
|
|
18248
|
+
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18246
18249
|
permissions: ["manage:database", "admin"],
|
|
18247
18250
|
dependencies: [],
|
|
18248
18251
|
is_core: false
|
|
@@ -18255,7 +18258,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18255
18258
|
version: "1.0.0-beta.1",
|
|
18256
18259
|
author: "SonicJS Team",
|
|
18257
18260
|
category: "development",
|
|
18258
|
-
icon: "\
|
|
18261
|
+
icon: "\xF0\x9F\x8C\xB1",
|
|
18259
18262
|
permissions: ["admin"],
|
|
18260
18263
|
dependencies: [],
|
|
18261
18264
|
is_core: false
|
|
@@ -18268,7 +18271,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18268
18271
|
version: "1.0.0",
|
|
18269
18272
|
author: "SonicJS Team",
|
|
18270
18273
|
category: "editor",
|
|
18271
|
-
icon: "\
|
|
18274
|
+
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18272
18275
|
permissions: [],
|
|
18273
18276
|
dependencies: [],
|
|
18274
18277
|
is_core: true
|
|
@@ -18281,7 +18284,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18281
18284
|
version: "1.0.0",
|
|
18282
18285
|
author: "SonicJS Team",
|
|
18283
18286
|
category: "editor",
|
|
18284
|
-
icon: "\
|
|
18287
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18285
18288
|
permissions: [],
|
|
18286
18289
|
dependencies: [],
|
|
18287
18290
|
is_core: false
|
|
@@ -18294,7 +18297,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18294
18297
|
version: "1.0.0",
|
|
18295
18298
|
author: "SonicJS Team",
|
|
18296
18299
|
category: "editor",
|
|
18297
|
-
icon: "\
|
|
18300
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18298
18301
|
permissions: [],
|
|
18299
18302
|
dependencies: [],
|
|
18300
18303
|
is_core: false
|
|
@@ -18307,7 +18310,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18307
18310
|
version: "1.0.0",
|
|
18308
18311
|
author: "SonicJS Team",
|
|
18309
18312
|
category: "security",
|
|
18310
|
-
icon: "\
|
|
18313
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18311
18314
|
permissions: [],
|
|
18312
18315
|
dependencies: [],
|
|
18313
18316
|
is_core: true
|
|
@@ -18320,7 +18323,7 @@ var AVAILABLE_PLUGINS = [
|
|
|
18320
18323
|
version: "1.0.0-beta.1",
|
|
18321
18324
|
author: "SonicJS Team",
|
|
18322
18325
|
category: "security",
|
|
18323
|
-
icon: "\
|
|
18326
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18324
18327
|
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18325
18328
|
dependencies: [],
|
|
18326
18329
|
is_core: false
|
|
@@ -18333,10 +18336,23 @@ var AVAILABLE_PLUGINS = [
|
|
|
18333
18336
|
version: "1.0.0",
|
|
18334
18337
|
author: "SonicJS Team",
|
|
18335
18338
|
category: "search",
|
|
18336
|
-
icon: "\
|
|
18339
|
+
icon: "\xF0\x9F\x94\x8D",
|
|
18337
18340
|
permissions: [],
|
|
18338
18341
|
dependencies: [],
|
|
18339
18342
|
is_core: true
|
|
18343
|
+
},
|
|
18344
|
+
{
|
|
18345
|
+
id: "form-builder",
|
|
18346
|
+
name: "form-builder",
|
|
18347
|
+
display_name: "Form Builder",
|
|
18348
|
+
description: "Drag-and-drop form builder with conditional logic, file uploads, and email notifications. Create contact forms, surveys, and data collection forms.",
|
|
18349
|
+
version: "1.0.0",
|
|
18350
|
+
author: "SonicJS Team",
|
|
18351
|
+
category: "content",
|
|
18352
|
+
icon: "\u{1F4DD}",
|
|
18353
|
+
permissions: ["forms:create", "forms:manage", "forms:submissions"],
|
|
18354
|
+
dependencies: [],
|
|
18355
|
+
is_core: false
|
|
18340
18356
|
}
|
|
18341
18357
|
];
|
|
18342
18358
|
adminPluginRoutes.get("/", async (c) => {
|
|
@@ -18542,7 +18558,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18542
18558
|
version: "2.0.0",
|
|
18543
18559
|
author: "Community Developer",
|
|
18544
18560
|
category: "content",
|
|
18545
|
-
icon: "\
|
|
18561
|
+
icon: "\xE2\x9D\x93",
|
|
18546
18562
|
permissions: ["manage:faqs"],
|
|
18547
18563
|
dependencies: [],
|
|
18548
18564
|
settings: {
|
|
@@ -18562,7 +18578,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18562
18578
|
version: "1.0.0-beta.1",
|
|
18563
18579
|
author: "SonicJS",
|
|
18564
18580
|
category: "demo",
|
|
18565
|
-
icon: "\
|
|
18581
|
+
icon: "\xF0\x9F\x8E\xAF",
|
|
18566
18582
|
permissions: [],
|
|
18567
18583
|
dependencies: [],
|
|
18568
18584
|
settings: {
|
|
@@ -18582,7 +18598,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18582
18598
|
version: "1.0.0-beta.1",
|
|
18583
18599
|
author: "SonicJS Team",
|
|
18584
18600
|
category: "security",
|
|
18585
|
-
icon: "\
|
|
18601
|
+
icon: "\xF0\x9F\x94\x90",
|
|
18586
18602
|
permissions: ["manage:users", "manage:roles", "manage:permissions"],
|
|
18587
18603
|
dependencies: [],
|
|
18588
18604
|
is_core: true,
|
|
@@ -18599,7 +18615,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18599
18615
|
version: "1.0.0-beta.1",
|
|
18600
18616
|
author: "SonicJS Team",
|
|
18601
18617
|
category: "media",
|
|
18602
|
-
icon: "\
|
|
18618
|
+
icon: "\xF0\x9F\x93\xB8",
|
|
18603
18619
|
permissions: ["manage:media", "upload:files"],
|
|
18604
18620
|
dependencies: [],
|
|
18605
18621
|
is_core: true,
|
|
@@ -18616,7 +18632,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18616
18632
|
version: "1.0.0-beta.1",
|
|
18617
18633
|
author: "SonicJS Team",
|
|
18618
18634
|
category: "content",
|
|
18619
|
-
icon: "\
|
|
18635
|
+
icon: "\xF0\x9F\x94\x84",
|
|
18620
18636
|
permissions: ["manage:workflows", "approve:content"],
|
|
18621
18637
|
dependencies: [],
|
|
18622
18638
|
is_core: true,
|
|
@@ -18633,7 +18649,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18633
18649
|
version: "1.0.0-beta.1",
|
|
18634
18650
|
author: "SonicJS Team",
|
|
18635
18651
|
category: "system",
|
|
18636
|
-
icon: "\
|
|
18652
|
+
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18637
18653
|
permissions: ["manage:database", "admin"],
|
|
18638
18654
|
dependencies: [],
|
|
18639
18655
|
is_core: false,
|
|
@@ -18655,7 +18671,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18655
18671
|
version: "1.0.0-beta.1",
|
|
18656
18672
|
author: "SonicJS Team",
|
|
18657
18673
|
category: "development",
|
|
18658
|
-
icon: "\
|
|
18674
|
+
icon: "\xF0\x9F\x8C\xB1",
|
|
18659
18675
|
permissions: ["admin"],
|
|
18660
18676
|
dependencies: [],
|
|
18661
18677
|
is_core: false,
|
|
@@ -18676,7 +18692,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18676
18692
|
version: "1.0.0",
|
|
18677
18693
|
author: "SonicJS Team",
|
|
18678
18694
|
category: "editor",
|
|
18679
|
-
icon: "\
|
|
18695
|
+
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18680
18696
|
permissions: [],
|
|
18681
18697
|
dependencies: [],
|
|
18682
18698
|
is_core: true,
|
|
@@ -18698,7 +18714,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18698
18714
|
version: "1.0.0",
|
|
18699
18715
|
author: "SonicJS Team",
|
|
18700
18716
|
category: "editor",
|
|
18701
|
-
icon: "\
|
|
18717
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18702
18718
|
permissions: [],
|
|
18703
18719
|
dependencies: [],
|
|
18704
18720
|
is_core: false,
|
|
@@ -18720,7 +18736,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18720
18736
|
version: "1.0.0",
|
|
18721
18737
|
author: "SonicJS Team",
|
|
18722
18738
|
category: "editor",
|
|
18723
|
-
icon: "\
|
|
18739
|
+
icon: "\xF0\x9F\x93\x9D",
|
|
18724
18740
|
permissions: [],
|
|
18725
18741
|
dependencies: [],
|
|
18726
18742
|
is_core: false,
|
|
@@ -18742,7 +18758,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18742
18758
|
version: "1.0.0-beta.1",
|
|
18743
18759
|
author: "SonicJS Team",
|
|
18744
18760
|
category: "security",
|
|
18745
|
-
icon: "\
|
|
18761
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18746
18762
|
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18747
18763
|
dependencies: [],
|
|
18748
18764
|
is_core: false,
|
|
@@ -18790,7 +18806,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18790
18806
|
version: "1.0.0",
|
|
18791
18807
|
author: "SonicJS Team",
|
|
18792
18808
|
category: "search",
|
|
18793
|
-
icon: "\
|
|
18809
|
+
icon: "\xF0\x9F\x94\x8D",
|
|
18794
18810
|
permissions: [],
|
|
18795
18811
|
dependencies: [],
|
|
18796
18812
|
is_core: true,
|
|
@@ -18807,7 +18823,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18807
18823
|
version: "1.0.0",
|
|
18808
18824
|
author: "SonicJS Team",
|
|
18809
18825
|
category: "security",
|
|
18810
|
-
icon: "\
|
|
18826
|
+
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18811
18827
|
permissions: [],
|
|
18812
18828
|
dependencies: [],
|
|
18813
18829
|
is_core: true,
|
|
@@ -18825,6 +18841,27 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18825
18841
|
});
|
|
18826
18842
|
return c.json({ success: true, plugin: turnstilePlugin });
|
|
18827
18843
|
}
|
|
18844
|
+
if (body.name === "form-builder") {
|
|
18845
|
+
const formBuilderPlugin = await pluginService.installPlugin({
|
|
18846
|
+
id: "form-builder",
|
|
18847
|
+
name: "form-builder",
|
|
18848
|
+
display_name: "Form Builder",
|
|
18849
|
+
description: "Drag-and-drop form builder with conditional logic, file uploads, and email notifications. Create contact forms, surveys, and data collection forms.",
|
|
18850
|
+
version: "1.0.0",
|
|
18851
|
+
author: "SonicJS Team",
|
|
18852
|
+
category: "content",
|
|
18853
|
+
icon: "\u{1F4DD}",
|
|
18854
|
+
permissions: ["forms:create", "forms:manage", "forms:submissions"],
|
|
18855
|
+
dependencies: [],
|
|
18856
|
+
settings: {
|
|
18857
|
+
enableNotifications: true,
|
|
18858
|
+
enableFileUploads: true,
|
|
18859
|
+
maxSubmissionsPerForm: 0,
|
|
18860
|
+
submissionRetentionDays: 90
|
|
18861
|
+
}
|
|
18862
|
+
});
|
|
18863
|
+
return c.json({ success: true, plugin: formBuilderPlugin });
|
|
18864
|
+
}
|
|
18828
18865
|
return c.json({ error: "Plugin not found in registry" }, 404);
|
|
18829
18866
|
} catch (error) {
|
|
18830
18867
|
console.error("Error installing plugin:", error);
|
|
@@ -18891,7 +18928,7 @@ function formatLastUpdated(timestamp) {
|
|
|
18891
18928
|
}
|
|
18892
18929
|
|
|
18893
18930
|
// src/templates/pages/admin-logs-list.template.ts
|
|
18894
|
-
|
|
18931
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
18895
18932
|
function renderLogsListPage(data) {
|
|
18896
18933
|
const { logs, pagination, filters, user } = data;
|
|
18897
18934
|
const content = `
|
|
@@ -19202,7 +19239,7 @@ function renderLogsListPage(data) {
|
|
|
19202
19239
|
user,
|
|
19203
19240
|
content
|
|
19204
19241
|
};
|
|
19205
|
-
return
|
|
19242
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
19206
19243
|
}
|
|
19207
19244
|
function renderLogDetailsPage(data) {
|
|
19208
19245
|
const { log, user } = data;
|
|
@@ -19414,7 +19451,7 @@ function renderLogDetailsPage(data) {
|
|
|
19414
19451
|
</div>
|
|
19415
19452
|
</div>
|
|
19416
19453
|
`;
|
|
19417
|
-
return
|
|
19454
|
+
return chunkQP3OHHON_cjs.adminLayoutV2({
|
|
19418
19455
|
title: `Log Details - ${log.id}`,
|
|
19419
19456
|
user,
|
|
19420
19457
|
content
|
|
@@ -19657,7 +19694,7 @@ function renderLogConfigPage(data) {
|
|
|
19657
19694
|
|
|
19658
19695
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
19659
19696
|
`;
|
|
19660
|
-
return
|
|
19697
|
+
return chunkQP3OHHON_cjs.adminLayoutV2({
|
|
19661
19698
|
title: "Log Configuration",
|
|
19662
19699
|
user,
|
|
19663
19700
|
content
|
|
@@ -19666,7 +19703,7 @@ function renderLogConfigPage(data) {
|
|
|
19666
19703
|
|
|
19667
19704
|
// src/routes/admin-logs.ts
|
|
19668
19705
|
var adminLogsRoutes = new hono.Hono();
|
|
19669
|
-
adminLogsRoutes.use("*",
|
|
19706
|
+
adminLogsRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
19670
19707
|
adminLogsRoutes.get("/", async (c) => {
|
|
19671
19708
|
try {
|
|
19672
19709
|
const user = c.get("user");
|
|
@@ -20038,7 +20075,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
20038
20075
|
role: user.role
|
|
20039
20076
|
} : void 0
|
|
20040
20077
|
};
|
|
20041
|
-
return c.html(
|
|
20078
|
+
return c.html(chunkQP3OHHON_cjs.renderDesignPage(pageData));
|
|
20042
20079
|
});
|
|
20043
20080
|
var adminCheckboxRoutes = new hono.Hono();
|
|
20044
20081
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -20050,7 +20087,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
20050
20087
|
role: user.role
|
|
20051
20088
|
} : void 0
|
|
20052
20089
|
};
|
|
20053
|
-
return c.html(
|
|
20090
|
+
return c.html(chunkQP3OHHON_cjs.renderCheckboxPage(pageData));
|
|
20054
20091
|
});
|
|
20055
20092
|
|
|
20056
20093
|
// src/templates/pages/admin-testimonials-form.template.ts
|
|
@@ -20078,7 +20115,7 @@ function renderTestimonialsForm(data) {
|
|
|
20078
20115
|
</div>
|
|
20079
20116
|
</div>
|
|
20080
20117
|
|
|
20081
|
-
${message ?
|
|
20118
|
+
${message ? chunkQP3OHHON_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20082
20119
|
|
|
20083
20120
|
<!-- Form -->
|
|
20084
20121
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -20307,7 +20344,7 @@ function renderTestimonialsForm(data) {
|
|
|
20307
20344
|
user: data.user,
|
|
20308
20345
|
content: pageContent
|
|
20309
20346
|
};
|
|
20310
|
-
return
|
|
20347
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
20311
20348
|
}
|
|
20312
20349
|
function escapeHtml4(unsafe) {
|
|
20313
20350
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -20333,7 +20370,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20333
20370
|
const offset = (currentPage - 1) * limit;
|
|
20334
20371
|
const db = c.env?.DB;
|
|
20335
20372
|
if (!db) {
|
|
20336
|
-
return c.html(
|
|
20373
|
+
return c.html(chunkQP3OHHON_cjs.renderTestimonialsList({
|
|
20337
20374
|
testimonials: [],
|
|
20338
20375
|
totalCount: 0,
|
|
20339
20376
|
currentPage: 1,
|
|
@@ -20373,7 +20410,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20373
20410
|
`;
|
|
20374
20411
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
20375
20412
|
const totalPages = Math.ceil(totalCount / limit);
|
|
20376
|
-
return c.html(
|
|
20413
|
+
return c.html(chunkQP3OHHON_cjs.renderTestimonialsList({
|
|
20377
20414
|
testimonials: testimonials || [],
|
|
20378
20415
|
totalCount,
|
|
20379
20416
|
currentPage,
|
|
@@ -20387,7 +20424,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20387
20424
|
} catch (error) {
|
|
20388
20425
|
console.error("Error fetching testimonials:", error);
|
|
20389
20426
|
const user = c.get("user");
|
|
20390
|
-
return c.html(
|
|
20427
|
+
return c.html(chunkQP3OHHON_cjs.renderTestimonialsList({
|
|
20391
20428
|
testimonials: [],
|
|
20392
20429
|
totalCount: 0,
|
|
20393
20430
|
currentPage: 1,
|
|
@@ -20706,7 +20743,7 @@ function renderCodeExamplesForm(data) {
|
|
|
20706
20743
|
</div>
|
|
20707
20744
|
</div>
|
|
20708
20745
|
|
|
20709
|
-
${message ?
|
|
20746
|
+
${message ? chunkQP3OHHON_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20710
20747
|
|
|
20711
20748
|
<!-- Form -->
|
|
20712
20749
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -20976,7 +21013,7 @@ function renderCodeExamplesForm(data) {
|
|
|
20976
21013
|
user: data.user,
|
|
20977
21014
|
content: pageContent
|
|
20978
21015
|
};
|
|
20979
|
-
return
|
|
21016
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
20980
21017
|
}
|
|
20981
21018
|
function escapeHtml5(unsafe) {
|
|
20982
21019
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -21003,7 +21040,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21003
21040
|
const offset = (currentPage - 1) * limit;
|
|
21004
21041
|
const db = c.env?.DB;
|
|
21005
21042
|
if (!db) {
|
|
21006
|
-
return c.html(
|
|
21043
|
+
return c.html(chunkQP3OHHON_cjs.renderCodeExamplesList({
|
|
21007
21044
|
codeExamples: [],
|
|
21008
21045
|
totalCount: 0,
|
|
21009
21046
|
currentPage: 1,
|
|
@@ -21043,7 +21080,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21043
21080
|
`;
|
|
21044
21081
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
21045
21082
|
const totalPages = Math.ceil(totalCount / limit);
|
|
21046
|
-
return c.html(
|
|
21083
|
+
return c.html(chunkQP3OHHON_cjs.renderCodeExamplesList({
|
|
21047
21084
|
codeExamples: codeExamples || [],
|
|
21048
21085
|
totalCount,
|
|
21049
21086
|
currentPage,
|
|
@@ -21057,7 +21094,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21057
21094
|
} catch (error) {
|
|
21058
21095
|
console.error("Error fetching code examples:", error);
|
|
21059
21096
|
const user = c.get("user");
|
|
21060
|
-
return c.html(
|
|
21097
|
+
return c.html(chunkQP3OHHON_cjs.renderCodeExamplesList({
|
|
21061
21098
|
codeExamples: [],
|
|
21062
21099
|
totalCount: 0,
|
|
21063
21100
|
currentPage: 1,
|
|
@@ -21446,7 +21483,7 @@ function renderDashboardPage(data) {
|
|
|
21446
21483
|
version: data.version,
|
|
21447
21484
|
content: pageContent
|
|
21448
21485
|
};
|
|
21449
|
-
return
|
|
21486
|
+
return chunkQP3OHHON_cjs.renderAdminLayout(layoutData);
|
|
21450
21487
|
}
|
|
21451
21488
|
function renderStatsCards(stats) {
|
|
21452
21489
|
const cards = [
|
|
@@ -21994,9 +22031,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
21994
22031
|
}
|
|
21995
22032
|
|
|
21996
22033
|
// src/routes/admin-dashboard.ts
|
|
21997
|
-
var VERSION =
|
|
22034
|
+
var VERSION = chunkXCP5GCBE_cjs.getCoreVersion();
|
|
21998
22035
|
var router = new hono.Hono();
|
|
21999
|
-
router.use("*",
|
|
22036
|
+
router.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
22000
22037
|
router.get("/", async (c) => {
|
|
22001
22038
|
const user = c.get("user");
|
|
22002
22039
|
try {
|
|
@@ -22235,7 +22272,7 @@ function normalizeFieldType(fieldType) {
|
|
|
22235
22272
|
}
|
|
22236
22273
|
|
|
22237
22274
|
// src/templates/pages/admin-collections-list.template.ts
|
|
22238
|
-
|
|
22275
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
22239
22276
|
|
|
22240
22277
|
// src/templates/components/table.template.ts
|
|
22241
22278
|
function renderTable2(data) {
|
|
@@ -22709,11 +22746,11 @@ function renderCollectionsListPage(data) {
|
|
|
22709
22746
|
version: data.version,
|
|
22710
22747
|
content: pageContent
|
|
22711
22748
|
};
|
|
22712
|
-
return
|
|
22749
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
22713
22750
|
}
|
|
22714
22751
|
|
|
22715
22752
|
// src/templates/pages/admin-collections-form.template.ts
|
|
22716
|
-
|
|
22753
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
22717
22754
|
function getFieldTypeBadge(fieldType) {
|
|
22718
22755
|
const typeLabels = {
|
|
22719
22756
|
"text": "Text",
|
|
@@ -22982,7 +23019,7 @@ function renderCollectionFormPage(data) {
|
|
|
22982
23019
|
}
|
|
22983
23020
|
</style>
|
|
22984
23021
|
|
|
22985
|
-
${
|
|
23022
|
+
${chunkQP3OHHON_cjs.renderForm(formData)}
|
|
22986
23023
|
|
|
22987
23024
|
${isEdit && data.managed ? `
|
|
22988
23025
|
<!-- Read-Only Fields Display for Managed Collections -->
|
|
@@ -23810,15 +23847,15 @@ function renderCollectionFormPage(data) {
|
|
|
23810
23847
|
version: data.version,
|
|
23811
23848
|
content: pageContent
|
|
23812
23849
|
};
|
|
23813
|
-
return
|
|
23850
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
23814
23851
|
}
|
|
23815
23852
|
|
|
23816
23853
|
// src/routes/admin-collections.ts
|
|
23817
23854
|
var adminCollectionsRoutes = new hono.Hono();
|
|
23818
|
-
adminCollectionsRoutes.use("*",
|
|
23819
|
-
adminCollectionsRoutes.post("*",
|
|
23820
|
-
adminCollectionsRoutes.put("*",
|
|
23821
|
-
adminCollectionsRoutes.delete("*",
|
|
23855
|
+
adminCollectionsRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
23856
|
+
adminCollectionsRoutes.post("*", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
23857
|
+
adminCollectionsRoutes.put("*", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
23858
|
+
adminCollectionsRoutes.delete("*", chunkEGUDIX6Q_cjs.requireRole(["admin"]));
|
|
23822
23859
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
23823
23860
|
try {
|
|
23824
23861
|
const user = c.get("user");
|
|
@@ -24550,7 +24587,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
24550
24587
|
});
|
|
24551
24588
|
|
|
24552
24589
|
// src/templates/pages/admin-settings.template.ts
|
|
24553
|
-
|
|
24590
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
24554
24591
|
function renderSettingsPage(data) {
|
|
24555
24592
|
const activeTab = data.activeTab || "general";
|
|
24556
24593
|
const pageContent = `
|
|
@@ -24932,7 +24969,7 @@ function renderSettingsPage(data) {
|
|
|
24932
24969
|
version: data.version,
|
|
24933
24970
|
content: pageContent
|
|
24934
24971
|
};
|
|
24935
|
-
return
|
|
24972
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
24936
24973
|
}
|
|
24937
24974
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
24938
24975
|
const isActive = activeTab === tabId;
|
|
@@ -26014,7 +26051,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
26014
26051
|
|
|
26015
26052
|
// src/routes/admin-settings.ts
|
|
26016
26053
|
var adminSettingsRoutes = new hono.Hono();
|
|
26017
|
-
adminSettingsRoutes.use("*",
|
|
26054
|
+
adminSettingsRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
26018
26055
|
function getMockSettings(user) {
|
|
26019
26056
|
return {
|
|
26020
26057
|
general: {
|
|
@@ -26182,7 +26219,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
26182
26219
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
26183
26220
|
try {
|
|
26184
26221
|
const db = c.env.DB;
|
|
26185
|
-
const migrationService = new
|
|
26222
|
+
const migrationService = new chunkSER23XI4_cjs.MigrationService(db);
|
|
26186
26223
|
const status = await migrationService.getMigrationStatus();
|
|
26187
26224
|
return c.json({
|
|
26188
26225
|
success: true,
|
|
@@ -26206,7 +26243,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26206
26243
|
}, 403);
|
|
26207
26244
|
}
|
|
26208
26245
|
const db = c.env.DB;
|
|
26209
|
-
const migrationService = new
|
|
26246
|
+
const migrationService = new chunkSER23XI4_cjs.MigrationService(db);
|
|
26210
26247
|
const result = await migrationService.runPendingMigrations();
|
|
26211
26248
|
return c.json({
|
|
26212
26249
|
success: result.success,
|
|
@@ -26224,7 +26261,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26224
26261
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
26225
26262
|
try {
|
|
26226
26263
|
const db = c.env.DB;
|
|
26227
|
-
const migrationService = new
|
|
26264
|
+
const migrationService = new chunkSER23XI4_cjs.MigrationService(db);
|
|
26228
26265
|
const validation = await migrationService.validateSchema();
|
|
26229
26266
|
return c.json({
|
|
26230
26267
|
success: true,
|
|
@@ -26433,7 +26470,7 @@ adminSettingsRoutes.post("/", async (c) => {
|
|
|
26433
26470
|
});
|
|
26434
26471
|
|
|
26435
26472
|
// src/templates/pages/admin-forms-list.template.ts
|
|
26436
|
-
|
|
26473
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
26437
26474
|
function renderFormsListPage(data) {
|
|
26438
26475
|
const tableData = {
|
|
26439
26476
|
tableId: "forms-table",
|
|
@@ -26695,11 +26732,11 @@ function renderFormsListPage(data) {
|
|
|
26695
26732
|
user: data.user,
|
|
26696
26733
|
version: data.version
|
|
26697
26734
|
};
|
|
26698
|
-
return
|
|
26735
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
26699
26736
|
}
|
|
26700
26737
|
|
|
26701
26738
|
// src/templates/pages/admin-forms-builder.template.ts
|
|
26702
|
-
|
|
26739
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
26703
26740
|
function getTurnstileComponentScript() {
|
|
26704
26741
|
return `
|
|
26705
26742
|
(function() {
|
|
@@ -27912,11 +27949,11 @@ ${getTurnstileComponentScript()}
|
|
|
27912
27949
|
user: data.user,
|
|
27913
27950
|
version: data.version
|
|
27914
27951
|
};
|
|
27915
|
-
return
|
|
27952
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
27916
27953
|
}
|
|
27917
27954
|
|
|
27918
27955
|
// src/templates/pages/admin-forms-create.template.ts
|
|
27919
|
-
|
|
27956
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
27920
27957
|
function renderFormCreatePage(data) {
|
|
27921
27958
|
const pageContent = `
|
|
27922
27959
|
<div class="max-w-3xl mx-auto">
|
|
@@ -28109,12 +28146,12 @@ function renderFormCreatePage(data) {
|
|
|
28109
28146
|
user: data.user,
|
|
28110
28147
|
version: data.version
|
|
28111
28148
|
};
|
|
28112
|
-
return
|
|
28149
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
28113
28150
|
}
|
|
28114
28151
|
|
|
28115
28152
|
// src/routes/admin-forms.ts
|
|
28116
28153
|
var adminFormsRoutes = new hono.Hono();
|
|
28117
|
-
adminFormsRoutes.use("*",
|
|
28154
|
+
adminFormsRoutes.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
28118
28155
|
adminFormsRoutes.get("/", async (c) => {
|
|
28119
28156
|
try {
|
|
28120
28157
|
const user = c.get("user");
|
|
@@ -28952,7 +28989,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28952
28989
|
var public_forms_default = publicFormsRoutes;
|
|
28953
28990
|
|
|
28954
28991
|
// src/templates/pages/admin-api-reference.template.ts
|
|
28955
|
-
|
|
28992
|
+
chunkQP3OHHON_cjs.init_admin_layout_catalyst_template();
|
|
28956
28993
|
function renderAuthBadge(auth) {
|
|
28957
28994
|
if (auth === true) {
|
|
28958
28995
|
return `
|
|
@@ -29283,13 +29320,13 @@ function renderAPIReferencePage(data) {
|
|
|
29283
29320
|
version: data.version,
|
|
29284
29321
|
content: pageContent
|
|
29285
29322
|
};
|
|
29286
|
-
return
|
|
29323
|
+
return chunkQP3OHHON_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
29287
29324
|
}
|
|
29288
29325
|
|
|
29289
29326
|
// src/routes/admin-api-reference.ts
|
|
29290
|
-
var VERSION2 =
|
|
29327
|
+
var VERSION2 = chunkXCP5GCBE_cjs.getCoreVersion();
|
|
29291
29328
|
var router2 = new hono.Hono();
|
|
29292
|
-
router2.use("*",
|
|
29329
|
+
router2.use("*", chunkEGUDIX6Q_cjs.requireAuth());
|
|
29293
29330
|
router2.get("/", async (c) => {
|
|
29294
29331
|
const user = c.get("user");
|
|
29295
29332
|
try {
|
|
@@ -29380,5 +29417,5 @@ exports.router2 = router2;
|
|
|
29380
29417
|
exports.test_cleanup_default = test_cleanup_default;
|
|
29381
29418
|
exports.userProfilesPlugin = userProfilesPlugin;
|
|
29382
29419
|
exports.userRoutes = userRoutes;
|
|
29383
|
-
//# sourceMappingURL=chunk-
|
|
29384
|
-
//# sourceMappingURL=chunk-
|
|
29420
|
+
//# sourceMappingURL=chunk-HVTSE2SF.cjs.map
|
|
29421
|
+
//# sourceMappingURL=chunk-HVTSE2SF.cjs.map
|