@sonicjs-cms/core 2.3.9 → 2.3.12
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-Q52ZQFMB.js → chunk-3YNNVSMC.js} +21 -34
- package/dist/chunk-3YNNVSMC.js.map +1 -0
- package/dist/{chunk-HNHKS2XF.js → chunk-74RYBO6J.js} +4 -5
- package/dist/chunk-74RYBO6J.js.map +1 -0
- package/dist/{chunk-ES3BRZQJ.cjs → chunk-7FOAMNTI.cjs} +29 -42
- package/dist/chunk-7FOAMNTI.cjs.map +1 -0
- package/dist/{chunk-AUU4H5MP.js → chunk-EIE35JCC.js} +4 -4
- package/dist/{chunk-AUU4H5MP.js.map → chunk-EIE35JCC.js.map} +1 -1
- package/dist/{chunk-I3M6I2FY.js → chunk-HDSRB23N.js} +18 -16
- package/dist/chunk-HDSRB23N.js.map +1 -0
- package/dist/{chunk-T7HDJE2H.cjs → chunk-HTJLBF6F.cjs} +200 -198
- package/dist/chunk-HTJLBF6F.cjs.map +1 -0
- package/dist/{chunk-N3EHA3AX.cjs → chunk-IB6UBZVD.cjs} +4 -5
- package/dist/chunk-IB6UBZVD.cjs.map +1 -0
- package/dist/{chunk-NAYD76QF.cjs → chunk-ILZ3DP4I.cjs} +15 -6
- package/dist/chunk-ILZ3DP4I.cjs.map +1 -0
- package/dist/{chunk-ZMSYKV62.cjs → chunk-K6BFUYJH.cjs} +5 -5
- package/dist/{chunk-ZMSYKV62.cjs.map → chunk-K6BFUYJH.cjs.map} +1 -1
- package/dist/{chunk-5RKQB2JG.js → chunk-KQCYQKSV.js} +8 -6
- package/dist/chunk-KQCYQKSV.js.map +1 -0
- package/dist/{chunk-624OTQ55.js → chunk-NTXPL746.js} +2 -2
- package/dist/{chunk-624OTQ55.js.map → chunk-NTXPL746.js.map} +1 -1
- package/dist/{chunk-YLFQXTTX.cjs → chunk-OJ5WUCSH.cjs} +7 -7
- package/dist/{chunk-YLFQXTTX.cjs.map → chunk-OJ5WUCSH.cjs.map} +1 -1
- package/dist/{chunk-7KCDFDRI.cjs → chunk-P3XDZL6Q.cjs} +3 -4
- package/dist/chunk-P3XDZL6Q.cjs.map +1 -0
- package/dist/{chunk-O446Q45G.cjs → chunk-P6NMVNJJ.cjs} +2 -2
- package/dist/{chunk-O446Q45G.cjs.map → chunk-P6NMVNJJ.cjs.map} +1 -1
- package/dist/{chunk-QNWYQZ55.js → chunk-REY542YK.js} +3 -3
- package/dist/{chunk-QNWYQZ55.js.map → chunk-REY542YK.js.map} +1 -1
- package/dist/{chunk-YU6QFFI4.cjs → chunk-RIOIKM3Y.cjs} +8 -6
- package/dist/chunk-RIOIKM3Y.cjs.map +1 -0
- package/dist/{chunk-7CXL5K7N.js → chunk-SGAG6FD3.js} +15 -6
- package/dist/chunk-SGAG6FD3.js.map +1 -0
- package/dist/{chunk-RRKXFGIO.js → chunk-X7ZAEI5S.js} +3 -4
- package/dist/chunk-X7ZAEI5S.js.map +1 -0
- package/dist/index.cjs +145 -145
- package/dist/index.js +14 -14
- package/dist/middleware.cjs +24 -24
- package/dist/middleware.js +3 -3
- package/dist/migrations-DQ74P6V4.cjs +13 -0
- package/dist/{migrations-RMI7TLPG.cjs.map → migrations-DQ74P6V4.cjs.map} +1 -1
- package/dist/migrations-YAFC5JVO.js +4 -0
- package/dist/{migrations-ALSBVBV5.js.map → migrations-YAFC5JVO.js.map} +1 -1
- package/dist/routes.cjs +28 -28
- package/dist/routes.js +8 -8
- package/dist/services.cjs +29 -29
- package/dist/services.d.cts +3 -4
- package/dist/services.d.ts +3 -4
- package/dist/services.js +4 -4
- package/dist/{telemetry-BFBIjBxK.d.cts → telemetry-UiD1i9GS.d.cts} +0 -1
- package/dist/{telemetry-BFBIjBxK.d.ts → telemetry-UiD1i9GS.d.ts} +0 -1
- package/dist/templates.cjs +17 -17
- package/dist/templates.js +2 -2
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.cjs +20 -20
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +2 -3
- package/dist/chunk-5RKQB2JG.js.map +0 -1
- package/dist/chunk-7CXL5K7N.js.map +0 -1
- package/dist/chunk-7KCDFDRI.cjs.map +0 -1
- package/dist/chunk-ES3BRZQJ.cjs.map +0 -1
- package/dist/chunk-HNHKS2XF.js.map +0 -1
- package/dist/chunk-I3M6I2FY.js.map +0 -1
- package/dist/chunk-N3EHA3AX.cjs.map +0 -1
- package/dist/chunk-NAYD76QF.cjs.map +0 -1
- package/dist/chunk-Q52ZQFMB.js.map +0 -1
- package/dist/chunk-RRKXFGIO.js.map +0 -1
- package/dist/chunk-T7HDJE2H.cjs.map +0 -1
- package/dist/chunk-YU6QFFI4.cjs.map +0 -1
- package/dist/migrations-ALSBVBV5.js +0 -4
- package/dist/migrations-RMI7TLPG.cjs +0 -13
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
3
|
+
var chunk7FOAMNTI_cjs = require('./chunk-7FOAMNTI.cjs');
|
|
4
|
+
var chunkOJ5WUCSH_cjs = require('./chunk-OJ5WUCSH.cjs');
|
|
5
|
+
var chunkILZ3DP4I_cjs = require('./chunk-ILZ3DP4I.cjs');
|
|
6
|
+
var chunkP6NMVNJJ_cjs = require('./chunk-P6NMVNJJ.cjs');
|
|
7
|
+
var chunkRIOIKM3Y_cjs = require('./chunk-RIOIKM3Y.cjs');
|
|
8
|
+
var chunkIB6UBZVD_cjs = require('./chunk-IB6UBZVD.cjs');
|
|
9
9
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
10
10
|
var hono = require('hono');
|
|
11
11
|
var cors = require('hono/cors');
|
|
@@ -44,7 +44,7 @@ apiContentCrudRoutes.get("/:id", async (c) => {
|
|
|
44
44
|
}, 500);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
apiContentCrudRoutes.post("/",
|
|
47
|
+
apiContentCrudRoutes.post("/", chunkOJ5WUCSH_cjs.requireAuth(), async (c) => {
|
|
48
48
|
try {
|
|
49
49
|
const db = c.env.DB;
|
|
50
50
|
const user = c.get("user");
|
|
@@ -85,7 +85,7 @@ apiContentCrudRoutes.post("/", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
|
85
85
|
now,
|
|
86
86
|
now
|
|
87
87
|
).run();
|
|
88
|
-
const cache =
|
|
88
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.api);
|
|
89
89
|
await cache.invalidate(`content:list:${collectionId}:*`);
|
|
90
90
|
await cache.invalidate("content-filtered:*");
|
|
91
91
|
const getStmt = db.prepare("SELECT * FROM content WHERE id = ?");
|
|
@@ -110,7 +110,7 @@ apiContentCrudRoutes.post("/", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
|
110
110
|
}, 500);
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
apiContentCrudRoutes.put("/:id",
|
|
113
|
+
apiContentCrudRoutes.put("/:id", chunkOJ5WUCSH_cjs.requireAuth(), async (c) => {
|
|
114
114
|
try {
|
|
115
115
|
const id = c.req.param("id");
|
|
116
116
|
const db = c.env.DB;
|
|
@@ -148,7 +148,7 @@ apiContentCrudRoutes.put("/:id", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
|
148
148
|
WHERE id = ?
|
|
149
149
|
`);
|
|
150
150
|
await updateStmt.bind(...params).run();
|
|
151
|
-
const cache =
|
|
151
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.api);
|
|
152
152
|
await cache.delete(cache.generateKey("content", id));
|
|
153
153
|
await cache.invalidate(`content:list:${existing.collection_id}:*`);
|
|
154
154
|
await cache.invalidate("content-filtered:*");
|
|
@@ -174,7 +174,7 @@ apiContentCrudRoutes.put("/:id", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
|
174
174
|
}, 500);
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
-
apiContentCrudRoutes.delete("/:id",
|
|
177
|
+
apiContentCrudRoutes.delete("/:id", chunkOJ5WUCSH_cjs.requireAuth(), async (c) => {
|
|
178
178
|
try {
|
|
179
179
|
const id = c.req.param("id");
|
|
180
180
|
const db = c.env.DB;
|
|
@@ -185,7 +185,7 @@ apiContentCrudRoutes.delete("/:id", chunkYLFQXTTX_cjs.requireAuth(), async (c) =
|
|
|
185
185
|
}
|
|
186
186
|
const deleteStmt = db.prepare("DELETE FROM content WHERE id = ?");
|
|
187
187
|
await deleteStmt.bind(id).run();
|
|
188
|
-
const cache =
|
|
188
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.api);
|
|
189
189
|
await cache.delete(cache.generateKey("content", id));
|
|
190
190
|
await cache.invalidate(`content:list:${existing.collection_id}:*`);
|
|
191
191
|
await cache.invalidate("content-filtered:*");
|
|
@@ -210,7 +210,7 @@ apiRoutes.use("*", async (c, next) => {
|
|
|
210
210
|
c.header("X-Response-Time", `${totalTime}ms`);
|
|
211
211
|
});
|
|
212
212
|
apiRoutes.use("*", async (c, next) => {
|
|
213
|
-
const cacheEnabled = await
|
|
213
|
+
const cacheEnabled = await chunkOJ5WUCSH_cjs.isPluginActive(c.env.DB, "core-cache");
|
|
214
214
|
c.set("cacheEnabled", cacheEnabled);
|
|
215
215
|
await next();
|
|
216
216
|
});
|
|
@@ -258,7 +258,7 @@ apiRoutes.get("/collections", async (c) => {
|
|
|
258
258
|
try {
|
|
259
259
|
const db = c.env.DB;
|
|
260
260
|
const cacheEnabled = c.get("cacheEnabled");
|
|
261
|
-
const cache =
|
|
261
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.api);
|
|
262
262
|
const cacheKey = cache.generateKey("collections", "all");
|
|
263
263
|
if (cacheEnabled) {
|
|
264
264
|
const cacheResult = await cache.getWithSource(cacheKey);
|
|
@@ -335,12 +335,12 @@ apiRoutes.get("/content", async (c) => {
|
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
const filter =
|
|
338
|
+
const filter = chunkIB6UBZVD_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
339
339
|
if (!filter.limit) {
|
|
340
340
|
filter.limit = 50;
|
|
341
341
|
}
|
|
342
342
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
343
|
-
const builder3 = new
|
|
343
|
+
const builder3 = new chunkIB6UBZVD_cjs.QueryFilterBuilder();
|
|
344
344
|
const queryResult = builder3.build("content", filter);
|
|
345
345
|
if (queryResult.errors.length > 0) {
|
|
346
346
|
return c.json({
|
|
@@ -349,7 +349,7 @@ apiRoutes.get("/content", async (c) => {
|
|
|
349
349
|
}, 400);
|
|
350
350
|
}
|
|
351
351
|
const cacheEnabled = c.get("cacheEnabled");
|
|
352
|
-
const cache =
|
|
352
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.api);
|
|
353
353
|
const cacheKey = cache.generateKey("content-filtered", JSON.stringify({ filter, query: queryResult.sql }));
|
|
354
354
|
if (cacheEnabled) {
|
|
355
355
|
const cacheResult = await cache.getWithSource(cacheKey);
|
|
@@ -427,7 +427,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
427
427
|
if (!collectionResult) {
|
|
428
428
|
return c.json({ error: "Collection not found" }, 404);
|
|
429
429
|
}
|
|
430
|
-
const filter =
|
|
430
|
+
const filter = chunkIB6UBZVD_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
431
431
|
if (!filter.where) {
|
|
432
432
|
filter.where = { and: [] };
|
|
433
433
|
}
|
|
@@ -443,7 +443,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
443
443
|
filter.limit = 50;
|
|
444
444
|
}
|
|
445
445
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
446
|
-
const builder3 = new
|
|
446
|
+
const builder3 = new chunkIB6UBZVD_cjs.QueryFilterBuilder();
|
|
447
447
|
const queryResult = builder3.build("content", filter);
|
|
448
448
|
if (queryResult.errors.length > 0) {
|
|
449
449
|
return c.json({
|
|
@@ -452,7 +452,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
452
452
|
}, 400);
|
|
453
453
|
}
|
|
454
454
|
const cacheEnabled = c.get("cacheEnabled");
|
|
455
|
-
const cache =
|
|
455
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.api);
|
|
456
456
|
const cacheKey = cache.generateKey("collection-content-filtered", `${collection}:${JSON.stringify({ filter, query: queryResult.sql })}`);
|
|
457
457
|
if (cacheEnabled) {
|
|
458
458
|
const cacheResult = await cache.getWithSource(cacheKey);
|
|
@@ -568,7 +568,7 @@ var fileValidationSchema = zod.z.object({
|
|
|
568
568
|
// 50MB max
|
|
569
569
|
});
|
|
570
570
|
var apiMediaRoutes = new hono.Hono();
|
|
571
|
-
apiMediaRoutes.use("*",
|
|
571
|
+
apiMediaRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
572
572
|
apiMediaRoutes.post("/upload", async (c) => {
|
|
573
573
|
try {
|
|
574
574
|
const user = c.get("user");
|
|
@@ -1312,8 +1312,8 @@ apiSystemRoutes.get("/env", (c) => {
|
|
|
1312
1312
|
});
|
|
1313
1313
|
var api_system_default = apiSystemRoutes;
|
|
1314
1314
|
var adminApiRoutes = new hono.Hono();
|
|
1315
|
-
adminApiRoutes.use("*",
|
|
1316
|
-
adminApiRoutes.use("*",
|
|
1315
|
+
adminApiRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
1316
|
+
adminApiRoutes.use("*", chunkOJ5WUCSH_cjs.requireRole(["admin", "editor"]));
|
|
1317
1317
|
adminApiRoutes.get("/stats", async (c) => {
|
|
1318
1318
|
try {
|
|
1319
1319
|
const db = c.env.DB;
|
|
@@ -1722,7 +1722,7 @@ adminApiRoutes.delete("/collections/:id", async (c) => {
|
|
|
1722
1722
|
});
|
|
1723
1723
|
adminApiRoutes.get("/migrations/status", async (c) => {
|
|
1724
1724
|
try {
|
|
1725
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1725
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-DQ74P6V4.cjs');
|
|
1726
1726
|
const db = c.env.DB;
|
|
1727
1727
|
const migrationService = new MigrationService2(db);
|
|
1728
1728
|
const status = await migrationService.getMigrationStatus();
|
|
@@ -1747,7 +1747,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
1747
1747
|
error: "Unauthorized. Admin access required."
|
|
1748
1748
|
}, 403);
|
|
1749
1749
|
}
|
|
1750
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1750
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-DQ74P6V4.cjs');
|
|
1751
1751
|
const db = c.env.DB;
|
|
1752
1752
|
const migrationService = new MigrationService2(db);
|
|
1753
1753
|
const result = await migrationService.runPendingMigrations();
|
|
@@ -1766,7 +1766,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
1766
1766
|
});
|
|
1767
1767
|
adminApiRoutes.get("/migrations/validate", async (c) => {
|
|
1768
1768
|
try {
|
|
1769
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1769
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-DQ74P6V4.cjs');
|
|
1770
1770
|
const db = c.env.DB;
|
|
1771
1771
|
const migrationService = new MigrationService2(db);
|
|
1772
1772
|
const validation = await migrationService.validateSchema();
|
|
@@ -1841,8 +1841,8 @@ function renderLoginPage(data, demoLoginActive = false) {
|
|
|
1841
1841
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
1842
1842
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
1843
1843
|
<!-- Alerts -->
|
|
1844
|
-
${data.error ? `<div class="mb-6">${
|
|
1845
|
-
${data.message ? `<div class="mb-6">${
|
|
1844
|
+
${data.error ? `<div class="mb-6">${chunkRIOIKM3Y_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
1845
|
+
${data.message ? `<div class="mb-6">${chunkRIOIKM3Y_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
|
|
1846
1846
|
|
|
1847
1847
|
<!-- Form Response (HTMX target) -->
|
|
1848
1848
|
<div id="form-response" class="mb-6"></div>
|
|
@@ -2006,7 +2006,7 @@ function renderRegisterPage(data) {
|
|
|
2006
2006
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
2007
2007
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
2008
2008
|
<!-- Alerts -->
|
|
2009
|
-
${data.error ? `<div class="mb-6">${
|
|
2009
|
+
${data.error ? `<div class="mb-6">${chunkRIOIKM3Y_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
2010
2010
|
|
|
2011
2011
|
<!-- Form -->
|
|
2012
2012
|
<form
|
|
@@ -2212,7 +2212,7 @@ authRoutes.post(
|
|
|
2212
2212
|
if (existingUser) {
|
|
2213
2213
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
2214
2214
|
}
|
|
2215
|
-
const passwordHash = await
|
|
2215
|
+
const passwordHash = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword(password);
|
|
2216
2216
|
const userId = crypto.randomUUID();
|
|
2217
2217
|
const now = /* @__PURE__ */ new Date();
|
|
2218
2218
|
await db.prepare(`
|
|
@@ -2232,7 +2232,7 @@ authRoutes.post(
|
|
|
2232
2232
|
now.getTime(),
|
|
2233
2233
|
now.getTime()
|
|
2234
2234
|
).run();
|
|
2235
|
-
const token = await
|
|
2235
|
+
const token = await chunkOJ5WUCSH_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer");
|
|
2236
2236
|
cookie.setCookie(c, "auth_token", token, {
|
|
2237
2237
|
httpOnly: true,
|
|
2238
2238
|
secure: true,
|
|
@@ -2273,7 +2273,7 @@ authRoutes.post("/login", async (c) => {
|
|
|
2273
2273
|
const { email, password } = validation.data;
|
|
2274
2274
|
const db = c.env.DB;
|
|
2275
2275
|
const normalizedEmail = email.toLowerCase();
|
|
2276
|
-
const cache =
|
|
2276
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.user);
|
|
2277
2277
|
let user = await cache.get(cache.generateKey("user", `email:${normalizedEmail}`));
|
|
2278
2278
|
if (!user) {
|
|
2279
2279
|
user = await db.prepare("SELECT * FROM users WHERE email = ? AND is_active = 1").bind(normalizedEmail).first();
|
|
@@ -2285,11 +2285,11 @@ authRoutes.post("/login", async (c) => {
|
|
|
2285
2285
|
if (!user) {
|
|
2286
2286
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2287
2287
|
}
|
|
2288
|
-
const isValidPassword = await
|
|
2288
|
+
const isValidPassword = await chunkOJ5WUCSH_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2289
2289
|
if (!isValidPassword) {
|
|
2290
2290
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2291
2291
|
}
|
|
2292
|
-
const token = await
|
|
2292
|
+
const token = await chunkOJ5WUCSH_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2293
2293
|
cookie.setCookie(c, "auth_token", token, {
|
|
2294
2294
|
httpOnly: true,
|
|
2295
2295
|
secure: true,
|
|
@@ -2338,7 +2338,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
2338
2338
|
});
|
|
2339
2339
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
2340
2340
|
});
|
|
2341
|
-
authRoutes.get("/me",
|
|
2341
|
+
authRoutes.get("/me", chunkOJ5WUCSH_cjs.requireAuth(), async (c) => {
|
|
2342
2342
|
try {
|
|
2343
2343
|
const user = c.get("user");
|
|
2344
2344
|
if (!user) {
|
|
@@ -2355,13 +2355,13 @@ authRoutes.get("/me", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
|
2355
2355
|
return c.json({ error: "Failed to get user" }, 500);
|
|
2356
2356
|
}
|
|
2357
2357
|
});
|
|
2358
|
-
authRoutes.post("/refresh",
|
|
2358
|
+
authRoutes.post("/refresh", chunkOJ5WUCSH_cjs.requireAuth(), async (c) => {
|
|
2359
2359
|
try {
|
|
2360
2360
|
const user = c.get("user");
|
|
2361
2361
|
if (!user) {
|
|
2362
2362
|
return c.json({ error: "Not authenticated" }, 401);
|
|
2363
2363
|
}
|
|
2364
|
-
const token = await
|
|
2364
|
+
const token = await chunkOJ5WUCSH_cjs.AuthManager.generateToken(user.userId, user.email, user.role);
|
|
2365
2365
|
cookie.setCookie(c, "auth_token", token, {
|
|
2366
2366
|
httpOnly: true,
|
|
2367
2367
|
secure: true,
|
|
@@ -2410,7 +2410,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2410
2410
|
</div>
|
|
2411
2411
|
`);
|
|
2412
2412
|
}
|
|
2413
|
-
const passwordHash = await
|
|
2413
|
+
const passwordHash = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword(password);
|
|
2414
2414
|
const userId = crypto.randomUUID();
|
|
2415
2415
|
const now = /* @__PURE__ */ new Date();
|
|
2416
2416
|
await db.prepare(`
|
|
@@ -2430,7 +2430,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2430
2430
|
now.getTime(),
|
|
2431
2431
|
now.getTime()
|
|
2432
2432
|
).run();
|
|
2433
|
-
const token = await
|
|
2433
|
+
const token = await chunkOJ5WUCSH_cjs.AuthManager.generateToken(userId, normalizedEmail, "admin");
|
|
2434
2434
|
cookie.setCookie(c, "auth_token", token, {
|
|
2435
2435
|
httpOnly: true,
|
|
2436
2436
|
secure: false,
|
|
@@ -2481,7 +2481,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2481
2481
|
</div>
|
|
2482
2482
|
`);
|
|
2483
2483
|
}
|
|
2484
|
-
const isValidPassword = await
|
|
2484
|
+
const isValidPassword = await chunkOJ5WUCSH_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2485
2485
|
if (!isValidPassword) {
|
|
2486
2486
|
return c.html(html.html`
|
|
2487
2487
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -2489,7 +2489,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2489
2489
|
</div>
|
|
2490
2490
|
`);
|
|
2491
2491
|
}
|
|
2492
|
-
const token = await
|
|
2492
|
+
const token = await chunkOJ5WUCSH_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2493
2493
|
cookie.setCookie(c, "auth_token", token, {
|
|
2494
2494
|
httpOnly: true,
|
|
2495
2495
|
secure: false,
|
|
@@ -2548,7 +2548,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2548
2548
|
`).run();
|
|
2549
2549
|
const existingAdmin = await db.prepare("SELECT id FROM users WHERE email = ? OR username = ?").bind("admin@sonicjs.com", "admin").first();
|
|
2550
2550
|
if (existingAdmin) {
|
|
2551
|
-
const passwordHash2 = await
|
|
2551
|
+
const passwordHash2 = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword("sonicjs!");
|
|
2552
2552
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(passwordHash2, Date.now(), existingAdmin.id).run();
|
|
2553
2553
|
return c.json({
|
|
2554
2554
|
message: "Admin user already exists (password updated)",
|
|
@@ -2560,7 +2560,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
});
|
|
2562
2562
|
}
|
|
2563
|
-
const passwordHash = await
|
|
2563
|
+
const passwordHash = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword("sonicjs!");
|
|
2564
2564
|
const userId = "admin-user-id";
|
|
2565
2565
|
const now = Date.now();
|
|
2566
2566
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -2780,7 +2780,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2780
2780
|
if (existingUsername) {
|
|
2781
2781
|
return c.json({ error: "Username is already taken" }, 400);
|
|
2782
2782
|
}
|
|
2783
|
-
const passwordHash = await
|
|
2783
|
+
const passwordHash = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword(password);
|
|
2784
2784
|
const updateStmt = db.prepare(`
|
|
2785
2785
|
UPDATE users SET
|
|
2786
2786
|
username = ?,
|
|
@@ -2799,7 +2799,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2799
2799
|
Date.now(),
|
|
2800
2800
|
invitedUser.id
|
|
2801
2801
|
).run();
|
|
2802
|
-
const authToken = await
|
|
2802
|
+
const authToken = await chunkOJ5WUCSH_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role);
|
|
2803
2803
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
2804
2804
|
httpOnly: true,
|
|
2805
2805
|
secure: true,
|
|
@@ -3029,7 +3029,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
3029
3029
|
if (Date.now() > user.password_reset_expires) {
|
|
3030
3030
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
3031
3031
|
}
|
|
3032
|
-
const newPasswordHash = await
|
|
3032
|
+
const newPasswordHash = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword(password);
|
|
3033
3033
|
try {
|
|
3034
3034
|
const historyStmt = db.prepare(`
|
|
3035
3035
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -3287,7 +3287,7 @@ app.post("/test-cleanup/content", async (c) => {
|
|
|
3287
3287
|
var test_cleanup_default = app;
|
|
3288
3288
|
|
|
3289
3289
|
// src/templates/pages/admin-content-form.template.ts
|
|
3290
|
-
|
|
3290
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
3291
3291
|
|
|
3292
3292
|
// src/templates/components/dynamic-field.template.ts
|
|
3293
3293
|
function renderDynamicField(field, options = {}) {
|
|
@@ -4526,8 +4526,8 @@ function renderContentFormPage(data) {
|
|
|
4526
4526
|
<!-- Form Content -->
|
|
4527
4527
|
<div class="px-6 py-6">
|
|
4528
4528
|
<div id="form-messages">
|
|
4529
|
-
${data.error ?
|
|
4530
|
-
${data.success ?
|
|
4529
|
+
${data.error ? chunkRIOIKM3Y_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
4530
|
+
${data.success ? chunkRIOIKM3Y_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
4531
4531
|
</div>
|
|
4532
4532
|
|
|
4533
4533
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -4762,7 +4762,7 @@ function renderContentFormPage(data) {
|
|
|
4762
4762
|
</div>
|
|
4763
4763
|
|
|
4764
4764
|
<!-- Confirmation Dialogs -->
|
|
4765
|
-
${
|
|
4765
|
+
${chunkRIOIKM3Y_cjs.renderConfirmationDialog({
|
|
4766
4766
|
id: "duplicate-content-confirm",
|
|
4767
4767
|
title: "Duplicate Content",
|
|
4768
4768
|
message: "Create a copy of this content?",
|
|
@@ -4773,7 +4773,7 @@ function renderContentFormPage(data) {
|
|
|
4773
4773
|
onConfirm: "performDuplicateContent()"
|
|
4774
4774
|
})}
|
|
4775
4775
|
|
|
4776
|
-
${
|
|
4776
|
+
${chunkRIOIKM3Y_cjs.renderConfirmationDialog({
|
|
4777
4777
|
id: "delete-content-confirm",
|
|
4778
4778
|
title: "Delete Content",
|
|
4779
4779
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -4784,7 +4784,7 @@ function renderContentFormPage(data) {
|
|
|
4784
4784
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
4785
4785
|
})}
|
|
4786
4786
|
|
|
4787
|
-
${
|
|
4787
|
+
${chunkRIOIKM3Y_cjs.getConfirmationDialogScript()}
|
|
4788
4788
|
|
|
4789
4789
|
${data.tinymceEnabled ? getTinyMCEScript(data.tinymceSettings?.apiKey) : "<!-- TinyMCE plugin not active -->"}
|
|
4790
4790
|
|
|
@@ -5089,11 +5089,11 @@ function renderContentFormPage(data) {
|
|
|
5089
5089
|
content: pageContent,
|
|
5090
5090
|
version: data.version
|
|
5091
5091
|
};
|
|
5092
|
-
return
|
|
5092
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
5093
5093
|
}
|
|
5094
5094
|
|
|
5095
5095
|
// src/templates/pages/admin-content-list.template.ts
|
|
5096
|
-
|
|
5096
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
5097
5097
|
function renderContentListPage(data) {
|
|
5098
5098
|
const urlParams = new URLSearchParams();
|
|
5099
5099
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -5498,8 +5498,8 @@ function renderContentListPage(data) {
|
|
|
5498
5498
|
|
|
5499
5499
|
<!-- Content List -->
|
|
5500
5500
|
<div id="content-list">
|
|
5501
|
-
${
|
|
5502
|
-
${
|
|
5501
|
+
${chunkRIOIKM3Y_cjs.renderTable(tableData)}
|
|
5502
|
+
${chunkRIOIKM3Y_cjs.renderPagination(paginationData)}
|
|
5503
5503
|
</div>
|
|
5504
5504
|
|
|
5505
5505
|
</div>
|
|
@@ -5708,7 +5708,7 @@ function renderContentListPage(data) {
|
|
|
5708
5708
|
</script>
|
|
5709
5709
|
|
|
5710
5710
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
5711
|
-
${
|
|
5711
|
+
${chunkRIOIKM3Y_cjs.renderConfirmationDialog({
|
|
5712
5712
|
id: "bulk-action-confirm",
|
|
5713
5713
|
title: "Confirm Bulk Action",
|
|
5714
5714
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -5720,7 +5720,7 @@ function renderContentListPage(data) {
|
|
|
5720
5720
|
})}
|
|
5721
5721
|
|
|
5722
5722
|
<!-- Confirmation Dialog Script -->
|
|
5723
|
-
${
|
|
5723
|
+
${chunkRIOIKM3Y_cjs.getConfirmationDialogScript()}
|
|
5724
5724
|
`;
|
|
5725
5725
|
const layoutData = {
|
|
5726
5726
|
title: "Content Management",
|
|
@@ -5730,7 +5730,7 @@ function renderContentListPage(data) {
|
|
|
5730
5730
|
version: data.version,
|
|
5731
5731
|
content: pageContent
|
|
5732
5732
|
};
|
|
5733
|
-
return
|
|
5733
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
5734
5734
|
}
|
|
5735
5735
|
|
|
5736
5736
|
// src/templates/components/version-history.template.ts
|
|
@@ -5924,9 +5924,9 @@ async function isPluginActive2(db, pluginId) {
|
|
|
5924
5924
|
|
|
5925
5925
|
// src/routes/admin-content.ts
|
|
5926
5926
|
var adminContentRoutes = new hono.Hono();
|
|
5927
|
-
adminContentRoutes.use("*",
|
|
5927
|
+
adminContentRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
5928
5928
|
async function getCollectionFields(db, collectionId) {
|
|
5929
|
-
const cache =
|
|
5929
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.collection);
|
|
5930
5930
|
return cache.getOrSet(
|
|
5931
5931
|
cache.generateKey("fields", collectionId),
|
|
5932
5932
|
async () => {
|
|
@@ -5981,7 +5981,7 @@ async function getCollectionFields(db, collectionId) {
|
|
|
5981
5981
|
);
|
|
5982
5982
|
}
|
|
5983
5983
|
async function getCollection(db, collectionId) {
|
|
5984
|
-
const cache =
|
|
5984
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.collection);
|
|
5985
5985
|
return cache.getOrSet(
|
|
5986
5986
|
cache.generateKey("collection", collectionId),
|
|
5987
5987
|
async () => {
|
|
@@ -6021,8 +6021,8 @@ adminContentRoutes.get("/", async (c) => {
|
|
|
6021
6021
|
conditions.push("c.status != 'deleted'");
|
|
6022
6022
|
}
|
|
6023
6023
|
if (search) {
|
|
6024
|
-
conditions.push("(c.title LIKE ? OR c.slug LIKE ?)");
|
|
6025
|
-
params.push(`%${search}%`, `%${search}%`);
|
|
6024
|
+
conditions.push("(c.title LIKE ? OR c.slug LIKE ? OR c.data LIKE ?)");
|
|
6025
|
+
params.push(`%${search}%`, `%${search}%`, `%${search}%`);
|
|
6026
6026
|
}
|
|
6027
6027
|
if (modelName !== "all") {
|
|
6028
6028
|
conditions.push("col.name = ?");
|
|
@@ -6206,21 +6206,21 @@ adminContentRoutes.get("/new", async (c) => {
|
|
|
6206
6206
|
const tinymceEnabled = await isPluginActive2(db, "tinymce-plugin");
|
|
6207
6207
|
let tinymceSettings;
|
|
6208
6208
|
if (tinymceEnabled) {
|
|
6209
|
-
const pluginService = new
|
|
6209
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
6210
6210
|
const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
|
|
6211
6211
|
tinymceSettings = tinymcePlugin2?.settings;
|
|
6212
6212
|
}
|
|
6213
6213
|
const quillEnabled = await isPluginActive2(db, "quill-editor");
|
|
6214
6214
|
let quillSettings;
|
|
6215
6215
|
if (quillEnabled) {
|
|
6216
|
-
const pluginService = new
|
|
6216
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
6217
6217
|
const quillPlugin = await pluginService.getPlugin("quill-editor");
|
|
6218
6218
|
quillSettings = quillPlugin?.settings;
|
|
6219
6219
|
}
|
|
6220
6220
|
const mdxeditorEnabled = await isPluginActive2(db, "easy-mdx");
|
|
6221
6221
|
let mdxeditorSettings;
|
|
6222
6222
|
if (mdxeditorEnabled) {
|
|
6223
|
-
const pluginService = new
|
|
6223
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
6224
6224
|
const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
|
|
6225
6225
|
mdxeditorSettings = mdxeditorPlugin?.settings;
|
|
6226
6226
|
}
|
|
@@ -6270,7 +6270,7 @@ adminContentRoutes.get("/:id/edit", async (c) => {
|
|
|
6270
6270
|
const db = c.env.DB;
|
|
6271
6271
|
const url = new URL(c.req.url);
|
|
6272
6272
|
const referrerParams = url.searchParams.get("ref") || "";
|
|
6273
|
-
const cache =
|
|
6273
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.content);
|
|
6274
6274
|
const content = await cache.getOrSet(
|
|
6275
6275
|
cache.generateKey("content", id),
|
|
6276
6276
|
async () => {
|
|
@@ -6311,21 +6311,21 @@ adminContentRoutes.get("/:id/edit", async (c) => {
|
|
|
6311
6311
|
const tinymceEnabled = await isPluginActive2(db, "tinymce-plugin");
|
|
6312
6312
|
let tinymceSettings;
|
|
6313
6313
|
if (tinymceEnabled) {
|
|
6314
|
-
const pluginService = new
|
|
6314
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
6315
6315
|
const tinymcePlugin2 = await pluginService.getPlugin("tinymce-plugin");
|
|
6316
6316
|
tinymceSettings = tinymcePlugin2?.settings;
|
|
6317
6317
|
}
|
|
6318
6318
|
const quillEnabled = await isPluginActive2(db, "quill-editor");
|
|
6319
6319
|
let quillSettings;
|
|
6320
6320
|
if (quillEnabled) {
|
|
6321
|
-
const pluginService = new
|
|
6321
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
6322
6322
|
const quillPlugin = await pluginService.getPlugin("quill-editor");
|
|
6323
6323
|
quillSettings = quillPlugin?.settings;
|
|
6324
6324
|
}
|
|
6325
6325
|
const mdxeditorEnabled = await isPluginActive2(db, "easy-mdx");
|
|
6326
6326
|
let mdxeditorSettings;
|
|
6327
6327
|
if (mdxeditorEnabled) {
|
|
6328
|
-
const pluginService = new
|
|
6328
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
6329
6329
|
const mdxeditorPlugin = await pluginService.getPlugin("easy-mdx");
|
|
6330
6330
|
mdxeditorSettings = mdxeditorPlugin?.settings;
|
|
6331
6331
|
}
|
|
@@ -6478,7 +6478,7 @@ adminContentRoutes.post("/", async (c) => {
|
|
|
6478
6478
|
now,
|
|
6479
6479
|
now
|
|
6480
6480
|
).run();
|
|
6481
|
-
const cache =
|
|
6481
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.content);
|
|
6482
6482
|
await cache.invalidate(`content:list:${collectionId}:*`);
|
|
6483
6483
|
const versionStmt = db.prepare(`
|
|
6484
6484
|
INSERT INTO content_versions (id, content_id, version, data, author_id, created_at)
|
|
@@ -6626,7 +6626,7 @@ adminContentRoutes.put("/:id", async (c) => {
|
|
|
6626
6626
|
now,
|
|
6627
6627
|
id
|
|
6628
6628
|
).run();
|
|
6629
|
-
const cache =
|
|
6629
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.content);
|
|
6630
6630
|
await cache.delete(cache.generateKey("content", id));
|
|
6631
6631
|
await cache.invalidate(`content:list:${existingContent.collection_id}:*`);
|
|
6632
6632
|
const existingData = JSON.parse(existingContent.data || "{}");
|
|
@@ -6919,7 +6919,7 @@ adminContentRoutes.post("/bulk-action", async (c) => {
|
|
|
6919
6919
|
} else {
|
|
6920
6920
|
return c.json({ success: false, error: "Invalid action" });
|
|
6921
6921
|
}
|
|
6922
|
-
const cache =
|
|
6922
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.content);
|
|
6923
6923
|
for (const contentId of ids) {
|
|
6924
6924
|
await cache.delete(cache.generateKey("content", contentId));
|
|
6925
6925
|
}
|
|
@@ -6947,7 +6947,7 @@ adminContentRoutes.delete("/:id", async (c) => {
|
|
|
6947
6947
|
WHERE id = ?
|
|
6948
6948
|
`);
|
|
6949
6949
|
await deleteStmt.bind(now, id).run();
|
|
6950
|
-
const cache =
|
|
6950
|
+
const cache = chunk7FOAMNTI_cjs.getCacheService(chunk7FOAMNTI_cjs.CACHE_CONFIGS.content);
|
|
6951
6951
|
await cache.delete(cache.generateKey("content", id));
|
|
6952
6952
|
await cache.invalidate("content:list:*");
|
|
6953
6953
|
return c.html(`
|
|
@@ -7139,7 +7139,7 @@ ${JSON.stringify(data, null, 2)}
|
|
|
7139
7139
|
var admin_content_default = adminContentRoutes;
|
|
7140
7140
|
|
|
7141
7141
|
// src/templates/pages/admin-profile.template.ts
|
|
7142
|
-
|
|
7142
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
7143
7143
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
7144
7144
|
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">
|
|
7145
7145
|
${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>`}
|
|
@@ -7159,8 +7159,8 @@ function renderProfilePage(data) {
|
|
|
7159
7159
|
</div>
|
|
7160
7160
|
|
|
7161
7161
|
<!-- Alert Messages -->
|
|
7162
|
-
${data.error ?
|
|
7163
|
-
${data.success ?
|
|
7162
|
+
${data.error ? chunkRIOIKM3Y_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7163
|
+
${data.success ? chunkRIOIKM3Y_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7164
7164
|
|
|
7165
7165
|
<!-- Profile Form -->
|
|
7166
7166
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -7547,7 +7547,7 @@ function renderProfilePage(data) {
|
|
|
7547
7547
|
version: data.version,
|
|
7548
7548
|
content: pageContent
|
|
7549
7549
|
};
|
|
7550
|
-
return
|
|
7550
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7551
7551
|
}
|
|
7552
7552
|
|
|
7553
7553
|
// src/templates/components/alert.template.ts
|
|
@@ -7830,7 +7830,7 @@ function renderActivityLogsPage(data) {
|
|
|
7830
7830
|
user: data.user,
|
|
7831
7831
|
content: pageContent
|
|
7832
7832
|
};
|
|
7833
|
-
return
|
|
7833
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayout(layoutData);
|
|
7834
7834
|
}
|
|
7835
7835
|
function getActionBadgeClass(action) {
|
|
7836
7836
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -7850,7 +7850,7 @@ function formatAction(action) {
|
|
|
7850
7850
|
}
|
|
7851
7851
|
|
|
7852
7852
|
// src/templates/pages/admin-user-edit.template.ts
|
|
7853
|
-
|
|
7853
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
7854
7854
|
|
|
7855
7855
|
// src/templates/components/confirmation-dialog.template.ts
|
|
7856
7856
|
function renderConfirmationDialog2(options) {
|
|
@@ -7971,8 +7971,8 @@ function renderUserEditPage(data) {
|
|
|
7971
7971
|
|
|
7972
7972
|
<!-- Alert Messages -->
|
|
7973
7973
|
<div id="form-messages">
|
|
7974
|
-
${data.error ?
|
|
7975
|
-
${data.success ?
|
|
7974
|
+
${data.error ? chunkRIOIKM3Y_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7975
|
+
${data.success ? chunkRIOIKM3Y_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7976
7976
|
</div>
|
|
7977
7977
|
|
|
7978
7978
|
<!-- User Edit Form -->
|
|
@@ -7991,7 +7991,7 @@ function renderUserEditPage(data) {
|
|
|
7991
7991
|
<input
|
|
7992
7992
|
type="text"
|
|
7993
7993
|
name="first_name"
|
|
7994
|
-
value="${
|
|
7994
|
+
value="${chunkIB6UBZVD_cjs.escapeHtml(data.userToEdit.firstName || "")}"
|
|
7995
7995
|
required
|
|
7996
7996
|
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"
|
|
7997
7997
|
/>
|
|
@@ -8002,7 +8002,7 @@ function renderUserEditPage(data) {
|
|
|
8002
8002
|
<input
|
|
8003
8003
|
type="text"
|
|
8004
8004
|
name="last_name"
|
|
8005
|
-
value="${
|
|
8005
|
+
value="${chunkIB6UBZVD_cjs.escapeHtml(data.userToEdit.lastName || "")}"
|
|
8006
8006
|
required
|
|
8007
8007
|
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"
|
|
8008
8008
|
/>
|
|
@@ -8013,7 +8013,7 @@ function renderUserEditPage(data) {
|
|
|
8013
8013
|
<input
|
|
8014
8014
|
type="text"
|
|
8015
8015
|
name="username"
|
|
8016
|
-
value="${
|
|
8016
|
+
value="${chunkIB6UBZVD_cjs.escapeHtml(data.userToEdit.username || "")}"
|
|
8017
8017
|
required
|
|
8018
8018
|
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"
|
|
8019
8019
|
/>
|
|
@@ -8024,7 +8024,7 @@ function renderUserEditPage(data) {
|
|
|
8024
8024
|
<input
|
|
8025
8025
|
type="email"
|
|
8026
8026
|
name="email"
|
|
8027
|
-
value="${
|
|
8027
|
+
value="${chunkIB6UBZVD_cjs.escapeHtml(data.userToEdit.email || "")}"
|
|
8028
8028
|
required
|
|
8029
8029
|
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"
|
|
8030
8030
|
/>
|
|
@@ -8035,7 +8035,7 @@ function renderUserEditPage(data) {
|
|
|
8035
8035
|
<input
|
|
8036
8036
|
type="tel"
|
|
8037
8037
|
name="phone"
|
|
8038
|
-
value="${
|
|
8038
|
+
value="${chunkIB6UBZVD_cjs.escapeHtml(data.userToEdit.phone || "")}"
|
|
8039
8039
|
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"
|
|
8040
8040
|
/>
|
|
8041
8041
|
</div>
|
|
@@ -8049,7 +8049,7 @@ function renderUserEditPage(data) {
|
|
|
8049
8049
|
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"
|
|
8050
8050
|
>
|
|
8051
8051
|
${data.roles.map((role) => `
|
|
8052
|
-
<option value="${
|
|
8052
|
+
<option value="${chunkIB6UBZVD_cjs.escapeHtml(role.value)}" ${data.userToEdit.role === role.value ? "selected" : ""}>${chunkIB6UBZVD_cjs.escapeHtml(role.label)}</option>
|
|
8053
8053
|
`).join("")}
|
|
8054
8054
|
</select>
|
|
8055
8055
|
<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">
|
|
@@ -8065,7 +8065,7 @@ function renderUserEditPage(data) {
|
|
|
8065
8065
|
name="bio"
|
|
8066
8066
|
rows="3"
|
|
8067
8067
|
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"
|
|
8068
|
-
>${
|
|
8068
|
+
>${chunkIB6UBZVD_cjs.escapeHtml(data.userToEdit.bio || "")}</textarea>
|
|
8069
8069
|
</div>
|
|
8070
8070
|
</div>
|
|
8071
8071
|
|
|
@@ -8265,11 +8265,11 @@ function renderUserEditPage(data) {
|
|
|
8265
8265
|
user: data.user,
|
|
8266
8266
|
content: pageContent
|
|
8267
8267
|
};
|
|
8268
|
-
return
|
|
8268
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8269
8269
|
}
|
|
8270
8270
|
|
|
8271
8271
|
// src/templates/pages/admin-user-new.template.ts
|
|
8272
|
-
|
|
8272
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
8273
8273
|
function renderUserNewPage(data) {
|
|
8274
8274
|
const pageContent = `
|
|
8275
8275
|
<div>
|
|
@@ -8308,8 +8308,8 @@ function renderUserNewPage(data) {
|
|
|
8308
8308
|
|
|
8309
8309
|
<!-- Alert Messages -->
|
|
8310
8310
|
<div id="form-messages">
|
|
8311
|
-
${data.error ?
|
|
8312
|
-
${data.success ?
|
|
8311
|
+
${data.error ? chunkRIOIKM3Y_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
8312
|
+
${data.success ? chunkRIOIKM3Y_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
8313
8313
|
</div>
|
|
8314
8314
|
|
|
8315
8315
|
<!-- User New Form -->
|
|
@@ -8553,11 +8553,11 @@ function renderUserNewPage(data) {
|
|
|
8553
8553
|
user: data.user,
|
|
8554
8554
|
content: pageContent
|
|
8555
8555
|
};
|
|
8556
|
-
return
|
|
8556
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8557
8557
|
}
|
|
8558
8558
|
|
|
8559
8559
|
// src/templates/pages/admin-users-list.template.ts
|
|
8560
|
-
|
|
8560
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
8561
8561
|
function renderUsersListPage(data) {
|
|
8562
8562
|
const columns = [
|
|
8563
8563
|
{
|
|
@@ -8708,8 +8708,8 @@ function renderUsersListPage(data) {
|
|
|
8708
8708
|
</div>
|
|
8709
8709
|
|
|
8710
8710
|
<!-- Alert Messages -->
|
|
8711
|
-
${data.error ?
|
|
8712
|
-
${data.success ?
|
|
8711
|
+
${data.error ? chunkRIOIKM3Y_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
8712
|
+
${data.success ? chunkRIOIKM3Y_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
8713
8713
|
|
|
8714
8714
|
<!-- Stats -->
|
|
8715
8715
|
<div class="mb-6">
|
|
@@ -8886,10 +8886,10 @@ function renderUsersListPage(data) {
|
|
|
8886
8886
|
</div>
|
|
8887
8887
|
|
|
8888
8888
|
<!-- Users Table -->
|
|
8889
|
-
${
|
|
8889
|
+
${chunkRIOIKM3Y_cjs.renderTable(tableData)}
|
|
8890
8890
|
|
|
8891
8891
|
<!-- Pagination -->
|
|
8892
|
-
${data.pagination ?
|
|
8892
|
+
${data.pagination ? chunkRIOIKM3Y_cjs.renderPagination(data.pagination) : ""}
|
|
8893
8893
|
</div>
|
|
8894
8894
|
|
|
8895
8895
|
<script>
|
|
@@ -8960,12 +8960,12 @@ function renderUsersListPage(data) {
|
|
|
8960
8960
|
version: data.version,
|
|
8961
8961
|
content: pageContent
|
|
8962
8962
|
};
|
|
8963
|
-
return
|
|
8963
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8964
8964
|
}
|
|
8965
8965
|
|
|
8966
8966
|
// src/routes/admin-users.ts
|
|
8967
8967
|
var userRoutes = new hono.Hono();
|
|
8968
|
-
userRoutes.use("*",
|
|
8968
|
+
userRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
8969
8969
|
userRoutes.get("/", (c) => {
|
|
8970
8970
|
return c.redirect("/admin/dashboard");
|
|
8971
8971
|
});
|
|
@@ -9064,12 +9064,12 @@ userRoutes.put("/profile", async (c) => {
|
|
|
9064
9064
|
const db = c.env.DB;
|
|
9065
9065
|
try {
|
|
9066
9066
|
const formData = await c.req.formData();
|
|
9067
|
-
const firstName =
|
|
9068
|
-
const lastName =
|
|
9069
|
-
const username =
|
|
9067
|
+
const firstName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9068
|
+
const lastName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9069
|
+
const username = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
9070
9070
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9071
|
-
const phone =
|
|
9072
|
-
const bio =
|
|
9071
|
+
const phone = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
9072
|
+
const bio = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
9073
9073
|
const timezone = formData.get("timezone")?.toString() || "UTC";
|
|
9074
9074
|
const language = formData.get("language")?.toString() || "en";
|
|
9075
9075
|
const emailNotifications = formData.get("email_notifications") === "1";
|
|
@@ -9120,7 +9120,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
9120
9120
|
Date.now(),
|
|
9121
9121
|
user.userId
|
|
9122
9122
|
).run();
|
|
9123
|
-
await
|
|
9123
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9124
9124
|
db,
|
|
9125
9125
|
user.userId,
|
|
9126
9126
|
"profile.update",
|
|
@@ -9183,7 +9183,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
9183
9183
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
9184
9184
|
`);
|
|
9185
9185
|
const userData = await userStmt.bind(user.userId).first();
|
|
9186
|
-
await
|
|
9186
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9187
9187
|
db,
|
|
9188
9188
|
user.userId,
|
|
9189
9189
|
"profile.avatar_update",
|
|
@@ -9254,7 +9254,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
9254
9254
|
dismissible: true
|
|
9255
9255
|
}));
|
|
9256
9256
|
}
|
|
9257
|
-
const validPassword = await
|
|
9257
|
+
const validPassword = await chunkOJ5WUCSH_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
9258
9258
|
if (!validPassword) {
|
|
9259
9259
|
return c.html(renderAlert2({
|
|
9260
9260
|
type: "error",
|
|
@@ -9262,7 +9262,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
9262
9262
|
dismissible: true
|
|
9263
9263
|
}));
|
|
9264
9264
|
}
|
|
9265
|
-
const newPasswordHash = await
|
|
9265
|
+
const newPasswordHash = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword(newPassword);
|
|
9266
9266
|
const historyStmt = db.prepare(`
|
|
9267
9267
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
9268
9268
|
VALUES (?, ?, ?, ?)
|
|
@@ -9278,7 +9278,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
9278
9278
|
WHERE id = ?
|
|
9279
9279
|
`);
|
|
9280
9280
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
9281
|
-
await
|
|
9281
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9282
9282
|
db,
|
|
9283
9283
|
user.userId,
|
|
9284
9284
|
"profile.password_change",
|
|
@@ -9345,7 +9345,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
9345
9345
|
`);
|
|
9346
9346
|
const countResult = await countStmt.bind(...params).first();
|
|
9347
9347
|
const totalUsers = countResult?.total || 0;
|
|
9348
|
-
await
|
|
9348
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9349
9349
|
db,
|
|
9350
9350
|
user.userId,
|
|
9351
9351
|
"users.list_view",
|
|
@@ -9447,12 +9447,12 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
9447
9447
|
const user = c.get("user");
|
|
9448
9448
|
try {
|
|
9449
9449
|
const formData = await c.req.formData();
|
|
9450
|
-
const firstName =
|
|
9451
|
-
const lastName =
|
|
9452
|
-
const username =
|
|
9450
|
+
const firstName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9451
|
+
const lastName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9452
|
+
const username = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
9453
9453
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9454
|
-
const phone =
|
|
9455
|
-
const bio =
|
|
9454
|
+
const phone = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
9455
|
+
const bio = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
9456
9456
|
const role = formData.get("role")?.toString() || "viewer";
|
|
9457
9457
|
const password = formData.get("password")?.toString() || "";
|
|
9458
9458
|
const confirmPassword = formData.get("confirm_password")?.toString() || "";
|
|
@@ -9499,7 +9499,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
9499
9499
|
dismissible: true
|
|
9500
9500
|
}));
|
|
9501
9501
|
}
|
|
9502
|
-
const passwordHash = await
|
|
9502
|
+
const passwordHash = await chunkOJ5WUCSH_cjs.AuthManager.hashPassword(password);
|
|
9503
9503
|
const userId = crypto.randomUUID();
|
|
9504
9504
|
const createStmt = db.prepare(`
|
|
9505
9505
|
INSERT INTO users (
|
|
@@ -9522,7 +9522,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
9522
9522
|
Date.now(),
|
|
9523
9523
|
Date.now()
|
|
9524
9524
|
).run();
|
|
9525
|
-
await
|
|
9525
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9526
9526
|
db,
|
|
9527
9527
|
user.userId,
|
|
9528
9528
|
"user!.create",
|
|
@@ -9560,7 +9560,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
9560
9560
|
if (!userRecord) {
|
|
9561
9561
|
return c.json({ error: "User not found" }, 404);
|
|
9562
9562
|
}
|
|
9563
|
-
await
|
|
9563
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9564
9564
|
db,
|
|
9565
9565
|
user.userId,
|
|
9566
9566
|
"user!.view",
|
|
@@ -9653,12 +9653,12 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
9653
9653
|
const userId = c.req.param("id");
|
|
9654
9654
|
try {
|
|
9655
9655
|
const formData = await c.req.formData();
|
|
9656
|
-
const firstName =
|
|
9657
|
-
const lastName =
|
|
9658
|
-
const username =
|
|
9656
|
+
const firstName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9657
|
+
const lastName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9658
|
+
const username = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
9659
9659
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9660
|
-
const phone =
|
|
9661
|
-
const bio =
|
|
9660
|
+
const phone = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
9661
|
+
const bio = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
9662
9662
|
const role = formData.get("role")?.toString() || "viewer";
|
|
9663
9663
|
const isActive = formData.get("is_active") === "1";
|
|
9664
9664
|
const emailVerified = formData.get("email_verified") === "1";
|
|
@@ -9709,7 +9709,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
9709
9709
|
Date.now(),
|
|
9710
9710
|
userId
|
|
9711
9711
|
).run();
|
|
9712
|
-
await
|
|
9712
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9713
9713
|
db,
|
|
9714
9714
|
user.userId,
|
|
9715
9715
|
"user!.update",
|
|
@@ -9754,7 +9754,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
|
|
|
9754
9754
|
UPDATE users SET is_active = ?, updated_at = ? WHERE id = ?
|
|
9755
9755
|
`);
|
|
9756
9756
|
await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
|
|
9757
|
-
await
|
|
9757
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9758
9758
|
db,
|
|
9759
9759
|
user.userId,
|
|
9760
9760
|
active ? "user.activate" : "user.deactivate",
|
|
@@ -9795,7 +9795,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
9795
9795
|
DELETE FROM users WHERE id = ?
|
|
9796
9796
|
`);
|
|
9797
9797
|
await deleteStmt.bind(userId).run();
|
|
9798
|
-
await
|
|
9798
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9799
9799
|
db,
|
|
9800
9800
|
user.userId,
|
|
9801
9801
|
"user!.hard_delete",
|
|
@@ -9814,7 +9814,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
9814
9814
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
9815
9815
|
`);
|
|
9816
9816
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
9817
|
-
await
|
|
9817
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9818
9818
|
db,
|
|
9819
9819
|
user.userId,
|
|
9820
9820
|
"user!.soft_delete",
|
|
@@ -9841,8 +9841,8 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
9841
9841
|
const formData = await c.req.formData();
|
|
9842
9842
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9843
9843
|
const role = formData.get("role")?.toString()?.trim() || "viewer";
|
|
9844
|
-
const firstName =
|
|
9845
|
-
const lastName =
|
|
9844
|
+
const firstName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9845
|
+
const lastName = chunkIB6UBZVD_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9846
9846
|
if (!email || !firstName || !lastName) {
|
|
9847
9847
|
return c.json({ error: "Email, first name, and last name are required" }, 400);
|
|
9848
9848
|
}
|
|
@@ -9880,7 +9880,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
9880
9880
|
Date.now(),
|
|
9881
9881
|
Date.now()
|
|
9882
9882
|
).run();
|
|
9883
|
-
await
|
|
9883
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9884
9884
|
db,
|
|
9885
9885
|
user.userId,
|
|
9886
9886
|
"user!.invite_sent",
|
|
@@ -9937,7 +9937,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
9937
9937
|
Date.now(),
|
|
9938
9938
|
userId
|
|
9939
9939
|
).run();
|
|
9940
|
-
await
|
|
9940
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9941
9941
|
db,
|
|
9942
9942
|
user.userId,
|
|
9943
9943
|
"user!.invitation_resent",
|
|
@@ -9973,7 +9973,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
9973
9973
|
}
|
|
9974
9974
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
9975
9975
|
await deleteStmt.bind(userId).run();
|
|
9976
|
-
await
|
|
9976
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
9977
9977
|
db,
|
|
9978
9978
|
user.userId,
|
|
9979
9979
|
"user!.invitation_cancelled",
|
|
@@ -10056,7 +10056,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
10056
10056
|
...log,
|
|
10057
10057
|
details: log.details ? JSON.parse(log.details) : null
|
|
10058
10058
|
}));
|
|
10059
|
-
await
|
|
10059
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
10060
10060
|
db,
|
|
10061
10061
|
user.userId,
|
|
10062
10062
|
"activity.logs_viewed",
|
|
@@ -10163,7 +10163,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
10163
10163
|
csvRows.push(row.join(","));
|
|
10164
10164
|
}
|
|
10165
10165
|
const csvContent = csvRows.join("\n");
|
|
10166
|
-
await
|
|
10166
|
+
await chunkOJ5WUCSH_cjs.logActivity(
|
|
10167
10167
|
db,
|
|
10168
10168
|
user.userId,
|
|
10169
10169
|
"activity.logs_exported",
|
|
@@ -10381,7 +10381,7 @@ function getFileIcon(mimeType) {
|
|
|
10381
10381
|
}
|
|
10382
10382
|
|
|
10383
10383
|
// src/templates/pages/admin-media-library.template.ts
|
|
10384
|
-
|
|
10384
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
10385
10385
|
function renderMediaLibraryPage(data) {
|
|
10386
10386
|
const pageContent = `
|
|
10387
10387
|
<div>
|
|
@@ -11316,7 +11316,7 @@ function renderMediaLibraryPage(data) {
|
|
|
11316
11316
|
version: data.version,
|
|
11317
11317
|
content: pageContent
|
|
11318
11318
|
};
|
|
11319
|
-
return
|
|
11319
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
11320
11320
|
}
|
|
11321
11321
|
|
|
11322
11322
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -11502,7 +11502,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
11502
11502
|
// 50MB max
|
|
11503
11503
|
});
|
|
11504
11504
|
var adminMediaRoutes = new hono.Hono();
|
|
11505
|
-
adminMediaRoutes.use("*",
|
|
11505
|
+
adminMediaRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
11506
11506
|
adminMediaRoutes.get("/", async (c) => {
|
|
11507
11507
|
try {
|
|
11508
11508
|
const user = c.get("user");
|
|
@@ -12088,7 +12088,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
12088
12088
|
`);
|
|
12089
12089
|
}
|
|
12090
12090
|
});
|
|
12091
|
-
adminMediaRoutes.delete("/cleanup",
|
|
12091
|
+
adminMediaRoutes.delete("/cleanup", chunkOJ5WUCSH_cjs.requireRole("admin"), async (c) => {
|
|
12092
12092
|
try {
|
|
12093
12093
|
const db = c.env.DB;
|
|
12094
12094
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -12338,7 +12338,7 @@ function formatFileSize(bytes) {
|
|
|
12338
12338
|
}
|
|
12339
12339
|
|
|
12340
12340
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
12341
|
-
|
|
12341
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
12342
12342
|
function renderPluginsListPage(data) {
|
|
12343
12343
|
const pageContent = `
|
|
12344
12344
|
<div>
|
|
@@ -12773,7 +12773,7 @@ function renderPluginsListPage(data) {
|
|
|
12773
12773
|
version: data.version,
|
|
12774
12774
|
content: pageContent
|
|
12775
12775
|
};
|
|
12776
|
-
return
|
|
12776
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12777
12777
|
}
|
|
12778
12778
|
function renderPluginCard(plugin) {
|
|
12779
12779
|
const statusColors = {
|
|
@@ -13430,7 +13430,7 @@ function renderPluginSettingsPage(data) {
|
|
|
13430
13430
|
user,
|
|
13431
13431
|
content: pageContent
|
|
13432
13432
|
};
|
|
13433
|
-
return
|
|
13433
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayout(layoutData);
|
|
13434
13434
|
}
|
|
13435
13435
|
function renderStatusBadge(status) {
|
|
13436
13436
|
const statusColors = {
|
|
@@ -13693,7 +13693,7 @@ function formatTimestamp(timestamp) {
|
|
|
13693
13693
|
|
|
13694
13694
|
// src/routes/admin-plugins.ts
|
|
13695
13695
|
var adminPluginRoutes = new hono.Hono();
|
|
13696
|
-
adminPluginRoutes.use("*",
|
|
13696
|
+
adminPluginRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
13697
13697
|
var AVAILABLE_PLUGINS = [
|
|
13698
13698
|
{
|
|
13699
13699
|
id: "third-party-faq",
|
|
@@ -13794,7 +13794,7 @@ adminPluginRoutes.get("/", async (c) => {
|
|
|
13794
13794
|
if (user?.role !== "admin") {
|
|
13795
13795
|
return c.text("Access denied", 403);
|
|
13796
13796
|
}
|
|
13797
|
-
const pluginService = new
|
|
13797
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
13798
13798
|
let installedPlugins = [];
|
|
13799
13799
|
let stats = { total: 0, active: 0, inactive: 0, errors: 0, uninstalled: 0 };
|
|
13800
13800
|
try {
|
|
@@ -13866,7 +13866,7 @@ adminPluginRoutes.get("/:id", async (c) => {
|
|
|
13866
13866
|
if (user?.role !== "admin") {
|
|
13867
13867
|
return c.redirect("/admin/plugins");
|
|
13868
13868
|
}
|
|
13869
|
-
const pluginService = new
|
|
13869
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
13870
13870
|
const plugin = await pluginService.getPlugin(pluginId);
|
|
13871
13871
|
if (!plugin) {
|
|
13872
13872
|
return c.text("Plugin not found", 404);
|
|
@@ -13920,7 +13920,7 @@ adminPluginRoutes.post("/:id/activate", async (c) => {
|
|
|
13920
13920
|
if (user?.role !== "admin") {
|
|
13921
13921
|
return c.json({ error: "Access denied" }, 403);
|
|
13922
13922
|
}
|
|
13923
|
-
const pluginService = new
|
|
13923
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
13924
13924
|
await pluginService.activatePlugin(pluginId);
|
|
13925
13925
|
return c.json({ success: true });
|
|
13926
13926
|
} catch (error) {
|
|
@@ -13937,7 +13937,7 @@ adminPluginRoutes.post("/:id/deactivate", async (c) => {
|
|
|
13937
13937
|
if (user?.role !== "admin") {
|
|
13938
13938
|
return c.json({ error: "Access denied" }, 403);
|
|
13939
13939
|
}
|
|
13940
|
-
const pluginService = new
|
|
13940
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
13941
13941
|
await pluginService.deactivatePlugin(pluginId);
|
|
13942
13942
|
return c.json({ success: true });
|
|
13943
13943
|
} catch (error) {
|
|
@@ -13954,7 +13954,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
13954
13954
|
return c.json({ error: "Access denied" }, 403);
|
|
13955
13955
|
}
|
|
13956
13956
|
const body = await c.req.json();
|
|
13957
|
-
const pluginService = new
|
|
13957
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
13958
13958
|
if (body.name === "faq-plugin") {
|
|
13959
13959
|
const faqPlugin = await pluginService.installPlugin({
|
|
13960
13960
|
id: "third-party-faq",
|
|
@@ -14170,7 +14170,7 @@ adminPluginRoutes.post("/:id/uninstall", async (c) => {
|
|
|
14170
14170
|
if (user?.role !== "admin") {
|
|
14171
14171
|
return c.json({ error: "Access denied" }, 403);
|
|
14172
14172
|
}
|
|
14173
|
-
const pluginService = new
|
|
14173
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
14174
14174
|
await pluginService.uninstallPlugin(pluginId);
|
|
14175
14175
|
return c.json({ success: true });
|
|
14176
14176
|
} catch (error) {
|
|
@@ -14188,7 +14188,7 @@ adminPluginRoutes.post("/:id/settings", async (c) => {
|
|
|
14188
14188
|
return c.json({ error: "Access denied" }, 403);
|
|
14189
14189
|
}
|
|
14190
14190
|
const settings = await c.req.json();
|
|
14191
|
-
const pluginService = new
|
|
14191
|
+
const pluginService = new chunkILZ3DP4I_cjs.PluginService(db);
|
|
14192
14192
|
await pluginService.updatePluginSettings(pluginId, settings);
|
|
14193
14193
|
return c.json({ success: true });
|
|
14194
14194
|
} catch (error) {
|
|
@@ -14209,7 +14209,7 @@ function formatLastUpdated(timestamp) {
|
|
|
14209
14209
|
}
|
|
14210
14210
|
|
|
14211
14211
|
// src/templates/pages/admin-logs-list.template.ts
|
|
14212
|
-
|
|
14212
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
14213
14213
|
function renderLogsListPage(data) {
|
|
14214
14214
|
const { logs, pagination, filters, user } = data;
|
|
14215
14215
|
const content = `
|
|
@@ -14520,7 +14520,7 @@ function renderLogsListPage(data) {
|
|
|
14520
14520
|
user,
|
|
14521
14521
|
content
|
|
14522
14522
|
};
|
|
14523
|
-
return
|
|
14523
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
14524
14524
|
}
|
|
14525
14525
|
function renderLogDetailsPage(data) {
|
|
14526
14526
|
const { log, user } = data;
|
|
@@ -14732,7 +14732,7 @@ function renderLogDetailsPage(data) {
|
|
|
14732
14732
|
</div>
|
|
14733
14733
|
</div>
|
|
14734
14734
|
`;
|
|
14735
|
-
return
|
|
14735
|
+
return chunkRIOIKM3Y_cjs.adminLayoutV2({
|
|
14736
14736
|
title: `Log Details - ${log.id}`,
|
|
14737
14737
|
user,
|
|
14738
14738
|
content
|
|
@@ -14975,7 +14975,7 @@ function renderLogConfigPage(data) {
|
|
|
14975
14975
|
|
|
14976
14976
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
14977
14977
|
`;
|
|
14978
|
-
return
|
|
14978
|
+
return chunkRIOIKM3Y_cjs.adminLayoutV2({
|
|
14979
14979
|
title: "Log Configuration",
|
|
14980
14980
|
user,
|
|
14981
14981
|
content
|
|
@@ -14984,11 +14984,11 @@ function renderLogConfigPage(data) {
|
|
|
14984
14984
|
|
|
14985
14985
|
// src/routes/admin-logs.ts
|
|
14986
14986
|
var adminLogsRoutes = new hono.Hono();
|
|
14987
|
-
adminLogsRoutes.use("*",
|
|
14987
|
+
adminLogsRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
14988
14988
|
adminLogsRoutes.get("/", async (c) => {
|
|
14989
14989
|
try {
|
|
14990
14990
|
const user = c.get("user");
|
|
14991
|
-
const logger =
|
|
14991
|
+
const logger = chunk7FOAMNTI_cjs.getLogger(c.env.DB);
|
|
14992
14992
|
const query = c.req.query();
|
|
14993
14993
|
const page = parseInt(query.page || "1");
|
|
14994
14994
|
const limit = parseInt(query.limit || "50");
|
|
@@ -15068,7 +15068,7 @@ adminLogsRoutes.get("/:id", async (c) => {
|
|
|
15068
15068
|
try {
|
|
15069
15069
|
const id = c.req.param("id");
|
|
15070
15070
|
const user = c.get("user");
|
|
15071
|
-
const logger =
|
|
15071
|
+
const logger = chunk7FOAMNTI_cjs.getLogger(c.env.DB);
|
|
15072
15072
|
const { logs } = await logger.getLogs({
|
|
15073
15073
|
limit: 1,
|
|
15074
15074
|
offset: 0,
|
|
@@ -15105,7 +15105,7 @@ adminLogsRoutes.get("/:id", async (c) => {
|
|
|
15105
15105
|
adminLogsRoutes.get("/config", async (c) => {
|
|
15106
15106
|
try {
|
|
15107
15107
|
const user = c.get("user");
|
|
15108
|
-
const logger =
|
|
15108
|
+
const logger = chunk7FOAMNTI_cjs.getLogger(c.env.DB);
|
|
15109
15109
|
const configs = await logger.getAllConfigs();
|
|
15110
15110
|
const pageData = {
|
|
15111
15111
|
configs,
|
|
@@ -15129,7 +15129,7 @@ adminLogsRoutes.post("/config/:category", async (c) => {
|
|
|
15129
15129
|
const level = formData.get("level");
|
|
15130
15130
|
const retention = parseInt(formData.get("retention"));
|
|
15131
15131
|
const maxSize = parseInt(formData.get("max_size"));
|
|
15132
|
-
const logger =
|
|
15132
|
+
const logger = chunk7FOAMNTI_cjs.getLogger(c.env.DB);
|
|
15133
15133
|
await logger.updateConfig(category, {
|
|
15134
15134
|
enabled,
|
|
15135
15135
|
level,
|
|
@@ -15158,7 +15158,7 @@ adminLogsRoutes.get("/export", async (c) => {
|
|
|
15158
15158
|
const category = query.category;
|
|
15159
15159
|
const startDate = query.start_date;
|
|
15160
15160
|
const endDate = query.end_date;
|
|
15161
|
-
const logger =
|
|
15161
|
+
const logger = chunk7FOAMNTI_cjs.getLogger(c.env.DB);
|
|
15162
15162
|
const filter = {
|
|
15163
15163
|
limit: 1e4,
|
|
15164
15164
|
// Export up to 10k logs
|
|
@@ -15239,7 +15239,7 @@ adminLogsRoutes.post("/cleanup", async (c) => {
|
|
|
15239
15239
|
error: "Unauthorized. Admin access required."
|
|
15240
15240
|
}, 403);
|
|
15241
15241
|
}
|
|
15242
|
-
const logger =
|
|
15242
|
+
const logger = chunk7FOAMNTI_cjs.getLogger(c.env.DB);
|
|
15243
15243
|
await logger.cleanupByRetention();
|
|
15244
15244
|
return c.html(html.html`
|
|
15245
15245
|
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded">
|
|
@@ -15261,7 +15261,7 @@ adminLogsRoutes.post("/search", async (c) => {
|
|
|
15261
15261
|
const search = formData.get("search");
|
|
15262
15262
|
const level = formData.get("level");
|
|
15263
15263
|
const category = formData.get("category");
|
|
15264
|
-
const logger =
|
|
15264
|
+
const logger = chunk7FOAMNTI_cjs.getLogger(c.env.DB);
|
|
15265
15265
|
const filter = {
|
|
15266
15266
|
limit: 20,
|
|
15267
15267
|
offset: 0,
|
|
@@ -15356,7 +15356,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
15356
15356
|
role: user.role
|
|
15357
15357
|
} : void 0
|
|
15358
15358
|
};
|
|
15359
|
-
return c.html(
|
|
15359
|
+
return c.html(chunkRIOIKM3Y_cjs.renderDesignPage(pageData));
|
|
15360
15360
|
});
|
|
15361
15361
|
var adminCheckboxRoutes = new hono.Hono();
|
|
15362
15362
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -15368,7 +15368,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
15368
15368
|
role: user.role
|
|
15369
15369
|
} : void 0
|
|
15370
15370
|
};
|
|
15371
|
-
return c.html(
|
|
15371
|
+
return c.html(chunkRIOIKM3Y_cjs.renderCheckboxPage(pageData));
|
|
15372
15372
|
});
|
|
15373
15373
|
|
|
15374
15374
|
// src/templates/pages/admin-testimonials-form.template.ts
|
|
@@ -15396,7 +15396,7 @@ function renderTestimonialsForm(data) {
|
|
|
15396
15396
|
</div>
|
|
15397
15397
|
</div>
|
|
15398
15398
|
|
|
15399
|
-
${message ?
|
|
15399
|
+
${message ? chunkRIOIKM3Y_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
15400
15400
|
|
|
15401
15401
|
<!-- Form -->
|
|
15402
15402
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -15625,7 +15625,7 @@ function renderTestimonialsForm(data) {
|
|
|
15625
15625
|
user: data.user,
|
|
15626
15626
|
content: pageContent
|
|
15627
15627
|
};
|
|
15628
|
-
return
|
|
15628
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayout(layoutData);
|
|
15629
15629
|
}
|
|
15630
15630
|
function escapeHtml4(unsafe) {
|
|
15631
15631
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -15651,7 +15651,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
15651
15651
|
const offset = (currentPage - 1) * limit;
|
|
15652
15652
|
const db = c.env?.DB;
|
|
15653
15653
|
if (!db) {
|
|
15654
|
-
return c.html(
|
|
15654
|
+
return c.html(chunkRIOIKM3Y_cjs.renderTestimonialsList({
|
|
15655
15655
|
testimonials: [],
|
|
15656
15656
|
totalCount: 0,
|
|
15657
15657
|
currentPage: 1,
|
|
@@ -15691,7 +15691,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
15691
15691
|
`;
|
|
15692
15692
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
15693
15693
|
const totalPages = Math.ceil(totalCount / limit);
|
|
15694
|
-
return c.html(
|
|
15694
|
+
return c.html(chunkRIOIKM3Y_cjs.renderTestimonialsList({
|
|
15695
15695
|
testimonials: testimonials || [],
|
|
15696
15696
|
totalCount,
|
|
15697
15697
|
currentPage,
|
|
@@ -15705,7 +15705,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
15705
15705
|
} catch (error) {
|
|
15706
15706
|
console.error("Error fetching testimonials:", error);
|
|
15707
15707
|
const user = c.get("user");
|
|
15708
|
-
return c.html(
|
|
15708
|
+
return c.html(chunkRIOIKM3Y_cjs.renderTestimonialsList({
|
|
15709
15709
|
testimonials: [],
|
|
15710
15710
|
totalCount: 0,
|
|
15711
15711
|
currentPage: 1,
|
|
@@ -16024,7 +16024,7 @@ function renderCodeExamplesForm(data) {
|
|
|
16024
16024
|
</div>
|
|
16025
16025
|
</div>
|
|
16026
16026
|
|
|
16027
|
-
${message ?
|
|
16027
|
+
${message ? chunkRIOIKM3Y_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
16028
16028
|
|
|
16029
16029
|
<!-- Form -->
|
|
16030
16030
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -16294,7 +16294,7 @@ function renderCodeExamplesForm(data) {
|
|
|
16294
16294
|
user: data.user,
|
|
16295
16295
|
content: pageContent
|
|
16296
16296
|
};
|
|
16297
|
-
return
|
|
16297
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayout(layoutData);
|
|
16298
16298
|
}
|
|
16299
16299
|
function escapeHtml5(unsafe) {
|
|
16300
16300
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -16321,7 +16321,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
16321
16321
|
const offset = (currentPage - 1) * limit;
|
|
16322
16322
|
const db = c.env?.DB;
|
|
16323
16323
|
if (!db) {
|
|
16324
|
-
return c.html(
|
|
16324
|
+
return c.html(chunkRIOIKM3Y_cjs.renderCodeExamplesList({
|
|
16325
16325
|
codeExamples: [],
|
|
16326
16326
|
totalCount: 0,
|
|
16327
16327
|
currentPage: 1,
|
|
@@ -16361,7 +16361,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
16361
16361
|
`;
|
|
16362
16362
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
16363
16363
|
const totalPages = Math.ceil(totalCount / limit);
|
|
16364
|
-
return c.html(
|
|
16364
|
+
return c.html(chunkRIOIKM3Y_cjs.renderCodeExamplesList({
|
|
16365
16365
|
codeExamples: codeExamples || [],
|
|
16366
16366
|
totalCount,
|
|
16367
16367
|
currentPage,
|
|
@@ -16375,7 +16375,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
16375
16375
|
} catch (error) {
|
|
16376
16376
|
console.error("Error fetching code examples:", error);
|
|
16377
16377
|
const user = c.get("user");
|
|
16378
|
-
return c.html(
|
|
16378
|
+
return c.html(chunkRIOIKM3Y_cjs.renderCodeExamplesList({
|
|
16379
16379
|
codeExamples: [],
|
|
16380
16380
|
totalCount: 0,
|
|
16381
16381
|
currentPage: 1,
|
|
@@ -16764,7 +16764,7 @@ function renderDashboardPage(data) {
|
|
|
16764
16764
|
version: data.version,
|
|
16765
16765
|
content: pageContent
|
|
16766
16766
|
};
|
|
16767
|
-
return
|
|
16767
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayout(layoutData);
|
|
16768
16768
|
}
|
|
16769
16769
|
function renderStatsCards(stats) {
|
|
16770
16770
|
const cards = [
|
|
@@ -17312,9 +17312,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
17312
17312
|
}
|
|
17313
17313
|
|
|
17314
17314
|
// src/routes/admin-dashboard.ts
|
|
17315
|
-
var VERSION =
|
|
17315
|
+
var VERSION = chunkIB6UBZVD_cjs.getCoreVersion();
|
|
17316
17316
|
var router = new hono.Hono();
|
|
17317
|
-
router.use("*",
|
|
17317
|
+
router.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
17318
17318
|
router.get("/", async (c) => {
|
|
17319
17319
|
const user = c.get("user");
|
|
17320
17320
|
try {
|
|
@@ -17539,7 +17539,7 @@ router.get("/system-status", async (c) => {
|
|
|
17539
17539
|
});
|
|
17540
17540
|
|
|
17541
17541
|
// src/templates/pages/admin-collections-list.template.ts
|
|
17542
|
-
|
|
17542
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
17543
17543
|
|
|
17544
17544
|
// src/templates/components/table.template.ts
|
|
17545
17545
|
function renderTable2(data) {
|
|
@@ -18013,11 +18013,11 @@ function renderCollectionsListPage(data) {
|
|
|
18013
18013
|
version: data.version,
|
|
18014
18014
|
content: pageContent
|
|
18015
18015
|
};
|
|
18016
|
-
return
|
|
18016
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
18017
18017
|
}
|
|
18018
18018
|
|
|
18019
18019
|
// src/templates/pages/admin-collections-form.template.ts
|
|
18020
|
-
|
|
18020
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
18021
18021
|
function getFieldTypeBadge(fieldType) {
|
|
18022
18022
|
const typeLabels = {
|
|
18023
18023
|
"text": "Text",
|
|
@@ -18278,7 +18278,7 @@ function renderCollectionFormPage(data) {
|
|
|
18278
18278
|
}
|
|
18279
18279
|
</style>
|
|
18280
18280
|
|
|
18281
|
-
${
|
|
18281
|
+
${chunkRIOIKM3Y_cjs.renderForm(formData)}
|
|
18282
18282
|
|
|
18283
18283
|
${isEdit && data.managed ? `
|
|
18284
18284
|
<!-- Read-Only Fields Display for Managed Collections -->
|
|
@@ -18350,7 +18350,7 @@ function renderCollectionFormPage(data) {
|
|
|
18350
18350
|
Add Field
|
|
18351
18351
|
</button>
|
|
18352
18352
|
</div>
|
|
18353
|
-
|
|
18353
|
+
|
|
18354
18354
|
<!-- Fields List -->
|
|
18355
18355
|
<div id="fields-list" class="space-y-3">
|
|
18356
18356
|
${fieldsWithData.map((field) => `
|
|
@@ -18421,7 +18421,9 @@ function renderCollectionFormPage(data) {
|
|
|
18421
18421
|
` : ""}
|
|
18422
18422
|
</div>
|
|
18423
18423
|
</div>
|
|
18424
|
-
` :
|
|
18424
|
+
` : ""}
|
|
18425
|
+
|
|
18426
|
+
${!isEdit ? `
|
|
18425
18427
|
<div class="mt-6 rounded-lg bg-cyan-50 dark:bg-cyan-900/20 border border-cyan-100 dark:border-cyan-900/30 p-4">
|
|
18426
18428
|
<div class="flex items-start gap-x-3">
|
|
18427
18429
|
<svg class="h-5 w-5 text-cyan-600 dark:text-cyan-400 mt-0.5" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -18437,7 +18439,7 @@ function renderCollectionFormPage(data) {
|
|
|
18437
18439
|
</div>
|
|
18438
18440
|
</div>
|
|
18439
18441
|
</div>
|
|
18440
|
-
`}
|
|
18442
|
+
` : ""}
|
|
18441
18443
|
|
|
18442
18444
|
<!-- Action Buttons -->
|
|
18443
18445
|
<div class="mt-6 pt-6 border-t border-zinc-950/5 dark:border-white/10 flex items-center justify-between">
|
|
@@ -19063,12 +19065,12 @@ function renderCollectionFormPage(data) {
|
|
|
19063
19065
|
version: data.version,
|
|
19064
19066
|
content: pageContent
|
|
19065
19067
|
};
|
|
19066
|
-
return
|
|
19068
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
19067
19069
|
}
|
|
19068
19070
|
|
|
19069
19071
|
// src/routes/admin-collections.ts
|
|
19070
19072
|
var adminCollectionsRoutes = new hono.Hono();
|
|
19071
|
-
adminCollectionsRoutes.use("*",
|
|
19073
|
+
adminCollectionsRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
19072
19074
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
19073
19075
|
try {
|
|
19074
19076
|
const user = c.get("user");
|
|
@@ -19681,7 +19683,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
19681
19683
|
});
|
|
19682
19684
|
|
|
19683
19685
|
// src/templates/pages/admin-settings.template.ts
|
|
19684
|
-
|
|
19686
|
+
chunkRIOIKM3Y_cjs.init_admin_layout_catalyst_template();
|
|
19685
19687
|
function renderSettingsPage(data) {
|
|
19686
19688
|
const activeTab = data.activeTab || "general";
|
|
19687
19689
|
const pageContent = `
|
|
@@ -20063,7 +20065,7 @@ function renderSettingsPage(data) {
|
|
|
20063
20065
|
version: data.version,
|
|
20064
20066
|
content: pageContent
|
|
20065
20067
|
};
|
|
20066
|
-
return
|
|
20068
|
+
return chunkRIOIKM3Y_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
20067
20069
|
}
|
|
20068
20070
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
20069
20071
|
const isActive = activeTab === tabId;
|
|
@@ -21145,7 +21147,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
21145
21147
|
|
|
21146
21148
|
// src/routes/admin-settings.ts
|
|
21147
21149
|
var adminSettingsRoutes = new hono.Hono();
|
|
21148
|
-
adminSettingsRoutes.use("*",
|
|
21150
|
+
adminSettingsRoutes.use("*", chunkOJ5WUCSH_cjs.requireAuth());
|
|
21149
21151
|
function getMockSettings(user) {
|
|
21150
21152
|
return {
|
|
21151
21153
|
general: {
|
|
@@ -21210,7 +21212,7 @@ adminSettingsRoutes.get("/", (c) => {
|
|
|
21210
21212
|
adminSettingsRoutes.get("/general", async (c) => {
|
|
21211
21213
|
const user = c.get("user");
|
|
21212
21214
|
const db = c.env.DB;
|
|
21213
|
-
const settingsService = new
|
|
21215
|
+
const settingsService = new chunk7FOAMNTI_cjs.SettingsService(db);
|
|
21214
21216
|
const generalSettings = await settingsService.getGeneralSettings(user?.email);
|
|
21215
21217
|
const mockSettings = getMockSettings(user);
|
|
21216
21218
|
mockSettings.general = generalSettings;
|
|
@@ -21313,7 +21315,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
21313
21315
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
21314
21316
|
try {
|
|
21315
21317
|
const db = c.env.DB;
|
|
21316
|
-
const migrationService = new
|
|
21318
|
+
const migrationService = new chunkP6NMVNJJ_cjs.MigrationService(db);
|
|
21317
21319
|
const status = await migrationService.getMigrationStatus();
|
|
21318
21320
|
return c.json({
|
|
21319
21321
|
success: true,
|
|
@@ -21337,7 +21339,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
21337
21339
|
}, 403);
|
|
21338
21340
|
}
|
|
21339
21341
|
const db = c.env.DB;
|
|
21340
|
-
const migrationService = new
|
|
21342
|
+
const migrationService = new chunkP6NMVNJJ_cjs.MigrationService(db);
|
|
21341
21343
|
const result = await migrationService.runPendingMigrations();
|
|
21342
21344
|
return c.json({
|
|
21343
21345
|
success: result.success,
|
|
@@ -21355,7 +21357,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
21355
21357
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
21356
21358
|
try {
|
|
21357
21359
|
const db = c.env.DB;
|
|
21358
|
-
const migrationService = new
|
|
21360
|
+
const migrationService = new chunkP6NMVNJJ_cjs.MigrationService(db);
|
|
21359
21361
|
const validation = await migrationService.validateSchema();
|
|
21360
21362
|
return c.json({
|
|
21361
21363
|
success: true,
|
|
@@ -21512,7 +21514,7 @@ adminSettingsRoutes.post("/general", async (c) => {
|
|
|
21512
21514
|
}
|
|
21513
21515
|
const formData = await c.req.formData();
|
|
21514
21516
|
const db = c.env.DB;
|
|
21515
|
-
const settingsService = new
|
|
21517
|
+
const settingsService = new chunk7FOAMNTI_cjs.SettingsService(db);
|
|
21516
21518
|
const settings = {
|
|
21517
21519
|
siteName: formData.get("siteName"),
|
|
21518
21520
|
siteDescription: formData.get("siteDescription"),
|
|
@@ -21600,5 +21602,5 @@ exports.auth_default = auth_default;
|
|
|
21600
21602
|
exports.router = router;
|
|
21601
21603
|
exports.test_cleanup_default = test_cleanup_default;
|
|
21602
21604
|
exports.userRoutes = userRoutes;
|
|
21603
|
-
//# sourceMappingURL=chunk-
|
|
21604
|
-
//# sourceMappingURL=chunk-
|
|
21605
|
+
//# sourceMappingURL=chunk-HTJLBF6F.cjs.map
|
|
21606
|
+
//# sourceMappingURL=chunk-HTJLBF6F.cjs.map
|