@sonicjs-cms/core 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-63K7XXRX.cjs → chunk-AYPF6C4D.cjs} +5 -5
- package/dist/{chunk-63K7XXRX.cjs.map → chunk-AYPF6C4D.cjs.map} +1 -1
- package/dist/{chunk-7DL5SPPX.js → chunk-DNHJS6RN.js} +3 -3
- package/dist/{chunk-7DL5SPPX.js.map → chunk-DNHJS6RN.js.map} +1 -1
- package/dist/{chunk-T3YIKW2A.cjs → chunk-E2BXLXPW.cjs} +4 -4
- package/dist/{chunk-T3YIKW2A.cjs.map → chunk-E2BXLXPW.cjs.map} +1 -1
- package/dist/{chunk-BZC4FYW7.cjs → chunk-EHSZ6TAN.cjs} +9 -2
- package/dist/chunk-EHSZ6TAN.cjs.map +1 -0
- package/dist/{chunk-KA2PDJNB.js → chunk-GRN3GHUG.js} +9 -2
- package/dist/chunk-GRN3GHUG.js.map +1 -0
- package/dist/{chunk-N7TDLOUE.cjs → chunk-J7F3NPAP.cjs} +208 -182
- package/dist/chunk-J7F3NPAP.cjs.map +1 -0
- package/dist/{chunk-EVZOVYLO.js → chunk-L2IDZI7F.js} +2 -2
- package/dist/{chunk-EVZOVYLO.js.map → chunk-L2IDZI7F.js.map} +1 -1
- package/dist/{chunk-YMTTGHEK.cjs → chunk-MYB5RY7H.cjs} +3 -3
- package/dist/{chunk-YMTTGHEK.cjs.map → chunk-MYB5RY7H.cjs.map} +1 -1
- package/dist/{chunk-F6GZURXJ.js → chunk-UISZ2MBW.js} +50 -26
- package/dist/chunk-UISZ2MBW.js.map +1 -0
- package/dist/{chunk-KAOWRIFD.js → chunk-V3KVSEG6.js} +3 -3
- package/dist/{chunk-KAOWRIFD.js.map → chunk-V3KVSEG6.js.map} +1 -1
- package/dist/{chunk-EYWR6UA2.js → chunk-Y3EWJQ4D.js} +3 -3
- package/dist/{chunk-EYWR6UA2.js.map → chunk-Y3EWJQ4D.js.map} +1 -1
- package/dist/{chunk-IIRVZSP2.cjs → chunk-YRFAQ6MI.cjs} +2 -2
- package/dist/{chunk-IIRVZSP2.cjs.map → chunk-YRFAQ6MI.cjs.map} +1 -1
- package/dist/index.cjs +1940 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1874 -56
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +23 -23
- package/dist/middleware.js +2 -2
- package/dist/migrations-LEMFV2ND.cjs +13 -0
- package/dist/{migrations-QNYAWQLB.cjs.map → migrations-LEMFV2ND.cjs.map} +1 -1
- package/dist/migrations-RKQES6XY.js +4 -0
- package/dist/{migrations-R6NQBKQV.js.map → migrations-RKQES6XY.js.map} +1 -1
- package/dist/routes.cjs +25 -25
- package/dist/routes.js +5 -5
- package/dist/services.cjs +2 -2
- package/dist/services.js +1 -1
- package/dist/templates.cjs +17 -17
- package/dist/templates.js +2 -2
- package/dist/utils.cjs +14 -14
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BZC4FYW7.cjs.map +0 -1
- package/dist/chunk-F6GZURXJ.js.map +0 -1
- package/dist/chunk-KA2PDJNB.js.map +0 -1
- package/dist/chunk-N7TDLOUE.cjs.map +0 -1
- package/dist/migrations-QNYAWQLB.cjs +0 -13
- package/dist/migrations-R6NQBKQV.js +0 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk7FOAMNTI_cjs = require('./chunk-7FOAMNTI.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkE2BXLXPW_cjs = require('./chunk-E2BXLXPW.cjs');
|
|
5
5
|
var chunkMPT5PA6U_cjs = require('./chunk-MPT5PA6U.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkYRFAQ6MI_cjs = require('./chunk-YRFAQ6MI.cjs');
|
|
7
|
+
var chunkEHSZ6TAN_cjs = require('./chunk-EHSZ6TAN.cjs');
|
|
8
8
|
var chunkYHW27CBV_cjs = require('./chunk-YHW27CBV.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkMYB5RY7H_cjs = require('./chunk-MYB5RY7H.cjs');
|
|
10
10
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
11
11
|
var hono = require('hono');
|
|
12
12
|
var cors = require('hono/cors');
|
|
@@ -76,7 +76,7 @@ apiContentCrudRoutes.get("/:id", async (c) => {
|
|
|
76
76
|
}, 500);
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
apiContentCrudRoutes.post("/",
|
|
79
|
+
apiContentCrudRoutes.post("/", chunkE2BXLXPW_cjs.requireAuth(), async (c) => {
|
|
80
80
|
try {
|
|
81
81
|
const db = c.env.DB;
|
|
82
82
|
const user = c.get("user");
|
|
@@ -142,7 +142,7 @@ apiContentCrudRoutes.post("/", chunkT3YIKW2A_cjs.requireAuth(), async (c) => {
|
|
|
142
142
|
}, 500);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
apiContentCrudRoutes.put("/:id",
|
|
145
|
+
apiContentCrudRoutes.put("/:id", chunkE2BXLXPW_cjs.requireAuth(), async (c) => {
|
|
146
146
|
try {
|
|
147
147
|
const id = c.req.param("id");
|
|
148
148
|
const db = c.env.DB;
|
|
@@ -206,7 +206,7 @@ apiContentCrudRoutes.put("/:id", chunkT3YIKW2A_cjs.requireAuth(), async (c) => {
|
|
|
206
206
|
}, 500);
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
-
apiContentCrudRoutes.delete("/:id",
|
|
209
|
+
apiContentCrudRoutes.delete("/:id", chunkE2BXLXPW_cjs.requireAuth(), async (c) => {
|
|
210
210
|
try {
|
|
211
211
|
const id = c.req.param("id");
|
|
212
212
|
const db = c.env.DB;
|
|
@@ -242,7 +242,7 @@ apiRoutes.use("*", async (c, next) => {
|
|
|
242
242
|
c.header("X-Response-Time", `${totalTime}ms`);
|
|
243
243
|
});
|
|
244
244
|
apiRoutes.use("*", async (c, next) => {
|
|
245
|
-
const cacheEnabled = await
|
|
245
|
+
const cacheEnabled = await chunkE2BXLXPW_cjs.isPluginActive(c.env.DB, "core-cache");
|
|
246
246
|
c.set("cacheEnabled", cacheEnabled);
|
|
247
247
|
await next();
|
|
248
248
|
});
|
|
@@ -367,12 +367,12 @@ apiRoutes.get("/content", async (c) => {
|
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
const filter =
|
|
370
|
+
const filter = chunkMYB5RY7H_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
371
371
|
if (!filter.limit) {
|
|
372
372
|
filter.limit = 50;
|
|
373
373
|
}
|
|
374
374
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
375
|
-
const builder3 = new
|
|
375
|
+
const builder3 = new chunkMYB5RY7H_cjs.QueryFilterBuilder();
|
|
376
376
|
const queryResult = builder3.build("content", filter);
|
|
377
377
|
if (queryResult.errors.length > 0) {
|
|
378
378
|
return c.json({
|
|
@@ -459,7 +459,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
459
459
|
if (!collectionResult) {
|
|
460
460
|
return c.json({ error: "Collection not found" }, 404);
|
|
461
461
|
}
|
|
462
|
-
const filter =
|
|
462
|
+
const filter = chunkMYB5RY7H_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
463
463
|
if (!filter.where) {
|
|
464
464
|
filter.where = { and: [] };
|
|
465
465
|
}
|
|
@@ -475,7 +475,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
475
475
|
filter.limit = 50;
|
|
476
476
|
}
|
|
477
477
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
478
|
-
const builder3 = new
|
|
478
|
+
const builder3 = new chunkMYB5RY7H_cjs.QueryFilterBuilder();
|
|
479
479
|
const queryResult = builder3.build("content", filter);
|
|
480
480
|
if (queryResult.errors.length > 0) {
|
|
481
481
|
return c.json({
|
|
@@ -600,7 +600,7 @@ var fileValidationSchema = zod.z.object({
|
|
|
600
600
|
// 50MB max
|
|
601
601
|
});
|
|
602
602
|
var apiMediaRoutes = new hono.Hono();
|
|
603
|
-
apiMediaRoutes.use("*",
|
|
603
|
+
apiMediaRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
604
604
|
apiMediaRoutes.post("/upload", async (c) => {
|
|
605
605
|
try {
|
|
606
606
|
const user = c.get("user");
|
|
@@ -1344,8 +1344,8 @@ apiSystemRoutes.get("/env", (c) => {
|
|
|
1344
1344
|
});
|
|
1345
1345
|
var api_system_default = apiSystemRoutes;
|
|
1346
1346
|
var adminApiRoutes = new hono.Hono();
|
|
1347
|
-
adminApiRoutes.use("*",
|
|
1348
|
-
adminApiRoutes.use("*",
|
|
1347
|
+
adminApiRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
1348
|
+
adminApiRoutes.use("*", chunkE2BXLXPW_cjs.requireRole(["admin", "editor"]));
|
|
1349
1349
|
adminApiRoutes.get("/stats", async (c) => {
|
|
1350
1350
|
try {
|
|
1351
1351
|
const db = c.env.DB;
|
|
@@ -1855,7 +1855,7 @@ adminApiRoutes.delete("/collections/:id", async (c) => {
|
|
|
1855
1855
|
});
|
|
1856
1856
|
adminApiRoutes.get("/migrations/status", async (c) => {
|
|
1857
1857
|
try {
|
|
1858
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1858
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-LEMFV2ND.cjs');
|
|
1859
1859
|
const db = c.env.DB;
|
|
1860
1860
|
const migrationService = new MigrationService2(db);
|
|
1861
1861
|
const status = await migrationService.getMigrationStatus();
|
|
@@ -1880,7 +1880,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
1880
1880
|
error: "Unauthorized. Admin access required."
|
|
1881
1881
|
}, 403);
|
|
1882
1882
|
}
|
|
1883
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1883
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-LEMFV2ND.cjs');
|
|
1884
1884
|
const db = c.env.DB;
|
|
1885
1885
|
const migrationService = new MigrationService2(db);
|
|
1886
1886
|
const result = await migrationService.runPendingMigrations();
|
|
@@ -1899,7 +1899,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
1899
1899
|
});
|
|
1900
1900
|
adminApiRoutes.get("/migrations/validate", async (c) => {
|
|
1901
1901
|
try {
|
|
1902
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1902
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-LEMFV2ND.cjs');
|
|
1903
1903
|
const db = c.env.DB;
|
|
1904
1904
|
const migrationService = new MigrationService2(db);
|
|
1905
1905
|
const validation = await migrationService.validateSchema();
|
|
@@ -1974,8 +1974,8 @@ function renderLoginPage(data, demoLoginActive = false) {
|
|
|
1974
1974
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
1975
1975
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
1976
1976
|
<!-- Alerts -->
|
|
1977
|
-
${data.error ? `<div class="mb-6">${
|
|
1978
|
-
${data.message ? `<div class="mb-6">${
|
|
1977
|
+
${data.error ? `<div class="mb-6">${chunkEHSZ6TAN_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
1978
|
+
${data.message ? `<div class="mb-6">${chunkEHSZ6TAN_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
|
|
1979
1979
|
|
|
1980
1980
|
<!-- Form Response (HTMX target) -->
|
|
1981
1981
|
<div id="form-response" class="mb-6"></div>
|
|
@@ -2139,7 +2139,7 @@ function renderRegisterPage(data) {
|
|
|
2139
2139
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2140
2140
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2141
2141
|
<!-- Alerts -->
|
|
2142
|
-
${data.error ? `<div class="mb-6">${
|
|
2142
|
+
${data.error ? `<div class="mb-6">${chunkEHSZ6TAN_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2143
2143
|
|
|
2144
2144
|
<!-- Form -->
|
|
2145
2145
|
<form
|
|
@@ -2381,7 +2381,7 @@ authRoutes.post(
|
|
|
2381
2381
|
if (existingUser) {
|
|
2382
2382
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
2383
2383
|
}
|
|
2384
|
-
const passwordHash = await
|
|
2384
|
+
const passwordHash = await chunkE2BXLXPW_cjs.AuthManager.hashPassword(password);
|
|
2385
2385
|
const userId = crypto.randomUUID();
|
|
2386
2386
|
const now = /* @__PURE__ */ new Date();
|
|
2387
2387
|
await db.prepare(`
|
|
@@ -2401,7 +2401,7 @@ authRoutes.post(
|
|
|
2401
2401
|
now.getTime(),
|
|
2402
2402
|
now.getTime()
|
|
2403
2403
|
).run();
|
|
2404
|
-
const token = await
|
|
2404
|
+
const token = await chunkE2BXLXPW_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer");
|
|
2405
2405
|
cookie.setCookie(c, "auth_token", token, {
|
|
2406
2406
|
httpOnly: true,
|
|
2407
2407
|
secure: true,
|
|
@@ -2454,11 +2454,11 @@ authRoutes.post("/login", async (c) => {
|
|
|
2454
2454
|
if (!user) {
|
|
2455
2455
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2456
2456
|
}
|
|
2457
|
-
const isValidPassword = await
|
|
2457
|
+
const isValidPassword = await chunkE2BXLXPW_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2458
2458
|
if (!isValidPassword) {
|
|
2459
2459
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2460
2460
|
}
|
|
2461
|
-
const token = await
|
|
2461
|
+
const token = await chunkE2BXLXPW_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2462
2462
|
cookie.setCookie(c, "auth_token", token, {
|
|
2463
2463
|
httpOnly: true,
|
|
2464
2464
|
secure: true,
|
|
@@ -2507,7 +2507,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
2507
2507
|
});
|
|
2508
2508
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
2509
2509
|
});
|
|
2510
|
-
authRoutes.get("/me",
|
|
2510
|
+
authRoutes.get("/me", chunkE2BXLXPW_cjs.requireAuth(), async (c) => {
|
|
2511
2511
|
try {
|
|
2512
2512
|
const user = c.get("user");
|
|
2513
2513
|
if (!user) {
|
|
@@ -2524,13 +2524,13 @@ authRoutes.get("/me", chunkT3YIKW2A_cjs.requireAuth(), async (c) => {
|
|
|
2524
2524
|
return c.json({ error: "Failed to get user" }, 500);
|
|
2525
2525
|
}
|
|
2526
2526
|
});
|
|
2527
|
-
authRoutes.post("/refresh",
|
|
2527
|
+
authRoutes.post("/refresh", chunkE2BXLXPW_cjs.requireAuth(), async (c) => {
|
|
2528
2528
|
try {
|
|
2529
2529
|
const user = c.get("user");
|
|
2530
2530
|
if (!user) {
|
|
2531
2531
|
return c.json({ error: "Not authenticated" }, 401);
|
|
2532
2532
|
}
|
|
2533
|
-
const token = await
|
|
2533
|
+
const token = await chunkE2BXLXPW_cjs.AuthManager.generateToken(user.userId, user.email, user.role);
|
|
2534
2534
|
cookie.setCookie(c, "auth_token", token, {
|
|
2535
2535
|
httpOnly: true,
|
|
2536
2536
|
secure: true,
|
|
@@ -2590,7 +2590,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2590
2590
|
</div>
|
|
2591
2591
|
`);
|
|
2592
2592
|
}
|
|
2593
|
-
const passwordHash = await
|
|
2593
|
+
const passwordHash = await chunkE2BXLXPW_cjs.AuthManager.hashPassword(password);
|
|
2594
2594
|
const role = isFirstUser ? "admin" : "viewer";
|
|
2595
2595
|
const userId = crypto.randomUUID();
|
|
2596
2596
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2610,7 +2610,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2610
2610
|
now.getTime(),
|
|
2611
2611
|
now.getTime()
|
|
2612
2612
|
).run();
|
|
2613
|
-
const token = await
|
|
2613
|
+
const token = await chunkE2BXLXPW_cjs.AuthManager.generateToken(userId, normalizedEmail, role);
|
|
2614
2614
|
cookie.setCookie(c, "auth_token", token, {
|
|
2615
2615
|
httpOnly: true,
|
|
2616
2616
|
secure: false,
|
|
@@ -2662,7 +2662,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2662
2662
|
</div>
|
|
2663
2663
|
`);
|
|
2664
2664
|
}
|
|
2665
|
-
const isValidPassword = await
|
|
2665
|
+
const isValidPassword = await chunkE2BXLXPW_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2666
2666
|
if (!isValidPassword) {
|
|
2667
2667
|
return c.html(html.html`
|
|
2668
2668
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -2670,7 +2670,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2670
2670
|
</div>
|
|
2671
2671
|
`);
|
|
2672
2672
|
}
|
|
2673
|
-
const token = await
|
|
2673
|
+
const token = await chunkE2BXLXPW_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2674
2674
|
cookie.setCookie(c, "auth_token", token, {
|
|
2675
2675
|
httpOnly: true,
|
|
2676
2676
|
secure: false,
|
|
@@ -2729,7 +2729,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2729
2729
|
`).run();
|
|
2730
2730
|
const existingAdmin = await db.prepare("SELECT id FROM users WHERE email = ? OR username = ?").bind("admin@sonicjs.com", "admin").first();
|
|
2731
2731
|
if (existingAdmin) {
|
|
2732
|
-
const passwordHash2 = await
|
|
2732
|
+
const passwordHash2 = await chunkE2BXLXPW_cjs.AuthManager.hashPassword("sonicjs!");
|
|
2733
2733
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(passwordHash2, Date.now(), existingAdmin.id).run();
|
|
2734
2734
|
return c.json({
|
|
2735
2735
|
message: "Admin user already exists (password updated)",
|
|
@@ -2741,7 +2741,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2741
2741
|
}
|
|
2742
2742
|
});
|
|
2743
2743
|
}
|
|
2744
|
-
const passwordHash = await
|
|
2744
|
+
const passwordHash = await chunkE2BXLXPW_cjs.AuthManager.hashPassword("sonicjs!");
|
|
2745
2745
|
const userId = "admin-user-id";
|
|
2746
2746
|
const now = Date.now();
|
|
2747
2747
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -2961,7 +2961,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2961
2961
|
if (existingUsername) {
|
|
2962
2962
|
return c.json({ error: "Username is already taken" }, 400);
|
|
2963
2963
|
}
|
|
2964
|
-
const passwordHash = await
|
|
2964
|
+
const passwordHash = await chunkE2BXLXPW_cjs.AuthManager.hashPassword(password);
|
|
2965
2965
|
const updateStmt = db.prepare(`
|
|
2966
2966
|
UPDATE users SET
|
|
2967
2967
|
username = ?,
|
|
@@ -2980,7 +2980,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2980
2980
|
Date.now(),
|
|
2981
2981
|
invitedUser.id
|
|
2982
2982
|
).run();
|
|
2983
|
-
const authToken = await
|
|
2983
|
+
const authToken = await chunkE2BXLXPW_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role);
|
|
2984
2984
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
2985
2985
|
httpOnly: true,
|
|
2986
2986
|
secure: true,
|
|
@@ -3210,7 +3210,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
3210
3210
|
if (Date.now() > user.password_reset_expires) {
|
|
3211
3211
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
3212
3212
|
}
|
|
3213
|
-
const newPasswordHash = await
|
|
3213
|
+
const newPasswordHash = await chunkE2BXLXPW_cjs.AuthManager.hashPassword(password);
|
|
3214
3214
|
try {
|
|
3215
3215
|
const historyStmt = db.prepare(`
|
|
3216
3216
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -3468,7 +3468,7 @@ app.post("/test-cleanup/content", async (c) => {
|
|
|
3468
3468
|
var test_cleanup_default = app;
|
|
3469
3469
|
|
|
3470
3470
|
// src/templates/pages/admin-content-form.template.ts
|
|
3471
|
-
|
|
3471
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
3472
3472
|
|
|
3473
3473
|
// src/templates/components/drag-sortable.template.ts
|
|
3474
3474
|
function getDragSortableScript() {
|
|
@@ -4051,11 +4051,11 @@ function renderDynamicField(field, options = {}) {
|
|
|
4051
4051
|
`;
|
|
4052
4052
|
break;
|
|
4053
4053
|
case "select":
|
|
4054
|
-
const
|
|
4054
|
+
const selectOptions = opts.options || [];
|
|
4055
4055
|
const multiple = opts.multiple ? "multiple" : "";
|
|
4056
4056
|
const selectedValues = Array.isArray(value) ? value : [value];
|
|
4057
4057
|
fieldHTML = `
|
|
4058
|
-
<select
|
|
4058
|
+
<select
|
|
4059
4059
|
id="${fieldId}"
|
|
4060
4060
|
name="${fieldName}${opts.multiple ? "[]" : ""}"
|
|
4061
4061
|
class="${baseClasses} ${errorClasses}"
|
|
@@ -4064,7 +4064,7 @@ function renderDynamicField(field, options = {}) {
|
|
|
4064
4064
|
${disabled ? "disabled" : ""}
|
|
4065
4065
|
>
|
|
4066
4066
|
${!required && !opts.multiple ? '<option value="">Choose an option...</option>' : ""}
|
|
4067
|
-
${
|
|
4067
|
+
${selectOptions.map((option) => {
|
|
4068
4068
|
const optionValue = typeof option === "string" ? option : option.value;
|
|
4069
4069
|
const optionLabel = typeof option === "string" ? option : option.label;
|
|
4070
4070
|
const selected = selectedValues.includes(optionValue) ? "selected" : "";
|
|
@@ -4190,13 +4190,13 @@ function renderDynamicField(field, options = {}) {
|
|
|
4190
4190
|
`;
|
|
4191
4191
|
break;
|
|
4192
4192
|
case "object":
|
|
4193
|
-
return renderStructuredObjectField(field,
|
|
4193
|
+
return renderStructuredObjectField(field, options);
|
|
4194
4194
|
case "array":
|
|
4195
4195
|
const itemsConfig = opts.items && typeof opts.items === "object" ? opts.items : {};
|
|
4196
4196
|
if (itemsConfig.blocks && typeof itemsConfig.blocks === "object") {
|
|
4197
|
-
return renderBlocksField(field,
|
|
4197
|
+
return renderBlocksField(field, options, baseClasses, errorClasses);
|
|
4198
4198
|
}
|
|
4199
|
-
return renderStructuredArrayField(field,
|
|
4199
|
+
return renderStructuredArrayField(field, options);
|
|
4200
4200
|
default:
|
|
4201
4201
|
fieldHTML = `
|
|
4202
4202
|
<input
|
|
@@ -5610,8 +5610,8 @@ function renderContentFormPage(data) {
|
|
|
5610
5610
|
<!-- Form Content -->
|
|
5611
5611
|
<div class="px-6 py-6">
|
|
5612
5612
|
<div id="form-messages">
|
|
5613
|
-
${data.error ?
|
|
5614
|
-
${data.success ?
|
|
5613
|
+
${data.error ? chunkEHSZ6TAN_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
5614
|
+
${data.success ? chunkEHSZ6TAN_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
5615
5615
|
</div>
|
|
5616
5616
|
|
|
5617
5617
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -5846,7 +5846,7 @@ function renderContentFormPage(data) {
|
|
|
5846
5846
|
</div>
|
|
5847
5847
|
|
|
5848
5848
|
<!-- Confirmation Dialogs -->
|
|
5849
|
-
${
|
|
5849
|
+
${chunkEHSZ6TAN_cjs.renderConfirmationDialog({
|
|
5850
5850
|
id: "duplicate-content-confirm",
|
|
5851
5851
|
title: "Duplicate Content",
|
|
5852
5852
|
message: "Create a copy of this content?",
|
|
@@ -5857,7 +5857,7 @@ function renderContentFormPage(data) {
|
|
|
5857
5857
|
onConfirm: "performDuplicateContent()"
|
|
5858
5858
|
})}
|
|
5859
5859
|
|
|
5860
|
-
${
|
|
5860
|
+
${chunkEHSZ6TAN_cjs.renderConfirmationDialog({
|
|
5861
5861
|
id: "delete-content-confirm",
|
|
5862
5862
|
title: "Delete Content",
|
|
5863
5863
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -5868,7 +5868,7 @@ function renderContentFormPage(data) {
|
|
|
5868
5868
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
5869
5869
|
})}
|
|
5870
5870
|
|
|
5871
|
-
${
|
|
5871
|
+
${chunkEHSZ6TAN_cjs.getConfirmationDialogScript()}
|
|
5872
5872
|
|
|
5873
5873
|
${data.tinymceEnabled ? getTinyMCEScript(data.tinymceSettings?.apiKey) : "<!-- TinyMCE plugin not active -->"}
|
|
5874
5874
|
|
|
@@ -6473,11 +6473,11 @@ function renderContentFormPage(data) {
|
|
|
6473
6473
|
content: pageContent,
|
|
6474
6474
|
version: data.version
|
|
6475
6475
|
};
|
|
6476
|
-
return
|
|
6476
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
6477
6477
|
}
|
|
6478
6478
|
|
|
6479
6479
|
// src/templates/pages/admin-content-list.template.ts
|
|
6480
|
-
|
|
6480
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
6481
6481
|
function renderContentListPage(data) {
|
|
6482
6482
|
const urlParams = new URLSearchParams();
|
|
6483
6483
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -6881,8 +6881,8 @@ function renderContentListPage(data) {
|
|
|
6881
6881
|
|
|
6882
6882
|
<!-- Content List -->
|
|
6883
6883
|
<div id="content-list">
|
|
6884
|
-
${
|
|
6885
|
-
${
|
|
6884
|
+
${chunkEHSZ6TAN_cjs.renderTable(tableData)}
|
|
6885
|
+
${chunkEHSZ6TAN_cjs.renderPagination(paginationData)}
|
|
6886
6886
|
</div>
|
|
6887
6887
|
|
|
6888
6888
|
</div>
|
|
@@ -6970,8 +6970,9 @@ function renderContentListPage(data) {
|
|
|
6970
6970
|
});
|
|
6971
6971
|
|
|
6972
6972
|
// Store current bulk action context
|
|
6973
|
-
let
|
|
6974
|
-
|
|
6973
|
+
// Using var instead of let to avoid redeclaration errors when HTMX re-executes script tags
|
|
6974
|
+
var currentBulkAction = null;
|
|
6975
|
+
var currentSelectedIds = [];
|
|
6975
6976
|
|
|
6976
6977
|
// Perform bulk action
|
|
6977
6978
|
function performBulkAction(action) {
|
|
@@ -7091,7 +7092,7 @@ function renderContentListPage(data) {
|
|
|
7091
7092
|
</script>
|
|
7092
7093
|
|
|
7093
7094
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
7094
|
-
${
|
|
7095
|
+
${chunkEHSZ6TAN_cjs.renderConfirmationDialog({
|
|
7095
7096
|
id: "bulk-action-confirm",
|
|
7096
7097
|
title: "Confirm Bulk Action",
|
|
7097
7098
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -7103,7 +7104,7 @@ function renderContentListPage(data) {
|
|
|
7103
7104
|
})}
|
|
7104
7105
|
|
|
7105
7106
|
<!-- Confirmation Dialog Script -->
|
|
7106
|
-
${
|
|
7107
|
+
${chunkEHSZ6TAN_cjs.getConfirmationDialogScript()}
|
|
7107
7108
|
|
|
7108
7109
|
<!-- Advanced Search Modal -->
|
|
7109
7110
|
<div id="advancedSearchModal" class="hidden fixed inset-0 z-50 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
|
|
@@ -7248,8 +7249,9 @@ function renderContentListPage(data) {
|
|
|
7248
7249
|
}
|
|
7249
7250
|
|
|
7250
7251
|
// Autocomplete
|
|
7251
|
-
let
|
|
7252
|
-
|
|
7252
|
+
// Using var instead of let to avoid redeclaration errors when HTMX re-executes script tags
|
|
7253
|
+
var autocompleteTimeout;
|
|
7254
|
+
var searchQueryInput = document.getElementById('searchQuery');
|
|
7253
7255
|
if (searchQueryInput) {
|
|
7254
7256
|
searchQueryInput.addEventListener('input', (e) => {
|
|
7255
7257
|
const query = e.target.value.trim();
|
|
@@ -7296,7 +7298,7 @@ function renderContentListPage(data) {
|
|
|
7296
7298
|
});
|
|
7297
7299
|
|
|
7298
7300
|
// Form submission
|
|
7299
|
-
|
|
7301
|
+
var advancedSearchForm = document.getElementById('advancedSearchForm');
|
|
7300
7302
|
if (advancedSearchForm) {
|
|
7301
7303
|
advancedSearchForm.addEventListener('submit', async (e) => {
|
|
7302
7304
|
e.preventDefault();
|
|
@@ -7399,7 +7401,7 @@ function renderContentListPage(data) {
|
|
|
7399
7401
|
version: data.version,
|
|
7400
7402
|
content: pageContent
|
|
7401
7403
|
};
|
|
7402
|
-
return
|
|
7404
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7403
7405
|
}
|
|
7404
7406
|
|
|
7405
7407
|
// src/templates/components/version-history.template.ts
|
|
@@ -7597,9 +7599,9 @@ function parseFieldValue(field, formData, options = {}) {
|
|
|
7597
7599
|
const { skipValidation = false } = options;
|
|
7598
7600
|
const value = formData.get(field.field_name);
|
|
7599
7601
|
const errors = [];
|
|
7600
|
-
const blocksConfig =
|
|
7602
|
+
const blocksConfig = chunkMYB5RY7H_cjs.getBlocksFieldConfig(field.field_options);
|
|
7601
7603
|
if (blocksConfig) {
|
|
7602
|
-
const parsed =
|
|
7604
|
+
const parsed = chunkMYB5RY7H_cjs.parseBlocksValue(value, blocksConfig);
|
|
7603
7605
|
if (!skipValidation && field.is_required && parsed.value.length === 0) {
|
|
7604
7606
|
parsed.errors.push(`${field.field_label} is required`);
|
|
7605
7607
|
}
|
|
@@ -7709,7 +7711,7 @@ function extractFieldData(fields, formData, options = {}) {
|
|
|
7709
7711
|
}
|
|
7710
7712
|
return { data, errors };
|
|
7711
7713
|
}
|
|
7712
|
-
adminContentRoutes.use("*",
|
|
7714
|
+
adminContentRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
7713
7715
|
async function getCollectionFields(db, collectionId) {
|
|
7714
7716
|
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.collection);
|
|
7715
7717
|
return cache.getOrSet(
|
|
@@ -8840,7 +8842,7 @@ ${JSON.stringify(data, null, 2)}
|
|
|
8840
8842
|
var admin_content_default = adminContentRoutes;
|
|
8841
8843
|
|
|
8842
8844
|
// src/templates/pages/admin-profile.template.ts
|
|
8843
|
-
|
|
8845
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
8844
8846
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
8845
8847
|
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">
|
|
8846
8848
|
${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>`}
|
|
@@ -8860,8 +8862,8 @@ function renderProfilePage(data) {
|
|
|
8860
8862
|
</div>
|
|
8861
8863
|
|
|
8862
8864
|
<!-- Alert Messages -->
|
|
8863
|
-
${data.error ?
|
|
8864
|
-
${data.success ?
|
|
8865
|
+
${data.error ? chunkEHSZ6TAN_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
8866
|
+
${data.success ? chunkEHSZ6TAN_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
8865
8867
|
|
|
8866
8868
|
<!-- Profile Form -->
|
|
8867
8869
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -9248,7 +9250,7 @@ function renderProfilePage(data) {
|
|
|
9248
9250
|
version: data.version,
|
|
9249
9251
|
content: pageContent
|
|
9250
9252
|
};
|
|
9251
|
-
return
|
|
9253
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
9252
9254
|
}
|
|
9253
9255
|
|
|
9254
9256
|
// src/templates/components/alert.template.ts
|
|
@@ -9531,7 +9533,7 @@ function renderActivityLogsPage(data) {
|
|
|
9531
9533
|
user: data.user,
|
|
9532
9534
|
content: pageContent
|
|
9533
9535
|
};
|
|
9534
|
-
return
|
|
9536
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayout(layoutData);
|
|
9535
9537
|
}
|
|
9536
9538
|
function getActionBadgeClass(action) {
|
|
9537
9539
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -9551,7 +9553,7 @@ function formatAction(action) {
|
|
|
9551
9553
|
}
|
|
9552
9554
|
|
|
9553
9555
|
// src/templates/pages/admin-user-edit.template.ts
|
|
9554
|
-
|
|
9556
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
9555
9557
|
|
|
9556
9558
|
// src/templates/components/confirmation-dialog.template.ts
|
|
9557
9559
|
function renderConfirmationDialog2(options) {
|
|
@@ -9672,8 +9674,8 @@ function renderUserEditPage(data) {
|
|
|
9672
9674
|
|
|
9673
9675
|
<!-- Alert Messages -->
|
|
9674
9676
|
<div id="form-messages">
|
|
9675
|
-
${data.error ?
|
|
9676
|
-
${data.success ?
|
|
9677
|
+
${data.error ? chunkEHSZ6TAN_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
9678
|
+
${data.success ? chunkEHSZ6TAN_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
9677
9679
|
</div>
|
|
9678
9680
|
|
|
9679
9681
|
<!-- User Edit Form -->
|
|
@@ -9692,7 +9694,7 @@ function renderUserEditPage(data) {
|
|
|
9692
9694
|
<input
|
|
9693
9695
|
type="text"
|
|
9694
9696
|
name="first_name"
|
|
9695
|
-
value="${
|
|
9697
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.firstName || "")}"
|
|
9696
9698
|
required
|
|
9697
9699
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9698
9700
|
/>
|
|
@@ -9703,7 +9705,7 @@ function renderUserEditPage(data) {
|
|
|
9703
9705
|
<input
|
|
9704
9706
|
type="text"
|
|
9705
9707
|
name="last_name"
|
|
9706
|
-
value="${
|
|
9708
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.lastName || "")}"
|
|
9707
9709
|
required
|
|
9708
9710
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9709
9711
|
/>
|
|
@@ -9714,7 +9716,7 @@ function renderUserEditPage(data) {
|
|
|
9714
9716
|
<input
|
|
9715
9717
|
type="text"
|
|
9716
9718
|
name="username"
|
|
9717
|
-
value="${
|
|
9719
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.username || "")}"
|
|
9718
9720
|
required
|
|
9719
9721
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9720
9722
|
/>
|
|
@@ -9725,7 +9727,7 @@ function renderUserEditPage(data) {
|
|
|
9725
9727
|
<input
|
|
9726
9728
|
type="email"
|
|
9727
9729
|
name="email"
|
|
9728
|
-
value="${
|
|
9730
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.email || "")}"
|
|
9729
9731
|
required
|
|
9730
9732
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9731
9733
|
/>
|
|
@@ -9736,7 +9738,7 @@ function renderUserEditPage(data) {
|
|
|
9736
9738
|
<input
|
|
9737
9739
|
type="tel"
|
|
9738
9740
|
name="phone"
|
|
9739
|
-
value="${
|
|
9741
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.phone || "")}"
|
|
9740
9742
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9741
9743
|
/>
|
|
9742
9744
|
</div>
|
|
@@ -9750,7 +9752,7 @@ function renderUserEditPage(data) {
|
|
|
9750
9752
|
class="col-start-1 row-start-1 w-full appearance-none rounded-md bg-white/5 dark:bg-white/5 py-1.5 pl-3 pr-8 text-base text-zinc-950 dark:text-white outline outline-1 -outline-offset-1 outline-zinc-500/30 dark:outline-zinc-400/30 *:bg-white dark:*:bg-zinc-800 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-zinc-500 dark:focus-visible:outline-zinc-400 sm:text-sm/6"
|
|
9751
9753
|
>
|
|
9752
9754
|
${data.roles.map((role) => `
|
|
9753
|
-
<option value="${
|
|
9755
|
+
<option value="${chunkMYB5RY7H_cjs.escapeHtml(role.value)}" ${data.userToEdit.role === role.value ? "selected" : ""}>${chunkMYB5RY7H_cjs.escapeHtml(role.label)}</option>
|
|
9754
9756
|
`).join("")}
|
|
9755
9757
|
</select>
|
|
9756
9758
|
<svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-zinc-600 dark:text-zinc-400 sm:size-4">
|
|
@@ -9771,7 +9773,7 @@ function renderUserEditPage(data) {
|
|
|
9771
9773
|
<input
|
|
9772
9774
|
type="text"
|
|
9773
9775
|
name="profile_display_name"
|
|
9774
|
-
value="${
|
|
9776
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.profile?.displayName || "")}"
|
|
9775
9777
|
placeholder="Public display name"
|
|
9776
9778
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9777
9779
|
/>
|
|
@@ -9782,7 +9784,7 @@ function renderUserEditPage(data) {
|
|
|
9782
9784
|
<input
|
|
9783
9785
|
type="text"
|
|
9784
9786
|
name="profile_company"
|
|
9785
|
-
value="${
|
|
9787
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.profile?.company || "")}"
|
|
9786
9788
|
placeholder="Company or organization"
|
|
9787
9789
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9788
9790
|
/>
|
|
@@ -9793,7 +9795,7 @@ function renderUserEditPage(data) {
|
|
|
9793
9795
|
<input
|
|
9794
9796
|
type="text"
|
|
9795
9797
|
name="profile_job_title"
|
|
9796
|
-
value="${
|
|
9798
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.profile?.jobTitle || "")}"
|
|
9797
9799
|
placeholder="Job title or role"
|
|
9798
9800
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9799
9801
|
/>
|
|
@@ -9804,7 +9806,7 @@ function renderUserEditPage(data) {
|
|
|
9804
9806
|
<input
|
|
9805
9807
|
type="url"
|
|
9806
9808
|
name="profile_website"
|
|
9807
|
-
value="${
|
|
9809
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.profile?.website || "")}"
|
|
9808
9810
|
placeholder="https://example.com"
|
|
9809
9811
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9810
9812
|
/>
|
|
@@ -9815,7 +9817,7 @@ function renderUserEditPage(data) {
|
|
|
9815
9817
|
<input
|
|
9816
9818
|
type="text"
|
|
9817
9819
|
name="profile_location"
|
|
9818
|
-
value="${
|
|
9820
|
+
value="${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.profile?.location || "")}"
|
|
9819
9821
|
placeholder="City, Country"
|
|
9820
9822
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9821
9823
|
/>
|
|
@@ -9839,7 +9841,7 @@ function renderUserEditPage(data) {
|
|
|
9839
9841
|
rows="3"
|
|
9840
9842
|
placeholder="Short bio or description"
|
|
9841
9843
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
9842
|
-
>${
|
|
9844
|
+
>${chunkMYB5RY7H_cjs.escapeHtml(data.userToEdit.profile?.bio || "")}</textarea>
|
|
9843
9845
|
</div>
|
|
9844
9846
|
</div>
|
|
9845
9847
|
|
|
@@ -10039,11 +10041,11 @@ function renderUserEditPage(data) {
|
|
|
10039
10041
|
user: data.user,
|
|
10040
10042
|
content: pageContent
|
|
10041
10043
|
};
|
|
10042
|
-
return
|
|
10044
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
10043
10045
|
}
|
|
10044
10046
|
|
|
10045
10047
|
// src/templates/pages/admin-user-new.template.ts
|
|
10046
|
-
|
|
10048
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
10047
10049
|
function renderUserNewPage(data) {
|
|
10048
10050
|
const pageContent = `
|
|
10049
10051
|
<div>
|
|
@@ -10082,8 +10084,8 @@ function renderUserNewPage(data) {
|
|
|
10082
10084
|
|
|
10083
10085
|
<!-- Alert Messages -->
|
|
10084
10086
|
<div id="form-messages">
|
|
10085
|
-
${data.error ?
|
|
10086
|
-
${data.success ?
|
|
10087
|
+
${data.error ? chunkEHSZ6TAN_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
10088
|
+
${data.success ? chunkEHSZ6TAN_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
10087
10089
|
</div>
|
|
10088
10090
|
|
|
10089
10091
|
<!-- User New Form -->
|
|
@@ -10327,11 +10329,11 @@ function renderUserNewPage(data) {
|
|
|
10327
10329
|
user: data.user,
|
|
10328
10330
|
content: pageContent
|
|
10329
10331
|
};
|
|
10330
|
-
return
|
|
10332
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
10331
10333
|
}
|
|
10332
10334
|
|
|
10333
10335
|
// src/templates/pages/admin-users-list.template.ts
|
|
10334
|
-
|
|
10336
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
10335
10337
|
function renderUsersListPage(data) {
|
|
10336
10338
|
const columns = [
|
|
10337
10339
|
{
|
|
@@ -10482,8 +10484,8 @@ function renderUsersListPage(data) {
|
|
|
10482
10484
|
</div>
|
|
10483
10485
|
|
|
10484
10486
|
<!-- Alert Messages -->
|
|
10485
|
-
${data.error ?
|
|
10486
|
-
${data.success ?
|
|
10487
|
+
${data.error ? chunkEHSZ6TAN_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
10488
|
+
${data.success ? chunkEHSZ6TAN_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
10487
10489
|
|
|
10488
10490
|
<!-- Stats -->
|
|
10489
10491
|
<div class="mb-6">
|
|
@@ -10660,10 +10662,10 @@ function renderUsersListPage(data) {
|
|
|
10660
10662
|
</div>
|
|
10661
10663
|
|
|
10662
10664
|
<!-- Users Table -->
|
|
10663
|
-
${
|
|
10665
|
+
${chunkEHSZ6TAN_cjs.renderTable(tableData)}
|
|
10664
10666
|
|
|
10665
10667
|
<!-- Pagination -->
|
|
10666
|
-
${data.pagination ?
|
|
10668
|
+
${data.pagination ? chunkEHSZ6TAN_cjs.renderPagination(data.pagination) : ""}
|
|
10667
10669
|
</div>
|
|
10668
10670
|
|
|
10669
10671
|
<script>
|
|
@@ -10734,12 +10736,12 @@ function renderUsersListPage(data) {
|
|
|
10734
10736
|
version: data.version,
|
|
10735
10737
|
content: pageContent
|
|
10736
10738
|
};
|
|
10737
|
-
return
|
|
10739
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
10738
10740
|
}
|
|
10739
10741
|
|
|
10740
10742
|
// src/routes/admin-users.ts
|
|
10741
10743
|
var userRoutes = new hono.Hono();
|
|
10742
|
-
userRoutes.use("*",
|
|
10744
|
+
userRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
10743
10745
|
userRoutes.get("/", (c) => {
|
|
10744
10746
|
return c.redirect("/admin/dashboard");
|
|
10745
10747
|
});
|
|
@@ -10838,12 +10840,12 @@ userRoutes.put("/profile", async (c) => {
|
|
|
10838
10840
|
const db = c.env.DB;
|
|
10839
10841
|
try {
|
|
10840
10842
|
const formData = await c.req.formData();
|
|
10841
|
-
const firstName =
|
|
10842
|
-
const lastName =
|
|
10843
|
-
const username =
|
|
10843
|
+
const firstName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
10844
|
+
const lastName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
10845
|
+
const username = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
10844
10846
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
10845
|
-
const phone =
|
|
10846
|
-
const bio =
|
|
10847
|
+
const phone = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
10848
|
+
const bio = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
10847
10849
|
const timezone = formData.get("timezone")?.toString() || "UTC";
|
|
10848
10850
|
const language = formData.get("language")?.toString() || "en";
|
|
10849
10851
|
const emailNotifications = formData.get("email_notifications") === "1";
|
|
@@ -10894,7 +10896,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
10894
10896
|
Date.now(),
|
|
10895
10897
|
user.userId
|
|
10896
10898
|
).run();
|
|
10897
|
-
await
|
|
10899
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
10898
10900
|
db,
|
|
10899
10901
|
user.userId,
|
|
10900
10902
|
"profile.update",
|
|
@@ -10957,7 +10959,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
10957
10959
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
10958
10960
|
`);
|
|
10959
10961
|
const userData = await userStmt.bind(user.userId).first();
|
|
10960
|
-
await
|
|
10962
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
10961
10963
|
db,
|
|
10962
10964
|
user.userId,
|
|
10963
10965
|
"profile.avatar_update",
|
|
@@ -11028,7 +11030,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
11028
11030
|
dismissible: true
|
|
11029
11031
|
}));
|
|
11030
11032
|
}
|
|
11031
|
-
const validPassword = await
|
|
11033
|
+
const validPassword = await chunkE2BXLXPW_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
11032
11034
|
if (!validPassword) {
|
|
11033
11035
|
return c.html(renderAlert2({
|
|
11034
11036
|
type: "error",
|
|
@@ -11036,7 +11038,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
11036
11038
|
dismissible: true
|
|
11037
11039
|
}));
|
|
11038
11040
|
}
|
|
11039
|
-
const newPasswordHash = await
|
|
11041
|
+
const newPasswordHash = await chunkE2BXLXPW_cjs.AuthManager.hashPassword(newPassword);
|
|
11040
11042
|
const historyStmt = db.prepare(`
|
|
11041
11043
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
11042
11044
|
VALUES (?, ?, ?, ?)
|
|
@@ -11052,7 +11054,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
11052
11054
|
WHERE id = ?
|
|
11053
11055
|
`);
|
|
11054
11056
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
11055
|
-
await
|
|
11057
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11056
11058
|
db,
|
|
11057
11059
|
user.userId,
|
|
11058
11060
|
"profile.password_change",
|
|
@@ -11119,7 +11121,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
11119
11121
|
`);
|
|
11120
11122
|
const countResult = await countStmt.bind(...params).first();
|
|
11121
11123
|
const totalUsers = countResult?.total || 0;
|
|
11122
|
-
await
|
|
11124
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11123
11125
|
db,
|
|
11124
11126
|
user.userId,
|
|
11125
11127
|
"users.list_view",
|
|
@@ -11221,12 +11223,12 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
11221
11223
|
const user = c.get("user");
|
|
11222
11224
|
try {
|
|
11223
11225
|
const formData = await c.req.formData();
|
|
11224
|
-
const firstName =
|
|
11225
|
-
const lastName =
|
|
11226
|
-
const username =
|
|
11226
|
+
const firstName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
11227
|
+
const lastName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
11228
|
+
const username = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
11227
11229
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
11228
|
-
const phone =
|
|
11229
|
-
const bio =
|
|
11230
|
+
const phone = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
11231
|
+
const bio = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
11230
11232
|
const role = formData.get("role")?.toString() || "viewer";
|
|
11231
11233
|
const password = formData.get("password")?.toString() || "";
|
|
11232
11234
|
const confirmPassword = formData.get("confirm_password")?.toString() || "";
|
|
@@ -11273,7 +11275,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
11273
11275
|
dismissible: true
|
|
11274
11276
|
}));
|
|
11275
11277
|
}
|
|
11276
|
-
const passwordHash = await
|
|
11278
|
+
const passwordHash = await chunkE2BXLXPW_cjs.AuthManager.hashPassword(password);
|
|
11277
11279
|
const userId = crypto.randomUUID();
|
|
11278
11280
|
const createStmt = db.prepare(`
|
|
11279
11281
|
INSERT INTO users (
|
|
@@ -11296,7 +11298,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
11296
11298
|
Date.now(),
|
|
11297
11299
|
Date.now()
|
|
11298
11300
|
).run();
|
|
11299
|
-
await
|
|
11301
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11300
11302
|
db,
|
|
11301
11303
|
user.userId,
|
|
11302
11304
|
"user!.create",
|
|
@@ -11334,7 +11336,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
11334
11336
|
if (!userRecord) {
|
|
11335
11337
|
return c.json({ error: "User not found" }, 404);
|
|
11336
11338
|
}
|
|
11337
|
-
await
|
|
11339
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11338
11340
|
db,
|
|
11339
11341
|
user.userId,
|
|
11340
11342
|
"user!.view",
|
|
@@ -11442,20 +11444,20 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
11442
11444
|
const userId = c.req.param("id");
|
|
11443
11445
|
try {
|
|
11444
11446
|
const formData = await c.req.formData();
|
|
11445
|
-
const firstName =
|
|
11446
|
-
const lastName =
|
|
11447
|
-
const username =
|
|
11447
|
+
const firstName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
11448
|
+
const lastName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
11449
|
+
const username = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
11448
11450
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
11449
|
-
const phone =
|
|
11451
|
+
const phone = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
11450
11452
|
const role = formData.get("role")?.toString() || "viewer";
|
|
11451
11453
|
const isActive = formData.get("is_active") === "1";
|
|
11452
11454
|
const emailVerified = formData.get("email_verified") === "1";
|
|
11453
|
-
const profileDisplayName =
|
|
11454
|
-
const profileBio =
|
|
11455
|
-
const profileCompany =
|
|
11456
|
-
const profileJobTitle =
|
|
11455
|
+
const profileDisplayName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("profile_display_name")?.toString()) || null;
|
|
11456
|
+
const profileBio = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("profile_bio")?.toString()) || null;
|
|
11457
|
+
const profileCompany = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("profile_company")?.toString()) || null;
|
|
11458
|
+
const profileJobTitle = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("profile_job_title")?.toString()) || null;
|
|
11457
11459
|
const profileWebsite = formData.get("profile_website")?.toString()?.trim() || null;
|
|
11458
|
-
const profileLocation =
|
|
11460
|
+
const profileLocation = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("profile_location")?.toString()) || null;
|
|
11459
11461
|
const profileDateOfBirthStr = formData.get("profile_date_of_birth")?.toString()?.trim() || null;
|
|
11460
11462
|
const profileDateOfBirth = profileDateOfBirthStr ? new Date(profileDateOfBirthStr).getTime() : null;
|
|
11461
11463
|
if (!firstName || !lastName || !username || !email) {
|
|
@@ -11559,7 +11561,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
11559
11561
|
).run();
|
|
11560
11562
|
}
|
|
11561
11563
|
}
|
|
11562
|
-
await
|
|
11564
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11563
11565
|
db,
|
|
11564
11566
|
user.userId,
|
|
11565
11567
|
"user.update",
|
|
@@ -11604,7 +11606,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
|
|
|
11604
11606
|
UPDATE users SET is_active = ?, updated_at = ? WHERE id = ?
|
|
11605
11607
|
`);
|
|
11606
11608
|
await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
|
|
11607
|
-
await
|
|
11609
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11608
11610
|
db,
|
|
11609
11611
|
user.userId,
|
|
11610
11612
|
active ? "user.activate" : "user.deactivate",
|
|
@@ -11645,7 +11647,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
11645
11647
|
DELETE FROM users WHERE id = ?
|
|
11646
11648
|
`);
|
|
11647
11649
|
await deleteStmt.bind(userId).run();
|
|
11648
|
-
await
|
|
11650
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11649
11651
|
db,
|
|
11650
11652
|
user.userId,
|
|
11651
11653
|
"user!.hard_delete",
|
|
@@ -11664,7 +11666,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
11664
11666
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
11665
11667
|
`);
|
|
11666
11668
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
11667
|
-
await
|
|
11669
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11668
11670
|
db,
|
|
11669
11671
|
user.userId,
|
|
11670
11672
|
"user!.soft_delete",
|
|
@@ -11691,8 +11693,8 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
11691
11693
|
const formData = await c.req.formData();
|
|
11692
11694
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
11693
11695
|
const role = formData.get("role")?.toString()?.trim() || "viewer";
|
|
11694
|
-
const firstName =
|
|
11695
|
-
const lastName =
|
|
11696
|
+
const firstName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
11697
|
+
const lastName = chunkMYB5RY7H_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
11696
11698
|
if (!email || !firstName || !lastName) {
|
|
11697
11699
|
return c.json({ error: "Email, first name, and last name are required" }, 400);
|
|
11698
11700
|
}
|
|
@@ -11730,7 +11732,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
11730
11732
|
Date.now(),
|
|
11731
11733
|
Date.now()
|
|
11732
11734
|
).run();
|
|
11733
|
-
await
|
|
11735
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11734
11736
|
db,
|
|
11735
11737
|
user.userId,
|
|
11736
11738
|
"user!.invite_sent",
|
|
@@ -11787,7 +11789,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
11787
11789
|
Date.now(),
|
|
11788
11790
|
userId
|
|
11789
11791
|
).run();
|
|
11790
|
-
await
|
|
11792
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11791
11793
|
db,
|
|
11792
11794
|
user.userId,
|
|
11793
11795
|
"user!.invitation_resent",
|
|
@@ -11823,7 +11825,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
11823
11825
|
}
|
|
11824
11826
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
11825
11827
|
await deleteStmt.bind(userId).run();
|
|
11826
|
-
await
|
|
11828
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11827
11829
|
db,
|
|
11828
11830
|
user.userId,
|
|
11829
11831
|
"user!.invitation_cancelled",
|
|
@@ -11906,7 +11908,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
11906
11908
|
...log,
|
|
11907
11909
|
details: log.details ? JSON.parse(log.details) : null
|
|
11908
11910
|
}));
|
|
11909
|
-
await
|
|
11911
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
11910
11912
|
db,
|
|
11911
11913
|
user.userId,
|
|
11912
11914
|
"activity.logs_viewed",
|
|
@@ -12013,7 +12015,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
12013
12015
|
csvRows.push(row.join(","));
|
|
12014
12016
|
}
|
|
12015
12017
|
const csvContent = csvRows.join("\n");
|
|
12016
|
-
await
|
|
12018
|
+
await chunkE2BXLXPW_cjs.logActivity(
|
|
12017
12019
|
db,
|
|
12018
12020
|
user.userId,
|
|
12019
12021
|
"activity.logs_exported",
|
|
@@ -12231,7 +12233,7 @@ function getFileIcon(mimeType) {
|
|
|
12231
12233
|
}
|
|
12232
12234
|
|
|
12233
12235
|
// src/templates/pages/admin-media-library.template.ts
|
|
12234
|
-
|
|
12236
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
12235
12237
|
function renderMediaLibraryPage(data) {
|
|
12236
12238
|
const pageContent = `
|
|
12237
12239
|
<div>
|
|
@@ -13166,7 +13168,7 @@ function renderMediaLibraryPage(data) {
|
|
|
13166
13168
|
version: data.version,
|
|
13167
13169
|
content: pageContent
|
|
13168
13170
|
};
|
|
13169
|
-
return
|
|
13171
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
13170
13172
|
}
|
|
13171
13173
|
|
|
13172
13174
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -13352,7 +13354,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
13352
13354
|
// 50MB max
|
|
13353
13355
|
});
|
|
13354
13356
|
var adminMediaRoutes = new hono.Hono();
|
|
13355
|
-
adminMediaRoutes.use("*",
|
|
13357
|
+
adminMediaRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
13356
13358
|
adminMediaRoutes.get("/", async (c) => {
|
|
13357
13359
|
try {
|
|
13358
13360
|
const user = c.get("user");
|
|
@@ -13938,7 +13940,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
13938
13940
|
`);
|
|
13939
13941
|
}
|
|
13940
13942
|
});
|
|
13941
|
-
adminMediaRoutes.delete("/cleanup",
|
|
13943
|
+
adminMediaRoutes.delete("/cleanup", chunkE2BXLXPW_cjs.requireRole("admin"), async (c) => {
|
|
13942
13944
|
try {
|
|
13943
13945
|
const db = c.env.DB;
|
|
13944
13946
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -14188,7 +14190,7 @@ function formatFileSize(bytes) {
|
|
|
14188
14190
|
}
|
|
14189
14191
|
|
|
14190
14192
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
14191
|
-
|
|
14193
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
14192
14194
|
function renderPluginsListPage(data) {
|
|
14193
14195
|
const categories = [
|
|
14194
14196
|
{ value: "content", label: "Content Management" },
|
|
@@ -14668,7 +14670,7 @@ function renderPluginsListPage(data) {
|
|
|
14668
14670
|
version: data.version,
|
|
14669
14671
|
content: pageContent
|
|
14670
14672
|
};
|
|
14671
|
-
return
|
|
14673
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
14672
14674
|
}
|
|
14673
14675
|
function renderPluginCard(plugin) {
|
|
14674
14676
|
const statusColors = {
|
|
@@ -15323,7 +15325,7 @@ function renderPluginSettingsPage(data) {
|
|
|
15323
15325
|
user,
|
|
15324
15326
|
content: pageContent
|
|
15325
15327
|
};
|
|
15326
|
-
return
|
|
15328
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayout(layoutData);
|
|
15327
15329
|
}
|
|
15328
15330
|
function renderStatusBadge(status) {
|
|
15329
15331
|
const statusColors = {
|
|
@@ -15664,7 +15666,7 @@ function formatTimestamp(timestamp) {
|
|
|
15664
15666
|
|
|
15665
15667
|
// src/routes/admin-plugins.ts
|
|
15666
15668
|
var adminPluginRoutes = new hono.Hono();
|
|
15667
|
-
adminPluginRoutes.use("*",
|
|
15669
|
+
adminPluginRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
15668
15670
|
var AVAILABLE_PLUGINS = [
|
|
15669
15671
|
{
|
|
15670
15672
|
id: "third-party-faq",
|
|
@@ -16263,7 +16265,7 @@ function formatLastUpdated(timestamp) {
|
|
|
16263
16265
|
}
|
|
16264
16266
|
|
|
16265
16267
|
// src/templates/pages/admin-logs-list.template.ts
|
|
16266
|
-
|
|
16268
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
16267
16269
|
function renderLogsListPage(data) {
|
|
16268
16270
|
const { logs, pagination, filters, user } = data;
|
|
16269
16271
|
const content = `
|
|
@@ -16574,7 +16576,7 @@ function renderLogsListPage(data) {
|
|
|
16574
16576
|
user,
|
|
16575
16577
|
content
|
|
16576
16578
|
};
|
|
16577
|
-
return
|
|
16579
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
16578
16580
|
}
|
|
16579
16581
|
function renderLogDetailsPage(data) {
|
|
16580
16582
|
const { log, user } = data;
|
|
@@ -16786,7 +16788,7 @@ function renderLogDetailsPage(data) {
|
|
|
16786
16788
|
</div>
|
|
16787
16789
|
</div>
|
|
16788
16790
|
`;
|
|
16789
|
-
return
|
|
16791
|
+
return chunkEHSZ6TAN_cjs.adminLayoutV2({
|
|
16790
16792
|
title: `Log Details - ${log.id}`,
|
|
16791
16793
|
user,
|
|
16792
16794
|
content
|
|
@@ -17029,7 +17031,7 @@ function renderLogConfigPage(data) {
|
|
|
17029
17031
|
|
|
17030
17032
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
17031
17033
|
`;
|
|
17032
|
-
return
|
|
17034
|
+
return chunkEHSZ6TAN_cjs.adminLayoutV2({
|
|
17033
17035
|
title: "Log Configuration",
|
|
17034
17036
|
user,
|
|
17035
17037
|
content
|
|
@@ -17038,7 +17040,7 @@ function renderLogConfigPage(data) {
|
|
|
17038
17040
|
|
|
17039
17041
|
// src/routes/admin-logs.ts
|
|
17040
17042
|
var adminLogsRoutes = new hono.Hono();
|
|
17041
|
-
adminLogsRoutes.use("*",
|
|
17043
|
+
adminLogsRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
17042
17044
|
adminLogsRoutes.get("/", async (c) => {
|
|
17043
17045
|
try {
|
|
17044
17046
|
const user = c.get("user");
|
|
@@ -17410,7 +17412,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
17410
17412
|
role: user.role
|
|
17411
17413
|
} : void 0
|
|
17412
17414
|
};
|
|
17413
|
-
return c.html(
|
|
17415
|
+
return c.html(chunkEHSZ6TAN_cjs.renderDesignPage(pageData));
|
|
17414
17416
|
});
|
|
17415
17417
|
var adminCheckboxRoutes = new hono.Hono();
|
|
17416
17418
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -17422,7 +17424,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
17422
17424
|
role: user.role
|
|
17423
17425
|
} : void 0
|
|
17424
17426
|
};
|
|
17425
|
-
return c.html(
|
|
17427
|
+
return c.html(chunkEHSZ6TAN_cjs.renderCheckboxPage(pageData));
|
|
17426
17428
|
});
|
|
17427
17429
|
|
|
17428
17430
|
// src/templates/pages/admin-testimonials-form.template.ts
|
|
@@ -17450,7 +17452,7 @@ function renderTestimonialsForm(data) {
|
|
|
17450
17452
|
</div>
|
|
17451
17453
|
</div>
|
|
17452
17454
|
|
|
17453
|
-
${message ?
|
|
17455
|
+
${message ? chunkEHSZ6TAN_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
17454
17456
|
|
|
17455
17457
|
<!-- Form -->
|
|
17456
17458
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -17679,7 +17681,7 @@ function renderTestimonialsForm(data) {
|
|
|
17679
17681
|
user: data.user,
|
|
17680
17682
|
content: pageContent
|
|
17681
17683
|
};
|
|
17682
|
-
return
|
|
17684
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayout(layoutData);
|
|
17683
17685
|
}
|
|
17684
17686
|
function escapeHtml4(unsafe) {
|
|
17685
17687
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -17705,7 +17707,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
17705
17707
|
const offset = (currentPage - 1) * limit;
|
|
17706
17708
|
const db = c.env?.DB;
|
|
17707
17709
|
if (!db) {
|
|
17708
|
-
return c.html(
|
|
17710
|
+
return c.html(chunkEHSZ6TAN_cjs.renderTestimonialsList({
|
|
17709
17711
|
testimonials: [],
|
|
17710
17712
|
totalCount: 0,
|
|
17711
17713
|
currentPage: 1,
|
|
@@ -17745,7 +17747,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
17745
17747
|
`;
|
|
17746
17748
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
17747
17749
|
const totalPages = Math.ceil(totalCount / limit);
|
|
17748
|
-
return c.html(
|
|
17750
|
+
return c.html(chunkEHSZ6TAN_cjs.renderTestimonialsList({
|
|
17749
17751
|
testimonials: testimonials || [],
|
|
17750
17752
|
totalCount,
|
|
17751
17753
|
currentPage,
|
|
@@ -17759,7 +17761,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
17759
17761
|
} catch (error) {
|
|
17760
17762
|
console.error("Error fetching testimonials:", error);
|
|
17761
17763
|
const user = c.get("user");
|
|
17762
|
-
return c.html(
|
|
17764
|
+
return c.html(chunkEHSZ6TAN_cjs.renderTestimonialsList({
|
|
17763
17765
|
testimonials: [],
|
|
17764
17766
|
totalCount: 0,
|
|
17765
17767
|
currentPage: 1,
|
|
@@ -18078,7 +18080,7 @@ function renderCodeExamplesForm(data) {
|
|
|
18078
18080
|
</div>
|
|
18079
18081
|
</div>
|
|
18080
18082
|
|
|
18081
|
-
${message ?
|
|
18083
|
+
${message ? chunkEHSZ6TAN_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
18082
18084
|
|
|
18083
18085
|
<!-- Form -->
|
|
18084
18086
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -18348,7 +18350,7 @@ function renderCodeExamplesForm(data) {
|
|
|
18348
18350
|
user: data.user,
|
|
18349
18351
|
content: pageContent
|
|
18350
18352
|
};
|
|
18351
|
-
return
|
|
18353
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayout(layoutData);
|
|
18352
18354
|
}
|
|
18353
18355
|
function escapeHtml5(unsafe) {
|
|
18354
18356
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -18375,7 +18377,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
18375
18377
|
const offset = (currentPage - 1) * limit;
|
|
18376
18378
|
const db = c.env?.DB;
|
|
18377
18379
|
if (!db) {
|
|
18378
|
-
return c.html(
|
|
18380
|
+
return c.html(chunkEHSZ6TAN_cjs.renderCodeExamplesList({
|
|
18379
18381
|
codeExamples: [],
|
|
18380
18382
|
totalCount: 0,
|
|
18381
18383
|
currentPage: 1,
|
|
@@ -18415,7 +18417,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
18415
18417
|
`;
|
|
18416
18418
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
18417
18419
|
const totalPages = Math.ceil(totalCount / limit);
|
|
18418
|
-
return c.html(
|
|
18420
|
+
return c.html(chunkEHSZ6TAN_cjs.renderCodeExamplesList({
|
|
18419
18421
|
codeExamples: codeExamples || [],
|
|
18420
18422
|
totalCount,
|
|
18421
18423
|
currentPage,
|
|
@@ -18429,7 +18431,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
18429
18431
|
} catch (error) {
|
|
18430
18432
|
console.error("Error fetching code examples:", error);
|
|
18431
18433
|
const user = c.get("user");
|
|
18432
|
-
return c.html(
|
|
18434
|
+
return c.html(chunkEHSZ6TAN_cjs.renderCodeExamplesList({
|
|
18433
18435
|
codeExamples: [],
|
|
18434
18436
|
totalCount: 0,
|
|
18435
18437
|
currentPage: 1,
|
|
@@ -18818,7 +18820,7 @@ function renderDashboardPage(data) {
|
|
|
18818
18820
|
version: data.version,
|
|
18819
18821
|
content: pageContent
|
|
18820
18822
|
};
|
|
18821
|
-
return
|
|
18823
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayout(layoutData);
|
|
18822
18824
|
}
|
|
18823
18825
|
function renderStatsCards(stats) {
|
|
18824
18826
|
const cards = [
|
|
@@ -19366,9 +19368,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
19366
19368
|
}
|
|
19367
19369
|
|
|
19368
19370
|
// src/routes/admin-dashboard.ts
|
|
19369
|
-
var VERSION =
|
|
19371
|
+
var VERSION = chunkMYB5RY7H_cjs.getCoreVersion();
|
|
19370
19372
|
var router = new hono.Hono();
|
|
19371
|
-
router.use("*",
|
|
19373
|
+
router.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
19372
19374
|
router.get("/", async (c) => {
|
|
19373
19375
|
const user = c.get("user");
|
|
19374
19376
|
try {
|
|
@@ -19593,7 +19595,7 @@ router.get("/system-status", async (c) => {
|
|
|
19593
19595
|
});
|
|
19594
19596
|
|
|
19595
19597
|
// src/templates/pages/admin-collections-list.template.ts
|
|
19596
|
-
|
|
19598
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
19597
19599
|
|
|
19598
19600
|
// src/templates/components/table.template.ts
|
|
19599
19601
|
function renderTable2(data) {
|
|
@@ -20067,11 +20069,11 @@ function renderCollectionsListPage(data) {
|
|
|
20067
20069
|
version: data.version,
|
|
20068
20070
|
content: pageContent
|
|
20069
20071
|
};
|
|
20070
|
-
return
|
|
20072
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
20071
20073
|
}
|
|
20072
20074
|
|
|
20073
20075
|
// src/templates/pages/admin-collections-form.template.ts
|
|
20074
|
-
|
|
20076
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
20075
20077
|
function getFieldTypeBadge(fieldType) {
|
|
20076
20078
|
const typeLabels = {
|
|
20077
20079
|
"text": "Text",
|
|
@@ -20082,7 +20084,8 @@ function getFieldTypeBadge(fieldType) {
|
|
|
20082
20084
|
"boolean": "Boolean",
|
|
20083
20085
|
"date": "Date",
|
|
20084
20086
|
"select": "Select",
|
|
20085
|
-
"media": "Media"
|
|
20087
|
+
"media": "Media",
|
|
20088
|
+
"reference": "Reference"
|
|
20086
20089
|
};
|
|
20087
20090
|
const typeColors = {
|
|
20088
20091
|
"text": "bg-blue-500/10 dark:bg-blue-400/10 text-blue-700 dark:text-blue-300 ring-blue-500/20 dark:ring-blue-400/20",
|
|
@@ -20093,7 +20096,8 @@ function getFieldTypeBadge(fieldType) {
|
|
|
20093
20096
|
"boolean": "bg-amber-500/10 dark:bg-amber-400/10 text-amber-700 dark:text-amber-300 ring-amber-500/20 dark:ring-amber-400/20",
|
|
20094
20097
|
"date": "bg-cyan-500/10 dark:bg-cyan-400/10 text-cyan-700 dark:text-cyan-300 ring-cyan-500/20 dark:ring-cyan-400/20",
|
|
20095
20098
|
"select": "bg-indigo-500/10 dark:bg-indigo-400/10 text-indigo-700 dark:text-indigo-300 ring-indigo-500/20 dark:ring-indigo-400/20",
|
|
20096
|
-
"media": "bg-rose-500/10 dark:bg-rose-400/10 text-rose-700 dark:text-rose-300 ring-rose-500/20 dark:ring-rose-400/20"
|
|
20099
|
+
"media": "bg-rose-500/10 dark:bg-rose-400/10 text-rose-700 dark:text-rose-300 ring-rose-500/20 dark:ring-rose-400/20",
|
|
20100
|
+
"reference": "bg-teal-500/10 dark:bg-teal-400/10 text-teal-700 dark:text-teal-300 ring-teal-500/20 dark:ring-teal-400/20"
|
|
20097
20101
|
};
|
|
20098
20102
|
const label = typeLabels[fieldType] || fieldType;
|
|
20099
20103
|
const color = typeColors[fieldType] || "bg-zinc-500/10 dark:bg-zinc-400/10 text-zinc-700 dark:text-zinc-300 ring-zinc-500/20 dark:ring-zinc-400/20";
|
|
@@ -20332,7 +20336,7 @@ function renderCollectionFormPage(data) {
|
|
|
20332
20336
|
}
|
|
20333
20337
|
</style>
|
|
20334
20338
|
|
|
20335
|
-
${
|
|
20339
|
+
${chunkEHSZ6TAN_cjs.renderForm(formData)}
|
|
20336
20340
|
|
|
20337
20341
|
${isEdit && data.managed ? `
|
|
20338
20342
|
<!-- Read-Only Fields Display for Managed Collections -->
|
|
@@ -20573,6 +20577,7 @@ function renderCollectionFormPage(data) {
|
|
|
20573
20577
|
<option value="date">Date</option>
|
|
20574
20578
|
<option value="select">Select</option>
|
|
20575
20579
|
<option value="media">Media</option>
|
|
20580
|
+
<option value="reference">Reference</option>
|
|
20576
20581
|
</select>
|
|
20577
20582
|
<svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-blue-600 dark:text-blue-400 sm:size-4">
|
|
20578
20583
|
<path d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" fill-rule="evenodd" />
|
|
@@ -20890,11 +20895,14 @@ function renderCollectionFormPage(data) {
|
|
|
20890
20895
|
}
|
|
20891
20896
|
|
|
20892
20897
|
// Show/hide options container based on field type
|
|
20893
|
-
|
|
20898
|
+
// Use the dropdown's actual value (not field.field_type) to ensure consistency
|
|
20899
|
+
const fieldType = fieldTypeSelect?.value || field.field_type;
|
|
20894
20900
|
const optionsContainer = document.getElementById('field-options-container');
|
|
20895
20901
|
const helpText = document.getElementById('field-type-help');
|
|
20896
20902
|
|
|
20897
|
-
|
|
20903
|
+
console.log('[Edit Field] Showing options for field type:', fieldType, '(original:', field.field_type, ')');
|
|
20904
|
+
|
|
20905
|
+
if (['select', 'media', 'richtext', 'reference'].includes(fieldType)) {
|
|
20898
20906
|
optionsContainer.classList.remove('hidden');
|
|
20899
20907
|
|
|
20900
20908
|
// Set help text based on type
|
|
@@ -20908,6 +20916,9 @@ function renderCollectionFormPage(data) {
|
|
|
20908
20916
|
case 'richtext':
|
|
20909
20917
|
helpText.textContent = 'Full-featured WYSIWYG text editor with formatting options';
|
|
20910
20918
|
break;
|
|
20919
|
+
case 'reference':
|
|
20920
|
+
helpText.textContent = 'Link to content from other collections';
|
|
20921
|
+
break;
|
|
20911
20922
|
}
|
|
20912
20923
|
} else {
|
|
20913
20924
|
optionsContainer.classList.add('hidden');
|
|
@@ -21042,7 +21053,7 @@ function renderCollectionFormPage(data) {
|
|
|
21042
21053
|
const fieldNameInput = document.getElementById('modal-field-name');
|
|
21043
21054
|
|
|
21044
21055
|
// Show/hide options based on field type
|
|
21045
|
-
if (['select', 'media', 'richtext', 'guid'].includes(this.value)) {
|
|
21056
|
+
if (['select', 'media', 'richtext', 'guid', 'reference'].includes(this.value)) {
|
|
21046
21057
|
optionsContainer.classList.remove('hidden');
|
|
21047
21058
|
|
|
21048
21059
|
// Set default options and help text based on type
|
|
@@ -21059,6 +21070,10 @@ function renderCollectionFormPage(data) {
|
|
|
21059
21070
|
fieldOptions.value = '{"toolbar": "full", "height": 400}';
|
|
21060
21071
|
helpText.textContent = 'Full-featured WYSIWYG text editor with formatting options';
|
|
21061
21072
|
break;
|
|
21073
|
+
case 'reference':
|
|
21074
|
+
fieldOptions.value = '{"collection": ["pages", "posts"]}';
|
|
21075
|
+
helpText.textContent = 'Link to content from other collections';
|
|
21076
|
+
break;
|
|
21062
21077
|
}
|
|
21063
21078
|
} else {
|
|
21064
21079
|
optionsContainer.classList.add('hidden');
|
|
@@ -21121,12 +21136,12 @@ function renderCollectionFormPage(data) {
|
|
|
21121
21136
|
version: data.version,
|
|
21122
21137
|
content: pageContent
|
|
21123
21138
|
};
|
|
21124
|
-
return
|
|
21139
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
21125
21140
|
}
|
|
21126
21141
|
|
|
21127
21142
|
// src/routes/admin-collections.ts
|
|
21128
21143
|
var adminCollectionsRoutes = new hono.Hono();
|
|
21129
|
-
adminCollectionsRoutes.use("*",
|
|
21144
|
+
adminCollectionsRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
21130
21145
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
21131
21146
|
try {
|
|
21132
21147
|
const user = c.get("user");
|
|
@@ -21627,6 +21642,8 @@ adminCollectionsRoutes.post("/:id/fields", async (c) => {
|
|
|
21627
21642
|
fieldConfig.type = "quill";
|
|
21628
21643
|
} else if (fieldType === "mdxeditor") {
|
|
21629
21644
|
fieldConfig.type = "mdxeditor";
|
|
21645
|
+
} else if (fieldType === "reference") {
|
|
21646
|
+
fieldConfig.type = "reference";
|
|
21630
21647
|
}
|
|
21631
21648
|
schema.properties[fieldName] = fieldConfig;
|
|
21632
21649
|
if (isRequired && !schema.required.includes(fieldName)) {
|
|
@@ -21715,8 +21732,15 @@ adminCollectionsRoutes.put("/:collectionId/fields/:fieldId", async (c) => {
|
|
|
21715
21732
|
schema.required = [];
|
|
21716
21733
|
}
|
|
21717
21734
|
if (schema.properties[fieldName]) {
|
|
21735
|
+
let parsedFieldOptions = {};
|
|
21736
|
+
try {
|
|
21737
|
+
parsedFieldOptions = JSON.parse(fieldOptions);
|
|
21738
|
+
} catch (e) {
|
|
21739
|
+
console.error("[Field Update] Error parsing field options:", e);
|
|
21740
|
+
}
|
|
21718
21741
|
const updatedFieldConfig = {
|
|
21719
21742
|
...schema.properties[fieldName],
|
|
21743
|
+
...parsedFieldOptions,
|
|
21720
21744
|
type: fieldType,
|
|
21721
21745
|
title: fieldLabel,
|
|
21722
21746
|
searchable: isSearchable
|
|
@@ -21842,7 +21866,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
21842
21866
|
});
|
|
21843
21867
|
|
|
21844
21868
|
// src/templates/pages/admin-settings.template.ts
|
|
21845
|
-
|
|
21869
|
+
chunkEHSZ6TAN_cjs.init_admin_layout_catalyst_template();
|
|
21846
21870
|
function renderSettingsPage(data) {
|
|
21847
21871
|
const activeTab = data.activeTab || "general";
|
|
21848
21872
|
const pageContent = `
|
|
@@ -22224,7 +22248,7 @@ function renderSettingsPage(data) {
|
|
|
22224
22248
|
version: data.version,
|
|
22225
22249
|
content: pageContent
|
|
22226
22250
|
};
|
|
22227
|
-
return
|
|
22251
|
+
return chunkEHSZ6TAN_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
22228
22252
|
}
|
|
22229
22253
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
22230
22254
|
const isActive = activeTab === tabId;
|
|
@@ -23306,7 +23330,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
23306
23330
|
|
|
23307
23331
|
// src/routes/admin-settings.ts
|
|
23308
23332
|
var adminSettingsRoutes = new hono.Hono();
|
|
23309
|
-
adminSettingsRoutes.use("*",
|
|
23333
|
+
adminSettingsRoutes.use("*", chunkE2BXLXPW_cjs.requireAuth());
|
|
23310
23334
|
function getMockSettings(user) {
|
|
23311
23335
|
return {
|
|
23312
23336
|
general: {
|
|
@@ -23474,7 +23498,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
23474
23498
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
23475
23499
|
try {
|
|
23476
23500
|
const db = c.env.DB;
|
|
23477
|
-
const migrationService = new
|
|
23501
|
+
const migrationService = new chunkYRFAQ6MI_cjs.MigrationService(db);
|
|
23478
23502
|
const status = await migrationService.getMigrationStatus();
|
|
23479
23503
|
return c.json({
|
|
23480
23504
|
success: true,
|
|
@@ -23498,7 +23522,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
23498
23522
|
}, 403);
|
|
23499
23523
|
}
|
|
23500
23524
|
const db = c.env.DB;
|
|
23501
|
-
const migrationService = new
|
|
23525
|
+
const migrationService = new chunkYRFAQ6MI_cjs.MigrationService(db);
|
|
23502
23526
|
const result = await migrationService.runPendingMigrations();
|
|
23503
23527
|
return c.json({
|
|
23504
23528
|
success: result.success,
|
|
@@ -23516,7 +23540,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
23516
23540
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
23517
23541
|
try {
|
|
23518
23542
|
const db = c.env.DB;
|
|
23519
|
-
const migrationService = new
|
|
23543
|
+
const migrationService = new chunkYRFAQ6MI_cjs.MigrationService(db);
|
|
23520
23544
|
const validation = await migrationService.validateSchema();
|
|
23521
23545
|
return c.json({
|
|
23522
23546
|
success: true,
|
|
@@ -23757,8 +23781,10 @@ exports.api_default = api_default;
|
|
|
23757
23781
|
exports.api_media_default = api_media_default;
|
|
23758
23782
|
exports.api_system_default = api_system_default;
|
|
23759
23783
|
exports.auth_default = auth_default;
|
|
23784
|
+
exports.getConfirmationDialogScript = getConfirmationDialogScript2;
|
|
23785
|
+
exports.renderConfirmationDialog = renderConfirmationDialog2;
|
|
23760
23786
|
exports.router = router;
|
|
23761
23787
|
exports.test_cleanup_default = test_cleanup_default;
|
|
23762
23788
|
exports.userRoutes = userRoutes;
|
|
23763
|
-
//# sourceMappingURL=chunk-
|
|
23764
|
-
//# sourceMappingURL=chunk-
|
|
23789
|
+
//# sourceMappingURL=chunk-J7F3NPAP.cjs.map
|
|
23790
|
+
//# sourceMappingURL=chunk-J7F3NPAP.cjs.map
|