@sonicjs-cms/core 2.14.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-DRWSHIFG.cjs → chunk-26HYU7MX.cjs} +228 -658
- package/dist/chunk-26HYU7MX.cjs.map +1 -0
- package/dist/{chunk-AFGOH2F6.js → chunk-2BL2A62D.js} +4 -4
- package/dist/{chunk-AFGOH2F6.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-JKNKO6LA.js → chunk-5SOFMH66.js} +2 -2
- package/dist/{chunk-JKNKO6LA.js.map → chunk-5SOFMH66.js.map} +1 -1
- package/dist/{chunk-6FHNRRJ3.cjs → chunk-635JAMSE.cjs} +76 -17
- package/dist/chunk-635JAMSE.cjs.map +1 -0
- package/dist/{chunk-23DP6TO5.js → chunk-7MMD5WMK.js} +44 -474
- 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-GAVTTYMC.js → chunk-EWXV2KG2.js} +3 -3
- package/dist/{chunk-GAVTTYMC.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-KZ2MFGET.cjs → chunk-RVD7PLMU.cjs} +2 -2
- package/dist/{chunk-KZ2MFGET.cjs.map → chunk-RVD7PLMU.cjs.map} +1 -1
- 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-YYMPHM3I.cjs → chunk-UFPT5KCQ.cjs} +8 -8
- package/dist/{chunk-YYMPHM3I.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-YULUPQZV.cjs → chunk-VUISYUHY.cjs} +3 -3
- package/dist/{chunk-YULUPQZV.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 +910 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +765 -88
- 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-F7KVA74T.cjs.map → migrations-APFGYCB6.cjs.map} +1 -1
- package/dist/migrations-YB52SLW7.js +4 -0
- package/dist/{migrations-WKONKRN7.js.map → migrations-YB52SLW7.js.map} +1 -1
- package/dist/{plugin-bootstrap-BGwBraaN.d.cts → plugin-bootstrap-DfVerYV4.d.cts} +2 -1
- package/dist/{plugin-bootstrap-Drns7X9w.d.ts → plugin-bootstrap-P_ciLp_C.d.ts} +2 -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.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-23DP6TO5.js.map +0 -1
- package/dist/chunk-6FHNRRJ3.cjs.map +0 -1
- package/dist/chunk-DRWSHIFG.cjs.map +0 -1
- package/dist/chunk-H3XXBAMO.js.map +0 -1
- package/dist/chunk-I6FFGQIT.cjs.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/migrations-F7KVA74T.cjs +0 -13
- package/dist/migrations-WKONKRN7.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("/", chunkYYMPHM3I_cjs.requireAuth(), chunkYYMPHM3I_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", chunkYYMPHM3I_cjs.requireAuth(), chunkYYMPHM3I_
|
|
|
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", chunkYYMPHM3I_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", chunkYYMPHM3I_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", chunkYYMPHM3I_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", chunkYYMPHM3I_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,7 +2378,7 @@ 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();
|
|
@@ -2399,7 +2400,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
2399
2400
|
});
|
|
2400
2401
|
adminApiRoutes.get("/migrations/validate", async (c) => {
|
|
2401
2402
|
try {
|
|
2402
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
2403
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-APFGYCB6.cjs');
|
|
2403
2404
|
const db = c.env.DB;
|
|
2404
2405
|
const migrationService = new MigrationService2(db);
|
|
2405
2406
|
const validation = await migrationService.validateSchema();
|
|
@@ -2474,8 +2475,8 @@ function renderLoginPage(data, demoLoginActive = false) {
|
|
|
2474
2475
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2475
2476
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2476
2477
|
<!-- Alerts -->
|
|
2477
|
-
${data.error ? `<div class="mb-6">${
|
|
2478
|
-
${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>` : ""}
|
|
2479
2480
|
|
|
2480
2481
|
<!-- Form Response (HTMX target) -->
|
|
2481
2482
|
<div id="form-response" class="mb-6"></div>
|
|
@@ -2639,7 +2640,7 @@ function renderRegisterPage(data) {
|
|
|
2639
2640
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2640
2641
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2641
2642
|
<!-- Alerts -->
|
|
2642
|
-
${data.error ? `<div class="mb-6">${
|
|
2643
|
+
${data.error ? `<div class="mb-6">${chunkOHYBNCVL_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2643
2644
|
|
|
2644
2645
|
<!-- Form -->
|
|
2645
2646
|
<form
|
|
@@ -5071,7 +5072,7 @@ function renderCustomProfileSection(config, customData) {
|
|
|
5071
5072
|
|
|
5072
5073
|
// src/plugins/core-plugins/user-profiles/index.ts
|
|
5073
5074
|
function createUserProfilesPlugin() {
|
|
5074
|
-
const builder3 =
|
|
5075
|
+
const builder3 = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
5075
5076
|
name: "user-profiles",
|
|
5076
5077
|
version: "1.0.0-beta.1",
|
|
5077
5078
|
description: "Configurable custom profile fields for users"
|
|
@@ -5152,7 +5153,7 @@ var JWT_SECRET_FALLBACK = "your-super-secret-jwt-key-change-in-production";
|
|
|
5152
5153
|
async function setCsrfCookie(c) {
|
|
5153
5154
|
const secret = c.env?.JWT_SECRET || JWT_SECRET_FALLBACK;
|
|
5154
5155
|
const isDev = c.env?.ENVIRONMENT === "development" || !c.env?.ENVIRONMENT;
|
|
5155
|
-
const csrfToken = await
|
|
5156
|
+
const csrfToken = await chunkUFPT5KCQ_cjs.generateCsrfToken(secret);
|
|
5156
5157
|
cookie.setCookie(c, "csrf_token", csrfToken, {
|
|
5157
5158
|
httpOnly: false,
|
|
5158
5159
|
secure: !isDev,
|
|
@@ -5209,7 +5210,7 @@ var loginSchema = zod.z.object({
|
|
|
5209
5210
|
});
|
|
5210
5211
|
authRoutes.post(
|
|
5211
5212
|
"/register",
|
|
5212
|
-
|
|
5213
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5213
5214
|
async (c) => {
|
|
5214
5215
|
try {
|
|
5215
5216
|
const db = c.env.DB;
|
|
@@ -5246,7 +5247,7 @@ authRoutes.post(
|
|
|
5246
5247
|
if (existingUser) {
|
|
5247
5248
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
5248
5249
|
}
|
|
5249
|
-
const passwordHash = await
|
|
5250
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5250
5251
|
const userId = crypto.randomUUID();
|
|
5251
5252
|
const now = /* @__PURE__ */ new Date();
|
|
5252
5253
|
await db.prepare(`
|
|
@@ -5280,7 +5281,7 @@ authRoutes.post(
|
|
|
5280
5281
|
await saveCustomData(db, userId, sanitized);
|
|
5281
5282
|
}
|
|
5282
5283
|
}
|
|
5283
|
-
const token = await
|
|
5284
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer", c.env.JWT_SECRET);
|
|
5284
5285
|
cookie.setCookie(c, "auth_token", token, {
|
|
5285
5286
|
httpOnly: true,
|
|
5286
5287
|
secure: true,
|
|
@@ -5314,7 +5315,7 @@ authRoutes.post(
|
|
|
5314
5315
|
);
|
|
5315
5316
|
authRoutes.post(
|
|
5316
5317
|
"/login",
|
|
5317
|
-
|
|
5318
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5318
5319
|
async (c) => {
|
|
5319
5320
|
try {
|
|
5320
5321
|
const body = await c.req.json();
|
|
@@ -5337,19 +5338,19 @@ authRoutes.post(
|
|
|
5337
5338
|
if (!user) {
|
|
5338
5339
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5339
5340
|
}
|
|
5340
|
-
const isValidPassword = await
|
|
5341
|
+
const isValidPassword = await chunkUFPT5KCQ_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5341
5342
|
if (!isValidPassword) {
|
|
5342
5343
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
5343
5344
|
}
|
|
5344
|
-
if (
|
|
5345
|
+
if (chunkUFPT5KCQ_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5345
5346
|
try {
|
|
5346
|
-
const newHash = await
|
|
5347
|
+
const newHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5347
5348
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5348
5349
|
} catch (rehashError) {
|
|
5349
5350
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5350
5351
|
}
|
|
5351
5352
|
}
|
|
5352
|
-
const token = await
|
|
5353
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5353
5354
|
cookie.setCookie(c, "auth_token", token, {
|
|
5354
5355
|
httpOnly: true,
|
|
5355
5356
|
secure: true,
|
|
@@ -5402,7 +5403,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
5402
5403
|
clearCsrfCookie(c);
|
|
5403
5404
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
5404
5405
|
});
|
|
5405
|
-
authRoutes.get("/me",
|
|
5406
|
+
authRoutes.get("/me", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
5406
5407
|
try {
|
|
5407
5408
|
const user = c.get("user");
|
|
5408
5409
|
if (!user) {
|
|
@@ -5419,13 +5420,13 @@ authRoutes.get("/me", chunkYYMPHM3I_cjs.requireAuth(), async (c) => {
|
|
|
5419
5420
|
return c.json({ error: "Failed to get user" }, 500);
|
|
5420
5421
|
}
|
|
5421
5422
|
});
|
|
5422
|
-
authRoutes.post("/refresh",
|
|
5423
|
+
authRoutes.post("/refresh", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
5423
5424
|
try {
|
|
5424
5425
|
const user = c.get("user");
|
|
5425
5426
|
if (!user) {
|
|
5426
5427
|
return c.json({ error: "Not authenticated" }, 401);
|
|
5427
5428
|
}
|
|
5428
|
-
const token = await
|
|
5429
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.userId, user.email, user.role, c.env.JWT_SECRET);
|
|
5429
5430
|
cookie.setCookie(c, "auth_token", token, {
|
|
5430
5431
|
httpOnly: true,
|
|
5431
5432
|
secure: true,
|
|
@@ -5442,7 +5443,7 @@ authRoutes.post("/refresh", chunkYYMPHM3I_cjs.requireAuth(), async (c) => {
|
|
|
5442
5443
|
});
|
|
5443
5444
|
authRoutes.post(
|
|
5444
5445
|
"/register/form",
|
|
5445
|
-
|
|
5446
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "register" }),
|
|
5446
5447
|
async (c) => {
|
|
5447
5448
|
try {
|
|
5448
5449
|
const db = c.env.DB;
|
|
@@ -5489,7 +5490,7 @@ authRoutes.post(
|
|
|
5489
5490
|
</div>
|
|
5490
5491
|
`);
|
|
5491
5492
|
}
|
|
5492
|
-
const passwordHash = await
|
|
5493
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5493
5494
|
const role = isFirstUser ? "admin" : "viewer";
|
|
5494
5495
|
const userId = crypto.randomUUID();
|
|
5495
5496
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -5524,7 +5525,7 @@ authRoutes.post(
|
|
|
5524
5525
|
await saveCustomData(db, userId, sanitized);
|
|
5525
5526
|
}
|
|
5526
5527
|
}
|
|
5527
|
-
const token = await
|
|
5528
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(userId, normalizedEmail, role, c.env.JWT_SECRET);
|
|
5528
5529
|
cookie.setCookie(c, "auth_token", token, {
|
|
5529
5530
|
httpOnly: true,
|
|
5530
5531
|
secure: false,
|
|
@@ -5557,7 +5558,7 @@ authRoutes.post(
|
|
|
5557
5558
|
);
|
|
5558
5559
|
authRoutes.post(
|
|
5559
5560
|
"/login/form",
|
|
5560
|
-
|
|
5561
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 30, windowMs: 60 * 1e3, keyPrefix: "login" }),
|
|
5561
5562
|
async (c) => {
|
|
5562
5563
|
try {
|
|
5563
5564
|
const formData = await c.req.formData();
|
|
@@ -5581,7 +5582,7 @@ authRoutes.post(
|
|
|
5581
5582
|
</div>
|
|
5582
5583
|
`);
|
|
5583
5584
|
}
|
|
5584
|
-
const isValidPassword = await
|
|
5585
|
+
const isValidPassword = await chunkUFPT5KCQ_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
5585
5586
|
if (!isValidPassword) {
|
|
5586
5587
|
return c.html(html.html`
|
|
5587
5588
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -5589,15 +5590,15 @@ authRoutes.post(
|
|
|
5589
5590
|
</div>
|
|
5590
5591
|
`);
|
|
5591
5592
|
}
|
|
5592
|
-
if (
|
|
5593
|
+
if (chunkUFPT5KCQ_cjs.AuthManager.isLegacyHash(user.password_hash)) {
|
|
5593
5594
|
try {
|
|
5594
|
-
const newHash = await
|
|
5595
|
+
const newHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5595
5596
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(newHash, Date.now(), user.id).run();
|
|
5596
5597
|
} catch (rehashError) {
|
|
5597
5598
|
console.error("Password rehash failed (non-fatal):", rehashError);
|
|
5598
5599
|
}
|
|
5599
5600
|
}
|
|
5600
|
-
const token = await
|
|
5601
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
5601
5602
|
cookie.setCookie(c, "auth_token", token, {
|
|
5602
5603
|
httpOnly: true,
|
|
5603
5604
|
secure: false,
|
|
@@ -5639,7 +5640,7 @@ authRoutes.post(
|
|
|
5639
5640
|
);
|
|
5640
5641
|
authRoutes.post(
|
|
5641
5642
|
"/seed-admin",
|
|
5642
|
-
|
|
5643
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 10, windowMs: 60 * 1e3, keyPrefix: "seed-admin" }),
|
|
5643
5644
|
async (c) => {
|
|
5644
5645
|
try {
|
|
5645
5646
|
const db = c.env.DB;
|
|
@@ -5661,7 +5662,7 @@ authRoutes.post(
|
|
|
5661
5662
|
`).run();
|
|
5662
5663
|
const existingAdmin = await db.prepare("SELECT id FROM users WHERE email = ? OR username = ?").bind("admin@sonicjs.com", "admin").first();
|
|
5663
5664
|
if (existingAdmin) {
|
|
5664
|
-
const passwordHash2 = await
|
|
5665
|
+
const passwordHash2 = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5665
5666
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(passwordHash2, Date.now(), existingAdmin.id).run();
|
|
5666
5667
|
return c.json({
|
|
5667
5668
|
message: "Admin user already exists (password updated)",
|
|
@@ -5673,7 +5674,7 @@ authRoutes.post(
|
|
|
5673
5674
|
}
|
|
5674
5675
|
});
|
|
5675
5676
|
}
|
|
5676
|
-
const passwordHash = await
|
|
5677
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword("sonicjs!");
|
|
5677
5678
|
const userId = "admin-user-id";
|
|
5678
5679
|
const now = Date.now();
|
|
5679
5680
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -5894,7 +5895,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5894
5895
|
if (existingUsername) {
|
|
5895
5896
|
return c.json({ error: "Username is already taken" }, 400);
|
|
5896
5897
|
}
|
|
5897
|
-
const passwordHash = await
|
|
5898
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
5898
5899
|
const updateStmt = db.prepare(`
|
|
5899
5900
|
UPDATE users SET
|
|
5900
5901
|
username = ?,
|
|
@@ -5913,7 +5914,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5913
5914
|
Date.now(),
|
|
5914
5915
|
invitedUser.id
|
|
5915
5916
|
).run();
|
|
5916
|
-
const authToken = await
|
|
5917
|
+
const authToken = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role, c.env.JWT_SECRET);
|
|
5917
5918
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
5918
5919
|
httpOnly: true,
|
|
5919
5920
|
secure: true,
|
|
@@ -5930,7 +5931,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
5930
5931
|
});
|
|
5931
5932
|
authRoutes.post(
|
|
5932
5933
|
"/request-password-reset",
|
|
5933
|
-
|
|
5934
|
+
chunkUFPT5KCQ_cjs.rateLimit({ max: 3, windowMs: 15 * 60 * 1e3, keyPrefix: "password-reset" }),
|
|
5934
5935
|
async (c) => {
|
|
5935
5936
|
try {
|
|
5936
5937
|
const formData = await c.req.formData();
|
|
@@ -6148,7 +6149,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
6148
6149
|
if (Date.now() > user.password_reset_expires) {
|
|
6149
6150
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
6150
6151
|
}
|
|
6151
|
-
const newPasswordHash = await
|
|
6152
|
+
const newPasswordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
6152
6153
|
try {
|
|
6153
6154
|
const historyStmt = db.prepare(`
|
|
6154
6155
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -6595,7 +6596,7 @@ function escapeHtml3(text) {
|
|
|
6595
6596
|
}
|
|
6596
6597
|
|
|
6597
6598
|
// src/plugins/available/easy-mdx/index.ts
|
|
6598
|
-
var builder =
|
|
6599
|
+
var builder = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
6599
6600
|
name: "easy-mdx",
|
|
6600
6601
|
version: "1.0.0",
|
|
6601
6602
|
description: "Lightweight markdown editor with live preview"
|
|
@@ -6807,7 +6808,7 @@ function getMDXEditorInitScript(config) {
|
|
|
6807
6808
|
}
|
|
6808
6809
|
|
|
6809
6810
|
// src/plugins/available/tinymce-plugin/index.ts
|
|
6810
|
-
var builder2 =
|
|
6811
|
+
var builder2 = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
6811
6812
|
name: "tinymce-plugin",
|
|
6812
6813
|
version: "1.0.0",
|
|
6813
6814
|
description: "Powerful WYSIWYG rich text editor for content creation"
|
|
@@ -7090,7 +7091,7 @@ function getQuillCDN(version = "2.0.2") {
|
|
|
7090
7091
|
`;
|
|
7091
7092
|
}
|
|
7092
7093
|
function createQuillEditorPlugin() {
|
|
7093
|
-
const builder3 =
|
|
7094
|
+
const builder3 = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
7094
7095
|
name: "quill-editor",
|
|
7095
7096
|
version: "1.0.0",
|
|
7096
7097
|
description: "Quill rich text editor integration for SonicJS"
|
|
@@ -7116,7 +7117,7 @@ function createQuillEditorPlugin() {
|
|
|
7116
7117
|
createQuillEditorPlugin();
|
|
7117
7118
|
|
|
7118
7119
|
// src/templates/pages/admin-content-form.template.ts
|
|
7119
|
-
|
|
7120
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
7120
7121
|
function renderContentFormPage(data) {
|
|
7121
7122
|
const isEdit = data.isEdit || !!data.id;
|
|
7122
7123
|
const title = isEdit ? `Edit: ${data.title || "Content"}` : `New ${data.collection.display_name}`;
|
|
@@ -7197,8 +7198,8 @@ function renderContentFormPage(data) {
|
|
|
7197
7198
|
<!-- Form Content -->
|
|
7198
7199
|
<div class="px-6 py-6">
|
|
7199
7200
|
<div id="form-messages">
|
|
7200
|
-
${data.error ?
|
|
7201
|
-
${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 }) : ""}
|
|
7202
7203
|
</div>
|
|
7203
7204
|
|
|
7204
7205
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -7434,7 +7435,7 @@ function renderContentFormPage(data) {
|
|
|
7434
7435
|
</div>
|
|
7435
7436
|
|
|
7436
7437
|
<!-- Confirmation Dialogs -->
|
|
7437
|
-
${
|
|
7438
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7438
7439
|
id: "duplicate-content-confirm",
|
|
7439
7440
|
title: "Duplicate Content",
|
|
7440
7441
|
message: "Create a copy of this content?",
|
|
@@ -7445,7 +7446,7 @@ function renderContentFormPage(data) {
|
|
|
7445
7446
|
onConfirm: "performDuplicateContent()"
|
|
7446
7447
|
})}
|
|
7447
7448
|
|
|
7448
|
-
${
|
|
7449
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7449
7450
|
id: "delete-content-confirm",
|
|
7450
7451
|
title: "Delete Content",
|
|
7451
7452
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -7456,7 +7457,7 @@ function renderContentFormPage(data) {
|
|
|
7456
7457
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
7457
7458
|
})}
|
|
7458
7459
|
|
|
7459
|
-
${
|
|
7460
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7460
7461
|
id: "delete-repeater-item-confirm",
|
|
7461
7462
|
title: "Delete Item",
|
|
7462
7463
|
message: "Are you sure you want to delete this item? This action cannot be undone.",
|
|
@@ -7467,7 +7468,7 @@ function renderContentFormPage(data) {
|
|
|
7467
7468
|
onConfirm: "performRepeaterDelete()"
|
|
7468
7469
|
})}
|
|
7469
7470
|
|
|
7470
|
-
${
|
|
7471
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
7471
7472
|
id: "delete-block-confirm",
|
|
7472
7473
|
title: "Delete Block",
|
|
7473
7474
|
message: "Are you sure you want to delete this block? This action cannot be undone.",
|
|
@@ -7478,7 +7479,7 @@ function renderContentFormPage(data) {
|
|
|
7478
7479
|
onConfirm: "performRepeaterDelete()"
|
|
7479
7480
|
})}
|
|
7480
7481
|
|
|
7481
|
-
${
|
|
7482
|
+
${chunkOHYBNCVL_cjs.getConfirmationDialogScript()}
|
|
7482
7483
|
|
|
7483
7484
|
${data.tinymceEnabled ? getTinyMCEScript(data.tinymceSettings?.apiKey) : "<!-- TinyMCE plugin not active -->"}
|
|
7484
7485
|
|
|
@@ -8553,11 +8554,11 @@ function renderContentFormPage(data) {
|
|
|
8553
8554
|
content: pageContent,
|
|
8554
8555
|
version: data.version
|
|
8555
8556
|
};
|
|
8556
|
-
return
|
|
8557
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8557
8558
|
}
|
|
8558
8559
|
|
|
8559
8560
|
// src/templates/pages/admin-content-list.template.ts
|
|
8560
|
-
|
|
8561
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
8561
8562
|
function renderContentListPage(data) {
|
|
8562
8563
|
const urlParams = new URLSearchParams();
|
|
8563
8564
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -8961,8 +8962,8 @@ function renderContentListPage(data) {
|
|
|
8961
8962
|
|
|
8962
8963
|
<!-- Content List -->
|
|
8963
8964
|
<div id="content-list">
|
|
8964
|
-
${
|
|
8965
|
-
${
|
|
8965
|
+
${chunkOHYBNCVL_cjs.renderTable(tableData)}
|
|
8966
|
+
${chunkOHYBNCVL_cjs.renderPagination(paginationData)}
|
|
8966
8967
|
</div>
|
|
8967
8968
|
|
|
8968
8969
|
</div>
|
|
@@ -9172,7 +9173,7 @@ function renderContentListPage(data) {
|
|
|
9172
9173
|
</script>
|
|
9173
9174
|
|
|
9174
9175
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
9175
|
-
${
|
|
9176
|
+
${chunkOHYBNCVL_cjs.renderConfirmationDialog({
|
|
9176
9177
|
id: "bulk-action-confirm",
|
|
9177
9178
|
title: "Confirm Bulk Action",
|
|
9178
9179
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -9184,7 +9185,7 @@ function renderContentListPage(data) {
|
|
|
9184
9185
|
})}
|
|
9185
9186
|
|
|
9186
9187
|
<!-- Confirmation Dialog Script -->
|
|
9187
|
-
${
|
|
9188
|
+
${chunkOHYBNCVL_cjs.getConfirmationDialogScript()}
|
|
9188
9189
|
|
|
9189
9190
|
<!-- Advanced Search Modal -->
|
|
9190
9191
|
<div id="advancedSearchModal" class="hidden fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
|
@@ -9481,7 +9482,7 @@ function renderContentListPage(data) {
|
|
|
9481
9482
|
version: data.version,
|
|
9482
9483
|
content: pageContent
|
|
9483
9484
|
};
|
|
9484
|
-
return
|
|
9485
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
9485
9486
|
}
|
|
9486
9487
|
|
|
9487
9488
|
// src/routes/admin-content-field-types.ts
|
|
@@ -9524,9 +9525,9 @@ function parseFieldValue(field, formData, options = {}) {
|
|
|
9524
9525
|
const { skipValidation = false } = options;
|
|
9525
9526
|
const value = formData.get(field.field_name);
|
|
9526
9527
|
const errors = [];
|
|
9527
|
-
const blocksConfig =
|
|
9528
|
+
const blocksConfig = chunkVUISYUHY_cjs.getBlocksFieldConfig(field.field_options);
|
|
9528
9529
|
if (blocksConfig) {
|
|
9529
|
-
const parsed =
|
|
9530
|
+
const parsed = chunkVUISYUHY_cjs.parseBlocksValue(value, blocksConfig);
|
|
9530
9531
|
if (!skipValidation && field.is_required && parsed.value.length === 0) {
|
|
9531
9532
|
parsed.errors.push(`${field.field_label} is required`);
|
|
9532
9533
|
}
|
|
@@ -9636,7 +9637,7 @@ function extractFieldData(fields, formData, options = {}) {
|
|
|
9636
9637
|
}
|
|
9637
9638
|
return { data, errors };
|
|
9638
9639
|
}
|
|
9639
|
-
adminContentRoutes.use("*",
|
|
9640
|
+
adminContentRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
9640
9641
|
async function getCollectionFields(db, collectionId) {
|
|
9641
9642
|
const cache = chunkNZWFCUDA_cjs.getCacheService(chunkNZWFCUDA_cjs.CACHE_CONFIGS.collection);
|
|
9642
9643
|
return cache.getOrSet(
|
|
@@ -9913,21 +9914,21 @@ adminContentRoutes.get("/new", async (c) => {
|
|
|
9913
9914
|
const tinymceEnabled = await isPluginActive2(db, "tinymce-plugin");
|
|
9914
9915
|
let tinymceSettings;
|
|
9915
9916
|
if (tinymceEnabled) {
|
|
9916
|
-
const pluginService = new
|
|
9917
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
9917
9918
|
const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
|
|
9918
9919
|
tinymceSettings = tinymcePlugin2?.settings;
|
|
9919
9920
|
}
|
|
9920
9921
|
const quillEnabled = await isPluginActive2(db, "quill-editor");
|
|
9921
9922
|
let quillSettings;
|
|
9922
9923
|
if (quillEnabled) {
|
|
9923
|
-
const pluginService = new
|
|
9924
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
9924
9925
|
const quillPlugin = await pluginService.getPlugin("quill-editor");
|
|
9925
9926
|
quillSettings = quillPlugin?.settings;
|
|
9926
9927
|
}
|
|
9927
9928
|
const mdxeditorEnabled = await isPluginActive2(db, "easy-mdx");
|
|
9928
9929
|
let mdxeditorSettings;
|
|
9929
9930
|
if (mdxeditorEnabled) {
|
|
9930
|
-
const pluginService = new
|
|
9931
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
9931
9932
|
const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
|
|
9932
9933
|
mdxeditorSettings = mdxeditorPlugin?.settings;
|
|
9933
9934
|
}
|
|
@@ -10018,21 +10019,21 @@ adminContentRoutes.get("/:id/edit", async (c) => {
|
|
|
10018
10019
|
const tinymceEnabled = await isPluginActive2(db, "tinymce-plugin");
|
|
10019
10020
|
let tinymceSettings;
|
|
10020
10021
|
if (tinymceEnabled) {
|
|
10021
|
-
const pluginService = new
|
|
10022
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
10022
10023
|
const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
|
|
10023
10024
|
tinymceSettings = tinymcePlugin2?.settings;
|
|
10024
10025
|
}
|
|
10025
10026
|
const quillEnabled = await isPluginActive2(db, "quill-editor");
|
|
10026
10027
|
let quillSettings;
|
|
10027
10028
|
if (quillEnabled) {
|
|
10028
|
-
const pluginService = new
|
|
10029
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
10029
10030
|
const quillPlugin = await pluginService.getPlugin("quill-editor");
|
|
10030
10031
|
quillSettings = quillPlugin?.settings;
|
|
10031
10032
|
}
|
|
10032
10033
|
const mdxeditorEnabled = await isPluginActive2(db, "easy-mdx");
|
|
10033
10034
|
let mdxeditorSettings;
|
|
10034
10035
|
if (mdxeditorEnabled) {
|
|
10035
|
-
const pluginService = new
|
|
10036
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
10036
10037
|
const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
|
|
10037
10038
|
mdxeditorSettings = mdxeditorPlugin?.settings;
|
|
10038
10039
|
}
|
|
@@ -10327,7 +10328,7 @@ adminContentRoutes.put("/:id", async (c) => {
|
|
|
10327
10328
|
`);
|
|
10328
10329
|
}
|
|
10329
10330
|
});
|
|
10330
|
-
adminContentRoutes.post("/preview",
|
|
10331
|
+
adminContentRoutes.post("/preview", chunkUFPT5KCQ_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10331
10332
|
try {
|
|
10332
10333
|
const formData = await c.req.formData();
|
|
10333
10334
|
const collectionId = formData.get("collection_id");
|
|
@@ -10705,7 +10706,7 @@ adminContentRoutes.post("/:id/restore/:version", async (c) => {
|
|
|
10705
10706
|
return c.json({ success: false, error: "Failed to restore version" });
|
|
10706
10707
|
}
|
|
10707
10708
|
});
|
|
10708
|
-
adminContentRoutes.get("/:id/version/:version/preview",
|
|
10709
|
+
adminContentRoutes.get("/:id/version/:version/preview", chunkUFPT5KCQ_cjs.requireRole(["admin", "editor", "author"]), async (c) => {
|
|
10709
10710
|
try {
|
|
10710
10711
|
const id = c.req.param("id");
|
|
10711
10712
|
const version = parseInt(c.req.param("version") || "0");
|
|
@@ -10773,7 +10774,7 @@ ${chunkMNWKYY5E_cjs.escapeHtml(JSON.stringify(data, null, 2))}
|
|
|
10773
10774
|
var admin_content_default = adminContentRoutes;
|
|
10774
10775
|
|
|
10775
10776
|
// src/templates/pages/admin-profile.template.ts
|
|
10776
|
-
|
|
10777
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
10777
10778
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
10778
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">
|
|
10779
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>`}
|
|
@@ -10793,8 +10794,8 @@ function renderProfilePage(data) {
|
|
|
10793
10794
|
</div>
|
|
10794
10795
|
|
|
10795
10796
|
<!-- Alert Messages -->
|
|
10796
|
-
${data.error ?
|
|
10797
|
-
${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 }) : ""}
|
|
10798
10799
|
|
|
10799
10800
|
<!-- Profile Form -->
|
|
10800
10801
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -11183,7 +11184,7 @@ function renderProfilePage(data) {
|
|
|
11183
11184
|
version: data.version,
|
|
11184
11185
|
content: pageContent
|
|
11185
11186
|
};
|
|
11186
|
-
return
|
|
11187
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
11187
11188
|
}
|
|
11188
11189
|
|
|
11189
11190
|
// src/templates/components/alert.template.ts
|
|
@@ -11466,7 +11467,7 @@ function renderActivityLogsPage(data) {
|
|
|
11466
11467
|
user: data.user,
|
|
11467
11468
|
content: pageContent
|
|
11468
11469
|
};
|
|
11469
|
-
return
|
|
11470
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
11470
11471
|
}
|
|
11471
11472
|
function getActionBadgeClass(action) {
|
|
11472
11473
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -11486,7 +11487,7 @@ function formatAction(action) {
|
|
|
11486
11487
|
}
|
|
11487
11488
|
|
|
11488
11489
|
// src/templates/pages/admin-user-edit.template.ts
|
|
11489
|
-
|
|
11490
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
11490
11491
|
|
|
11491
11492
|
// src/templates/components/confirmation-dialog.template.ts
|
|
11492
11493
|
function renderConfirmationDialog2(options) {
|
|
@@ -11607,8 +11608,8 @@ function renderUserEditPage(data) {
|
|
|
11607
11608
|
|
|
11608
11609
|
<!-- Alert Messages -->
|
|
11609
11610
|
<div id="form-messages">
|
|
11610
|
-
${data.error ?
|
|
11611
|
-
${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 }) : ""}
|
|
11612
11613
|
</div>
|
|
11613
11614
|
|
|
11614
11615
|
<!-- User Edit Form -->
|
|
@@ -12006,11 +12007,11 @@ function renderUserEditPage(data) {
|
|
|
12006
12007
|
user: data.user,
|
|
12007
12008
|
content: pageContent
|
|
12008
12009
|
};
|
|
12009
|
-
return
|
|
12010
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12010
12011
|
}
|
|
12011
12012
|
|
|
12012
12013
|
// src/templates/pages/admin-user-new.template.ts
|
|
12013
|
-
|
|
12014
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
12014
12015
|
function renderUserNewPage(data) {
|
|
12015
12016
|
const pageContent = `
|
|
12016
12017
|
<div>
|
|
@@ -12049,8 +12050,8 @@ function renderUserNewPage(data) {
|
|
|
12049
12050
|
|
|
12050
12051
|
<!-- Alert Messages -->
|
|
12051
12052
|
<div id="form-messages">
|
|
12052
|
-
${data.error ?
|
|
12053
|
-
${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 }) : ""}
|
|
12054
12055
|
</div>
|
|
12055
12056
|
|
|
12056
12057
|
<!-- User New Form -->
|
|
@@ -12294,11 +12295,11 @@ function renderUserNewPage(data) {
|
|
|
12294
12295
|
user: data.user,
|
|
12295
12296
|
content: pageContent
|
|
12296
12297
|
};
|
|
12297
|
-
return
|
|
12298
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12298
12299
|
}
|
|
12299
12300
|
|
|
12300
12301
|
// src/templates/pages/admin-users-list.template.ts
|
|
12301
|
-
|
|
12302
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
12302
12303
|
function renderUsersListPage(data) {
|
|
12303
12304
|
const columns = [
|
|
12304
12305
|
{
|
|
@@ -12449,8 +12450,8 @@ function renderUsersListPage(data) {
|
|
|
12449
12450
|
</div>
|
|
12450
12451
|
|
|
12451
12452
|
<!-- Alert Messages -->
|
|
12452
|
-
${data.error ?
|
|
12453
|
-
${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 }) : ""}
|
|
12454
12455
|
|
|
12455
12456
|
<!-- Stats -->
|
|
12456
12457
|
<div class="mb-6">
|
|
@@ -12627,10 +12628,10 @@ function renderUsersListPage(data) {
|
|
|
12627
12628
|
</div>
|
|
12628
12629
|
|
|
12629
12630
|
<!-- Users Table -->
|
|
12630
|
-
${
|
|
12631
|
+
${chunkOHYBNCVL_cjs.renderTable(tableData)}
|
|
12631
12632
|
|
|
12632
12633
|
<!-- Pagination -->
|
|
12633
|
-
${data.pagination ?
|
|
12634
|
+
${data.pagination ? chunkOHYBNCVL_cjs.renderPagination(data.pagination) : ""}
|
|
12634
12635
|
</div>
|
|
12635
12636
|
|
|
12636
12637
|
<script>
|
|
@@ -12701,19 +12702,19 @@ function renderUsersListPage(data) {
|
|
|
12701
12702
|
version: data.version,
|
|
12702
12703
|
content: pageContent
|
|
12703
12704
|
};
|
|
12704
|
-
return
|
|
12705
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12705
12706
|
}
|
|
12706
12707
|
|
|
12707
12708
|
// src/routes/admin-users.ts
|
|
12708
12709
|
var userRoutes = new hono.Hono();
|
|
12709
|
-
userRoutes.use("*",
|
|
12710
|
-
userRoutes.use("/users/*",
|
|
12711
|
-
userRoutes.use("/users",
|
|
12712
|
-
userRoutes.use("/invite-user",
|
|
12713
|
-
userRoutes.use("/resend-invitation/*",
|
|
12714
|
-
userRoutes.use("/cancel-invitation/*",
|
|
12715
|
-
userRoutes.use("/activity-logs",
|
|
12716
|
-
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"]));
|
|
12717
12718
|
userRoutes.get("/", (c) => {
|
|
12718
12719
|
return c.redirect("/admin/dashboard");
|
|
12719
12720
|
});
|
|
@@ -12883,7 +12884,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
12883
12884
|
}
|
|
12884
12885
|
await saveCustomData(db, user.userId, sanitized);
|
|
12885
12886
|
}
|
|
12886
|
-
await
|
|
12887
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
12887
12888
|
db,
|
|
12888
12889
|
user.userId,
|
|
12889
12890
|
"profile.update",
|
|
@@ -12946,7 +12947,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
12946
12947
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
12947
12948
|
`);
|
|
12948
12949
|
const userData = await userStmt.bind(user.userId).first();
|
|
12949
|
-
await
|
|
12950
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
12950
12951
|
db,
|
|
12951
12952
|
user.userId,
|
|
12952
12953
|
"profile.avatar_update",
|
|
@@ -13017,7 +13018,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13017
13018
|
dismissible: true
|
|
13018
13019
|
}));
|
|
13019
13020
|
}
|
|
13020
|
-
const validPassword = await
|
|
13021
|
+
const validPassword = await chunkUFPT5KCQ_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
13021
13022
|
if (!validPassword) {
|
|
13022
13023
|
return c.html(renderAlert2({
|
|
13023
13024
|
type: "error",
|
|
@@ -13025,7 +13026,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13025
13026
|
dismissible: true
|
|
13026
13027
|
}));
|
|
13027
13028
|
}
|
|
13028
|
-
const newPasswordHash = await
|
|
13029
|
+
const newPasswordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(newPassword);
|
|
13029
13030
|
const historyStmt = db.prepare(`
|
|
13030
13031
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
13031
13032
|
VALUES (?, ?, ?, ?)
|
|
@@ -13041,7 +13042,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
13041
13042
|
WHERE id = ?
|
|
13042
13043
|
`);
|
|
13043
13044
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
13044
|
-
await
|
|
13045
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13045
13046
|
db,
|
|
13046
13047
|
user.userId,
|
|
13047
13048
|
"profile.password_change",
|
|
@@ -13108,7 +13109,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
13108
13109
|
`);
|
|
13109
13110
|
const countResult = await countStmt.bind(...params).first();
|
|
13110
13111
|
const totalUsers = countResult?.total || 0;
|
|
13111
|
-
await
|
|
13112
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13112
13113
|
db,
|
|
13113
13114
|
user.userId,
|
|
13114
13115
|
"users.list_view",
|
|
@@ -13266,7 +13267,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13266
13267
|
dismissible: true
|
|
13267
13268
|
}));
|
|
13268
13269
|
}
|
|
13269
|
-
const passwordHash = await
|
|
13270
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(password);
|
|
13270
13271
|
const userId = crypto.randomUUID();
|
|
13271
13272
|
const createStmt = db.prepare(`
|
|
13272
13273
|
INSERT INTO users (
|
|
@@ -13289,7 +13290,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
13289
13290
|
Date.now(),
|
|
13290
13291
|
Date.now()
|
|
13291
13292
|
).run();
|
|
13292
|
-
await
|
|
13293
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13293
13294
|
db,
|
|
13294
13295
|
user.userId,
|
|
13295
13296
|
"user!.create",
|
|
@@ -13328,7 +13329,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
13328
13329
|
if (!userRecord) {
|
|
13329
13330
|
return c.json({ error: "User not found" }, 404);
|
|
13330
13331
|
}
|
|
13331
|
-
await
|
|
13332
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13332
13333
|
db,
|
|
13333
13334
|
user.userId,
|
|
13334
13335
|
"user!.view",
|
|
@@ -13554,7 +13555,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13554
13555
|
userId
|
|
13555
13556
|
).run();
|
|
13556
13557
|
if (newPassword) {
|
|
13557
|
-
const passwordHash = await
|
|
13558
|
+
const passwordHash = await chunkUFPT5KCQ_cjs.AuthManager.hashPassword(newPassword);
|
|
13558
13559
|
const updatePasswordStmt = db.prepare(`
|
|
13559
13560
|
UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?
|
|
13560
13561
|
`);
|
|
@@ -13608,7 +13609,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
13608
13609
|
).run();
|
|
13609
13610
|
}
|
|
13610
13611
|
}
|
|
13611
|
-
await
|
|
13612
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13612
13613
|
db,
|
|
13613
13614
|
user.userId,
|
|
13614
13615
|
"user.update",
|
|
@@ -13653,7 +13654,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
|
|
|
13653
13654
|
UPDATE users SET is_active = ?, updated_at = ? WHERE id = ?
|
|
13654
13655
|
`);
|
|
13655
13656
|
await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
|
|
13656
|
-
await
|
|
13657
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13657
13658
|
db,
|
|
13658
13659
|
user.userId,
|
|
13659
13660
|
active ? "user.activate" : "user.deactivate",
|
|
@@ -13694,7 +13695,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13694
13695
|
DELETE FROM users WHERE id = ?
|
|
13695
13696
|
`);
|
|
13696
13697
|
await deleteStmt.bind(userId).run();
|
|
13697
|
-
await
|
|
13698
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13698
13699
|
db,
|
|
13699
13700
|
user.userId,
|
|
13700
13701
|
"user!.hard_delete",
|
|
@@ -13713,7 +13714,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
13713
13714
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
13714
13715
|
`);
|
|
13715
13716
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
13716
|
-
await
|
|
13717
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13717
13718
|
db,
|
|
13718
13719
|
user.userId,
|
|
13719
13720
|
"user!.soft_delete",
|
|
@@ -13779,7 +13780,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
13779
13780
|
Date.now(),
|
|
13780
13781
|
Date.now()
|
|
13781
13782
|
).run();
|
|
13782
|
-
await
|
|
13783
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13783
13784
|
db,
|
|
13784
13785
|
user.userId,
|
|
13785
13786
|
"user!.invite_sent",
|
|
@@ -13836,7 +13837,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
13836
13837
|
Date.now(),
|
|
13837
13838
|
userId
|
|
13838
13839
|
).run();
|
|
13839
|
-
await
|
|
13840
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13840
13841
|
db,
|
|
13841
13842
|
user.userId,
|
|
13842
13843
|
"user!.invitation_resent",
|
|
@@ -13872,7 +13873,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
13872
13873
|
}
|
|
13873
13874
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
13874
13875
|
await deleteStmt.bind(userId).run();
|
|
13875
|
-
await
|
|
13876
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13876
13877
|
db,
|
|
13877
13878
|
user.userId,
|
|
13878
13879
|
"user!.invitation_cancelled",
|
|
@@ -13955,7 +13956,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
13955
13956
|
...log,
|
|
13956
13957
|
details: log.details ? JSON.parse(log.details) : null
|
|
13957
13958
|
}));
|
|
13958
|
-
await
|
|
13959
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
13959
13960
|
db,
|
|
13960
13961
|
user.userId,
|
|
13961
13962
|
"activity.logs_viewed",
|
|
@@ -14062,7 +14063,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
14062
14063
|
csvRows.push(row.join(","));
|
|
14063
14064
|
}
|
|
14064
14065
|
const csvContent = csvRows.join("\n");
|
|
14065
|
-
await
|
|
14066
|
+
await chunkUFPT5KCQ_cjs.logActivity(
|
|
14066
14067
|
db,
|
|
14067
14068
|
user.userId,
|
|
14068
14069
|
"activity.logs_exported",
|
|
@@ -14280,7 +14281,7 @@ function getFileIcon(mimeType) {
|
|
|
14280
14281
|
}
|
|
14281
14282
|
|
|
14282
14283
|
// src/templates/pages/admin-media-library.template.ts
|
|
14283
|
-
|
|
14284
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
14284
14285
|
function renderMediaLibraryPage(data) {
|
|
14285
14286
|
const pageContent = `
|
|
14286
14287
|
<div>
|
|
@@ -15215,7 +15216,7 @@ function renderMediaLibraryPage(data) {
|
|
|
15215
15216
|
version: data.version,
|
|
15216
15217
|
content: pageContent
|
|
15217
15218
|
};
|
|
15218
|
-
return
|
|
15219
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
15219
15220
|
}
|
|
15220
15221
|
|
|
15221
15222
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -15401,7 +15402,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
15401
15402
|
// 50MB max
|
|
15402
15403
|
});
|
|
15403
15404
|
var adminMediaRoutes = new hono.Hono();
|
|
15404
|
-
adminMediaRoutes.use("*",
|
|
15405
|
+
adminMediaRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
15405
15406
|
adminMediaRoutes.get("/", async (c) => {
|
|
15406
15407
|
try {
|
|
15407
15408
|
const user = c.get("user");
|
|
@@ -15987,7 +15988,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
15987
15988
|
`);
|
|
15988
15989
|
}
|
|
15989
15990
|
});
|
|
15990
|
-
adminMediaRoutes.delete("/cleanup",
|
|
15991
|
+
adminMediaRoutes.delete("/cleanup", chunkUFPT5KCQ_cjs.requireRole("admin"), async (c) => {
|
|
15991
15992
|
try {
|
|
15992
15993
|
const db = c.env.DB;
|
|
15993
15994
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -16237,7 +16238,7 @@ function formatFileSize(bytes) {
|
|
|
16237
16238
|
}
|
|
16238
16239
|
|
|
16239
16240
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
16240
|
-
|
|
16241
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
16241
16242
|
function renderPluginsListPage(data) {
|
|
16242
16243
|
const categories = [
|
|
16243
16244
|
{ value: "content", label: "Content Management" },
|
|
@@ -16707,7 +16708,7 @@ function renderPluginsListPage(data) {
|
|
|
16707
16708
|
version: data.version,
|
|
16708
16709
|
content: pageContent
|
|
16709
16710
|
};
|
|
16710
|
-
return
|
|
16711
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
16711
16712
|
}
|
|
16712
16713
|
function renderPluginCard(plugin) {
|
|
16713
16714
|
const statusColors = {
|
|
@@ -17344,7 +17345,7 @@ function renderPluginSettingsPage(data) {
|
|
|
17344
17345
|
user,
|
|
17345
17346
|
content: pageContent
|
|
17346
17347
|
};
|
|
17347
|
-
return
|
|
17348
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
17348
17349
|
}
|
|
17349
17350
|
function renderStatusBadge(status) {
|
|
17350
17351
|
const statusColors = {
|
|
@@ -18212,152 +18213,20 @@ function renderEmailSettingsContent(plugin, settings) {
|
|
|
18212
18213
|
|
|
18213
18214
|
// src/routes/admin-plugins.ts
|
|
18214
18215
|
var adminPluginRoutes = new hono.Hono();
|
|
18215
|
-
adminPluginRoutes.use("*",
|
|
18216
|
-
var AVAILABLE_PLUGINS =
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
},
|
|
18230
|
-
{
|
|
18231
|
-
id: "demo-login-prefill",
|
|
18232
|
-
name: "demo-login-plugin",
|
|
18233
|
-
display_name: "Demo Login Prefill",
|
|
18234
|
-
description: "Prefills login form with demo credentials (admin@sonicjs.com/sonicjs!) for easy site demonstration",
|
|
18235
|
-
version: "1.0.0-beta.1",
|
|
18236
|
-
author: "SonicJS",
|
|
18237
|
-
category: "demo",
|
|
18238
|
-
icon: "\xF0\x9F\x8E\xAF",
|
|
18239
|
-
permissions: [],
|
|
18240
|
-
dependencies: [],
|
|
18241
|
-
is_core: false
|
|
18242
|
-
},
|
|
18243
|
-
{
|
|
18244
|
-
id: "database-tools",
|
|
18245
|
-
name: "database-tools",
|
|
18246
|
-
display_name: "Database Tools",
|
|
18247
|
-
description: "Database management tools including truncate, backup, and validation",
|
|
18248
|
-
version: "1.0.0-beta.1",
|
|
18249
|
-
author: "SonicJS Team",
|
|
18250
|
-
category: "system",
|
|
18251
|
-
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18252
|
-
permissions: ["manage:database", "admin"],
|
|
18253
|
-
dependencies: [],
|
|
18254
|
-
is_core: false
|
|
18255
|
-
},
|
|
18256
|
-
{
|
|
18257
|
-
id: "seed-data",
|
|
18258
|
-
name: "seed-data",
|
|
18259
|
-
display_name: "Seed Data",
|
|
18260
|
-
description: "Generate realistic example users and content for testing and development",
|
|
18261
|
-
version: "1.0.0-beta.1",
|
|
18262
|
-
author: "SonicJS Team",
|
|
18263
|
-
category: "development",
|
|
18264
|
-
icon: "\xF0\x9F\x8C\xB1",
|
|
18265
|
-
permissions: ["admin"],
|
|
18266
|
-
dependencies: [],
|
|
18267
|
-
is_core: false
|
|
18268
|
-
},
|
|
18269
|
-
{
|
|
18270
|
-
id: "quill-editor",
|
|
18271
|
-
name: "quill-editor",
|
|
18272
|
-
display_name: "Quill Rich Text Editor",
|
|
18273
|
-
description: "Quill WYSIWYG editor integration for rich text editing. Lightweight, modern editor with customizable toolbars and dark mode support.",
|
|
18274
|
-
version: "1.0.0",
|
|
18275
|
-
author: "SonicJS Team",
|
|
18276
|
-
category: "editor",
|
|
18277
|
-
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18278
|
-
permissions: [],
|
|
18279
|
-
dependencies: [],
|
|
18280
|
-
is_core: true
|
|
18281
|
-
},
|
|
18282
|
-
{
|
|
18283
|
-
id: "tinymce-plugin",
|
|
18284
|
-
name: "tinymce-plugin",
|
|
18285
|
-
display_name: "TinyMCE Rich Text Editor",
|
|
18286
|
-
description: "Powerful WYSIWYG rich text editor for content creation. Provides a full-featured editor with formatting, media embedding, and customizable toolbars for richtext fields.",
|
|
18287
|
-
version: "1.0.0",
|
|
18288
|
-
author: "SonicJS Team",
|
|
18289
|
-
category: "editor",
|
|
18290
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18291
|
-
permissions: [],
|
|
18292
|
-
dependencies: [],
|
|
18293
|
-
is_core: false
|
|
18294
|
-
},
|
|
18295
|
-
{
|
|
18296
|
-
id: "easy-mdx",
|
|
18297
|
-
name: "easy-mdx",
|
|
18298
|
-
display_name: "EasyMDE Markdown Editor",
|
|
18299
|
-
description: "Lightweight markdown editor with live preview. Provides a simple and efficient editor with markdown support for richtext fields.",
|
|
18300
|
-
version: "1.0.0",
|
|
18301
|
-
author: "SonicJS Team",
|
|
18302
|
-
category: "editor",
|
|
18303
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18304
|
-
permissions: [],
|
|
18305
|
-
dependencies: [],
|
|
18306
|
-
is_core: false
|
|
18307
|
-
},
|
|
18308
|
-
{
|
|
18309
|
-
id: "turnstile",
|
|
18310
|
-
name: "turnstile-plugin",
|
|
18311
|
-
display_name: "Cloudflare Turnstile",
|
|
18312
|
-
description: "CAPTCHA-free bot protection for forms using Cloudflare Turnstile. Provides seamless spam prevention with configurable modes, themes, and pre-clearance options.",
|
|
18313
|
-
version: "1.0.0",
|
|
18314
|
-
author: "SonicJS Team",
|
|
18315
|
-
category: "security",
|
|
18316
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18317
|
-
permissions: [],
|
|
18318
|
-
dependencies: [],
|
|
18319
|
-
is_core: true
|
|
18320
|
-
},
|
|
18321
|
-
{
|
|
18322
|
-
id: "security-audit",
|
|
18323
|
-
name: "security-audit",
|
|
18324
|
-
display_name: "Security Audit",
|
|
18325
|
-
description: "Security event logging, brute-force detection, and analytics dashboard. Monitors login attempts, registrations, lockouts, and suspicious activity.",
|
|
18326
|
-
version: "1.0.0-beta.1",
|
|
18327
|
-
author: "SonicJS Team",
|
|
18328
|
-
category: "security",
|
|
18329
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18330
|
-
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18331
|
-
dependencies: [],
|
|
18332
|
-
is_core: false
|
|
18333
|
-
},
|
|
18334
|
-
{
|
|
18335
|
-
id: "ai-search",
|
|
18336
|
-
name: "ai-search-plugin",
|
|
18337
|
-
display_name: "AI Search",
|
|
18338
|
-
description: "Advanced search with Cloudflare AI Search. Full-text search, semantic search, and advanced filtering across all content collections.",
|
|
18339
|
-
version: "1.0.0",
|
|
18340
|
-
author: "SonicJS Team",
|
|
18341
|
-
category: "search",
|
|
18342
|
-
icon: "\xF0\x9F\x94\x8D",
|
|
18343
|
-
permissions: [],
|
|
18344
|
-
dependencies: [],
|
|
18345
|
-
is_core: true
|
|
18346
|
-
},
|
|
18347
|
-
{
|
|
18348
|
-
id: "form-builder",
|
|
18349
|
-
name: "form-builder",
|
|
18350
|
-
display_name: "Form Builder",
|
|
18351
|
-
description: "Drag-and-drop form builder with conditional logic, file uploads, and email notifications. Create contact forms, surveys, and data collection forms.",
|
|
18352
|
-
version: "1.0.0",
|
|
18353
|
-
author: "SonicJS Team",
|
|
18354
|
-
category: "content",
|
|
18355
|
-
icon: "\u{1F4DD}",
|
|
18356
|
-
permissions: ["forms:create", "forms:manage", "forms:submissions"],
|
|
18357
|
-
dependencies: [],
|
|
18358
|
-
is_core: false
|
|
18359
|
-
}
|
|
18360
|
-
];
|
|
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
|
+
}));
|
|
18361
18230
|
adminPluginRoutes.get("/", async (c) => {
|
|
18362
18231
|
try {
|
|
18363
18232
|
const user = c.get("user");
|
|
@@ -18365,7 +18234,7 @@ adminPluginRoutes.get("/", async (c) => {
|
|
|
18365
18234
|
if (user?.role !== "admin") {
|
|
18366
18235
|
return c.text("Access denied", 403);
|
|
18367
18236
|
}
|
|
18368
|
-
const pluginService = new
|
|
18237
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18369
18238
|
let installedPlugins = [];
|
|
18370
18239
|
let stats = { total: 0, active: 0, inactive: 0, errors: 0, uninstalled: 0 };
|
|
18371
18240
|
try {
|
|
@@ -18434,14 +18303,10 @@ adminPluginRoutes.get("/:id", async (c) => {
|
|
|
18434
18303
|
const user = c.get("user");
|
|
18435
18304
|
const db = c.env.DB;
|
|
18436
18305
|
const pluginId = c.req.param("id");
|
|
18437
|
-
const pluginsWithCustomPages = ["ai-search", "security-audit"];
|
|
18438
|
-
if (pluginsWithCustomPages.includes(pluginId)) {
|
|
18439
|
-
return c.text("", 404);
|
|
18440
|
-
}
|
|
18441
18306
|
if (user?.role !== "admin") {
|
|
18442
18307
|
return c.redirect("/admin/plugins");
|
|
18443
18308
|
}
|
|
18444
|
-
const pluginService = new
|
|
18309
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18445
18310
|
const plugin = await pluginService.getPlugin(pluginId);
|
|
18446
18311
|
if (!plugin) {
|
|
18447
18312
|
return c.text("Plugin not found", 404);
|
|
@@ -18517,7 +18382,7 @@ adminPluginRoutes.post("/:id/activate", async (c) => {
|
|
|
18517
18382
|
if (user?.role !== "admin") {
|
|
18518
18383
|
return c.json({ error: "Access denied" }, 403);
|
|
18519
18384
|
}
|
|
18520
|
-
const pluginService = new
|
|
18385
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18521
18386
|
await pluginService.activatePlugin(pluginId);
|
|
18522
18387
|
return c.json({ success: true });
|
|
18523
18388
|
} catch (error) {
|
|
@@ -18534,7 +18399,7 @@ adminPluginRoutes.post("/:id/deactivate", async (c) => {
|
|
|
18534
18399
|
if (user?.role !== "admin") {
|
|
18535
18400
|
return c.json({ error: "Access denied" }, 403);
|
|
18536
18401
|
}
|
|
18537
|
-
const pluginService = new
|
|
18402
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18538
18403
|
await pluginService.deactivatePlugin(pluginId);
|
|
18539
18404
|
return c.json({ success: true });
|
|
18540
18405
|
} catch (error) {
|
|
@@ -18551,321 +18416,26 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
18551
18416
|
return c.json({ error: "Access denied" }, 403);
|
|
18552
18417
|
}
|
|
18553
18418
|
const body = await c.req.json();
|
|
18554
|
-
const pluginService = new
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
|
|
18574
|
-
}
|
|
18575
|
-
if (body.name === "demo-login-plugin") {
|
|
18576
|
-
const demoPlugin = await pluginService.installPlugin({
|
|
18577
|
-
id: "demo-login-prefill",
|
|
18578
|
-
name: "demo-login-plugin",
|
|
18579
|
-
display_name: "Demo Login Prefill",
|
|
18580
|
-
description: "Prefills login form with demo credentials (admin@sonicjs.com/sonicjs!) for easy site demonstration",
|
|
18581
|
-
version: "1.0.0-beta.1",
|
|
18582
|
-
author: "SonicJS",
|
|
18583
|
-
category: "demo",
|
|
18584
|
-
icon: "\xF0\x9F\x8E\xAF",
|
|
18585
|
-
permissions: [],
|
|
18586
|
-
dependencies: [],
|
|
18587
|
-
settings: {
|
|
18588
|
-
enableNotice: true,
|
|
18589
|
-
demoEmail: "admin@sonicjs.com",
|
|
18590
|
-
demoPassword: "sonicjs!"
|
|
18591
|
-
}
|
|
18592
|
-
});
|
|
18593
|
-
return c.json({ success: true, plugin: demoPlugin });
|
|
18594
|
-
}
|
|
18595
|
-
if (body.name === "core-auth") {
|
|
18596
|
-
const authPlugin = await pluginService.installPlugin({
|
|
18597
|
-
id: "core-auth",
|
|
18598
|
-
name: "core-auth",
|
|
18599
|
-
display_name: "Authentication System",
|
|
18600
|
-
description: "Core authentication and user management system",
|
|
18601
|
-
version: "1.0.0-beta.1",
|
|
18602
|
-
author: "SonicJS Team",
|
|
18603
|
-
category: "security",
|
|
18604
|
-
icon: "\xF0\x9F\x94\x90",
|
|
18605
|
-
permissions: ["manage:users", "manage:roles", "manage:permissions"],
|
|
18606
|
-
dependencies: [],
|
|
18607
|
-
is_core: true,
|
|
18608
|
-
settings: {}
|
|
18609
|
-
});
|
|
18610
|
-
return c.json({ success: true, plugin: authPlugin });
|
|
18611
|
-
}
|
|
18612
|
-
if (body.name === "core-media") {
|
|
18613
|
-
const mediaPlugin = await pluginService.installPlugin({
|
|
18614
|
-
id: "core-media",
|
|
18615
|
-
name: "core-media",
|
|
18616
|
-
display_name: "Media Manager",
|
|
18617
|
-
description: "Core media upload and management system",
|
|
18618
|
-
version: "1.0.0-beta.1",
|
|
18619
|
-
author: "SonicJS Team",
|
|
18620
|
-
category: "media",
|
|
18621
|
-
icon: "\xF0\x9F\x93\xB8",
|
|
18622
|
-
permissions: ["manage:media", "upload:files"],
|
|
18623
|
-
dependencies: [],
|
|
18624
|
-
is_core: true,
|
|
18625
|
-
settings: {}
|
|
18626
|
-
});
|
|
18627
|
-
return c.json({ success: true, plugin: mediaPlugin });
|
|
18628
|
-
}
|
|
18629
|
-
if (body.name === "core-workflow") {
|
|
18630
|
-
const workflowPlugin = await pluginService.installPlugin({
|
|
18631
|
-
id: "core-workflow",
|
|
18632
|
-
name: "core-workflow",
|
|
18633
|
-
display_name: "Workflow Engine",
|
|
18634
|
-
description: "Content workflow and approval system",
|
|
18635
|
-
version: "1.0.0-beta.1",
|
|
18636
|
-
author: "SonicJS Team",
|
|
18637
|
-
category: "content",
|
|
18638
|
-
icon: "\xF0\x9F\x94\x84",
|
|
18639
|
-
permissions: ["manage:workflows", "approve:content"],
|
|
18640
|
-
dependencies: [],
|
|
18641
|
-
is_core: true,
|
|
18642
|
-
settings: {}
|
|
18643
|
-
});
|
|
18644
|
-
return c.json({ success: true, plugin: workflowPlugin });
|
|
18645
|
-
}
|
|
18646
|
-
if (body.name === "database-tools") {
|
|
18647
|
-
const databaseToolsPlugin = await pluginService.installPlugin({
|
|
18648
|
-
id: "database-tools",
|
|
18649
|
-
name: "database-tools",
|
|
18650
|
-
display_name: "Database Tools",
|
|
18651
|
-
description: "Database management tools including truncate, backup, and validation",
|
|
18652
|
-
version: "1.0.0-beta.1",
|
|
18653
|
-
author: "SonicJS Team",
|
|
18654
|
-
category: "system",
|
|
18655
|
-
icon: "\xF0\x9F\x97\x84\xEF\xB8\x8F",
|
|
18656
|
-
permissions: ["manage:database", "admin"],
|
|
18657
|
-
dependencies: [],
|
|
18658
|
-
is_core: false,
|
|
18659
|
-
settings: {
|
|
18660
|
-
enableTruncate: true,
|
|
18661
|
-
enableBackup: true,
|
|
18662
|
-
enableValidation: true,
|
|
18663
|
-
requireConfirmation: true
|
|
18664
|
-
}
|
|
18665
|
-
});
|
|
18666
|
-
return c.json({ success: true, plugin: databaseToolsPlugin });
|
|
18667
|
-
}
|
|
18668
|
-
if (body.name === "seed-data") {
|
|
18669
|
-
const seedDataPlugin = await pluginService.installPlugin({
|
|
18670
|
-
id: "seed-data",
|
|
18671
|
-
name: "seed-data",
|
|
18672
|
-
display_name: "Seed Data",
|
|
18673
|
-
description: "Generate realistic example users and content for testing and development",
|
|
18674
|
-
version: "1.0.0-beta.1",
|
|
18675
|
-
author: "SonicJS Team",
|
|
18676
|
-
category: "development",
|
|
18677
|
-
icon: "\xF0\x9F\x8C\xB1",
|
|
18678
|
-
permissions: ["admin"],
|
|
18679
|
-
dependencies: [],
|
|
18680
|
-
is_core: false,
|
|
18681
|
-
settings: {
|
|
18682
|
-
userCount: 20,
|
|
18683
|
-
contentCount: 200,
|
|
18684
|
-
defaultPassword: "password123"
|
|
18685
|
-
}
|
|
18686
|
-
});
|
|
18687
|
-
return c.json({ success: true, plugin: seedDataPlugin });
|
|
18688
|
-
}
|
|
18689
|
-
if (body.name === "quill-editor") {
|
|
18690
|
-
const quillPlugin = await pluginService.installPlugin({
|
|
18691
|
-
id: "quill-editor",
|
|
18692
|
-
name: "quill-editor",
|
|
18693
|
-
display_name: "Quill Rich Text Editor",
|
|
18694
|
-
description: "Quill WYSIWYG editor integration for rich text editing. Lightweight, modern editor with customizable toolbars and dark mode support.",
|
|
18695
|
-
version: "1.0.0",
|
|
18696
|
-
author: "SonicJS Team",
|
|
18697
|
-
category: "editor",
|
|
18698
|
-
icon: "\xE2\x9C\x8D\xEF\xB8\x8F",
|
|
18699
|
-
permissions: [],
|
|
18700
|
-
dependencies: [],
|
|
18701
|
-
is_core: true,
|
|
18702
|
-
settings: {
|
|
18703
|
-
version: "2.0.2",
|
|
18704
|
-
defaultHeight: 300,
|
|
18705
|
-
defaultToolbar: "full",
|
|
18706
|
-
theme: "snow"
|
|
18707
|
-
}
|
|
18708
|
-
});
|
|
18709
|
-
return c.json({ success: true, plugin: quillPlugin });
|
|
18710
|
-
}
|
|
18711
|
-
if (body.name === "tinymce-plugin") {
|
|
18712
|
-
const tinymcePlugin2 = await pluginService.installPlugin({
|
|
18713
|
-
id: "tinymce-plugin",
|
|
18714
|
-
name: "tinymce-plugin",
|
|
18715
|
-
display_name: "TinyMCE Rich Text Editor",
|
|
18716
|
-
description: "Powerful WYSIWYG rich text editor for content creation. Provides a full-featured editor with formatting, media embedding, and customizable toolbars for richtext fields.",
|
|
18717
|
-
version: "1.0.0",
|
|
18718
|
-
author: "SonicJS Team",
|
|
18719
|
-
category: "editor",
|
|
18720
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18721
|
-
permissions: [],
|
|
18722
|
-
dependencies: [],
|
|
18723
|
-
is_core: false,
|
|
18724
|
-
settings: {
|
|
18725
|
-
apiKey: "no-api-key",
|
|
18726
|
-
defaultHeight: 300,
|
|
18727
|
-
defaultToolbar: "full",
|
|
18728
|
-
skin: "oxide-dark"
|
|
18729
|
-
}
|
|
18730
|
-
});
|
|
18731
|
-
return c.json({ success: true, plugin: tinymcePlugin2 });
|
|
18732
|
-
}
|
|
18733
|
-
if (body.name === "easy-mdx") {
|
|
18734
|
-
const easyMdxPlugin2 = await pluginService.installPlugin({
|
|
18735
|
-
id: "easy-mdx",
|
|
18736
|
-
name: "easy-mdx",
|
|
18737
|
-
display_name: "EasyMDE Markdown Editor",
|
|
18738
|
-
description: "Lightweight markdown editor with live preview. Provides a simple and efficient editor with markdown support for richtext fields.",
|
|
18739
|
-
version: "1.0.0",
|
|
18740
|
-
author: "SonicJS Team",
|
|
18741
|
-
category: "editor",
|
|
18742
|
-
icon: "\xF0\x9F\x93\x9D",
|
|
18743
|
-
permissions: [],
|
|
18744
|
-
dependencies: [],
|
|
18745
|
-
is_core: false,
|
|
18746
|
-
settings: {
|
|
18747
|
-
defaultHeight: 400,
|
|
18748
|
-
theme: "dark",
|
|
18749
|
-
toolbar: "full",
|
|
18750
|
-
placeholder: "Start writing your content..."
|
|
18751
|
-
}
|
|
18752
|
-
});
|
|
18753
|
-
return c.json({ success: true, plugin: easyMdxPlugin2 });
|
|
18754
|
-
}
|
|
18755
|
-
if (body.name === "security-audit") {
|
|
18756
|
-
const securityAuditPlugin = await pluginService.installPlugin({
|
|
18757
|
-
id: "security-audit",
|
|
18758
|
-
name: "security-audit",
|
|
18759
|
-
display_name: "Security Audit",
|
|
18760
|
-
description: "Security event logging, brute-force detection, and analytics dashboard. Monitors login attempts, registrations, lockouts, and suspicious activity.",
|
|
18761
|
-
version: "1.0.0-beta.1",
|
|
18762
|
-
author: "SonicJS Team",
|
|
18763
|
-
category: "security",
|
|
18764
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18765
|
-
permissions: ["security-audit:view", "security-audit:manage"],
|
|
18766
|
-
dependencies: [],
|
|
18767
|
-
is_core: false,
|
|
18768
|
-
settings: {
|
|
18769
|
-
retention: {
|
|
18770
|
-
daysToKeep: 90,
|
|
18771
|
-
maxEvents: 1e5,
|
|
18772
|
-
autoPurge: true
|
|
18773
|
-
},
|
|
18774
|
-
bruteForce: {
|
|
18775
|
-
enabled: true,
|
|
18776
|
-
maxFailedAttemptsPerIP: 10,
|
|
18777
|
-
maxFailedAttemptsPerEmail: 5,
|
|
18778
|
-
windowMinutes: 15,
|
|
18779
|
-
lockoutDurationMinutes: 30,
|
|
18780
|
-
alertThreshold: 20
|
|
18781
|
-
},
|
|
18782
|
-
logging: {
|
|
18783
|
-
logSuccessfulLogins: true,
|
|
18784
|
-
logLogouts: true,
|
|
18785
|
-
logRegistrations: true,
|
|
18786
|
-
logPasswordResets: true,
|
|
18787
|
-
logPermissionDenied: true
|
|
18788
|
-
}
|
|
18789
|
-
}
|
|
18790
|
-
});
|
|
18791
|
-
return c.json({ success: true, plugin: securityAuditPlugin });
|
|
18792
|
-
}
|
|
18793
|
-
if (body.name === "ai-search-plugin" || body.name === "ai-search") {
|
|
18794
|
-
const defaultSettings = {
|
|
18795
|
-
enabled: true,
|
|
18796
|
-
ai_mode_enabled: true,
|
|
18797
|
-
selected_collections: [],
|
|
18798
|
-
dismissed_collections: [],
|
|
18799
|
-
autocomplete_enabled: true,
|
|
18800
|
-
cache_duration: 1,
|
|
18801
|
-
results_limit: 20,
|
|
18802
|
-
index_media: false
|
|
18803
|
-
};
|
|
18804
|
-
const aiSearchPlugin = await pluginService.installPlugin({
|
|
18805
|
-
id: "ai-search",
|
|
18806
|
-
name: "ai-search-plugin",
|
|
18807
|
-
display_name: "AI Search",
|
|
18808
|
-
description: "Advanced search with Cloudflare AI Search. Full-text search, semantic search, and advanced filtering across all content collections.",
|
|
18809
|
-
version: "1.0.0",
|
|
18810
|
-
author: "SonicJS Team",
|
|
18811
|
-
category: "search",
|
|
18812
|
-
icon: "\xF0\x9F\x94\x8D",
|
|
18813
|
-
permissions: [],
|
|
18814
|
-
dependencies: [],
|
|
18815
|
-
is_core: true,
|
|
18816
|
-
settings: defaultSettings
|
|
18817
|
-
});
|
|
18818
|
-
return c.json({ success: true, plugin: aiSearchPlugin });
|
|
18819
|
-
}
|
|
18820
|
-
if (body.name === "turnstile-plugin") {
|
|
18821
|
-
const turnstilePlugin = await pluginService.installPlugin({
|
|
18822
|
-
id: "turnstile",
|
|
18823
|
-
name: "turnstile-plugin",
|
|
18824
|
-
display_name: "Cloudflare Turnstile",
|
|
18825
|
-
description: "CAPTCHA-free bot protection for forms using Cloudflare Turnstile. Provides seamless spam prevention with configurable modes, themes, and pre-clearance options.",
|
|
18826
|
-
version: "1.0.0",
|
|
18827
|
-
author: "SonicJS Team",
|
|
18828
|
-
category: "security",
|
|
18829
|
-
icon: "\xF0\x9F\x9B\xA1\xEF\xB8\x8F",
|
|
18830
|
-
permissions: [],
|
|
18831
|
-
dependencies: [],
|
|
18832
|
-
is_core: true,
|
|
18833
|
-
settings: {
|
|
18834
|
-
siteKey: "",
|
|
18835
|
-
secretKey: "",
|
|
18836
|
-
theme: "auto",
|
|
18837
|
-
size: "normal",
|
|
18838
|
-
mode: "managed",
|
|
18839
|
-
appearance: "always",
|
|
18840
|
-
preClearanceEnabled: false,
|
|
18841
|
-
preClearanceLevel: "managed",
|
|
18842
|
-
enabled: false
|
|
18843
|
-
}
|
|
18844
|
-
});
|
|
18845
|
-
return c.json({ success: true, plugin: turnstilePlugin });
|
|
18846
|
-
}
|
|
18847
|
-
if (body.name === "form-builder") {
|
|
18848
|
-
const formBuilderPlugin = await pluginService.installPlugin({
|
|
18849
|
-
id: "form-builder",
|
|
18850
|
-
name: "form-builder",
|
|
18851
|
-
display_name: "Form Builder",
|
|
18852
|
-
description: "Drag-and-drop form builder with conditional logic, file uploads, and email notifications. Create contact forms, surveys, and data collection forms.",
|
|
18853
|
-
version: "1.0.0",
|
|
18854
|
-
author: "SonicJS Team",
|
|
18855
|
-
category: "content",
|
|
18856
|
-
icon: "\u{1F4DD}",
|
|
18857
|
-
permissions: ["forms:create", "forms:manage", "forms:submissions"],
|
|
18858
|
-
dependencies: [],
|
|
18859
|
-
settings: {
|
|
18860
|
-
enableNotifications: true,
|
|
18861
|
-
enableFileUploads: true,
|
|
18862
|
-
maxSubmissionsPerForm: 0,
|
|
18863
|
-
submissionRetentionDays: 90
|
|
18864
|
-
}
|
|
18865
|
-
});
|
|
18866
|
-
return c.json({ success: true, plugin: formBuilderPlugin });
|
|
18867
|
-
}
|
|
18868
|
-
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 });
|
|
18869
18439
|
} catch (error) {
|
|
18870
18440
|
console.error("Error installing plugin:", error);
|
|
18871
18441
|
const message = error instanceof Error ? error.message : "Failed to install plugin";
|
|
@@ -18880,7 +18450,7 @@ adminPluginRoutes.post("/:id/uninstall", async (c) => {
|
|
|
18880
18450
|
if (user?.role !== "admin") {
|
|
18881
18451
|
return c.json({ error: "Access denied" }, 403);
|
|
18882
18452
|
}
|
|
18883
|
-
const pluginService = new
|
|
18453
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18884
18454
|
await pluginService.uninstallPlugin(pluginId);
|
|
18885
18455
|
return c.json({ success: true });
|
|
18886
18456
|
} catch (error) {
|
|
@@ -18898,7 +18468,7 @@ adminPluginRoutes.post("/:id/settings", async (c) => {
|
|
|
18898
18468
|
return c.json({ error: "Access denied" }, 403);
|
|
18899
18469
|
}
|
|
18900
18470
|
const settings = await c.req.json();
|
|
18901
|
-
const pluginService = new
|
|
18471
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
18902
18472
|
await pluginService.updatePluginSettings(pluginId, settings);
|
|
18903
18473
|
if (pluginId === "core-auth") {
|
|
18904
18474
|
try {
|
|
@@ -18931,7 +18501,7 @@ function formatLastUpdated(timestamp) {
|
|
|
18931
18501
|
}
|
|
18932
18502
|
|
|
18933
18503
|
// src/templates/pages/admin-logs-list.template.ts
|
|
18934
|
-
|
|
18504
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
18935
18505
|
function renderLogsListPage(data) {
|
|
18936
18506
|
const { logs, pagination, filters, user } = data;
|
|
18937
18507
|
const content = `
|
|
@@ -19242,7 +18812,7 @@ function renderLogsListPage(data) {
|
|
|
19242
18812
|
user,
|
|
19243
18813
|
content
|
|
19244
18814
|
};
|
|
19245
|
-
return
|
|
18815
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
19246
18816
|
}
|
|
19247
18817
|
function renderLogDetailsPage(data) {
|
|
19248
18818
|
const { log, user } = data;
|
|
@@ -19454,7 +19024,7 @@ function renderLogDetailsPage(data) {
|
|
|
19454
19024
|
</div>
|
|
19455
19025
|
</div>
|
|
19456
19026
|
`;
|
|
19457
|
-
return
|
|
19027
|
+
return chunkOHYBNCVL_cjs.adminLayoutV2({
|
|
19458
19028
|
title: `Log Details - ${log.id}`,
|
|
19459
19029
|
user,
|
|
19460
19030
|
content
|
|
@@ -19697,7 +19267,7 @@ function renderLogConfigPage(data) {
|
|
|
19697
19267
|
|
|
19698
19268
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
19699
19269
|
`;
|
|
19700
|
-
return
|
|
19270
|
+
return chunkOHYBNCVL_cjs.adminLayoutV2({
|
|
19701
19271
|
title: "Log Configuration",
|
|
19702
19272
|
user,
|
|
19703
19273
|
content
|
|
@@ -19706,7 +19276,7 @@ function renderLogConfigPage(data) {
|
|
|
19706
19276
|
|
|
19707
19277
|
// src/routes/admin-logs.ts
|
|
19708
19278
|
var adminLogsRoutes = new hono.Hono();
|
|
19709
|
-
adminLogsRoutes.use("*",
|
|
19279
|
+
adminLogsRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
19710
19280
|
adminLogsRoutes.get("/", async (c) => {
|
|
19711
19281
|
try {
|
|
19712
19282
|
const user = c.get("user");
|
|
@@ -20078,7 +19648,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
20078
19648
|
role: user.role
|
|
20079
19649
|
} : void 0
|
|
20080
19650
|
};
|
|
20081
|
-
return c.html(
|
|
19651
|
+
return c.html(chunkOHYBNCVL_cjs.renderDesignPage(pageData));
|
|
20082
19652
|
});
|
|
20083
19653
|
var adminCheckboxRoutes = new hono.Hono();
|
|
20084
19654
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -20090,7 +19660,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
20090
19660
|
role: user.role
|
|
20091
19661
|
} : void 0
|
|
20092
19662
|
};
|
|
20093
|
-
return c.html(
|
|
19663
|
+
return c.html(chunkOHYBNCVL_cjs.renderCheckboxPage(pageData));
|
|
20094
19664
|
});
|
|
20095
19665
|
|
|
20096
19666
|
// src/templates/pages/admin-testimonials-form.template.ts
|
|
@@ -20118,7 +19688,7 @@ function renderTestimonialsForm(data) {
|
|
|
20118
19688
|
</div>
|
|
20119
19689
|
</div>
|
|
20120
19690
|
|
|
20121
|
-
${message ?
|
|
19691
|
+
${message ? chunkOHYBNCVL_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20122
19692
|
|
|
20123
19693
|
<!-- Form -->
|
|
20124
19694
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -20347,7 +19917,7 @@ function renderTestimonialsForm(data) {
|
|
|
20347
19917
|
user: data.user,
|
|
20348
19918
|
content: pageContent
|
|
20349
19919
|
};
|
|
20350
|
-
return
|
|
19920
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
20351
19921
|
}
|
|
20352
19922
|
function escapeHtml4(unsafe) {
|
|
20353
19923
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -20373,7 +19943,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20373
19943
|
const offset = (currentPage - 1) * limit;
|
|
20374
19944
|
const db = c.env?.DB;
|
|
20375
19945
|
if (!db) {
|
|
20376
|
-
return c.html(
|
|
19946
|
+
return c.html(chunkOHYBNCVL_cjs.renderTestimonialsList({
|
|
20377
19947
|
testimonials: [],
|
|
20378
19948
|
totalCount: 0,
|
|
20379
19949
|
currentPage: 1,
|
|
@@ -20413,7 +19983,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20413
19983
|
`;
|
|
20414
19984
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
20415
19985
|
const totalPages = Math.ceil(totalCount / limit);
|
|
20416
|
-
return c.html(
|
|
19986
|
+
return c.html(chunkOHYBNCVL_cjs.renderTestimonialsList({
|
|
20417
19987
|
testimonials: testimonials || [],
|
|
20418
19988
|
totalCount,
|
|
20419
19989
|
currentPage,
|
|
@@ -20427,7 +19997,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
20427
19997
|
} catch (error) {
|
|
20428
19998
|
console.error("Error fetching testimonials:", error);
|
|
20429
19999
|
const user = c.get("user");
|
|
20430
|
-
return c.html(
|
|
20000
|
+
return c.html(chunkOHYBNCVL_cjs.renderTestimonialsList({
|
|
20431
20001
|
testimonials: [],
|
|
20432
20002
|
totalCount: 0,
|
|
20433
20003
|
currentPage: 1,
|
|
@@ -20746,7 +20316,7 @@ function renderCodeExamplesForm(data) {
|
|
|
20746
20316
|
</div>
|
|
20747
20317
|
</div>
|
|
20748
20318
|
|
|
20749
|
-
${message ?
|
|
20319
|
+
${message ? chunkOHYBNCVL_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
20750
20320
|
|
|
20751
20321
|
<!-- Form -->
|
|
20752
20322
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -21016,7 +20586,7 @@ function renderCodeExamplesForm(data) {
|
|
|
21016
20586
|
user: data.user,
|
|
21017
20587
|
content: pageContent
|
|
21018
20588
|
};
|
|
21019
|
-
return
|
|
20589
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
21020
20590
|
}
|
|
21021
20591
|
function escapeHtml5(unsafe) {
|
|
21022
20592
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -21043,7 +20613,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21043
20613
|
const offset = (currentPage - 1) * limit;
|
|
21044
20614
|
const db = c.env?.DB;
|
|
21045
20615
|
if (!db) {
|
|
21046
|
-
return c.html(
|
|
20616
|
+
return c.html(chunkOHYBNCVL_cjs.renderCodeExamplesList({
|
|
21047
20617
|
codeExamples: [],
|
|
21048
20618
|
totalCount: 0,
|
|
21049
20619
|
currentPage: 1,
|
|
@@ -21083,7 +20653,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21083
20653
|
`;
|
|
21084
20654
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
21085
20655
|
const totalPages = Math.ceil(totalCount / limit);
|
|
21086
|
-
return c.html(
|
|
20656
|
+
return c.html(chunkOHYBNCVL_cjs.renderCodeExamplesList({
|
|
21087
20657
|
codeExamples: codeExamples || [],
|
|
21088
20658
|
totalCount,
|
|
21089
20659
|
currentPage,
|
|
@@ -21097,7 +20667,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
21097
20667
|
} catch (error) {
|
|
21098
20668
|
console.error("Error fetching code examples:", error);
|
|
21099
20669
|
const user = c.get("user");
|
|
21100
|
-
return c.html(
|
|
20670
|
+
return c.html(chunkOHYBNCVL_cjs.renderCodeExamplesList({
|
|
21101
20671
|
codeExamples: [],
|
|
21102
20672
|
totalCount: 0,
|
|
21103
20673
|
currentPage: 1,
|
|
@@ -21486,7 +21056,7 @@ function renderDashboardPage(data) {
|
|
|
21486
21056
|
version: data.version,
|
|
21487
21057
|
content: pageContent
|
|
21488
21058
|
};
|
|
21489
|
-
return
|
|
21059
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout(layoutData);
|
|
21490
21060
|
}
|
|
21491
21061
|
function renderStatsCards(stats) {
|
|
21492
21062
|
const cards = [
|
|
@@ -22034,9 +21604,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
22034
21604
|
}
|
|
22035
21605
|
|
|
22036
21606
|
// src/routes/admin-dashboard.ts
|
|
22037
|
-
var VERSION =
|
|
21607
|
+
var VERSION = chunkVUISYUHY_cjs.getCoreVersion();
|
|
22038
21608
|
var router = new hono.Hono();
|
|
22039
|
-
router.use("*",
|
|
21609
|
+
router.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
22040
21610
|
router.get("/", async (c) => {
|
|
22041
21611
|
const user = c.get("user");
|
|
22042
21612
|
try {
|
|
@@ -22275,7 +21845,7 @@ function normalizeFieldType(fieldType) {
|
|
|
22275
21845
|
}
|
|
22276
21846
|
|
|
22277
21847
|
// src/templates/pages/admin-collections-list.template.ts
|
|
22278
|
-
|
|
21848
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
22279
21849
|
|
|
22280
21850
|
// src/templates/components/table.template.ts
|
|
22281
21851
|
function renderTable2(data) {
|
|
@@ -22749,11 +22319,11 @@ function renderCollectionsListPage(data) {
|
|
|
22749
22319
|
version: data.version,
|
|
22750
22320
|
content: pageContent
|
|
22751
22321
|
};
|
|
22752
|
-
return
|
|
22322
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
22753
22323
|
}
|
|
22754
22324
|
|
|
22755
22325
|
// src/templates/pages/admin-collections-form.template.ts
|
|
22756
|
-
|
|
22326
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
22757
22327
|
function getFieldTypeBadge(fieldType) {
|
|
22758
22328
|
const typeLabels = {
|
|
22759
22329
|
"text": "Text",
|
|
@@ -23022,7 +22592,7 @@ function renderCollectionFormPage(data) {
|
|
|
23022
22592
|
}
|
|
23023
22593
|
</style>
|
|
23024
22594
|
|
|
23025
|
-
${
|
|
22595
|
+
${chunkOHYBNCVL_cjs.renderForm(formData)}
|
|
23026
22596
|
|
|
23027
22597
|
${isEdit && data.managed ? `
|
|
23028
22598
|
<!-- Read-Only Fields Display for Managed Collections -->
|
|
@@ -23850,15 +23420,15 @@ function renderCollectionFormPage(data) {
|
|
|
23850
23420
|
version: data.version,
|
|
23851
23421
|
content: pageContent
|
|
23852
23422
|
};
|
|
23853
|
-
return
|
|
23423
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
23854
23424
|
}
|
|
23855
23425
|
|
|
23856
23426
|
// src/routes/admin-collections.ts
|
|
23857
23427
|
var adminCollectionsRoutes = new hono.Hono();
|
|
23858
|
-
adminCollectionsRoutes.use("*",
|
|
23859
|
-
adminCollectionsRoutes.post("*",
|
|
23860
|
-
adminCollectionsRoutes.put("*",
|
|
23861
|
-
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"]));
|
|
23862
23432
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
23863
23433
|
try {
|
|
23864
23434
|
const user = c.get("user");
|
|
@@ -24590,7 +24160,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
24590
24160
|
});
|
|
24591
24161
|
|
|
24592
24162
|
// src/templates/pages/admin-settings.template.ts
|
|
24593
|
-
|
|
24163
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
24594
24164
|
function renderSettingsPage(data) {
|
|
24595
24165
|
const activeTab = data.activeTab || "general";
|
|
24596
24166
|
const pageContent = `
|
|
@@ -24972,7 +24542,7 @@ function renderSettingsPage(data) {
|
|
|
24972
24542
|
version: data.version,
|
|
24973
24543
|
content: pageContent
|
|
24974
24544
|
};
|
|
24975
|
-
return
|
|
24545
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
24976
24546
|
}
|
|
24977
24547
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
24978
24548
|
const isActive = activeTab === tabId;
|
|
@@ -26054,7 +25624,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
26054
25624
|
|
|
26055
25625
|
// src/routes/admin-settings.ts
|
|
26056
25626
|
var adminSettingsRoutes = new hono.Hono();
|
|
26057
|
-
adminSettingsRoutes.use("*",
|
|
25627
|
+
adminSettingsRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
26058
25628
|
function getMockSettings(user) {
|
|
26059
25629
|
return {
|
|
26060
25630
|
general: {
|
|
@@ -26222,7 +25792,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
26222
25792
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
26223
25793
|
try {
|
|
26224
25794
|
const db = c.env.DB;
|
|
26225
|
-
const migrationService = new
|
|
25795
|
+
const migrationService = new chunkRVD7PLMU_cjs.MigrationService(db);
|
|
26226
25796
|
const status = await migrationService.getMigrationStatus();
|
|
26227
25797
|
return c.json({
|
|
26228
25798
|
success: true,
|
|
@@ -26246,7 +25816,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26246
25816
|
}, 403);
|
|
26247
25817
|
}
|
|
26248
25818
|
const db = c.env.DB;
|
|
26249
|
-
const migrationService = new
|
|
25819
|
+
const migrationService = new chunkRVD7PLMU_cjs.MigrationService(db);
|
|
26250
25820
|
const result = await migrationService.runPendingMigrations();
|
|
26251
25821
|
return c.json({
|
|
26252
25822
|
success: result.success,
|
|
@@ -26264,7 +25834,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
26264
25834
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
26265
25835
|
try {
|
|
26266
25836
|
const db = c.env.DB;
|
|
26267
|
-
const migrationService = new
|
|
25837
|
+
const migrationService = new chunkRVD7PLMU_cjs.MigrationService(db);
|
|
26268
25838
|
const validation = await migrationService.validateSchema();
|
|
26269
25839
|
return c.json({
|
|
26270
25840
|
success: true,
|
|
@@ -26473,7 +26043,7 @@ adminSettingsRoutes.post("/", async (c) => {
|
|
|
26473
26043
|
});
|
|
26474
26044
|
|
|
26475
26045
|
// src/templates/pages/admin-forms-list.template.ts
|
|
26476
|
-
|
|
26046
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
26477
26047
|
function renderFormsListPage(data) {
|
|
26478
26048
|
const tableData = {
|
|
26479
26049
|
tableId: "forms-table",
|
|
@@ -26735,11 +26305,11 @@ function renderFormsListPage(data) {
|
|
|
26735
26305
|
user: data.user,
|
|
26736
26306
|
version: data.version
|
|
26737
26307
|
};
|
|
26738
|
-
return
|
|
26308
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
26739
26309
|
}
|
|
26740
26310
|
|
|
26741
26311
|
// src/templates/pages/admin-forms-builder.template.ts
|
|
26742
|
-
|
|
26312
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
26743
26313
|
function getTurnstileComponentScript() {
|
|
26744
26314
|
return `
|
|
26745
26315
|
(function() {
|
|
@@ -27952,11 +27522,11 @@ ${getTurnstileComponentScript()}
|
|
|
27952
27522
|
user: data.user,
|
|
27953
27523
|
version: data.version
|
|
27954
27524
|
};
|
|
27955
|
-
return
|
|
27525
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
27956
27526
|
}
|
|
27957
27527
|
|
|
27958
27528
|
// src/templates/pages/admin-forms-create.template.ts
|
|
27959
|
-
|
|
27529
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
27960
27530
|
function renderFormCreatePage(data) {
|
|
27961
27531
|
const pageContent = `
|
|
27962
27532
|
<div class="max-w-3xl mx-auto">
|
|
@@ -28149,12 +27719,12 @@ function renderFormCreatePage(data) {
|
|
|
28149
27719
|
user: data.user,
|
|
28150
27720
|
version: data.version
|
|
28151
27721
|
};
|
|
28152
|
-
return
|
|
27722
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
28153
27723
|
}
|
|
28154
27724
|
|
|
28155
27725
|
// src/routes/admin-forms.ts
|
|
28156
27726
|
var adminFormsRoutes = new hono.Hono();
|
|
28157
|
-
adminFormsRoutes.use("*",
|
|
27727
|
+
adminFormsRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
28158
27728
|
adminFormsRoutes.get("/", async (c) => {
|
|
28159
27729
|
try {
|
|
28160
27730
|
const user = c.get("user");
|
|
@@ -28318,7 +27888,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
|
|
|
28318
27888
|
if (!form) {
|
|
28319
27889
|
return c.html("<p>Form not found</p>", 404);
|
|
28320
27890
|
}
|
|
28321
|
-
const turnstileService = new
|
|
27891
|
+
const turnstileService = new chunk635JAMSE_cjs.TurnstileService(db);
|
|
28322
27892
|
const turnstileSettings = await turnstileService.getSettings();
|
|
28323
27893
|
const pageData = {
|
|
28324
27894
|
id: form.id,
|
|
@@ -28482,7 +28052,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
|
|
|
28482
28052
|
if (!form) {
|
|
28483
28053
|
return c.json({ error: "Form not found" }, 404);
|
|
28484
28054
|
}
|
|
28485
|
-
const turnstileService = new
|
|
28055
|
+
const turnstileService = new chunk635JAMSE_cjs.TurnstileService(db);
|
|
28486
28056
|
const globalSettings = await turnstileService.getSettings();
|
|
28487
28057
|
const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
28488
28058
|
const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
|
|
@@ -28909,7 +28479,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28909
28479
|
const turnstileEnabled = form.turnstile_enabled === 1;
|
|
28910
28480
|
const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
|
|
28911
28481
|
if (turnstileEnabled || turnstileSettings.inherit) {
|
|
28912
|
-
const turnstileService = new
|
|
28482
|
+
const turnstileService = new chunk635JAMSE_cjs.TurnstileService(db);
|
|
28913
28483
|
const globalEnabled = await turnstileService.isEnabled();
|
|
28914
28484
|
if (globalEnabled || turnstileEnabled) {
|
|
28915
28485
|
const turnstileToken = body.data?.turnstile || body.turnstile;
|
|
@@ -28959,7 +28529,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28959
28529
|
`).bind(now, form.id).run();
|
|
28960
28530
|
let contentId = null;
|
|
28961
28531
|
try {
|
|
28962
|
-
contentId = await
|
|
28532
|
+
contentId = await chunk43AB4EH4_cjs.createContentFromSubmission(
|
|
28963
28533
|
db,
|
|
28964
28534
|
sanitizedData,
|
|
28965
28535
|
{ id: form.id, name: form.name, display_name: form.display_name },
|
|
@@ -28992,7 +28562,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
|
|
|
28992
28562
|
var public_forms_default = publicFormsRoutes;
|
|
28993
28563
|
|
|
28994
28564
|
// src/templates/pages/admin-api-reference.template.ts
|
|
28995
|
-
|
|
28565
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
28996
28566
|
function renderAuthBadge(auth) {
|
|
28997
28567
|
if (auth === true) {
|
|
28998
28568
|
return `
|
|
@@ -29323,13 +28893,13 @@ function renderAPIReferencePage(data) {
|
|
|
29323
28893
|
version: data.version,
|
|
29324
28894
|
content: pageContent
|
|
29325
28895
|
};
|
|
29326
|
-
return
|
|
28896
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
29327
28897
|
}
|
|
29328
28898
|
|
|
29329
28899
|
// src/routes/admin-api-reference.ts
|
|
29330
|
-
var VERSION2 =
|
|
28900
|
+
var VERSION2 = chunkVUISYUHY_cjs.getCoreVersion();
|
|
29331
28901
|
var router2 = new hono.Hono();
|
|
29332
|
-
router2.use("*",
|
|
28902
|
+
router2.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
29333
28903
|
router2.get("/", async (c) => {
|
|
29334
28904
|
const user = c.get("user");
|
|
29335
28905
|
try {
|
|
@@ -29420,5 +28990,5 @@ exports.router2 = router2;
|
|
|
29420
28990
|
exports.test_cleanup_default = test_cleanup_default;
|
|
29421
28991
|
exports.userProfilesPlugin = userProfilesPlugin;
|
|
29422
28992
|
exports.userRoutes = userRoutes;
|
|
29423
|
-
//# sourceMappingURL=chunk-
|
|
29424
|
-
//# sourceMappingURL=chunk-
|
|
28993
|
+
//# sourceMappingURL=chunk-26HYU7MX.cjs.map
|
|
28994
|
+
//# sourceMappingURL=chunk-26HYU7MX.cjs.map
|