@sonicjs-cms/core 2.13.0 → 2.15.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/admin-layout-catalyst.template-HFD37TY5.cjs +17 -0
- package/dist/admin-layout-catalyst.template-HFD37TY5.cjs.map +1 -0
- package/dist/admin-layout-catalyst.template-UMTIN66R.js +7 -0
- package/dist/admin-layout-catalyst.template-UMTIN66R.js.map +1 -0
- package/dist/{chunk-HVTSE2SF.cjs → chunk-26HYU7MX.cjs} +233 -660
- package/dist/chunk-26HYU7MX.cjs.map +1 -0
- package/dist/{chunk-DB2GJJTM.js → chunk-2BL2A62D.js} +4 -4
- package/dist/{chunk-DB2GJJTM.js.map → chunk-2BL2A62D.js.map} +1 -1
- package/dist/{chunk-I6FFGQIT.cjs → chunk-43AB4EH4.cjs} +723 -211
- package/dist/chunk-43AB4EH4.cjs.map +1 -0
- package/dist/{chunk-3QCEYJLK.cjs → chunk-4ZSNJDLS.cjs} +9 -9
- package/dist/{chunk-3QCEYJLK.cjs.map → chunk-4ZSNJDLS.cjs.map} +1 -1
- package/dist/chunk-55RDMDOP.js +684 -0
- package/dist/chunk-55RDMDOP.js.map +1 -0
- package/dist/{chunk-3VAKUFNQ.js → chunk-5SOFMH66.js} +22 -5
- package/dist/chunk-5SOFMH66.js.map +1 -0
- package/dist/{chunk-6FHNRRJ3.cjs → chunk-635JAMSE.cjs} +76 -17
- package/dist/chunk-635JAMSE.cjs.map +1 -0
- package/dist/{chunk-IYFSNRZN.js → chunk-7MMD5WMK.js} +49 -476
- package/dist/chunk-7MMD5WMK.js.map +1 -0
- package/dist/{chunk-56GUBLJE.cjs → chunk-ABB34XUS.cjs} +13 -13
- package/dist/{chunk-56GUBLJE.cjs.map → chunk-ABB34XUS.cjs.map} +1 -1
- package/dist/{chunk-CO4B5EYF.js → chunk-EWXV2KG2.js} +3 -3
- package/dist/{chunk-CO4B5EYF.js.map → chunk-EWXV2KG2.js.map} +1 -1
- package/dist/{chunk-J5WGMRSU.js → chunk-EXNEW5US.js} +76 -17
- package/dist/chunk-EXNEW5US.js.map +1 -0
- package/dist/{chunk-H3XXBAMO.js → chunk-G7XSN72O.js} +722 -212
- package/dist/chunk-G7XSN72O.js.map +1 -0
- package/dist/{chunk-QP3OHHON.cjs → chunk-OHYBNCVL.cjs} +18 -696
- package/dist/chunk-OHYBNCVL.cjs.map +1 -0
- package/dist/{chunk-CB7ONLGB.js → chunk-ON5ZMSU4.js} +3 -3
- package/dist/{chunk-CB7ONLGB.js.map → chunk-ON5ZMSU4.js.map} +1 -1
- package/dist/{chunk-SER23XI4.cjs → chunk-RVD7PLMU.cjs} +22 -5
- package/dist/chunk-RVD7PLMU.cjs.map +1 -0
- package/dist/{chunk-2MXF4RYZ.js → chunk-TFNTM3OA.js} +3 -3
- package/dist/{chunk-2MXF4RYZ.js.map → chunk-TFNTM3OA.js.map} +1 -1
- package/dist/{chunk-EGUDIX6Q.cjs → chunk-UFPT5KCQ.cjs} +8 -8
- package/dist/{chunk-EGUDIX6Q.cjs.map → chunk-UFPT5KCQ.cjs.map} +1 -1
- package/dist/chunk-UYJ6TJHX.cjs +691 -0
- package/dist/chunk-UYJ6TJHX.cjs.map +1 -0
- package/dist/{chunk-XCP5GCBE.cjs → chunk-VUISYUHY.cjs} +3 -3
- package/dist/{chunk-XCP5GCBE.cjs.map → chunk-VUISYUHY.cjs.map} +1 -1
- package/dist/{chunk-JTUCC6WZ.js → chunk-XWIA3HVX.js} +9 -683
- package/dist/chunk-XWIA3HVX.js.map +1 -0
- package/dist/index.cjs +1604 -173
- 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 +1461 -30
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +29 -29
- package/dist/middleware.js +3 -3
- package/dist/migrations-APFGYCB6.cjs +13 -0
- package/dist/{migrations-GMHTJI7D.cjs.map → migrations-APFGYCB6.cjs.map} +1 -1
- package/dist/migrations-YB52SLW7.js +4 -0
- package/dist/{migrations-IVFIDOSO.js.map → migrations-YB52SLW7.js.map} +1 -1
- package/dist/{plugin-bootstrap-DVGLQrcO.d.cts → plugin-bootstrap-DfVerYV4.d.cts} +3 -1
- package/dist/{plugin-bootstrap-CZ1GDum7.d.ts → plugin-bootstrap-P_ciLp_C.d.ts} +3 -1
- package/dist/plugins.cjs +11 -11
- package/dist/plugins.js +2 -2
- package/dist/routes.cjs +31 -30
- package/dist/routes.js +8 -7
- package/dist/services.cjs +23 -23
- package/dist/services.d.cts +1 -1
- package/dist/services.d.ts +1 -1
- package/dist/services.js +2 -2
- package/dist/templates.cjs +26 -25
- package/dist/templates.js +3 -2
- package/dist/utils.cjs +11 -11
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3VAKUFNQ.js.map +0 -1
- package/dist/chunk-6FHNRRJ3.cjs.map +0 -1
- package/dist/chunk-H3XXBAMO.js.map +0 -1
- package/dist/chunk-HVTSE2SF.cjs.map +0 -1
- package/dist/chunk-I6FFGQIT.cjs.map +0 -1
- package/dist/chunk-IYFSNRZN.js.map +0 -1
- package/dist/chunk-J5WGMRSU.js.map +0 -1
- package/dist/chunk-JTUCC6WZ.js.map +0 -1
- package/dist/chunk-QP3OHHON.cjs.map +0 -1
- package/dist/chunk-SER23XI4.cjs.map +0 -1
- package/dist/migrations-GMHTJI7D.cjs +0 -13
- package/dist/migrations-IVFIDOSO.js +0 -4
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkNZWFCUDA_cjs = require('./chunk-NZWFCUDA.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
4
|
+
var chunkUFPT5KCQ_cjs = require('./chunk-UFPT5KCQ.cjs');
|
|
5
|
+
var chunk43AB4EH4_cjs = require('./chunk-43AB4EH4.cjs');
|
|
6
|
+
var chunkRVD7PLMU_cjs = require('./chunk-RVD7PLMU.cjs');
|
|
7
|
+
var chunkOHYBNCVL_cjs = require('./chunk-OHYBNCVL.cjs');
|
|
8
|
+
var chunkUYJ6TJHX_cjs = require('./chunk-UYJ6TJHX.cjs');
|
|
9
|
+
var chunk635JAMSE_cjs = require('./chunk-635JAMSE.cjs');
|
|
10
|
+
var chunkVUISYUHY_cjs = require('./chunk-VUISYUHY.cjs');
|
|
10
11
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
11
12
|
var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
|
|
12
13
|
var hono = require('hono');
|
|
@@ -188,7 +189,7 @@ apiContentCrudRoutes.get("/:id", async (c) => {
|
|
|
188
189
|
}, 500);
|
|
189
190
|
}
|
|
190
191
|
});
|
|
191
|
-
apiContentCrudRoutes.post("/",
|
|
192
|
+
apiContentCrudRoutes.post("/", chunkUFPT5KCQ_cjs.requireAuth(), chunkUFPT5KCQ_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
192
193
|
try {
|
|
193
194
|
const db = c.env.DB;
|
|
194
195
|
const user = c.get("user");
|
|
@@ -254,7 +255,7 @@ apiContentCrudRoutes.post("/", chunkEGUDIX6Q_cjs.requireAuth(), chunkEGUDIX6Q_cj
|
|
|
254
255
|
}, 500);
|
|
255
256
|
}
|
|
256
257
|
});
|
|
257
|
-
apiContentCrudRoutes.put("/:id",
|
|
258
|
+
apiContentCrudRoutes.put("/:id", chunkUFPT5KCQ_cjs.requireAuth(), chunkUFPT5KCQ_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
258
259
|
try {
|
|
259
260
|
const id = c.req.param("id");
|
|
260
261
|
const db = c.env.DB;
|
|
@@ -318,7 +319,7 @@ apiContentCrudRoutes.put("/:id", chunkEGUDIX6Q_cjs.requireAuth(), chunkEGUDIX6Q_
|
|
|
318
319
|
}, 500);
|
|
319
320
|
}
|
|
320
321
|
});
|
|
321
|
-
apiContentCrudRoutes.delete("/:id",
|
|
322
|
+
apiContentCrudRoutes.delete("/:id", chunkUFPT5KCQ_cjs.requireAuth(), chunkUFPT5KCQ_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
322
323
|
try {
|
|
323
324
|
const id = c.req.param("id");
|
|
324
325
|
const db = c.env.DB;
|
|
@@ -354,7 +355,7 @@ apiRoutes.use("*", async (c, next) => {
|
|
|
354
355
|
c.header("X-Response-Time", `${totalTime}ms`);
|
|
355
356
|
});
|
|
356
357
|
apiRoutes.use("*", async (c, next) => {
|
|
357
|
-
const cacheEnabled = await
|
|
358
|
+
const cacheEnabled = await chunkUFPT5KCQ_cjs.isPluginActive(c.env.DB, "core-cache");
|
|
358
359
|
c.set("cacheEnabled", cacheEnabled);
|
|
359
360
|
await next();
|
|
360
361
|
});
|
|
@@ -845,7 +846,7 @@ apiRoutes.get("/collections", async (c) => {
|
|
|
845
846
|
return c.json({ error: "Failed to fetch collections" }, 500);
|
|
846
847
|
}
|
|
847
848
|
});
|
|
848
|
-
apiRoutes.get("/content",
|
|
849
|
+
apiRoutes.get("/content", chunkUFPT5KCQ_cjs.optionalAuth(), async (c) => {
|
|
849
850
|
const executionStart = Date.now();
|
|
850
851
|
try {
|
|
851
852
|
const db = c.env.DB;
|
|
@@ -868,13 +869,13 @@ apiRoutes.get("/content", chunkEGUDIX6Q_cjs.optionalAuth(), async (c) => {
|
|
|
868
869
|
});
|
|
869
870
|
}
|
|
870
871
|
}
|
|
871
|
-
const filter =
|
|
872
|
+
const filter = chunkVUISYUHY_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
872
873
|
const normalizedFilter = normalizePublicContentFilter(filter, c.get("user")?.role);
|
|
873
874
|
if (!normalizedFilter.limit) {
|
|
874
875
|
normalizedFilter.limit = 50;
|
|
875
876
|
}
|
|
876
877
|
normalizedFilter.limit = Math.min(normalizedFilter.limit, 1e3);
|
|
877
|
-
const builder3 = new
|
|
878
|
+
const builder3 = new chunkVUISYUHY_cjs.QueryFilterBuilder();
|
|
878
879
|
const queryResult = builder3.build("content", normalizedFilter);
|
|
879
880
|
if (queryResult.errors.length > 0) {
|
|
880
881
|
return c.json({
|
|
@@ -946,7 +947,7 @@ apiRoutes.get("/content", chunkEGUDIX6Q_cjs.optionalAuth(), async (c) => {
|
|
|
946
947
|
}, 500);
|
|
947
948
|
}
|
|
948
949
|
});
|
|
949
|
-
apiRoutes.get("/collections/:collection/content",
|
|
950
|
+
apiRoutes.get("/collections/:collection/content", chunkUFPT5KCQ_cjs.optionalAuth(), async (c) => {
|
|
950
951
|
const executionStart = Date.now();
|
|
951
952
|
try {
|
|
952
953
|
const collection = c.req.param("collection");
|
|
@@ -957,7 +958,7 @@ apiRoutes.get("/collections/:collection/content", chunkEGUDIX6Q_cjs.optionalAuth
|
|
|
957
958
|
if (!collectionResult) {
|
|
958
959
|
return c.json({ error: "Collection not found" }, 404);
|
|
959
960
|
}
|
|
960
|
-
const filter =
|
|
961
|
+
const filter = chunkVUISYUHY_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
961
962
|
const normalizedFilter = normalizePublicContentFilter(filter, c.get("user")?.role);
|
|
962
963
|
if (!normalizedFilter.where) {
|
|
963
964
|
normalizedFilter.where = { and: [] };
|
|
@@ -974,7 +975,7 @@ apiRoutes.get("/collections/:collection/content", chunkEGUDIX6Q_cjs.optionalAuth
|
|
|
974
975
|
normalizedFilter.limit = 50;
|
|
975
976
|
}
|
|
976
977
|
normalizedFilter.limit = Math.min(normalizedFilter.limit, 1e3);
|
|
977
|
-
const builder3 = new
|
|
978
|
+
const builder3 = new chunkVUISYUHY_cjs.QueryFilterBuilder();
|
|
978
979
|
const queryResult = builder3.build("content", normalizedFilter);
|
|
979
980
|
if (queryResult.errors.length > 0) {
|
|
980
981
|
return c.json({
|
|
@@ -1095,7 +1096,7 @@ var fileValidationSchema = zod.z.object({
|
|
|
1095
1096
|
// 50MB max
|
|
1096
1097
|
});
|
|
1097
1098
|
var apiMediaRoutes = new hono.Hono();
|
|
1098
|
-
apiMediaRoutes.use("*",
|
|
1099
|
+
apiMediaRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
1099
1100
|
apiMediaRoutes.post("/upload", async (c) => {
|
|
1100
1101
|
try {
|
|
1101
1102
|
const user = c.get("user");
|
|
@@ -1839,8 +1840,8 @@ apiSystemRoutes.get("/env", (c) => {
|
|
|
1839
1840
|
});
|
|
1840
1841
|
var api_system_default = apiSystemRoutes;
|
|
1841
1842
|
var adminApiRoutes = new hono.Hono();
|
|
1842
|
-
adminApiRoutes.use("*",
|
|
1843
|
-
adminApiRoutes.use("*",
|
|
1843
|
+
adminApiRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
1844
|
+
adminApiRoutes.use("*", chunkUFPT5KCQ_cjs.requireRole(["admin", "editor"]));
|
|
1844
1845
|
adminApiRoutes.get("/stats", async (c) => {
|
|
1845
1846
|
try {
|
|
1846
1847
|
const db = c.env.DB;
|
|
@@ -2352,7 +2353,7 @@ adminApiRoutes.delete("/collections/:id", async (c) => {
|
|
|
2352
2353
|
});
|
|
2353
2354
|
adminApiRoutes.get("/migrations/status", async (c) => {
|
|
2354
2355
|
try {
|
|
2355
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2356
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-APFGYCB6.cjs');
|
|
2356
2357
|
const db = c.env.DB;
|
|
2357
2358
|
const migrationService = new MigrationService2(db);
|
|
2358
2359
|
const status = await migrationService.getMigrationStatus();
|
|
@@ -2377,26 +2378,29 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
2377
2378
|
error: "Unauthorized. Admin access required."
|
|
2378
2379
|
}, 403);
|
|
2379
2380
|
}
|
|
2380
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2381
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-APFGYCB6.cjs');
|
|
2381
2382
|
const db = c.env.DB;
|
|
2382
2383
|
const migrationService = new MigrationService2(db);
|
|
2383
2384
|
const result = await migrationService.runPendingMigrations();
|
|
2384
2385
|
return c.json({
|
|
2385
2386
|
success: result.success,
|
|
2386
2387
|
message: result.message,
|
|
2387
|
-
applied: result.applied
|
|
2388
|
+
applied: result.applied,
|
|
2389
|
+
errors: result.errors
|
|
2388
2390
|
});
|
|
2389
2391
|
} catch (error) {
|
|
2390
2392
|
console.error("Error running migrations:", error);
|
|
2393
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2391
2394
|
return c.json({
|
|
2392
2395
|
success: false,
|
|
2393
|
-
error:
|
|
2396
|
+
error: `Failed to run migrations: ${errorMessage}`,
|
|
2397
|
+
errors: [errorMessage]
|
|
2394
2398
|
}, 500);
|
|
2395
2399
|
}
|
|
2396
2400
|
});
|
|
2397
2401
|
adminApiRoutes.get("/migrations/validate", async (c) => {
|
|
2398
2402
|
try {
|
|
2399
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2403
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-APFGYCB6.cjs');
|
|
2400
2404
|
const db = c.env.DB;
|
|
2401
2405
|
const migrationService = new MigrationService2(db);
|
|
2402
2406
|
const validation = await migrationService.validateSchema();
|
|
@@ -2471,8 +2475,8 @@ function renderLoginPage(data, demoLoginActive = false) {
|
|
|
2471
2475
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2472
2476
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2473
2477
|
<!-- Alerts -->
|
|
2474
|
-
${data.error ? `<div class="mb-6">${
|
|
2475
|
-
${data.message ? `<div class="mb-6">${
|
|
2478
|
+
${data.error ? `<div class="mb-6">${chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2479
|
+
${data.message ? `<div class="mb-6">${chunkOHYBNCVL_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
|
|
2476
2480
|
|
|
2477
2481
|
<!-- Form Response (HTMX target) -->
|
|
2478
2482
|
<div id="form-response" class="mb-6"></div>
|
|
@@ -2636,7 +2640,7 @@ function renderRegisterPage(data) {
|
|
|
2636
2640
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2637
2641
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2638
2642
|
<!-- Alerts -->
|
|
2639
|
-
${data.error ? `<div class="mb-6">${
|
|
2643
|
+
${data.error ? `<div class="mb-6">${chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2640
2644
|
|
|
2641
2645
|
<!-- Form -->
|
|
2642
2646
|
<form
|
|
@@ -5068,7 +5072,7 @@ function renderCustomProfileSection(config, customData) {
|
|
|
5068
5072
|
|
|
5069
5073
|
// src/plugins/core-plugins/user-profiles/index.ts
|
|
5070
5074
|
function createUserProfilesPlugin() {
|
|
5071
|
-
const builder3 =
|
|
5075
|
+
const builder3 = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
5072
5076
|
name: "user-profiles",
|
|
5073
5077
|
version: "1.0.0-beta.1",
|
|
5074
5078
|
description: "Configurable custom profile fields for users"
|
|
@@ -5149,7 +5153,7 @@ var JWT_SECRET_FALLBACK = "your-super-secret-jwt-key-change-in-production";
|
|
|
5149
5153
|
async function setCsrfCookie(c) {
|
|
5150
5154
|
const secret = c.env?.JWT_SECRET || JWT_SECRET_FALLBACK;
|
|
5151
5155
|
const isDev = c.env?.ENVIRONMENT === "development" || !c.env?.ENVIRONMENT;
|
|
5152
|
-
const csrfToken = await
|
|
5156
|
+
const csrfToken = await chunkUFPT5KCQ_cjs.generateCsrfToken(secret);
|
|
5153
5157
|
cookie.setCookie(c, "csrf_token", csrfToken, {
|
|
5154
5158
|
httpOnly: false,
|
|
5155
5159
|
secure: !isDev,
|
|
@@ -5206,7 +5210,7 @@ var loginSchema = zod.z.object({
|
|
|
5206
5210
|
});
|
|
5207
5211
|
authRoutes.post(
|
|
5208
5212
|
"/register",
|
|
5209
|
-
|
|
5213
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5210
5214
|
async (c) => {
|
|
5211
5215
|
try {
|
|
5212
5216
|
const db = c.env.DB;
|
|
@@ -5243,7 +5247,7 @@ authRoutes.post(
|
|
|
5243
5247
|
if (existingUser) {
|
|
5244
5248
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
5245
5249
|
}
|
|
5246
|
-
const passwordHash = await
|
|
5250
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5247
5251
|
const userId = crypto.randomUUID();
|
|
5248
5252
|
const now = /* @__PURE__ */ new Date();
|
|
5249
5253
|
await db.prepare(`
|
|
@@ -5277,7 +5281,7 @@ authRoutes.post(
|
|
|
5277
5281
|
await saveCustomData(db, userId, sanitized);
|
|
5278
5282
|
}
|
|
5279
5283
|
}
|
|
5280
|
-
const token = await
|
|
5284
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET);
|
|
5281
5285
|
cookie.setCookie(c, "auth_token", token, {
|
|
5282
5286
|
httpOnly: true,
|
|
5283
5287
|
secure: true,
|
|
@@ -5311,7 +5315,7 @@ authRoutes.post(
|
|
|
5311
5315
|
);
|
|
5312
5316
|
authRoutes.post(
|
|
5313
5317
|
"/login",
|
|
5314
|
-
|
|
5318
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5315
5319
|
async (c) => {
|
|
5316
5320
|
try {
|
|
5317
5321
|
const body = await c.req.json();
|
|
@@ -5334,19 +5338,19 @@ authRoutes.post(
|
|
|
5334
5338
|
if (!user) {
|
|
5335
5339
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5336
5340
|
}
|
|
5337
|
-
const isValidPassword = await
|
|
5341
|
+
const isValidPassword = await chunkUFPT5KCQ_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5338
5342
|
if (!isValidPassword) {
|
|
5339
5343
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5340
5344
|
}
|
|
5341
|
-
if (
|
|
5345
|
+
if (chunkUFPT5KCQ_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5342
5346
|
try {
|
|
5343
|
-
const newHash = await
|
|
5347
|
+
const newHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5344
5348
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5345
5349
|
} catch (rehashError) {
|
|
5346
5350
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5347
5351
|
}
|
|
5348
5352
|
}
|
|
5349
|
-
const token = await
|
|
5353
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5350
5354
|
cookie.setCookie(c, "auth_token", token, {
|
|
5351
5355
|
httpOnly: true,
|
|
5352
5356
|
secure: true,
|
|
@@ -5399,7 +5403,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
5399
5403
|
clearCsrfCookie(c);
|
|
5400
5404
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
5401
5405
|
});
|
|
5402
|
-
authRoutes.get("/me",
|
|
5406
|
+
authRoutes.get("/me", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
5403
5407
|
try {
|
|
5404
5408
|
const user = c.get("user");
|
|
5405
5409
|
if (!user) {
|
|
@@ -5416,13 +5420,13 @@ authRoutes.get("/me", chunkEGUDIX6Q_cjs.requireAuth(), async (c) => {
|
|
|
5416
5420
|
return c.json({ error: "Failed to get user" }, 500);
|
|
5417
5421
|
}
|
|
5418
5422
|
});
|
|
5419
|
-
authRoutes.post("/refresh",
|
|
5423
|
+
authRoutes.post("/refresh", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
5420
5424
|
try {
|
|
5421
5425
|
const user = c.get("user");
|
|
5422
5426
|
if (!user) {
|
|
5423
5427
|
return c.json({ error: "Not authenticated" }, 401);
|
|
5424
5428
|
}
|
|
5425
|
-
const token = await
|
|
5429
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.userId, user.email, user.role, c.env.JWT_SECRET);
|
|
5426
5430
|
cookie.setCookie(c, "auth_token", token, {
|
|
5427
5431
|
httpOnly: true,
|
|
5428
5432
|
secure: true,
|
|
@@ -5439,7 +5443,7 @@ authRoutes.post("/refresh", chunkEGUDIX6Q_cjs.requireAuth(), async (c) => {
|
|
|
5439
5443
|
});
|
|
5440
5444
|
authRoutes.post(
|
|
5441
5445
|
"/register/form",
|
|
5442
|
-
|
|
5446
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5443
5447
|
async (c) => {
|
|
5444
5448
|
try {
|
|
5445
5449
|
const db = c.env.DB;
|
|
@@ -5486,7 +5490,7 @@ authRoutes.post(
|
|
|
5486
5490
|
</div>
|
|
5487
5491
|
`);
|
|
5488
5492
|
}
|
|
5489
|
-
const passwordHash = await
|
|
5493
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5490
5494
|
const role = isFirstUser ? "admin" : "viewer";
|
|
5491
5495
|
const userId = crypto.randomUUID();
|
|
5492
5496
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -5521,7 +5525,7 @@ authRoutes.post(
|
|
|
5521
5525
|
await saveCustomData(db, userId, sanitized);
|
|
5522
5526
|
}
|
|
5523
5527
|
}
|
|
5524
|
-
const token = await
|
|
5528
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET);
|
|
5525
5529
|
cookie.setCookie(c, "auth_token", token, {
|
|
5526
5530
|
httpOnly: true,
|
|
5527
5531
|
secure: false,
|
|
@@ -5554,7 +5558,7 @@ authRoutes.post(
|
|
|
5554
5558
|
);
|
|
5555
5559
|
authRoutes.post(
|
|
5556
5560
|
"/login/form",
|
|
5557
|
-
|
|
5561
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5558
5562
|
async (c) => {
|
|
5559
5563
|
try {
|
|
5560
5564
|
const formData = await c.req.formData();
|
|
@@ -5578,7 +5582,7 @@ authRoutes.post(
|
|
|
5578
5582
|
</div>
|
|
5579
5583
|
`);
|
|
5580
5584
|
}
|
|
5581
|
-
const isValidPassword = await
|
|
5585
|
+
const isValidPassword = await chunkUFPT5KCQ_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5582
5586
|
if (!isValidPassword) {
|
|
5583
5587
|
return c.html(html.html`
|
|
5584
5588
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -5586,15 +5590,15 @@ authRoutes.post(
|
|
|
5586
5590
|
</div>
|
|
5587
5591
|
`);
|
|
5588
5592
|
}
|
|
5589
|
-
if (
|
|
5593
|
+
if (chunkUFPT5KCQ_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5590
5594
|
try {
|
|
5591
|
-
const newHash = await
|
|
5595
|
+
const newHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5592
5596
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5593
5597
|
} catch (rehashError) {
|
|
5594
5598
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5595
5599
|
}
|
|
5596
5600
|
}
|
|
5597
|
-
const token = await
|
|
5601
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5598
5602
|
cookie.setCookie(c, "auth_token", token, {
|
|
5599
5603
|
httpOnly: true,
|
|
5600
5604
|
secure: false,
|
|
@@ -5636,7 +5640,7 @@ authRoutes.post(
|
|
|
5636
5640
|
);
|
|
5637
5641
|
authRoutes.post(
|
|
5638
5642
|
"/seed-admin",
|
|
5639
|
-
|
|
5643
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
|
|
5640
5644
|
async (c) => {
|
|
5641
5645
|
try {
|
|
5642
5646
|
const db = c.env.DB;
|
|
@@ -5658,7 +5662,7 @@ authRoutes.post(
|
|
|
5658
5662
|
`).run();
|
|
5659
5663
|
const existingAdmin = await db.prepare("SELECT id FROM users WHERE email = ? OR username = ?").bind("admin@sonicjs.com", "admin").first();
|
|
5660
5664
|
if (existingAdmin) {
|
|
5661
|
-
const passwordHash2 = await
|
|
5665
|
+
const passwordHash2 = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5662
5666
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(passwordHash2, Date.now(), existingAdmin.id).run();
|
|
5663
5667
|
return c.json({
|
|
5664
5668
|
message: "Admin user already exists (password updated)",
|
|
@@ -5670,7 +5674,7 @@ authRoutes.post(
|
|
|
5670
5674
|
}
|
|
5671
5675
|
});
|
|
5672
5676
|
}
|
|
5673
|
-
const passwordHash = await
|
|
5677
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5674
5678
|
const userId = "admin-user-id";
|
|
5675
5679
|
const now = Date.now();
|
|
5676
5680
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -5891,7 +5895,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5891
5895
|
if (existingUsername) {
|
|
5892
5896
|
return c.json({ error: "Username is already taken" }, 400);
|
|
5893
5897
|
}
|
|
5894
|
-
const passwordHash = await
|
|
5898
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5895
5899
|
const updateStmt = db.prepare(`
|
|
5896
5900
|
UPDATE users SET
|
|
5897
5901
|
username = ?,
|
|
@@ -5910,7 +5914,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5910
5914
|
Date.now(),
|
|
5911
5915
|
invitedUser.id
|
|
5912
5916
|
).run();
|
|
5913
|
-
const authToken = await
|
|
5917
|
+
const authToken = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET);
|
|
5914
5918
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
5915
5919
|
httpOnly: true,
|
|
5916
5920
|
secure: true,
|
|
@@ -5927,7 +5931,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5927
5931
|
});
|
|
5928
5932
|
authRoutes.post(
|
|
5929
5933
|
"/request-password-reset",
|
|
5930
|
-
|
|
5934
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
|
|
5931
5935
|
async (c) => {
|
|
5932
5936
|
try {
|
|
5933
5937
|
const formData = await c.req.formData();
|
|
@@ -6145,7 +6149,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
6145
6149
|
if (Date.now() > user.password_reset_expires) {
|
|
6146
6150
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
6147
6151
|
}
|
|
6148
|
-
const newPasswordHash = await
|
|
6152
|
+
const newPasswordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
6149
6153
|
try {
|
|
6150
6154
|
const historyStmt = db.prepare(`
|
|
6151
6155
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -6592,7 +6596,7 @@ function escapeHtml3(text) {
|
|
|
6592
6596
|
}
|
|
6593
6597
|
|
|
6594
6598
|
// src/plugins/available/easy-mdx/index.ts
|
|
6595
|
-
var builder =
|
|
6599
|
+
var builder = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
6596
6600
|
name: "easy-mdx",
|
|
6597
6601
|
version: "1.0.0",
|
|
6598
6602
|
description: "Lightweight markdown editor with live preview"
|
|
@@ -6804,7 +6808,7 @@ function getMDXEditorInitScript(config) {
|
|
|
6804
6808
|
}
|
|
6805
6809
|
|
|
6806
6810
|
// src/plugins/available/tinymce-plugin/index.ts
|
|
6807
|
-
var builder2 =
|
|
6811
|
+
var builder2 = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
6808
6812
|
name: "tinymce-plugin",
|
|
6809
6813
|
version: "1.0.0",
|
|
6810
6814
|
description: "Powerful WYSIWYG rich text editor for content creation"
|
|
@@ -7087,7 +7091,7 @@ function getQuillCDN(version = "2.0.2") {
|
|
|
7087
7091
|
`;
|
|
7088
7092
|
}
|
|
7089
7093
|
function createQuillEditorPlugin() {
|
|
7090
|
-
const builder3 =
|
|
7094
|
+
const builder3 = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
7091
7095
|
name: "quill-editor",
|
|
7092
7096
|
version: "1.0.0",
|
|
7093
7097
|
description: "Quill rich text editor integration for SonicJS"
|
|
@@ -7113,7 +7117,7 @@ function createQuillEditorPlugin() {
|
|
|
7113
7117
|
createQuillEditorPlugin();
|
|
7114
7118
|
|
|
7115
7119
|
// src/templates/pages/admin-content-form.template.ts
|
|
7116
|
-
|
|
7120
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
7117
7121
|
function renderContentFormPage(data) {
|
|
7118
7122
|
const isEdit = data.isEdit || !!data.id;
|
|
7119
7123
|
const title = isEdit ? `Edit: ${data.title || "Content"}` : `New ${data.collection.display_name}`;
|
|
@@ -7194,8 +7198,8 @@ function renderContentFormPage(data) {
|
|
|
7194
7198
|
<!-- Form Content -->
|
|
7195
7199
|
<div class="px-6 py-6">
|
|
7196
7200
|
<div id="form-messages">
|
|
7197
|
-
${data.error ?
|
|
7198
|
-
${data.success ?
|
|
7201
|
+
${data.error ? chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7202
|
+
${data.success ? chunkOHYBNCVL_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7199
7203
|
</div>
|
|
7200
7204
|
|
|
7201
7205
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -7431,7 +7435,7 @@ function renderContentFormPage(data) {
|
|
|
7431
7435
|
</div>
|
|
7432
7436
|
|
|
7433
7437
|
<!-- Confirmation Dialogs -->
|
|
7434
|
-
${
|
|
7438
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7435
7439
|
id: "duplicate-content-confirm",
|
|
7436
7440
|
title: "Duplicate Content",
|
|
7437
7441
|
message: "Create a copy of this content?",
|
|
@@ -7442,7 +7446,7 @@ function renderContentFormPage(data) {
|
|
|
7442
7446
|
onConfirm: "performDuplicateContent()"
|
|
7443
7447
|
})}
|
|
7444
7448
|
|
|
7445
|
-
${
|
|
7449
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7446
7450
|
id: "delete-content-confirm",
|
|
7447
7451
|
title: "Delete Content",
|
|
7448
7452
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -7453,7 +7457,7 @@ function renderContentFormPage(data) {
|
|
|
7453
7457
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
7454
7458
|
})}
|
|
7455
7459
|
|
|
7456
|
-
${
|
|
7460
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7457
7461
|
id: "delete-repeater-item-confirm",
|
|
7458
7462
|
title: "Delete Item",
|
|
7459
7463
|
message: "Are you sure you want to delete this item? This action cannot be undone.",
|
|
@@ -7464,7 +7468,7 @@ function renderContentFormPage(data) {
|
|
|
7464
7468
|
onConfirm: "performRepeaterDelete()"
|
|
7465
7469
|
})}
|
|
7466
7470
|
|
|
7467
|
-
${
|
|
7471
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7468
7472
|
id: "delete-block-confirm",
|
|
7469
7473
|
title: "Delete Block",
|
|
7470
7474
|
message: "Are you sure you want to delete this block? This action cannot be undone.",
|
|
@@ -7475,7 +7479,7 @@ function renderContentFormPage(data) {
|
|
|
7475
7479
|
onConfirm: "performRepeaterDelete()"
|
|
7476
7480
|
})}
|
|
7477
7481
|
|
|
7478
|
-
${
|
|
7482
|
+
${chunkOHYBNCVL_cjs.getConfirmationDialogScript()}
|
|
7479
7483
|
|
|
7480
7484
|
${data.tinymceEnabled ? getTinyMCEScript(data.tinymceSettings?.apiKey) : "<!-- TinyMCE plugin not active -->"}
|
|
7481
7485
|
|
|
@@ -8550,11 +8554,11 @@ function renderContentFormPage(data) {
|
|
|
8550
8554
|
content: pageContent,
|
|
8551
8555
|
version: data.version
|
|
8552
8556
|
};
|
|
8553
|
-
return
|
|
8557
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8554
8558
|
}
|
|
8555
8559
|
|
|
8556
8560
|
// src/templates/pages/admin-content-list.template.ts
|
|
8557
|
-
|
|
8561
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
8558
8562
|
function renderContentListPage(data) {
|
|
8559
8563
|
const urlParams = new URLSearchParams();
|
|
8560
8564
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -8958,8 +8962,8 @@ function renderContentListPage(data) {
|
|
|
8958
8962
|
|
|
8959
8963
|
<!-- Content List -->
|
|
8960
8964
|
<div id="content-list">
|
|
8961
|
-
${
|
|
8962
|
-
${
|
|
8965
|
+
${chunkOHYBNCVL_cjs.renderTable(tableData)}
|
|
8966
|
+
${chunkOHYBNCVL_cjs.renderPagination(paginationData)}
|
|
8963
8967
|
</div>
|
|
8964
8968
|
|
|
8965
8969
|
</div>
|
|
@@ -9169,7 +9173,7 @@ function renderContentListPage(data) {
|
|
|
9169
9173
|
</script>
|
|
9170
9174
|
|
|
9171
9175
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
9172
|
-
${
|
|
9176
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
9173
9177
|
id: "bulk-action-confirm",
|
|
9174
9178
|
title: "Confirm Bulk Action",
|
|
9175
9179
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -9181,7 +9185,7 @@ function renderContentListPage(data) {
|
|
|
9181
9185
|
})}
|
|
9182
9186
|
|
|
9183
9187
|
<!-- Confirmation Dialog Script -->
|
|
9184
|
-
${
|
|
9188
|
+
${chunkOHYBNCVL_cjs.getConfirmationDialogScript()}
|
|
9185
9189
|
|
|
9186
9190
|
<!-- Advanced Search Modal -->
|
|
9187
9191
|
<div id="advancedSearchModal" class="hidden fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
|
@@ -9478,7 +9482,7 @@ function renderContentListPage(data) {
|
|
|
9478
9482
|
version: data.version,
|
|
9479
9483
|
content: pageContent
|
|
9480
9484
|
};
|
|
9481
|
-
return
|
|
9485
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
9482
9486
|
}
|
|
9483
9487
|
|
|
9484
9488
|
// src/routes/admin-content-field-types.ts
|
|
@@ -9521,9 +9525,9 @@ function parseFieldValue(field, formData, options = {}) {
|
|
|
9521
9525
|
const { skipValidation = false } = options;
|
|
9522
9526
|
const value = formData.get(field.field_name);
|
|
9523
9527
|
const errors = [];
|
|
9524
|
-
const blocksConfig =
|
|
9528
|
+
const blocksConfig = chunkVUISYUHY_cjs.getBlocksFieldConfig(field.field_options);
|
|
9525
9529
|
if (blocksConfig) {
|
|
9526
|
-
const parsed =
|
|
9530
|
+
const parsed = chunkVUISYUHY_cjs.parseBlocksValue(value, blocksConfig);
|
|
9527
9531
|
if (!skipValidation && field.is_required && parsed.value.length === 0) {
|
|
9528
9532
|
parsed.errors.push(`${field.field_label} is required`);
|
|
9529
9533
|
}
|
|
@@ -9633,7 +9637,7 @@ function extractFieldData(fields, formData, options = {}) {
|
|
|
9633
9637
|
}
|
|
9634
9638
|
return { data, errors };
|
|
9635
9639
|
}
|
|
9636
|
-
adminContentRoutes.use("*",
|
|
9640
|
+
adminContentRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
9637
9641
|
async function getCollectionFields(db, collectionId) {
|
|
9638
9642
|
const cache = chunkNZWFCUDA_cjs.getCacheService(chunkNZWFCUDA_cjs.CACHE_CONFIGS.collection);
|
|
9639
9643
|
return cache.getOrSet(
|
|
@@ -9910,21 +9914,21 @@ adminContentRoutes.get("/new", async (c) => {
|
|
|
9910
9914
|
const tinymceEnabled = await isPluginActive2(db, "tinymce-plugin");
|
|
9911
9915
|
let tinymceSettings;
|
|
9912
9916
|
if (tinymceEnabled) {
|
|
9913
|
-
const pluginService = new
|
|
9917
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
9914
9918
|
const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
|
|
9915
9919
|
tinymceSettings = tinymcePlugin2?.settings;
|
|
9916
9920
|
}
|
|
9917
9921
|
const quillEnabled = await isPluginActive2(db, "quill-editor");
|
|
9918
9922
|
let quillSettings;
|
|
9919
9923
|
if (quillEnabled) {
|
|
9920
|
-
const pluginService = new
|
|
9924
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
9921
9925
|
const quillPlugin = await pluginService.getPlugin("quill-editor");
|
|
9922
9926
|
quillSettings = quillPlugin?.settings;
|
|
9923
9927
|
}
|
|
9924
9928
|
const mdxeditorEnabled = await isPluginActive2(db, "easy-mdx");
|
|
9925
9929
|
let mdxeditorSettings;
|
|
9926
9930
|
if (mdxeditorEnabled) {
|
|
9927
|
-
const pluginService = new
|
|
9931
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
9928
9932
|
const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
|
|
9929
9933
|
mdxeditorSettings = mdxeditorPlugin?.settings;
|
|
9930
9934
|
}
|
|
@@ -10015,21 +10019,21 @@ adminContentRoutes.get("/:id/edit", async (c) => {
|
|
|
10015
10019
|
const tinymceEnabled = await isPluginActive2(db, "tinymce-plugin");
|
|
10016
10020
|
let tinymceSettings;
|
|
10017
10021
|
if (tinymceEnabled) {
|
|
10018
|
-
const pluginService = new
|
|
10022
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
10019
10023
|
const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
|
|
10020
10024
|
tinymceSettings = tinymcePlugin2?.settings;
|
|
10021
10025
|
}
|
|
10022
10026
|
const quillEnabled = await isPluginActive2(db, "quill-editor");
|
|
10023
10027
|
let quillSettings;
|
|
10024
10028
|
if (quillEnabled) {
|
|
10025
|
-
const pluginService = new
|
|
10029
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
10026
10030
|
const quillPlugin = await pluginService.getPlugin("quill-editor");
|
|
10027
10031
|
quillSettings = quillPlugin?.settings;
|
|
10028
10032
|
}
|
|
10029
10033
|
const mdxeditorEnabled = await isPluginActive2(db, "easy-mdx");
|
|
10030
10034
|
let mdxeditorSettings;
|
|
10031
10035
|
if (mdxeditorEnabled) {
|
|
10032
|
-
const pluginService = new
|
|
10036
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
10033
10037
|
const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
|
|
10034
10038
|
mdxeditorSettings = mdxeditorPlugin?.settings;
|
|
10035
10039
|
}
|
|
@@ -10324,7 +10328,7 @@ adminContentRoutes.put("/:id", async (c) => {
|
|
|
10324
10328
|
`);
|
|
10325
10329
|
}
|
|
10326
10330
|
});
|
|
10327
|
-
adminContentRoutes.post("/preview",
|
|
10331
|
+
adminContentRoutes.post("/preview", chunkUFPT5KCQ_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10328
10332
|
try {
|
|
10329
10333
|
const formData = await c.req.formData();
|
|
10330
10334
|
const collectionId = formData.get("collection_id");
|
|
@@ -10702,7 +10706,7 @@ adminContentRoutes.post("/:id/restore/:version", async (c) => {
|
|
|
10702
10706
|
return c.json({ success: false, error: "Failed to restore version" });
|
|
10703
10707
|
}
|
|
10704
10708
|
});
|
|
10705
|
-
adminContentRoutes.get("/:id/version/:version/preview",
|
|
10709
|
+
adminContentRoutes.get("/:id/version/:version/preview", chunkUFPT5KCQ_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10706
10710
|
try {
|
|
10707
10711
|
const id = c.req.param("id");
|
|
10708
10712
|
const version = parseInt(c.req.param("version") || "0");
|
|
@@ -10770,7 +10774,7 @@ ${chunkMNWKYY5E_cjs.escapeHtml(JSON.stringify(data, null, 2))}
|
|
|
10770
10774
|
var admin_content_default = adminContentRoutes;
|
|
10771
10775
|
|
|
10772
10776
|
// src/templates/pages/admin-profile.template.ts
|
|
10773
|
-
|
|
10777
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
10774
10778
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
10775
10779
|
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">
|
|
10776
10780
|
${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>`}
|
|
@@ -10790,8 +10794,8 @@ function renderProfilePage(data) {
|
|
|
10790
10794
|
</div>
|
|
10791
10795
|
|
|
10792
10796
|
<!-- Alert Messages -->
|
|
10793
|
-
${data.error ?
|
|
10794
|
-
${data.success ?
|
|
10797
|
+
${data.error ? chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
10798
|
+
${data.success ? chunkOHYBNCVL_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
10795
10799
|
|
|
10796
10800
|
<!-- Profile Form -->
|
|
10797
10801
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -11180,7 +11184,7 @@ function renderProfilePage(data) {
|
|
|
11180
11184
|
version: data.version,
|
|
11181
11185
|
content: pageContent
|
|
11182
11186
|
};
|
|
11183
|
-
return
|
|
11187
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
11184
11188
|
}
|
|
11185
11189
|
|
|
11186
11190
|
// src/templates/components/alert.template.ts
|
|
@@ -11463,7 +11467,7 @@ function renderActivityLogsPage(data) {
|
|
|
11463
11467
|
user: data.user,
|
|
11464
11468
|
content: pageContent
|
|
11465
11469
|
};
|
|
11466
|
-
return
|
|
11470
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
11467
11471
|
}
|
|
11468
11472
|
function getActionBadgeClass(action) {
|
|
11469
11473
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -11483,7 +11487,7 @@ function formatAction(action) {
|
|
|
11483
11487
|
}
|
|
11484
11488
|
|
|
11485
11489
|
// src/templates/pages/admin-user-edit.template.ts
|
|
11486
|
-
|
|
11490
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
11487
11491
|
|
|
11488
11492
|
// src/templates/components/confirmation-dialog.template.ts
|
|
11489
11493
|
function renderConfirmationDialog2(options) {
|
|
@@ -11604,8 +11608,8 @@ function renderUserEditPage(data) {
|
|
|
11604
11608
|
|
|
11605
11609
|
<!-- Alert Messages -->
|
|
11606
11610
|
<div id="form-messages">
|
|
11607
|
-
${data.error ?
|
|
11608
|
-
${data.success ?
|
|
11611
|
+
${data.error ? chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
11612
|
+
${data.success ? chunkOHYBNCVL_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
11609
11613
|
</div>
|
|
11610
11614
|
|
|
11611
11615
|
<!-- User Edit Form -->
|
|
@@ -12003,11 +12007,11 @@ function renderUserEditPage(data) {
|
|
|
12003
12007
|
user: data.user,
|
|
12004
12008
|
content: pageContent
|
|
12005
12009
|
};
|
|
12006
|
-
return
|
|
12010
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12007
12011
|
}
|
|
12008
12012
|
|
|
12009
12013
|
// src/templates/pages/admin-user-new.template.ts
|
|
12010
|
-
|
|
12014
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
12011
12015
|
function renderUserNewPage(data) {
|
|
12012
12016
|
const pageContent = `
|
|
12013
12017
|
<div>
|
|
@@ -12046,8 +12050,8 @@ function renderUserNewPage(data) {
|
|
|
12046
12050
|
|
|
12047
12051
|
<!-- Alert Messages -->
|
|
12048
12052
|
<div id="form-messages">
|
|
12049
|
-
${data.error ?
|
|
12050
|
-
${data.success ?
|
|
12053
|
+
${data.error ? chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
12054
|
+
${data.success ? chunkOHYBNCVL_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
12051
12055
|
</div>
|
|
12052
12056
|
|
|
12053
12057
|
<!-- User New Form -->
|
|
@@ -12291,11 +12295,11 @@ function renderUserNewPage(data) {
|
|
|
12291
12295
|
user: data.user,
|
|
12292
12296
|
content: pageContent
|
|
12293
12297
|
};
|
|
12294
|
-
return
|
|
12298
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12295
12299
|
}
|
|
12296
12300
|
|
|
12297
12301
|
// src/templates/pages/admin-users-list.template.ts
|
|
12298
|
-
|
|
12302
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
12299
12303
|
function renderUsersListPage(data) {
|
|
12300
12304
|
const columns = [
|
|
12301
12305
|
{
|
|
@@ -12446,8 +12450,8 @@ function renderUsersListPage(data) {
|
|
|
12446
12450
|
</div>
|
|
12447
12451
|
|
|
12448
12452
|
<!-- Alert Messages -->
|
|
12449
|
-
${data.error ?
|
|
12450
|
-
${data.success ?
|
|
12453
|
+
${data.error ? chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
12454
|
+
${data.success ? chunkOHYBNCVL_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
12451
12455
|
|
|
12452
12456
|
<!-- Stats -->
|
|
12453
12457
|
<div class="mb-6">
|
|
@@ -12624,10 +12628,10 @@ function renderUsersListPage(data) {
|
|
|
12624
12628
|
</div>
|
|
12625
12629
|
|
|
12626
12630
|
<!-- Users Table -->
|
|
12627
|
-
${
|
|
12631
|
+
${chunkOHYBNCVL_cjs.renderTable(tableData)}
|
|
12628
12632
|
|
|
12629
12633
|
<!-- Pagination -->
|
|
12630
|
-
${data.pagination ?
|
|
12634
|
+
${data.pagination ? chunkOHYBNCVL_cjs.renderPagination(data.pagination) : ""}
|
|
12631
12635
|
</div>
|
|
12632
12636
|
|
|
12633
12637
|
<script>
|
|
@@ -12698,19 +12702,19 @@ function renderUsersListPage(data) {
|
|
|
12698
12702
|
version: data.version,
|
|
12699
12703
|
content: pageContent
|
|
12700
12704
|
};
|
|
12701
|
-
return
|
|
12705
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12702
12706
|
}
|
|
12703
12707
|
|
|
12704
12708
|
// src/routes/admin-users.ts
|
|
12705
12709
|
var userRoutes = new hono.Hono();
|
|
12706
|
-
userRoutes.use("*",
|
|
12707
|
-
userRoutes.use("/users/*",
|
|
12708
|
-
userRoutes.use("/users",
|
|
12709
|
-
userRoutes.use("/invite-user",
|
|
12710
|
-
userRoutes.use("/resend-invitation/*",
|
|
12711
|
-
userRoutes.use("/cancel-invitation/*",
|
|
12712
|
-
userRoutes.use("/activity-logs",
|
|
12713
|
-
userRoutes.use("/activity-logs/*",
|
|
12710
|
+
userRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
12711
|
+
userRoutes.use("/users/*", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
12712
|
+
userRoutes.use("/users", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
12713
|
+
userRoutes.use("/invite-user", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
12714
|
+
userRoutes.use("/resend-invitation/*", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
12715
|
+
userRoutes.use("/cancel-invitation/*", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
12716
|
+
userRoutes.use("/activity-logs", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
12717
|
+
userRoutes.use("/activity-logs/*", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
12714
12718
|
userRoutes.get("/", (c) => {
|
|
12715
12719
|
return c.redirect("/admin/dashboard");
|
|
12716
12720
|
});
|
|
@@ -12880,7 +12884,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
12880
12884
|
}
|
|
12881
12885
|
await saveCustomData(db, user.userId, sanitized);
|
|
12882
12886
|
}
|
|
12883
|
-
await
|
|
12887
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
12884
12888
|
db,
|
|
12885
12889
|
user.userId,
|
|
12886
12890
|
"profile.update",
|
|
@@ -12943,7 +12947,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
12943
12947
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
12944
12948
|
`);
|
|
12945
12949
|
const userData = await userStmt.bind(user.userId).first();
|
|
12946
|
-
await
|
|
12950
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
12947
12951
|
db,
|
|
12948
12952
|
user.userId,
|
|
12949
12953
|
"profile.avatar_update",
|
|
@@ -13014,7 +13018,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13014
13018
|
dismissible: true
|
|
13015
13019
|
}));
|
|
13016
13020
|
}
|
|
13017
|
-
const validPassword = await
|
|
13021
|
+
const validPassword = await chunkUFPT5KCQ_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
13018
13022
|
if (!validPassword) {
|
|
13019
13023
|
return c.html(renderAlert2({
|
|
13020
13024
|
type: "error",
|
|
@@ -13022,7 +13026,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13022
13026
|
dismissible: true
|
|
13023
13027
|
}));
|
|
13024
13028
|
}
|
|
13025
|
-
const newPasswordHash = await
|
|
13029
|
+
const newPasswordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(newPassword);
|
|
13026
13030
|
const historyStmt = db.prepare(`
|
|
13027
13031
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
13028
13032
|
VALUES (?, ?, ?, ?)
|
|
@@ -13038,7 +13042,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13038
13042
|
WHERE id = ?
|
|
13039
13043
|
`);
|
|
13040
13044
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
13041
|
-
await
|
|
13045
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13042
13046
|
db,
|
|
13043
13047
|
user.userId,
|
|
13044
13048
|
"profile.password_change",
|
|
@@ -13105,7 +13109,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
13105
13109
|
`);
|
|
13106
13110
|
const countResult = await countStmt.bind(...params).first();
|
|
13107
13111
|
const totalUsers = countResult?.total || 0;
|
|
13108
|
-
await
|
|
13112
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13109
13113
|
db,
|
|
13110
13114
|
user.userId,
|
|
13111
13115
|
"users.list_view",
|
|
@@ -13263,7 +13267,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13263
13267
|
dismissible: true
|
|
13264
13268
|
}));
|
|
13265
13269
|
}
|
|
13266
|
-
const passwordHash = await
|
|
13270
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
13267
13271
|
const userId = crypto.randomUUID();
|
|
13268
13272
|
const createStmt = db.prepare(`
|
|
13269
13273
|
INSERT INTO users (
|
|
@@ -13286,7 +13290,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13286
13290
|
Date.now(),
|
|
13287
13291
|
Date.now()
|
|
13288
13292
|
).run();
|
|
13289
|
-
await
|
|
13293
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13290
13294
|
db,
|
|
13291
13295
|
user.userId,
|
|
13292
13296
|
"user!.create",
|
|
@@ -13325,7 +13329,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
13325
13329
|
if (!userRecord) {
|
|
13326
13330
|
return c.json({ error: "User not found" }, 404);
|
|
13327
13331
|
}
|
|
13328
|
-
await
|
|
13332
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13329
13333
|
db,
|
|
13330
13334
|
user.userId,
|
|
13331
13335
|
"user!.view",
|
|
@@ -13551,7 +13555,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13551
13555
|
userId
|
|
13552
13556
|
).run();
|
|
13553
13557
|
if (newPassword) {
|
|
13554
|
-
const passwordHash = await
|
|
13558
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(newPassword);
|
|
13555
13559
|
const updatePasswordStmt = db.prepare(`
|
|
13556
13560
|
UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?
|
|
13557
13561
|
`);
|
|
@@ -13605,7 +13609,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13605
13609
|
).run();
|
|
13606
13610
|
}
|
|
13607
13611
|
}
|
|
13608
|
-
await
|
|
13612
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13609
13613
|
db,
|
|
13610
13614
|
user.userId,
|
|
13611
13615
|
"user.update",
|
|
@@ -13650,7 +13654,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
|
|
|
13650
13654
|
UPDATE users SET is_active = ?, updated_at = ? WHERE id = ?
|
|
13651
13655
|
`);
|
|
13652
13656
|
await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
|
|
13653
|
-
await
|
|
13657
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13654
13658
|
db,
|
|
13655
13659
|
user.userId,
|
|
13656
13660
|
active ? "user.activate" : "user.deactivate",
|
|
@@ -13691,7 +13695,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13691
13695
|
DELETE FROM users WHERE id = ?
|
|
13692
13696
|
`);
|
|
13693
13697
|
await deleteStmt.bind(userId).run();
|
|
13694
|
-
await
|
|
13698
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13695
13699
|
db,
|
|
13696
13700
|
user.userId,
|
|
13697
13701
|
"user!.hard_delete",
|
|
@@ -13710,7 +13714,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13710
13714
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
13711
13715
|
`);
|
|
13712
13716
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
13713
|
-
await
|
|
13717
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13714
13718
|
db,
|
|
13715
13719
|
user.userId,
|
|
13716
13720
|
"user!.soft_delete",
|
|
@@ -13776,7 +13780,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
13776
13780
|
Date.now(),
|
|
13777
13781
|
Date.now()
|
|
13778
13782
|
).run();
|
|
13779
|
-
await
|
|
13783
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13780
13784
|
db,
|
|
13781
13785
|
user.userId,
|
|
13782
13786
|
"user!.invite_sent",
|
|
@@ -13833,7 +13837,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
13833
13837
|
Date.now(),
|
|
13834
13838
|
userId
|
|
13835
13839
|
).run();
|
|
13836
|
-
await
|
|
13840
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13837
13841
|
db,
|
|
13838
13842
|
user.userId,
|
|
13839
13843
|
"user!.invitation_resent",
|
|
@@ -13869,7 +13873,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
13869
13873
|
}
|
|
13870
13874
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
13871
13875
|
await deleteStmt.bind(userId).run();
|
|
13872
|
-
await
|
|
13876
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13873
13877
|
db,
|
|
13874
13878
|
user.userId,
|
|
13875
13879
|
"user!.invitation_cancelled",
|
|
@@ -13952,7 +13956,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
13952
13956
|
...log,
|
|
13953
13957
|
details: log.details ? JSON.parse(log.details) : null
|
|
13954
13958
|
}));
|
|
13955
|
-
await
|
|
13959
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13956
13960
|
db,
|
|
13957
13961
|
user.userId,
|
|
13958
13962
|
"activity.logs_viewed",
|
|
@@ -14059,7 +14063,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
14059
14063
|
csvRows.push(row.join(","));
|
|
14060
14064
|
}
|
|
14061
14065
|
const csvContent = csvRows.join("\n");
|
|
14062
|
-
await
|
|
14066
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
14063
14067
|
db,
|
|
14064
14068
|
user.userId,
|
|
14065
14069
|
"activity.logs_exported",
|
|
@@ -14277,7 +14281,7 @@ function getFileIcon(mimeType) {
|
|
|
14277
14281
|
}
|
|
14278
14282
|
|
|
14279
14283
|
// src/templates/pages/admin-media-library.template.ts
|
|
14280
|
-
|
|
14284
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
14281
14285
|
function renderMediaLibraryPage(data) {
|
|
14282
14286
|
const pageContent = `
|
|
14283
14287
|
<div>
|
|
@@ -15212,7 +15216,7 @@ function renderMediaLibraryPage(data) {
|
|
|
15212
15216
|
version: data.version,
|
|
15213
15217
|
content: pageContent
|
|
15214
15218
|
};
|
|
15215
|
-
return
|
|
15219
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
15216
15220
|
}
|
|
15217
15221
|
|
|
15218
15222
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -15398,7 +15402,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
15398
15402
|
// 50MB max
|
|
15399
15403
|
});
|
|
15400
15404
|
var adminMediaRoutes = new hono.Hono();
|
|
15401
|
-
adminMediaRoutes.use("*",
|
|
15405
|
+
adminMediaRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
15402
15406
|
adminMediaRoutes.get("/", async (c) => {
|
|
15403
15407
|
try {
|
|
15404
15408
|
const user = c.get("user");
|
|
@@ -15984,7 +15988,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
15984
15988
|
`);
|
|
15985
15989
|
}
|
|
15986
15990
|
});
|
|
15987
|
-
adminMediaRoutes.delete("/cleanup",
|
|
15991
|
+
adminMediaRoutes.delete("/cleanup", chunkUFPT5KCQ_cjs.requireRole("admin"), async (c) => {
|
|
15988
15992
|
try {
|
|
15989
15993
|
const db = c.env.DB;
|
|
15990
15994
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -16234,7 +16238,7 @@ function formatFileSize(bytes) {
|
|
|
16234
16238
|
}
|
|
16235
16239
|
|
|
16236
16240
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
16237
|
-
|
|
16241
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
16238
16242
|
function renderPluginsListPage(data) {
|
|
16239
16243
|
const categories = [
|
|
16240
16244
|
{ value: "content", label: "Content Management" },
|
|
@@ -16704,7 +16708,7 @@ function renderPluginsListPage(data) {
|
|
|
16704
16708
|
version: data.version,
|
|
16705
16709
|
content: pageContent
|
|
16706
16710
|
};
|
|
16707
|
-
return
|
|
16711
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
16708
16712
|
}
|
|
16709
16713
|
function renderPluginCard(plugin) {
|
|
16710
16714
|
const statusColors = {
|
|
@@ -17341,7 +17345,7 @@ function renderPluginSettingsPage(data) {
|
|
|
17341
17345
|
user,
|
|
17342
17346
|
content: pageContent
|
|
17343
17347
|
};
|
|
17344
|
-
return
|
|
17348
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
17345
17349
|
}
|
|
17346
17350
|
function renderStatusBadge(status) {
|
|
17347
17351
|
const statusColors = {
|
|
@@ -18209,152 +18213,20 @@ function renderEmailSettingsContent(plugin, settings) {
|
|
|
18209
18213
|
|
|
18210
18214
|
// src/routes/admin-plugins.ts
|
|
18211
18215
|
var adminPluginRoutes = new hono.Hono();
|
|
18212
|
-
adminPluginRoutes.use("*",
|
|
18213
|
-
var AVAILABLE_PLUGINS =
|
|
18214
|
-
|
|
18215
|
-
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
},
|
|
18227
|
-
{
|
|
18228
|
-
id: "demo-login-prefill",
|
|
18229
|
-
name: "demo-login-plugin",
|
|
18230
|
-
display_name: "Demo Login Prefill",
|
|
18231
|
-
description: "Prefills login form with demo credentials (admin@sonicjs.com/sonicjs!) for easy site demonstration",
|
|
18232
|
-
version: "1.0.0-beta.1",
|
|
18233
|
-
author: "SonicJS",
|
|
18234
|
-
category: "demo",
|
|
18235
|
-
icon: "\xF0\x9F\x8E\xAF",
|
|
18236
|
-
permissions: [],
|
|
18237
|
-
dependencies: [],
|
|
18238
|
-
is_core: false
|
|
18239
|
-
},
|
|
18240
|
-
{
|
|
18241
|
-
id: "database-tools",
|
|
18242
|
-
name: "database-tools",
|
|
18243
|
-
display_name: "Database Tools",
|
|
18244
|
-
description: "Database management tools including truncate, backup, and validation",
|
|
18245
|
-
version: "1.0.0-beta.1",
|
|
18246
|
-
author: "SonicJS Team",
|
|
18247
|
-
category: "system",
|
|
18248
|
-
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18249
|
-
permissions: ["manage:database", "admin"],
|
|
18250
|
-
dependencies: [],
|
|
18251
|
-
is_core: false
|
|
18252
|
-
},
|
|
18253
|
-
{
|
|
18254
|
-
id: "seed-data",
|
|
18255
|
-
name: "seed-data",
|
|
18256
|
-
display_name: "Seed Data",
|
|
18257
|
-
description: "Generate realistic example users and content for testing and development",
|
|
18258
|
-
version: "1.0.0-beta.1",
|
|
18259
|
-
author: "SonicJS Team",
|
|
18260
|
-
category: "development",
|
|
18261
|
-
icon: "\xF0\x9F\x8C\xB1",
|
|
18262
|
-
permissions: ["admin"],
|
|
18263
|
-
dependencies: [],
|
|
18264
|
-
is_core: false
|
|
18265
|
-
},
|
|
18266
|
-
{
|
|
18267
|
-
id: "quill-editor",
|
|
18268
|
-
name: "quill-editor",
|
|
18269
|
-
display_name: "Quill Rich Text Editor",
|
|
18270
|
-
description: "Quill WYSIWYG editor integration for rich text editing. Lightweight, modern editor with customizable toolbars and dark mode support.",
|
|
18271
|
-
version: "1.0.0",
|
|
18272
|
-
author: "SonicJS Team",
|
|
18273
|
-
category: "editor",
|
|
18274
|
-
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18275
|
-
permissions: [],
|
|
18276
|
-
dependencies: [],
|
|
18277
|
-
is_core: true
|
|
18278
|
-
},
|
|
18279
|
-
{
|
|
18280
|
-
id: "tinymce-plugin",
|
|
18281
|
-
name: "tinymce-plugin",
|
|
18282
|
-
display_name: "TinyMCE Rich Text Editor",
|
|
18283
|
-
description: "Powerful WYSIWYG rich text editor for content creation. Provides a full-featured editor with formatting, media embedding, and customizable toolbars for richtext fields.",
|
|
18284
|
-
version: "1.0.0",
|
|
18285
|
-
author: "SonicJS Team",
|
|
18286
|
-
category: "editor",
|
|
18287
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18288
|
-
permissions: [],
|
|
18289
|
-
dependencies: [],
|
|
18290
|
-
is_core: false
|
|
18291
|
-
},
|
|
18292
|
-
{
|
|
18293
|
-
id: "easy-mdx",
|
|
18294
|
-
name: "easy-mdx",
|
|
18295
|
-
display_name: "EasyMDE Markdown Editor",
|
|
18296
|
-
description: "Lightweight markdown editor with live preview. Provides a simple and efficient editor with markdown support for richtext fields.",
|
|
18297
|
-
version: "1.0.0",
|
|
18298
|
-
author: "SonicJS Team",
|
|
18299
|
-
category: "editor",
|
|
18300
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18301
|
-
permissions: [],
|
|
18302
|
-
dependencies: [],
|
|
18303
|
-
is_core: false
|
|
18304
|
-
},
|
|
18305
|
-
{
|
|
18306
|
-
id: "turnstile",
|
|
18307
|
-
name: "turnstile-plugin",
|
|
18308
|
-
display_name: "Cloudflare Turnstile",
|
|
18309
|
-
description: "CAPTCHA-free bot protection for forms using Cloudflare Turnstile. Provides seamless spam prevention with configurable modes, themes, and pre-clearance options.",
|
|
18310
|
-
version: "1.0.0",
|
|
18311
|
-
author: "SonicJS Team",
|
|
18312
|
-
category: "security",
|
|
18313
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18314
|
-
permissions: [],
|
|
18315
|
-
dependencies: [],
|
|
18316
|
-
is_core: true
|
|
18317
|
-
},
|
|
18318
|
-
{
|
|
18319
|
-
id: "security-audit",
|
|
18320
|
-
name: "security-audit",
|
|
18321
|
-
display_name: "Security Audit",
|
|
18322
|
-
description: "Security event logging, brute-force detection, and analytics dashboard. Monitors login attempts, registrations, lockouts, and suspicious activity.",
|
|
18323
|
-
version: "1.0.0-beta.1",
|
|
18324
|
-
author: "SonicJS Team",
|
|
18325
|
-
category: "security",
|
|
18326
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18327
|
-
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18328
|
-
dependencies: [],
|
|
18329
|
-
is_core: false
|
|
18330
|
-
},
|
|
18331
|
-
{
|
|
18332
|
-
id: "ai-search",
|
|
18333
|
-
name: "ai-search-plugin",
|
|
18334
|
-
display_name: "AI Search",
|
|
18335
|
-
description: "Advanced search with Cloudflare AI Search. Full-text search, semantic search, and advanced filtering across all content collections.",
|
|
18336
|
-
version: "1.0.0",
|
|
18337
|
-
author: "SonicJS Team",
|
|
18338
|
-
category: "search",
|
|
18339
|
-
icon: "\xF0\x9F\x94\x8D",
|
|
18340
|
-
permissions: [],
|
|
18341
|
-
dependencies: [],
|
|
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
|
|
18356
|
-
}
|
|
18357
|
-
];
|
|
18216
|
+
adminPluginRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
18217
|
+
var AVAILABLE_PLUGINS = Object.values(chunk43AB4EH4_cjs.PLUGIN_REGISTRY).map((p) => ({
|
|
18218
|
+
id: p.id,
|
|
18219
|
+
name: p.codeName,
|
|
18220
|
+
display_name: p.displayName,
|
|
18221
|
+
description: p.description,
|
|
18222
|
+
version: p.version,
|
|
18223
|
+
author: p.author,
|
|
18224
|
+
category: p.category,
|
|
18225
|
+
icon: p.iconEmoji,
|
|
18226
|
+
permissions: p.permissions,
|
|
18227
|
+
dependencies: p.dependencies,
|
|
18228
|
+
is_core: p.is_core
|
|
18229
|
+
}));
|
|
18358
18230
|
adminPluginRoutes.get("/", async (c) => {
|
|
18359
18231
|
try {
|
|
18360
18232
|
const user = c.get("user");
|
|
@@ -18362,7 +18234,7 @@ adminPluginRoutes.get("/", async (c) => {
|
|
|
18362
18234
|
if (user?.role !== "admin") {
|
|
18363
18235
|
return c.text("Access denied", 403);
|
|
18364
18236
|
}
|
|
18365
|
-
const pluginService = new
|
|
18237
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18366
18238
|
let installedPlugins = [];
|
|
18367
18239
|
let stats = { total: 0, active: 0, inactive: 0, errors: 0, uninstalled: 0 };
|
|
18368
18240
|
try {
|
|
@@ -18431,14 +18303,10 @@ adminPluginRoutes.get("/:id", async (c) => {
|
|
|
18431
18303
|
const user = c.get("user");
|
|
18432
18304
|
const db = c.env.DB;
|
|
18433
18305
|
const pluginId = c.req.param("id");
|
|
18434
|
-
const pluginsWithCustomPages = ["ai-search", "security-audit"];
|
|
18435
|
-
if (pluginsWithCustomPages.includes(pluginId)) {
|
|
18436
|
-
return c.text("", 404);
|
|
18437
|
-
}
|
|
18438
18306
|
if (user?.role !== "admin") {
|
|
18439
18307
|
return c.redirect("/admin/plugins");
|
|
18440
18308
|
}
|
|
18441
|
-
const pluginService = new
|
|
18309
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18442
18310
|
const plugin = await pluginService.getPlugin(pluginId);
|
|
18443
18311
|
if (!plugin) {
|
|
18444
18312
|
return c.text("Plugin not found", 404);
|
|
@@ -18514,7 +18382,7 @@ adminPluginRoutes.post("/:id/activate", async (c) => {
|
|
|
18514
18382
|
if (user?.role !== "admin") {
|
|
18515
18383
|
return c.json({ error: "Access denied" }, 403);
|
|
18516
18384
|
}
|
|
18517
|
-
const pluginService = new
|
|
18385
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18518
18386
|
await pluginService.activatePlugin(pluginId);
|
|
18519
18387
|
return c.json({ success: true });
|
|
18520
18388
|
} catch (error) {
|
|
@@ -18531,7 +18399,7 @@ adminPluginRoutes.post("/:id/deactivate", async (c) => {
|
|
|
18531
18399
|
if (user?.role !== "admin") {
|
|
18532
18400
|
return c.json({ error: "Access denied" }, 403);
|
|
18533
18401
|
}
|
|
18534
|
-
const pluginService = new
|
|
18402
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18535
18403
|
await pluginService.deactivatePlugin(pluginId);
|
|
18536
18404
|
return c.json({ success: true });
|
|
18537
18405
|
} catch (error) {
|
|
@@ -18548,321 +18416,26 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18548
18416
|
return c.json({ error: "Access denied" }, 403);
|
|
18549
18417
|
}
|
|
18550
18418
|
const body = await c.req.json();
|
|
18551
|
-
const pluginService = new
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
}
|
|
18572
|
-
if (body.name === "demo-login-plugin") {
|
|
18573
|
-
const demoPlugin = await pluginService.installPlugin({
|
|
18574
|
-
id: "demo-login-prefill",
|
|
18575
|
-
name: "demo-login-plugin",
|
|
18576
|
-
display_name: "Demo Login Prefill",
|
|
18577
|
-
description: "Prefills login form with demo credentials (admin@sonicjs.com/sonicjs!) for easy site demonstration",
|
|
18578
|
-
version: "1.0.0-beta.1",
|
|
18579
|
-
author: "SonicJS",
|
|
18580
|
-
category: "demo",
|
|
18581
|
-
icon: "\xF0\x9F\x8E\xAF",
|
|
18582
|
-
permissions: [],
|
|
18583
|
-
dependencies: [],
|
|
18584
|
-
settings: {
|
|
18585
|
-
enableNotice: true,
|
|
18586
|
-
demoEmail: "admin@sonicjs.com",
|
|
18587
|
-
demoPassword: "sonicjs!"
|
|
18588
|
-
}
|
|
18589
|
-
});
|
|
18590
|
-
return c.json({ success: true, plugin: demoPlugin });
|
|
18591
|
-
}
|
|
18592
|
-
if (body.name === "core-auth") {
|
|
18593
|
-
const authPlugin = await pluginService.installPlugin({
|
|
18594
|
-
id: "core-auth",
|
|
18595
|
-
name: "core-auth",
|
|
18596
|
-
display_name: "Authentication System",
|
|
18597
|
-
description: "Core authentication and user management system",
|
|
18598
|
-
version: "1.0.0-beta.1",
|
|
18599
|
-
author: "SonicJS Team",
|
|
18600
|
-
category: "security",
|
|
18601
|
-
icon: "\xF0\x9F\x94\x90",
|
|
18602
|
-
permissions: ["manage:users", "manage:roles", "manage:permissions"],
|
|
18603
|
-
dependencies: [],
|
|
18604
|
-
is_core: true,
|
|
18605
|
-
settings: {}
|
|
18606
|
-
});
|
|
18607
|
-
return c.json({ success: true, plugin: authPlugin });
|
|
18608
|
-
}
|
|
18609
|
-
if (body.name === "core-media") {
|
|
18610
|
-
const mediaPlugin = await pluginService.installPlugin({
|
|
18611
|
-
id: "core-media",
|
|
18612
|
-
name: "core-media",
|
|
18613
|
-
display_name: "Media Manager",
|
|
18614
|
-
description: "Core media upload and management system",
|
|
18615
|
-
version: "1.0.0-beta.1",
|
|
18616
|
-
author: "SonicJS Team",
|
|
18617
|
-
category: "media",
|
|
18618
|
-
icon: "\xF0\x9F\x93\xB8",
|
|
18619
|
-
permissions: ["manage:media", "upload:files"],
|
|
18620
|
-
dependencies: [],
|
|
18621
|
-
is_core: true,
|
|
18622
|
-
settings: {}
|
|
18623
|
-
});
|
|
18624
|
-
return c.json({ success: true, plugin: mediaPlugin });
|
|
18625
|
-
}
|
|
18626
|
-
if (body.name === "core-workflow") {
|
|
18627
|
-
const workflowPlugin = await pluginService.installPlugin({
|
|
18628
|
-
id: "core-workflow",
|
|
18629
|
-
name: "core-workflow",
|
|
18630
|
-
display_name: "Workflow Engine",
|
|
18631
|
-
description: "Content workflow and approval system",
|
|
18632
|
-
version: "1.0.0-beta.1",
|
|
18633
|
-
author: "SonicJS Team",
|
|
18634
|
-
category: "content",
|
|
18635
|
-
icon: "\xF0\x9F\x94\x84",
|
|
18636
|
-
permissions: ["manage:workflows", "approve:content"],
|
|
18637
|
-
dependencies: [],
|
|
18638
|
-
is_core: true,
|
|
18639
|
-
settings: {}
|
|
18640
|
-
});
|
|
18641
|
-
return c.json({ success: true, plugin: workflowPlugin });
|
|
18642
|
-
}
|
|
18643
|
-
if (body.name === "database-tools") {
|
|
18644
|
-
const databaseToolsPlugin = await pluginService.installPlugin({
|
|
18645
|
-
id: "database-tools",
|
|
18646
|
-
name: "database-tools",
|
|
18647
|
-
display_name: "Database Tools",
|
|
18648
|
-
description: "Database management tools including truncate, backup, and validation",
|
|
18649
|
-
version: "1.0.0-beta.1",
|
|
18650
|
-
author: "SonicJS Team",
|
|
18651
|
-
category: "system",
|
|
18652
|
-
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18653
|
-
permissions: ["manage:database", "admin"],
|
|
18654
|
-
dependencies: [],
|
|
18655
|
-
is_core: false,
|
|
18656
|
-
settings: {
|
|
18657
|
-
enableTruncate: true,
|
|
18658
|
-
enableBackup: true,
|
|
18659
|
-
enableValidation: true,
|
|
18660
|
-
requireConfirmation: true
|
|
18661
|
-
}
|
|
18662
|
-
});
|
|
18663
|
-
return c.json({ success: true, plugin: databaseToolsPlugin });
|
|
18664
|
-
}
|
|
18665
|
-
if (body.name === "seed-data") {
|
|
18666
|
-
const seedDataPlugin = await pluginService.installPlugin({
|
|
18667
|
-
id: "seed-data",
|
|
18668
|
-
name: "seed-data",
|
|
18669
|
-
display_name: "Seed Data",
|
|
18670
|
-
description: "Generate realistic example users and content for testing and development",
|
|
18671
|
-
version: "1.0.0-beta.1",
|
|
18672
|
-
author: "SonicJS Team",
|
|
18673
|
-
category: "development",
|
|
18674
|
-
icon: "\xF0\x9F\x8C\xB1",
|
|
18675
|
-
permissions: ["admin"],
|
|
18676
|
-
dependencies: [],
|
|
18677
|
-
is_core: false,
|
|
18678
|
-
settings: {
|
|
18679
|
-
userCount: 20,
|
|
18680
|
-
contentCount: 200,
|
|
18681
|
-
defaultPassword: "password123"
|
|
18682
|
-
}
|
|
18683
|
-
});
|
|
18684
|
-
return c.json({ success: true, plugin: seedDataPlugin });
|
|
18685
|
-
}
|
|
18686
|
-
if (body.name === "quill-editor") {
|
|
18687
|
-
const quillPlugin = await pluginService.installPlugin({
|
|
18688
|
-
id: "quill-editor",
|
|
18689
|
-
name: "quill-editor",
|
|
18690
|
-
display_name: "Quill Rich Text Editor",
|
|
18691
|
-
description: "Quill WYSIWYG editor integration for rich text editing. Lightweight, modern editor with customizable toolbars and dark mode support.",
|
|
18692
|
-
version: "1.0.0",
|
|
18693
|
-
author: "SonicJS Team",
|
|
18694
|
-
category: "editor",
|
|
18695
|
-
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18696
|
-
permissions: [],
|
|
18697
|
-
dependencies: [],
|
|
18698
|
-
is_core: true,
|
|
18699
|
-
settings: {
|
|
18700
|
-
version: "2.0.2",
|
|
18701
|
-
defaultHeight: 300,
|
|
18702
|
-
defaultToolbar: "full",
|
|
18703
|
-
theme: "snow"
|
|
18704
|
-
}
|
|
18705
|
-
});
|
|
18706
|
-
return c.json({ success: true, plugin: quillPlugin });
|
|
18707
|
-
}
|
|
18708
|
-
if (body.name === "tinymce-plugin") {
|
|
18709
|
-
const tinymcePlugin2 = await pluginService.installPlugin({
|
|
18710
|
-
id: "tinymce-plugin",
|
|
18711
|
-
name: "tinymce-plugin",
|
|
18712
|
-
display_name: "TinyMCE Rich Text Editor",
|
|
18713
|
-
description: "Powerful WYSIWYG rich text editor for content creation. Provides a full-featured editor with formatting, media embedding, and customizable toolbars for richtext fields.",
|
|
18714
|
-
version: "1.0.0",
|
|
18715
|
-
author: "SonicJS Team",
|
|
18716
|
-
category: "editor",
|
|
18717
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18718
|
-
permissions: [],
|
|
18719
|
-
dependencies: [],
|
|
18720
|
-
is_core: false,
|
|
18721
|
-
settings: {
|
|
18722
|
-
apiKey: "no-api-key",
|
|
18723
|
-
defaultHeight: 300,
|
|
18724
|
-
defaultToolbar: "full",
|
|
18725
|
-
skin: "oxide-dark"
|
|
18726
|
-
}
|
|
18727
|
-
});
|
|
18728
|
-
return c.json({ success: true, plugin: tinymcePlugin2 });
|
|
18729
|
-
}
|
|
18730
|
-
if (body.name === "easy-mdx") {
|
|
18731
|
-
const easyMdxPlugin2 = await pluginService.installPlugin({
|
|
18732
|
-
id: "easy-mdx",
|
|
18733
|
-
name: "easy-mdx",
|
|
18734
|
-
display_name: "EasyMDE Markdown Editor",
|
|
18735
|
-
description: "Lightweight markdown editor with live preview. Provides a simple and efficient editor with markdown support for richtext fields.",
|
|
18736
|
-
version: "1.0.0",
|
|
18737
|
-
author: "SonicJS Team",
|
|
18738
|
-
category: "editor",
|
|
18739
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18740
|
-
permissions: [],
|
|
18741
|
-
dependencies: [],
|
|
18742
|
-
is_core: false,
|
|
18743
|
-
settings: {
|
|
18744
|
-
defaultHeight: 400,
|
|
18745
|
-
theme: "dark",
|
|
18746
|
-
toolbar: "full",
|
|
18747
|
-
placeholder: "Start writing your content..."
|
|
18748
|
-
}
|
|
18749
|
-
});
|
|
18750
|
-
return c.json({ success: true, plugin: easyMdxPlugin2 });
|
|
18751
|
-
}
|
|
18752
|
-
if (body.name === "security-audit") {
|
|
18753
|
-
const securityAuditPlugin = await pluginService.installPlugin({
|
|
18754
|
-
id: "security-audit",
|
|
18755
|
-
name: "security-audit",
|
|
18756
|
-
display_name: "Security Audit",
|
|
18757
|
-
description: "Security event logging, brute-force detection, and analytics dashboard. Monitors login attempts, registrations, lockouts, and suspicious activity.",
|
|
18758
|
-
version: "1.0.0-beta.1",
|
|
18759
|
-
author: "SonicJS Team",
|
|
18760
|
-
category: "security",
|
|
18761
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18762
|
-
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18763
|
-
dependencies: [],
|
|
18764
|
-
is_core: false,
|
|
18765
|
-
settings: {
|
|
18766
|
-
retention: {
|
|
18767
|
-
daysToKeep: 90,
|
|
18768
|
-
maxEvents: 1e5,
|
|
18769
|
-
autoPurge: true
|
|
18770
|
-
},
|
|
18771
|
-
bruteForce: {
|
|
18772
|
-
enabled: true,
|
|
18773
|
-
maxFailedAttemptsPerIP: 10,
|
|
18774
|
-
maxFailedAttemptsPerEmail: 5,
|
|
18775
|
-
windowMinutes: 15,
|
|
18776
|
-
lockoutDurationMinutes: 30,
|
|
18777
|
-
alertThreshold: 20
|
|
18778
|
-
},
|
|
18779
|
-
logging: {
|
|
18780
|
-
logSuccessfulLogins: true,
|
|
18781
|
-
logLogouts: true,
|
|
18782
|
-
logRegistrations: true,
|
|
18783
|
-
logPasswordResets: true,
|
|
18784
|
-
logPermissionDenied: true
|
|
18785
|
-
}
|
|
18786
|
-
}
|
|
18787
|
-
});
|
|
18788
|
-
return c.json({ success: true, plugin: securityAuditPlugin });
|
|
18789
|
-
}
|
|
18790
|
-
if (body.name === "ai-search-plugin" || body.name === "ai-search") {
|
|
18791
|
-
const defaultSettings = {
|
|
18792
|
-
enabled: true,
|
|
18793
|
-
ai_mode_enabled: true,
|
|
18794
|
-
selected_collections: [],
|
|
18795
|
-
dismissed_collections: [],
|
|
18796
|
-
autocomplete_enabled: true,
|
|
18797
|
-
cache_duration: 1,
|
|
18798
|
-
results_limit: 20,
|
|
18799
|
-
index_media: false
|
|
18800
|
-
};
|
|
18801
|
-
const aiSearchPlugin = await pluginService.installPlugin({
|
|
18802
|
-
id: "ai-search",
|
|
18803
|
-
name: "ai-search-plugin",
|
|
18804
|
-
display_name: "AI Search",
|
|
18805
|
-
description: "Advanced search with Cloudflare AI Search. Full-text search, semantic search, and advanced filtering across all content collections.",
|
|
18806
|
-
version: "1.0.0",
|
|
18807
|
-
author: "SonicJS Team",
|
|
18808
|
-
category: "search",
|
|
18809
|
-
icon: "\xF0\x9F\x94\x8D",
|
|
18810
|
-
permissions: [],
|
|
18811
|
-
dependencies: [],
|
|
18812
|
-
is_core: true,
|
|
18813
|
-
settings: defaultSettings
|
|
18814
|
-
});
|
|
18815
|
-
return c.json({ success: true, plugin: aiSearchPlugin });
|
|
18816
|
-
}
|
|
18817
|
-
if (body.name === "turnstile-plugin") {
|
|
18818
|
-
const turnstilePlugin = await pluginService.installPlugin({
|
|
18819
|
-
id: "turnstile",
|
|
18820
|
-
name: "turnstile-plugin",
|
|
18821
|
-
display_name: "Cloudflare Turnstile",
|
|
18822
|
-
description: "CAPTCHA-free bot protection for forms using Cloudflare Turnstile. Provides seamless spam prevention with configurable modes, themes, and pre-clearance options.",
|
|
18823
|
-
version: "1.0.0",
|
|
18824
|
-
author: "SonicJS Team",
|
|
18825
|
-
category: "security",
|
|
18826
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18827
|
-
permissions: [],
|
|
18828
|
-
dependencies: [],
|
|
18829
|
-
is_core: true,
|
|
18830
|
-
settings: {
|
|
18831
|
-
siteKey: "",
|
|
18832
|
-
secretKey: "",
|
|
18833
|
-
theme: "auto",
|
|
18834
|
-
size: "normal",
|
|
18835
|
-
mode: "managed",
|
|
18836
|
-
appearance: "always",
|
|
18837
|
-
preClearanceEnabled: false,
|
|
18838
|
-
preClearanceLevel: "managed",
|
|
18839
|
-
enabled: false
|
|
18840
|
-
}
|
|
18841
|
-
});
|
|
18842
|
-
return c.json({ success: true, plugin: turnstilePlugin });
|
|
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
|
-
}
|
|
18865
|
-
return c.json({ error: "Plugin not found in registry" }, 404);
|
|
18419
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18420
|
+
const registryEntry = chunk43AB4EH4_cjs.findPluginByCodeName(body.name) || chunk43AB4EH4_cjs.PLUGIN_REGISTRY[body.name] || chunk43AB4EH4_cjs.PLUGIN_REGISTRY[body.id];
|
|
18421
|
+
if (!registryEntry) {
|
|
18422
|
+
return c.json({ error: "Plugin not found in registry" }, 404);
|
|
18423
|
+
}
|
|
18424
|
+
const plugin = await pluginService.installPlugin({
|
|
18425
|
+
id: registryEntry.id,
|
|
18426
|
+
name: registryEntry.codeName,
|
|
18427
|
+
display_name: registryEntry.displayName,
|
|
18428
|
+
description: registryEntry.description,
|
|
18429
|
+
version: registryEntry.version,
|
|
18430
|
+
author: registryEntry.author,
|
|
18431
|
+
category: registryEntry.category,
|
|
18432
|
+
icon: registryEntry.iconEmoji,
|
|
18433
|
+
permissions: registryEntry.permissions,
|
|
18434
|
+
dependencies: registryEntry.dependencies,
|
|
18435
|
+
is_core: registryEntry.is_core,
|
|
18436
|
+
settings: registryEntry.defaultSettings
|
|
18437
|
+
});
|
|
18438
|
+
return c.json({ success: true, plugin });
|
|
18866
18439
|
} catch (error) {
|
|
18867
18440
|
console.error("Error installing plugin:", error);
|
|
18868
18441
|
const message = error instanceof Error ? error.message : "Failed to install plugin";
|
|
@@ -18877,7 +18450,7 @@ adminPluginRoutes.post("/:id/uninstall", async (c) => {
|
|
|
18877
18450
|
if (user?.role !== "admin") {
|
|
18878
18451
|
return c.json({ error: "Access denied" }, 403);
|
|
18879
18452
|
}
|
|
18880
|
-
const pluginService = new
|
|
18453
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18881
18454
|
await pluginService.uninstallPlugin(pluginId);
|
|
18882
18455
|
return c.json({ success: true });
|
|
18883
18456
|
} catch (error) {
|
|
@@ -18895,7 +18468,7 @@ adminPluginRoutes.post("/:id/settings", async (c) => {
|
|
|
18895
18468
|
return c.json({ error: "Access denied" }, 403);
|
|
18896
18469
|
}
|
|
18897
18470
|
const settings = await c.req.json();
|
|
18898
|
-
const pluginService = new
|
|
18471
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18899
18472
|
await pluginService.updatePluginSettings(pluginId, settings);
|
|
18900
18473
|
if (pluginId === "core-auth") {
|
|
18901
18474
|
try {
|
|
@@ -18928,7 +18501,7 @@ function formatLastUpdated(timestamp) {
|
|
|
18928
18501
|
}
|
|
18929
18502
|
|
|
18930
18503
|
// src/templates/pages/admin-logs-list.template.ts
|
|
18931
|
-
|
|
18504
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
18932
18505
|
function renderLogsListPage(data) {
|
|
18933
18506
|
const { logs, pagination, filters, user } = data;
|
|
18934
18507
|
const content = `
|
|
@@ -19239,7 +18812,7 @@ function renderLogsListPage(data) {
|
|
|
19239
18812
|
user,
|
|
19240
18813
|
content
|
|
19241
18814
|
};
|
|
19242
|
-
return
|
|
18815
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
19243
18816
|
}
|
|
19244
18817
|
function renderLogDetailsPage(data) {
|
|
19245
18818
|
const { log, user } = data;
|
|
@@ -19451,7 +19024,7 @@ function renderLogDetailsPage(data) {
|
|
|
19451
19024
|
</div>
|
|
19452
19025
|
</div>
|
|
19453
19026
|
`;
|
|
19454
|
-
return
|
|
19027
|
+
return chunkOHYBNCVL_cjs.adminLayoutV2({
|
|
19455
19028
|
title: `Log Details - ${log.id}`,
|
|
19456
19029
|
user,
|
|
19457
19030
|
content
|
|
@@ -19694,7 +19267,7 @@ function renderLogConfigPage(data) {
|
|
|
19694
19267
|
|
|
19695
19268
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
19696
19269
|
`;
|
|
19697
|
-
return
|
|
19270
|
+
return chunkOHYBNCVL_cjs.adminLayoutV2({
|
|
19698
19271
|
title: "Log Configuration",
|
|
19699
19272
|
user,
|
|
19700
19273
|
content
|
|
@@ -19703,7 +19276,7 @@ function renderLogConfigPage(data) {
|
|
|
19703
19276
|
|
|
19704
19277
|
// src/routes/admin-logs.ts
|
|
19705
19278
|
var adminLogsRoutes = new hono.Hono();
|
|
19706
|
-
adminLogsRoutes.use("*",
|
|
19279
|
+
adminLogsRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
19707
19280
|
adminLogsRoutes.get("/", async (c) => {
|
|
19708
19281
|
try {
|
|
19709
19282
|
const user = c.get("user");
|
|
@@ -20075,7 +19648,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
20075
19648
|
role: user.role
|
|
20076
19649
|
} : void 0
|
|
20077
19650
|
};
|
|
20078
|
-
return c.html(
|
|
19651
|
+
return c.html(chunkOHYBNCVL_cjs.renderDesignPage(pageData));
|
|
20079
19652
|
});
|
|
20080
19653
|
var adminCheckboxRoutes = new hono.Hono();
|
|
20081
19654
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -20087,7 +19660,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
20087
19660
|
role: user.role
|
|
20088
19661
|
} : void 0
|
|
20089
19662
|
};
|
|
20090
|
-
return c.html(
|
|
19663
|
+
return c.html(chunkOHYBNCVL_cjs.renderCheckboxPage(pageData));
|
|
20091
19664
|
});
|
|
20092
19665
|
|
|
20093
19666
|
// src/templates/pages/admin-testimonials-form.template.ts
|
|
@@ -20115,7 +19688,7 @@ function renderTestimonialsForm(data) {
|
|
|
20115
19688
|
</div>
|
|
20116
19689
|
</div>
|
|
20117
19690
|
|
|
20118
|
-
${message ?
|
|
19691
|
+
${message ? chunkOHYBNCVL_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20119
19692
|
|
|
20120
19693
|
<!-- Form -->
|
|
20121
19694
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -20344,7 +19917,7 @@ function renderTestimonialsForm(data) {
|
|
|
20344
19917
|
user: data.user,
|
|
20345
19918
|
content: pageContent
|
|
20346
19919
|
};
|
|
20347
|
-
return
|
|
19920
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
20348
19921
|
}
|
|
20349
19922
|
function escapeHtml4(unsafe) {
|
|
20350
19923
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -20370,7 +19943,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20370
19943
|
const offset = (currentPage - 1) * limit;
|
|
20371
19944
|
const db = c.env?.DB;
|
|
20372
19945
|
if (!db) {
|
|
20373
|
-
return c.html(
|
|
19946
|
+
return c.html(chunkOHYBNCVL_cjs.renderTestimonialsList({
|
|
20374
19947
|
testimonials: [],
|
|
20375
19948
|
totalCount: 0,
|
|
20376
19949
|
currentPage: 1,
|
|
@@ -20410,7 +19983,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20410
19983
|
`;
|
|
20411
19984
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
20412
19985
|
const totalPages = Math.ceil(totalCount / limit);
|
|
20413
|
-
return c.html(
|
|
19986
|
+
return c.html(chunkOHYBNCVL_cjs.renderTestimonialsList({
|
|
20414
19987
|
testimonials: testimonials || [],
|
|
20415
19988
|
totalCount,
|
|
20416
19989
|
currentPage,
|
|
@@ -20424,7 +19997,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20424
19997
|
} catch (error) {
|
|
20425
19998
|
console.error("Error fetching testimonials:", error);
|
|
20426
19999
|
const user = c.get("user");
|
|
20427
|
-
return c.html(
|
|
20000
|
+
return c.html(chunkOHYBNCVL_cjs.renderTestimonialsList({
|
|
20428
20001
|
testimonials: [],
|
|
20429
20002
|
totalCount: 0,
|
|
20430
20003
|
currentPage: 1,
|
|
@@ -20743,7 +20316,7 @@ function renderCodeExamplesForm(data) {
|
|
|
20743
20316
|
</div>
|
|
20744
20317
|
</div>
|
|
20745
20318
|
|
|
20746
|
-
${message ?
|
|
20319
|
+
${message ? chunkOHYBNCVL_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20747
20320
|
|
|
20748
20321
|
<!-- Form -->
|
|
20749
20322
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -21013,7 +20586,7 @@ function renderCodeExamplesForm(data) {
|
|
|
21013
20586
|
user: data.user,
|
|
21014
20587
|
content: pageContent
|
|
21015
20588
|
};
|
|
21016
|
-
return
|
|
20589
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
21017
20590
|
}
|
|
21018
20591
|
function escapeHtml5(unsafe) {
|
|
21019
20592
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -21040,7 +20613,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21040
20613
|
const offset = (currentPage - 1) * limit;
|
|
21041
20614
|
const db = c.env?.DB;
|
|
21042
20615
|
if (!db) {
|
|
21043
|
-
return c.html(
|
|
20616
|
+
return c.html(chunkOHYBNCVL_cjs.renderCodeExamplesList({
|
|
21044
20617
|
codeExamples: [],
|
|
21045
20618
|
totalCount: 0,
|
|
21046
20619
|
currentPage: 1,
|
|
@@ -21080,7 +20653,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21080
20653
|
`;
|
|
21081
20654
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
21082
20655
|
const totalPages = Math.ceil(totalCount / limit);
|
|
21083
|
-
return c.html(
|
|
20656
|
+
return c.html(chunkOHYBNCVL_cjs.renderCodeExamplesList({
|
|
21084
20657
|
codeExamples: codeExamples || [],
|
|
21085
20658
|
totalCount,
|
|
21086
20659
|
currentPage,
|
|
@@ -21094,7 +20667,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21094
20667
|
} catch (error) {
|
|
21095
20668
|
console.error("Error fetching code examples:", error);
|
|
21096
20669
|
const user = c.get("user");
|
|
21097
|
-
return c.html(
|
|
20670
|
+
return c.html(chunkOHYBNCVL_cjs.renderCodeExamplesList({
|
|
21098
20671
|
codeExamples: [],
|
|
21099
20672
|
totalCount: 0,
|
|
21100
20673
|
currentPage: 1,
|
|
@@ -21483,7 +21056,7 @@ function renderDashboardPage(data) {
|
|
|
21483
21056
|
version: data.version,
|
|
21484
21057
|
content: pageContent
|
|
21485
21058
|
};
|
|
21486
|
-
return
|
|
21059
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
21487
21060
|
}
|
|
21488
21061
|
function renderStatsCards(stats) {
|
|
21489
21062
|
const cards = [
|
|
@@ -22031,9 +21604,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
22031
21604
|
}
|
|
22032
21605
|
|
|
22033
21606
|
// src/routes/admin-dashboard.ts
|
|
22034
|
-
var VERSION =
|
|
21607
|
+
var VERSION = chunkVUISYUHY_cjs.getCoreVersion();
|
|
22035
21608
|
var router = new hono.Hono();
|
|
22036
|
-
router.use("*",
|
|
21609
|
+
router.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
22037
21610
|
router.get("/", async (c) => {
|
|
22038
21611
|
const user = c.get("user");
|
|
22039
21612
|
try {
|
|
@@ -22272,7 +21845,7 @@ function normalizeFieldType(fieldType) {
|
|
|
22272
21845
|
}
|
|
22273
21846
|
|
|
22274
21847
|
// src/templates/pages/admin-collections-list.template.ts
|
|
22275
|
-
|
|
21848
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
22276
21849
|
|
|
22277
21850
|
// src/templates/components/table.template.ts
|
|
22278
21851
|
function renderTable2(data) {
|
|
@@ -22746,11 +22319,11 @@ function renderCollectionsListPage(data) {
|
|
|
22746
22319
|
version: data.version,
|
|
22747
22320
|
content: pageContent
|
|
22748
22321
|
};
|
|
22749
|
-
return
|
|
22322
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
22750
22323
|
}
|
|
22751
22324
|
|
|
22752
22325
|
// src/templates/pages/admin-collections-form.template.ts
|
|
22753
|
-
|
|
22326
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
22754
22327
|
function getFieldTypeBadge(fieldType) {
|
|
22755
22328
|
const typeLabels = {
|
|
22756
22329
|
"text": "Text",
|
|
@@ -23019,7 +22592,7 @@ function renderCollectionFormPage(data) {
|
|
|
23019
22592
|
}
|
|
23020
22593
|
</style>
|
|
23021
22594
|
|
|
23022
|
-
${
|
|
22595
|
+
${chunkOHYBNCVL_cjs.renderForm(formData)}
|
|
23023
22596
|
|
|
23024
22597
|
${isEdit && data.managed ? `
|
|
23025
22598
|
<!-- Read-Only Fields Display for Managed Collections -->
|
|
@@ -23847,15 +23420,15 @@ function renderCollectionFormPage(data) {
|
|
|
23847
23420
|
version: data.version,
|
|
23848
23421
|
content: pageContent
|
|
23849
23422
|
};
|
|
23850
|
-
return
|
|
23423
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
23851
23424
|
}
|
|
23852
23425
|
|
|
23853
23426
|
// src/routes/admin-collections.ts
|
|
23854
23427
|
var adminCollectionsRoutes = new hono.Hono();
|
|
23855
|
-
adminCollectionsRoutes.use("*",
|
|
23856
|
-
adminCollectionsRoutes.post("*",
|
|
23857
|
-
adminCollectionsRoutes.put("*",
|
|
23858
|
-
adminCollectionsRoutes.delete("*",
|
|
23428
|
+
adminCollectionsRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
23429
|
+
adminCollectionsRoutes.post("*", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
23430
|
+
adminCollectionsRoutes.put("*", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
23431
|
+
adminCollectionsRoutes.delete("*", chunkUFPT5KCQ_cjs.requireRole(["admin"]));
|
|
23859
23432
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
23860
23433
|
try {
|
|
23861
23434
|
const user = c.get("user");
|
|
@@ -24587,7 +24160,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
24587
24160
|
});
|
|
24588
24161
|
|
|
24589
24162
|
// src/templates/pages/admin-settings.template.ts
|
|
24590
|
-
|
|
24163
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
24591
24164
|
function renderSettingsPage(data) {
|
|
24592
24165
|
const activeTab = data.activeTab || "general";
|
|
24593
24166
|
const pageContent = `
|
|
@@ -24969,7 +24542,7 @@ function renderSettingsPage(data) {
|
|
|
24969
24542
|
version: data.version,
|
|
24970
24543
|
content: pageContent
|
|
24971
24544
|
};
|
|
24972
|
-
return
|
|
24545
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
24973
24546
|
}
|
|
24974
24547
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
24975
24548
|
const isActive = activeTab === tabId;
|
|
@@ -26051,7 +25624,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
26051
25624
|
|
|
26052
25625
|
// src/routes/admin-settings.ts
|
|
26053
25626
|
var adminSettingsRoutes = new hono.Hono();
|
|
26054
|
-
adminSettingsRoutes.use("*",
|
|
25627
|
+
adminSettingsRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
26055
25628
|
function getMockSettings(user) {
|
|
26056
25629
|
return {
|
|
26057
25630
|
general: {
|
|
@@ -26219,7 +25792,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
26219
25792
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
26220
25793
|
try {
|
|
26221
25794
|
const db = c.env.DB;
|
|
26222
|
-
const migrationService = new
|
|
25795
|
+
const migrationService = new chunkRVD7PLMU_cjs.MigrationService(db);
|
|
26223
25796
|
const status = await migrationService.getMigrationStatus();
|
|
26224
25797
|
return c.json({
|
|
26225
25798
|
success: true,
|
|
@@ -26243,7 +25816,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26243
25816
|
}, 403);
|
|
26244
25817
|
}
|
|
26245
25818
|
const db = c.env.DB;
|
|
26246
|
-
const migrationService = new
|
|
25819
|
+
const migrationService = new chunkRVD7PLMU_cjs.MigrationService(db);
|
|
26247
25820
|
const result = await migrationService.runPendingMigrations();
|
|
26248
25821
|
return c.json({
|
|
26249
25822
|
success: result.success,
|
|
@@ -26261,7 +25834,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26261
25834
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
26262
25835
|
try {
|
|
26263
25836
|
const db = c.env.DB;
|
|
26264
|
-
const migrationService = new
|
|
25837
|
+
const migrationService = new chunkRVD7PLMU_cjs.MigrationService(db);
|
|
26265
25838
|
const validation = await migrationService.validateSchema();
|
|
26266
25839
|
return c.json({
|
|
26267
25840
|
success: true,
|
|
@@ -26470,7 +26043,7 @@ adminSettingsRoutes.post("/", async (c) => {
|
|
|
26470
26043
|
});
|
|
26471
26044
|
|
|
26472
26045
|
// src/templates/pages/admin-forms-list.template.ts
|
|
26473
|
-
|
|
26046
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
26474
26047
|
function renderFormsListPage(data) {
|
|
26475
26048
|
const tableData = {
|
|
26476
26049
|
tableId: "forms-table",
|
|
@@ -26732,11 +26305,11 @@ function renderFormsListPage(data) {
|
|
|
26732
26305
|
user: data.user,
|
|
26733
26306
|
version: data.version
|
|
26734
26307
|
};
|
|
26735
|
-
return
|
|
26308
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
26736
26309
|
}
|
|
26737
26310
|
|
|
26738
26311
|
// src/templates/pages/admin-forms-builder.template.ts
|
|
26739
|
-
|
|
26312
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
26740
26313
|
function getTurnstileComponentScript() {
|
|
26741
26314
|
return `
|
|
26742
26315
|
(function() {
|
|
@@ -27949,11 +27522,11 @@ ${getTurnstileComponentScript()}
|
|
|
27949
27522
|
user: data.user,
|
|
27950
27523
|
version: data.version
|
|
27951
27524
|
};
|
|
27952
|
-
return
|
|
27525
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
27953
27526
|
}
|
|
27954
27527
|
|
|
27955
27528
|
// src/templates/pages/admin-forms-create.template.ts
|
|
27956
|
-
|
|
27529
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
27957
27530
|
function renderFormCreatePage(data) {
|
|
27958
27531
|
const pageContent = `
|
|
27959
27532
|
<div class="max-w-3xl mx-auto">
|
|
@@ -28146,12 +27719,12 @@ function renderFormCreatePage(data) {
|
|
|
28146
27719
|
user: data.user,
|
|
28147
27720
|
version: data.version
|
|
28148
27721
|
};
|
|
28149
|
-
return
|
|
27722
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
28150
27723
|
}
|
|
28151
27724
|
|
|
28152
27725
|
// src/routes/admin-forms.ts
|
|
28153
27726
|
var adminFormsRoutes = new hono.Hono();
|
|
28154
|
-
adminFormsRoutes.use("*",
|
|
27727
|
+
adminFormsRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
28155
27728
|
adminFormsRoutes.get("/", async (c) => {
|
|
28156
27729
|
try {
|
|
28157
27730
|
const user = c.get("user");
|
|
@@ -28315,7 +27888,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
|
|
|
28315
27888
|
if (!form) {
|
|
28316
27889
|
return c.html("<p>Form not found</p>", 404);
|
|
28317
27890
|
}
|
|
28318
|
-
const turnstileService = new
|
|
27891
|
+
const turnstileService = new chunk635JAMSE_cjs.TurnstileService(db);
|
|
28319
27892
|
const turnstileSettings = await turnstileService.getSettings();
|
|
28320
27893
|
const pageData = {
|
|
28321
27894
|
id: form.id,
|
|
@@ -28479,7 +28052,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
|
|
|
28479
28052
|
if (!form) {
|
|
28480
28053
|
return c.json({ error: "Form not found" }, 404);
|
|
28481
28054
|
}
|
|
28482
|
-
const turnstileService = new
|
|
28055
|
+
const turnstileService = new chunk635JAMSE_cjs.TurnstileService(db);
|
|
28483
28056
|
const globalSettings = await turnstileService.getSettings();
|
|
28484
28057
|
const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
28485
28058
|
const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
|
|
@@ -28906,7 +28479,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28906
28479
|
const turnstileEnabled = form.turnstile_enabled === 1;
|
|
28907
28480
|
const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
28908
28481
|
if (turnstileEnabled || turnstileSettings.inherit) {
|
|
28909
|
-
const turnstileService = new
|
|
28482
|
+
const turnstileService = new chunk635JAMSE_cjs.TurnstileService(db);
|
|
28910
28483
|
const globalEnabled = await turnstileService.isEnabled();
|
|
28911
28484
|
if (globalEnabled || turnstileEnabled) {
|
|
28912
28485
|
const turnstileToken = body.data?.turnstile || body.turnstile;
|
|
@@ -28956,7 +28529,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28956
28529
|
`).bind(now, form.id).run();
|
|
28957
28530
|
let contentId = null;
|
|
28958
28531
|
try {
|
|
28959
|
-
contentId = await
|
|
28532
|
+
contentId = await chunk43AB4EH4_cjs.createContentFromSubmission(
|
|
28960
28533
|
db,
|
|
28961
28534
|
sanitizedData,
|
|
28962
28535
|
{ id: form.id, name: form.name, display_name: form.display_name },
|
|
@@ -28989,7 +28562,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28989
28562
|
var public_forms_default = publicFormsRoutes;
|
|
28990
28563
|
|
|
28991
28564
|
// src/templates/pages/admin-api-reference.template.ts
|
|
28992
|
-
|
|
28565
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
28993
28566
|
function renderAuthBadge(auth) {
|
|
28994
28567
|
if (auth === true) {
|
|
28995
28568
|
return `
|
|
@@ -29320,13 +28893,13 @@ function renderAPIReferencePage(data) {
|
|
|
29320
28893
|
version: data.version,
|
|
29321
28894
|
content: pageContent
|
|
29322
28895
|
};
|
|
29323
|
-
return
|
|
28896
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
29324
28897
|
}
|
|
29325
28898
|
|
|
29326
28899
|
// src/routes/admin-api-reference.ts
|
|
29327
|
-
var VERSION2 =
|
|
28900
|
+
var VERSION2 = chunkVUISYUHY_cjs.getCoreVersion();
|
|
29328
28901
|
var router2 = new hono.Hono();
|
|
29329
|
-
router2.use("*",
|
|
28902
|
+
router2.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
29330
28903
|
router2.get("/", async (c) => {
|
|
29331
28904
|
const user = c.get("user");
|
|
29332
28905
|
try {
|
|
@@ -29417,5 +28990,5 @@ exports.router2 = router2;
|
|
|
29417
28990
|
exports.test_cleanup_default = test_cleanup_default;
|
|
29418
28991
|
exports.userProfilesPlugin = userProfilesPlugin;
|
|
29419
28992
|
exports.userRoutes = userRoutes;
|
|
29420
|
-
//# sourceMappingURL=chunk-
|
|
29421
|
-
//# sourceMappingURL=chunk-
|
|
28993
|
+
//# sourceMappingURL=chunk-26HYU7MX.cjs.map
|
|
28994
|
+
//# sourceMappingURL=chunk-26HYU7MX.cjs.map
|