@sonicjs-cms/core 2.0.5 → 2.0.8
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/README.md +16 -0
- package/dist/{chunk-IM5SDXOE.cjs → chunk-3R7EQNGO.cjs} +6 -6
- package/dist/{chunk-IM5SDXOE.cjs.map → chunk-3R7EQNGO.cjs.map} +1 -1
- package/dist/{chunk-HSRPDEQQ.js → chunk-4MBTSUI6.js} +17 -3
- package/dist/chunk-4MBTSUI6.js.map +1 -0
- package/dist/{chunk-3SPQ3J4N.cjs → chunk-7XEESVSX.cjs} +73 -2
- package/dist/chunk-7XEESVSX.cjs.map +1 -0
- package/dist/{chunk-TRSHFTF6.cjs → chunk-CHMO2DOC.cjs} +15 -15
- package/dist/{chunk-TRSHFTF6.cjs.map → chunk-CHMO2DOC.cjs.map} +1 -1
- package/dist/{chunk-LGC3TNCY.js → chunk-CUEIM4FE.js} +6 -6
- package/dist/{chunk-LGC3TNCY.js.map → chunk-CUEIM4FE.js.map} +1 -1
- package/dist/{chunk-NPWWR6RI.cjs → chunk-GN7Q6V5C.cjs} +162 -162
- package/dist/{chunk-NPWWR6RI.cjs.map → chunk-GN7Q6V5C.cjs.map} +1 -1
- package/dist/{chunk-5APKEYFK.cjs → chunk-KHNSPJ6X.cjs} +5 -5
- package/dist/{chunk-5APKEYFK.cjs.map → chunk-KHNSPJ6X.cjs.map} +1 -1
- package/dist/{chunk-RYQCT2IV.js → chunk-LS5CMDNL.js} +3 -3
- package/dist/{chunk-RYQCT2IV.js.map → chunk-LS5CMDNL.js.map} +1 -1
- package/dist/{chunk-G5KY3WJV.js → chunk-O7LMFJMZ.js} +3 -3
- package/dist/{chunk-G5KY3WJV.js.map → chunk-O7LMFJMZ.js.map} +1 -1
- package/dist/{chunk-3JMOWGUU.cjs → chunk-YGVWY6KO.cjs} +17 -3
- package/dist/chunk-YGVWY6KO.cjs.map +1 -0
- package/dist/{chunk-3LZ6TLPC.js → chunk-YHLLVUJC.js} +73 -2
- package/dist/chunk-YHLLVUJC.js.map +1 -0
- package/dist/{chunk-VSLEA22M.js → chunk-Z2CZC6TC.js} +15 -15
- package/dist/{chunk-VSLEA22M.js.map → chunk-Z2CZC6TC.js.map} +1 -1
- package/dist/index.cjs +97 -97
- package/dist/index.js +10 -10
- package/dist/middleware.cjs +23 -23
- package/dist/middleware.js +2 -2
- package/dist/routes.cjs +25 -25
- package/dist/routes.js +5 -5
- package/dist/services.cjs +14 -14
- package/dist/services.js +1 -1
- package/dist/templates.cjs +18 -18
- package/dist/templates.js +2 -2
- package/dist/utils.cjs +11 -11
- package/dist/utils.js +1 -1
- package/package.json +13 -13
- package/dist/chunk-3JMOWGUU.cjs.map +0 -1
- package/dist/chunk-3LZ6TLPC.js.map +0 -1
- package/dist/chunk-3SPQ3J4N.cjs.map +0 -1
- package/dist/chunk-HSRPDEQQ.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkDOR2IU73_cjs = require('./chunk-DOR2IU73.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
4
|
+
var chunk3R7EQNGO_cjs = require('./chunk-3R7EQNGO.cjs');
|
|
5
|
+
var chunkYGVWY6KO_cjs = require('./chunk-YGVWY6KO.cjs');
|
|
6
|
+
var chunk7XEESVSX_cjs = require('./chunk-7XEESVSX.cjs');
|
|
7
|
+
var chunkCHMO2DOC_cjs = require('./chunk-CHMO2DOC.cjs');
|
|
8
8
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
9
9
|
var hono = require('hono');
|
|
10
10
|
var cors = require('hono/cors');
|
|
@@ -43,7 +43,7 @@ apiContentCrudRoutes.get("/:id", async (c) => {
|
|
|
43
43
|
}, 500);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
apiContentCrudRoutes.post("/",
|
|
46
|
+
apiContentCrudRoutes.post("/", chunk3R7EQNGO_cjs.requireAuth(), async (c) => {
|
|
47
47
|
try {
|
|
48
48
|
const db = c.env.DB;
|
|
49
49
|
const user = c.get("user");
|
|
@@ -109,7 +109,7 @@ apiContentCrudRoutes.post("/", chunkIM5SDXOE_cjs.requireAuth(), async (c) => {
|
|
|
109
109
|
}, 500);
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
apiContentCrudRoutes.put("/:id",
|
|
112
|
+
apiContentCrudRoutes.put("/:id", chunk3R7EQNGO_cjs.requireAuth(), async (c) => {
|
|
113
113
|
try {
|
|
114
114
|
const id = c.req.param("id");
|
|
115
115
|
const db = c.env.DB;
|
|
@@ -173,7 +173,7 @@ apiContentCrudRoutes.put("/:id", chunkIM5SDXOE_cjs.requireAuth(), async (c) => {
|
|
|
173
173
|
}, 500);
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
|
-
apiContentCrudRoutes.delete("/:id",
|
|
176
|
+
apiContentCrudRoutes.delete("/:id", chunk3R7EQNGO_cjs.requireAuth(), async (c) => {
|
|
177
177
|
try {
|
|
178
178
|
const id = c.req.param("id");
|
|
179
179
|
const db = c.env.DB;
|
|
@@ -209,7 +209,7 @@ apiRoutes.use("*", async (c, next) => {
|
|
|
209
209
|
c.header("X-Response-Time", `${totalTime}ms`);
|
|
210
210
|
});
|
|
211
211
|
apiRoutes.use("*", async (c, next) => {
|
|
212
|
-
const cacheEnabled = await
|
|
212
|
+
const cacheEnabled = await chunk3R7EQNGO_cjs.isPluginActive(c.env.DB, "core-cache");
|
|
213
213
|
c.set("cacheEnabled", cacheEnabled);
|
|
214
214
|
await next();
|
|
215
215
|
});
|
|
@@ -334,12 +334,12 @@ apiRoutes.get("/content", async (c) => {
|
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
const filter =
|
|
337
|
+
const filter = chunkCHMO2DOC_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
338
338
|
if (!filter.limit) {
|
|
339
339
|
filter.limit = 50;
|
|
340
340
|
}
|
|
341
341
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
342
|
-
const builder = new
|
|
342
|
+
const builder = new chunkCHMO2DOC_cjs.QueryFilterBuilder();
|
|
343
343
|
const queryResult = builder.build("content", filter);
|
|
344
344
|
if (queryResult.errors.length > 0) {
|
|
345
345
|
return c.json({
|
|
@@ -426,7 +426,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
426
426
|
if (!collectionResult) {
|
|
427
427
|
return c.json({ error: "Collection not found" }, 404);
|
|
428
428
|
}
|
|
429
|
-
const filter =
|
|
429
|
+
const filter = chunkCHMO2DOC_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
430
430
|
if (!filter.where) {
|
|
431
431
|
filter.where = { and: [] };
|
|
432
432
|
}
|
|
@@ -442,7 +442,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
442
442
|
filter.limit = 50;
|
|
443
443
|
}
|
|
444
444
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
445
|
-
const builder = new
|
|
445
|
+
const builder = new chunkCHMO2DOC_cjs.QueryFilterBuilder();
|
|
446
446
|
const queryResult = builder.build("content", filter);
|
|
447
447
|
if (queryResult.errors.length > 0) {
|
|
448
448
|
return c.json({
|
|
@@ -567,7 +567,7 @@ var fileValidationSchema = zod.z.object({
|
|
|
567
567
|
// 50MB max
|
|
568
568
|
});
|
|
569
569
|
var apiMediaRoutes = new hono.Hono();
|
|
570
|
-
apiMediaRoutes.use("*",
|
|
570
|
+
apiMediaRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
571
571
|
apiMediaRoutes.post("/upload", async (c) => {
|
|
572
572
|
try {
|
|
573
573
|
const user = c.get("user");
|
|
@@ -1311,8 +1311,8 @@ apiSystemRoutes.get("/env", (c) => {
|
|
|
1311
1311
|
});
|
|
1312
1312
|
var api_system_default = apiSystemRoutes;
|
|
1313
1313
|
var adminApiRoutes = new hono.Hono();
|
|
1314
|
-
adminApiRoutes.use("*",
|
|
1315
|
-
adminApiRoutes.use("*",
|
|
1314
|
+
adminApiRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
1315
|
+
adminApiRoutes.use("*", chunk3R7EQNGO_cjs.requireRole(["admin", "editor"]));
|
|
1316
1316
|
adminApiRoutes.get("/stats", async (c) => {
|
|
1317
1317
|
try {
|
|
1318
1318
|
const db = c.env.DB;
|
|
@@ -1778,8 +1778,8 @@ function renderLoginPage(data, demoLoginActive = false) {
|
|
|
1778
1778
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
1779
1779
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
1780
1780
|
<!-- Alerts -->
|
|
1781
|
-
${data.error ? `<div class="mb-6">${
|
|
1782
|
-
${data.message ? `<div class="mb-6">${
|
|
1781
|
+
${data.error ? `<div class="mb-6">${chunk7XEESVSX_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
1782
|
+
${data.message ? `<div class="mb-6">${chunk7XEESVSX_cjs.renderAlert({ type: "success", message: data.message })}</div>` : ""}
|
|
1783
1783
|
|
|
1784
1784
|
<!-- Form Response (HTMX target) -->
|
|
1785
1785
|
<div id="form-response" class="mb-6"></div>
|
|
@@ -1943,7 +1943,7 @@ function renderRegisterPage(data) {
|
|
|
1943
1943
|
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
|
1944
1944
|
<div class="bg-zinc-900 shadow-sm ring-1 ring-white/10 rounded-xl px-6 py-8 sm:px-10">
|
|
1945
1945
|
<!-- Alerts -->
|
|
1946
|
-
${data.error ? `<div class="mb-6">${
|
|
1946
|
+
${data.error ? `<div class="mb-6">${chunk7XEESVSX_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
1947
1947
|
|
|
1948
1948
|
<!-- Form -->
|
|
1949
1949
|
<form
|
|
@@ -2142,7 +2142,7 @@ authRoutes.post(
|
|
|
2142
2142
|
if (existingUser) {
|
|
2143
2143
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
2144
2144
|
}
|
|
2145
|
-
const passwordHash = await
|
|
2145
|
+
const passwordHash = await chunk3R7EQNGO_cjs.AuthManager.hashPassword(password);
|
|
2146
2146
|
const userId = crypto.randomUUID();
|
|
2147
2147
|
const now = /* @__PURE__ */ new Date();
|
|
2148
2148
|
await db.prepare(`
|
|
@@ -2162,7 +2162,7 @@ authRoutes.post(
|
|
|
2162
2162
|
now.getTime(),
|
|
2163
2163
|
now.getTime()
|
|
2164
2164
|
).run();
|
|
2165
|
-
const token = await
|
|
2165
|
+
const token = await chunk3R7EQNGO_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer");
|
|
2166
2166
|
cookie.setCookie(c, "auth_token", token, {
|
|
2167
2167
|
httpOnly: true,
|
|
2168
2168
|
secure: true,
|
|
@@ -2209,11 +2209,11 @@ authRoutes.post("/login", async (c) => {
|
|
|
2209
2209
|
if (!user) {
|
|
2210
2210
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2211
2211
|
}
|
|
2212
|
-
const isValidPassword = await
|
|
2212
|
+
const isValidPassword = await chunk3R7EQNGO_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2213
2213
|
if (!isValidPassword) {
|
|
2214
2214
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2215
2215
|
}
|
|
2216
|
-
const token = await
|
|
2216
|
+
const token = await chunk3R7EQNGO_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2217
2217
|
cookie.setCookie(c, "auth_token", token, {
|
|
2218
2218
|
httpOnly: true,
|
|
2219
2219
|
secure: true,
|
|
@@ -2262,7 +2262,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
2262
2262
|
});
|
|
2263
2263
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
2264
2264
|
});
|
|
2265
|
-
authRoutes.get("/me",
|
|
2265
|
+
authRoutes.get("/me", chunk3R7EQNGO_cjs.requireAuth(), async (c) => {
|
|
2266
2266
|
try {
|
|
2267
2267
|
const user = c.get("user");
|
|
2268
2268
|
if (!user) {
|
|
@@ -2279,13 +2279,13 @@ authRoutes.get("/me", chunkIM5SDXOE_cjs.requireAuth(), async (c) => {
|
|
|
2279
2279
|
return c.json({ error: "Failed to get user" }, 500);
|
|
2280
2280
|
}
|
|
2281
2281
|
});
|
|
2282
|
-
authRoutes.post("/refresh",
|
|
2282
|
+
authRoutes.post("/refresh", chunk3R7EQNGO_cjs.requireAuth(), async (c) => {
|
|
2283
2283
|
try {
|
|
2284
2284
|
const user = c.get("user");
|
|
2285
2285
|
if (!user) {
|
|
2286
2286
|
return c.json({ error: "Not authenticated" }, 401);
|
|
2287
2287
|
}
|
|
2288
|
-
const token = await
|
|
2288
|
+
const token = await chunk3R7EQNGO_cjs.AuthManager.generateToken(user.userId, user.email, user.role);
|
|
2289
2289
|
cookie.setCookie(c, "auth_token", token, {
|
|
2290
2290
|
httpOnly: true,
|
|
2291
2291
|
secure: true,
|
|
@@ -2335,7 +2335,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2335
2335
|
</div>
|
|
2336
2336
|
`);
|
|
2337
2337
|
}
|
|
2338
|
-
const passwordHash = await
|
|
2338
|
+
const passwordHash = await chunk3R7EQNGO_cjs.AuthManager.hashPassword(password);
|
|
2339
2339
|
const userId = crypto.randomUUID();
|
|
2340
2340
|
const now = /* @__PURE__ */ new Date();
|
|
2341
2341
|
await db.prepare(`
|
|
@@ -2355,7 +2355,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2355
2355
|
now.getTime(),
|
|
2356
2356
|
now.getTime()
|
|
2357
2357
|
).run();
|
|
2358
|
-
const token = await
|
|
2358
|
+
const token = await chunk3R7EQNGO_cjs.AuthManager.generateToken(userId, normalizedEmail, "admin");
|
|
2359
2359
|
cookie.setCookie(c, "auth_token", token, {
|
|
2360
2360
|
httpOnly: true,
|
|
2361
2361
|
secure: false,
|
|
@@ -2406,7 +2406,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2406
2406
|
</div>
|
|
2407
2407
|
`);
|
|
2408
2408
|
}
|
|
2409
|
-
const isValidPassword = await
|
|
2409
|
+
const isValidPassword = await chunk3R7EQNGO_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2410
2410
|
if (!isValidPassword) {
|
|
2411
2411
|
return c.html(html.html`
|
|
2412
2412
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -2414,7 +2414,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2414
2414
|
</div>
|
|
2415
2415
|
`);
|
|
2416
2416
|
}
|
|
2417
|
-
const token = await
|
|
2417
|
+
const token = await chunk3R7EQNGO_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2418
2418
|
cookie.setCookie(c, "auth_token", token, {
|
|
2419
2419
|
httpOnly: true,
|
|
2420
2420
|
secure: false,
|
|
@@ -2483,7 +2483,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
});
|
|
2485
2485
|
}
|
|
2486
|
-
const passwordHash = await
|
|
2486
|
+
const passwordHash = await chunk3R7EQNGO_cjs.AuthManager.hashPassword("admin123");
|
|
2487
2487
|
const userId = "admin-user-id";
|
|
2488
2488
|
const now = Date.now();
|
|
2489
2489
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -2703,7 +2703,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2703
2703
|
if (existingUsername) {
|
|
2704
2704
|
return c.json({ error: "Username is already taken" }, 400);
|
|
2705
2705
|
}
|
|
2706
|
-
const passwordHash = await
|
|
2706
|
+
const passwordHash = await chunk3R7EQNGO_cjs.AuthManager.hashPassword(password);
|
|
2707
2707
|
const updateStmt = db.prepare(`
|
|
2708
2708
|
UPDATE users SET
|
|
2709
2709
|
username = ?,
|
|
@@ -2722,7 +2722,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2722
2722
|
Date.now(),
|
|
2723
2723
|
invitedUser.id
|
|
2724
2724
|
).run();
|
|
2725
|
-
const authToken = await
|
|
2725
|
+
const authToken = await chunk3R7EQNGO_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role);
|
|
2726
2726
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
2727
2727
|
httpOnly: true,
|
|
2728
2728
|
secure: true,
|
|
@@ -2952,7 +2952,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
2952
2952
|
if (Date.now() > user.password_reset_expires) {
|
|
2953
2953
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
2954
2954
|
}
|
|
2955
|
-
const newPasswordHash = await
|
|
2955
|
+
const newPasswordHash = await chunk3R7EQNGO_cjs.AuthManager.hashPassword(password);
|
|
2956
2956
|
try {
|
|
2957
2957
|
const historyStmt = db.prepare(`
|
|
2958
2958
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -2989,7 +2989,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
2989
2989
|
var auth_default = authRoutes;
|
|
2990
2990
|
|
|
2991
2991
|
// src/templates/pages/admin-content-form.template.ts
|
|
2992
|
-
|
|
2992
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
2993
2993
|
|
|
2994
2994
|
// src/templates/components/dynamic-field.template.ts
|
|
2995
2995
|
function renderDynamicField(field, options = {}) {
|
|
@@ -3393,8 +3393,8 @@ function renderContentFormPage(data) {
|
|
|
3393
3393
|
<!-- Form Content -->
|
|
3394
3394
|
<div class="px-6 py-6">
|
|
3395
3395
|
<div id="form-messages">
|
|
3396
|
-
${data.error ?
|
|
3397
|
-
${data.success ?
|
|
3396
|
+
${data.error ? chunk7XEESVSX_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
3397
|
+
${data.success ? chunk7XEESVSX_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
3398
3398
|
</div>
|
|
3399
3399
|
|
|
3400
3400
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -3629,7 +3629,7 @@ function renderContentFormPage(data) {
|
|
|
3629
3629
|
</div>
|
|
3630
3630
|
|
|
3631
3631
|
<!-- Confirmation Dialogs -->
|
|
3632
|
-
${
|
|
3632
|
+
${chunk7XEESVSX_cjs.renderConfirmationDialog({
|
|
3633
3633
|
id: "duplicate-content-confirm",
|
|
3634
3634
|
title: "Duplicate Content",
|
|
3635
3635
|
message: "Create a copy of this content?",
|
|
@@ -3640,7 +3640,7 @@ function renderContentFormPage(data) {
|
|
|
3640
3640
|
onConfirm: "performDuplicateContent()"
|
|
3641
3641
|
})}
|
|
3642
3642
|
|
|
3643
|
-
${
|
|
3643
|
+
${chunk7XEESVSX_cjs.renderConfirmationDialog({
|
|
3644
3644
|
id: "delete-content-confirm",
|
|
3645
3645
|
title: "Delete Content",
|
|
3646
3646
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -3651,7 +3651,7 @@ function renderContentFormPage(data) {
|
|
|
3651
3651
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
3652
3652
|
})}
|
|
3653
3653
|
|
|
3654
|
-
${
|
|
3654
|
+
${chunk7XEESVSX_cjs.getConfirmationDialogScript()}
|
|
3655
3655
|
|
|
3656
3656
|
<!-- TinyMCE CDN -->
|
|
3657
3657
|
<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>
|
|
@@ -3939,11 +3939,11 @@ function renderContentFormPage(data) {
|
|
|
3939
3939
|
content: pageContent,
|
|
3940
3940
|
version: data.version
|
|
3941
3941
|
};
|
|
3942
|
-
return
|
|
3942
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
3943
3943
|
}
|
|
3944
3944
|
|
|
3945
3945
|
// src/templates/pages/admin-content-list.template.ts
|
|
3946
|
-
|
|
3946
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
3947
3947
|
function renderContentListPage(data) {
|
|
3948
3948
|
const urlParams = new URLSearchParams();
|
|
3949
3949
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -4339,8 +4339,8 @@ function renderContentListPage(data) {
|
|
|
4339
4339
|
|
|
4340
4340
|
<!-- Content List -->
|
|
4341
4341
|
<div id="content-list">
|
|
4342
|
-
${
|
|
4343
|
-
${
|
|
4342
|
+
${chunk7XEESVSX_cjs.renderTable(tableData)}
|
|
4343
|
+
${chunk7XEESVSX_cjs.renderPagination(paginationData)}
|
|
4344
4344
|
</div>
|
|
4345
4345
|
|
|
4346
4346
|
</div>
|
|
@@ -4549,7 +4549,7 @@ function renderContentListPage(data) {
|
|
|
4549
4549
|
</script>
|
|
4550
4550
|
|
|
4551
4551
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
4552
|
-
${
|
|
4552
|
+
${chunk7XEESVSX_cjs.renderConfirmationDialog({
|
|
4553
4553
|
id: "bulk-action-confirm",
|
|
4554
4554
|
title: "Confirm Bulk Action",
|
|
4555
4555
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -4561,7 +4561,7 @@ function renderContentListPage(data) {
|
|
|
4561
4561
|
})}
|
|
4562
4562
|
|
|
4563
4563
|
<!-- Confirmation Dialog Script -->
|
|
4564
|
-
${
|
|
4564
|
+
${chunk7XEESVSX_cjs.getConfirmationDialogScript()}
|
|
4565
4565
|
`;
|
|
4566
4566
|
const layoutData = {
|
|
4567
4567
|
title: "Content Management",
|
|
@@ -4571,7 +4571,7 @@ function renderContentListPage(data) {
|
|
|
4571
4571
|
version: data.version,
|
|
4572
4572
|
content: pageContent
|
|
4573
4573
|
};
|
|
4574
|
-
return
|
|
4574
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
4575
4575
|
}
|
|
4576
4576
|
|
|
4577
4577
|
// src/templates/components/version-history.template.ts
|
|
@@ -4757,7 +4757,7 @@ var isPluginActive2 = () => false;
|
|
|
4757
4757
|
|
|
4758
4758
|
// src/routes/admin-content.ts
|
|
4759
4759
|
var adminContentRoutes = new hono.Hono();
|
|
4760
|
-
adminContentRoutes.use("*",
|
|
4760
|
+
adminContentRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
4761
4761
|
async function getCollectionFields(db, collectionId) {
|
|
4762
4762
|
const cache = chunkDOR2IU73_cjs.getCacheService(chunkDOR2IU73_cjs.CACHE_CONFIGS.collection);
|
|
4763
4763
|
return cache.getOrSet(
|
|
@@ -5892,7 +5892,7 @@ ${JSON.stringify(data, null, 2)}
|
|
|
5892
5892
|
var admin_content_default = adminContentRoutes;
|
|
5893
5893
|
|
|
5894
5894
|
// src/templates/pages/admin-profile.template.ts
|
|
5895
|
-
|
|
5895
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
5896
5896
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
5897
5897
|
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">
|
|
5898
5898
|
${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>`}
|
|
@@ -5912,8 +5912,8 @@ function renderProfilePage(data) {
|
|
|
5912
5912
|
</div>
|
|
5913
5913
|
|
|
5914
5914
|
<!-- Alert Messages -->
|
|
5915
|
-
${data.error ?
|
|
5916
|
-
${data.success ?
|
|
5915
|
+
${data.error ? chunk7XEESVSX_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
5916
|
+
${data.success ? chunk7XEESVSX_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
5917
5917
|
|
|
5918
5918
|
<!-- Profile Form -->
|
|
5919
5919
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -6300,7 +6300,7 @@ function renderProfilePage(data) {
|
|
|
6300
6300
|
version: data.version,
|
|
6301
6301
|
content: pageContent
|
|
6302
6302
|
};
|
|
6303
|
-
return
|
|
6303
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
6304
6304
|
}
|
|
6305
6305
|
|
|
6306
6306
|
// src/templates/components/alert.template.ts
|
|
@@ -6583,7 +6583,7 @@ function renderActivityLogsPage(data) {
|
|
|
6583
6583
|
user: data.user,
|
|
6584
6584
|
content: pageContent
|
|
6585
6585
|
};
|
|
6586
|
-
return
|
|
6586
|
+
return chunk7XEESVSX_cjs.renderAdminLayout(layoutData);
|
|
6587
6587
|
}
|
|
6588
6588
|
function getActionBadgeClass(action) {
|
|
6589
6589
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -6603,7 +6603,7 @@ function formatAction(action) {
|
|
|
6603
6603
|
}
|
|
6604
6604
|
|
|
6605
6605
|
// src/templates/pages/admin-user-edit.template.ts
|
|
6606
|
-
|
|
6606
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
6607
6607
|
|
|
6608
6608
|
// src/templates/components/confirmation-dialog.template.ts
|
|
6609
6609
|
function renderConfirmationDialog2(options) {
|
|
@@ -6724,8 +6724,8 @@ function renderUserEditPage(data) {
|
|
|
6724
6724
|
|
|
6725
6725
|
<!-- Alert Messages -->
|
|
6726
6726
|
<div id="form-messages">
|
|
6727
|
-
${data.error ?
|
|
6728
|
-
${data.success ?
|
|
6727
|
+
${data.error ? chunk7XEESVSX_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
6728
|
+
${data.success ? chunk7XEESVSX_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
6729
6729
|
</div>
|
|
6730
6730
|
|
|
6731
6731
|
<!-- User Edit Form -->
|
|
@@ -6744,7 +6744,7 @@ function renderUserEditPage(data) {
|
|
|
6744
6744
|
<input
|
|
6745
6745
|
type="text"
|
|
6746
6746
|
name="first_name"
|
|
6747
|
-
value="${
|
|
6747
|
+
value="${chunkCHMO2DOC_cjs.escapeHtml(data.userToEdit.firstName || "")}"
|
|
6748
6748
|
required
|
|
6749
6749
|
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"
|
|
6750
6750
|
/>
|
|
@@ -6755,7 +6755,7 @@ function renderUserEditPage(data) {
|
|
|
6755
6755
|
<input
|
|
6756
6756
|
type="text"
|
|
6757
6757
|
name="last_name"
|
|
6758
|
-
value="${
|
|
6758
|
+
value="${chunkCHMO2DOC_cjs.escapeHtml(data.userToEdit.lastName || "")}"
|
|
6759
6759
|
required
|
|
6760
6760
|
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"
|
|
6761
6761
|
/>
|
|
@@ -6766,7 +6766,7 @@ function renderUserEditPage(data) {
|
|
|
6766
6766
|
<input
|
|
6767
6767
|
type="text"
|
|
6768
6768
|
name="username"
|
|
6769
|
-
value="${
|
|
6769
|
+
value="${chunkCHMO2DOC_cjs.escapeHtml(data.userToEdit.username || "")}"
|
|
6770
6770
|
required
|
|
6771
6771
|
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"
|
|
6772
6772
|
/>
|
|
@@ -6777,7 +6777,7 @@ function renderUserEditPage(data) {
|
|
|
6777
6777
|
<input
|
|
6778
6778
|
type="email"
|
|
6779
6779
|
name="email"
|
|
6780
|
-
value="${
|
|
6780
|
+
value="${chunkCHMO2DOC_cjs.escapeHtml(data.userToEdit.email || "")}"
|
|
6781
6781
|
required
|
|
6782
6782
|
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"
|
|
6783
6783
|
/>
|
|
@@ -6788,7 +6788,7 @@ function renderUserEditPage(data) {
|
|
|
6788
6788
|
<input
|
|
6789
6789
|
type="tel"
|
|
6790
6790
|
name="phone"
|
|
6791
|
-
value="${
|
|
6791
|
+
value="${chunkCHMO2DOC_cjs.escapeHtml(data.userToEdit.phone || "")}"
|
|
6792
6792
|
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"
|
|
6793
6793
|
/>
|
|
6794
6794
|
</div>
|
|
@@ -6802,7 +6802,7 @@ function renderUserEditPage(data) {
|
|
|
6802
6802
|
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"
|
|
6803
6803
|
>
|
|
6804
6804
|
${data.roles.map((role) => `
|
|
6805
|
-
<option value="${
|
|
6805
|
+
<option value="${chunkCHMO2DOC_cjs.escapeHtml(role.value)}" ${data.userToEdit.role === role.value ? "selected" : ""}>${chunkCHMO2DOC_cjs.escapeHtml(role.label)}</option>
|
|
6806
6806
|
`).join("")}
|
|
6807
6807
|
</select>
|
|
6808
6808
|
<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">
|
|
@@ -6818,7 +6818,7 @@ function renderUserEditPage(data) {
|
|
|
6818
6818
|
name="bio"
|
|
6819
6819
|
rows="3"
|
|
6820
6820
|
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"
|
|
6821
|
-
>${
|
|
6821
|
+
>${chunkCHMO2DOC_cjs.escapeHtml(data.userToEdit.bio || "")}</textarea>
|
|
6822
6822
|
</div>
|
|
6823
6823
|
</div>
|
|
6824
6824
|
|
|
@@ -7018,11 +7018,11 @@ function renderUserEditPage(data) {
|
|
|
7018
7018
|
user: data.user,
|
|
7019
7019
|
content: pageContent
|
|
7020
7020
|
};
|
|
7021
|
-
return
|
|
7021
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7022
7022
|
}
|
|
7023
7023
|
|
|
7024
7024
|
// src/templates/pages/admin-user-new.template.ts
|
|
7025
|
-
|
|
7025
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
7026
7026
|
function renderUserNewPage(data) {
|
|
7027
7027
|
const pageContent = `
|
|
7028
7028
|
<div>
|
|
@@ -7061,8 +7061,8 @@ function renderUserNewPage(data) {
|
|
|
7061
7061
|
|
|
7062
7062
|
<!-- Alert Messages -->
|
|
7063
7063
|
<div id="form-messages">
|
|
7064
|
-
${data.error ?
|
|
7065
|
-
${data.success ?
|
|
7064
|
+
${data.error ? chunk7XEESVSX_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7065
|
+
${data.success ? chunk7XEESVSX_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7066
7066
|
</div>
|
|
7067
7067
|
|
|
7068
7068
|
<!-- User New Form -->
|
|
@@ -7306,11 +7306,11 @@ function renderUserNewPage(data) {
|
|
|
7306
7306
|
user: data.user,
|
|
7307
7307
|
content: pageContent
|
|
7308
7308
|
};
|
|
7309
|
-
return
|
|
7309
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7310
7310
|
}
|
|
7311
7311
|
|
|
7312
7312
|
// src/templates/pages/admin-users-list.template.ts
|
|
7313
|
-
|
|
7313
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
7314
7314
|
function renderUsersListPage(data) {
|
|
7315
7315
|
const columns = [
|
|
7316
7316
|
{
|
|
@@ -7461,8 +7461,8 @@ function renderUsersListPage(data) {
|
|
|
7461
7461
|
</div>
|
|
7462
7462
|
|
|
7463
7463
|
<!-- Alert Messages -->
|
|
7464
|
-
${data.error ?
|
|
7465
|
-
${data.success ?
|
|
7464
|
+
${data.error ? chunk7XEESVSX_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7465
|
+
${data.success ? chunk7XEESVSX_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7466
7466
|
|
|
7467
7467
|
<!-- Stats -->
|
|
7468
7468
|
<div class="mb-6">
|
|
@@ -7639,10 +7639,10 @@ function renderUsersListPage(data) {
|
|
|
7639
7639
|
</div>
|
|
7640
7640
|
|
|
7641
7641
|
<!-- Users Table -->
|
|
7642
|
-
${
|
|
7642
|
+
${chunk7XEESVSX_cjs.renderTable(tableData)}
|
|
7643
7643
|
|
|
7644
7644
|
<!-- Pagination -->
|
|
7645
|
-
${data.pagination ?
|
|
7645
|
+
${data.pagination ? chunk7XEESVSX_cjs.renderPagination(data.pagination) : ""}
|
|
7646
7646
|
</div>
|
|
7647
7647
|
|
|
7648
7648
|
<script>
|
|
@@ -7713,12 +7713,12 @@ function renderUsersListPage(data) {
|
|
|
7713
7713
|
version: data.version,
|
|
7714
7714
|
content: pageContent
|
|
7715
7715
|
};
|
|
7716
|
-
return
|
|
7716
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7717
7717
|
}
|
|
7718
7718
|
|
|
7719
7719
|
// src/routes/admin-users.ts
|
|
7720
7720
|
var userRoutes = new hono.Hono();
|
|
7721
|
-
userRoutes.use("*",
|
|
7721
|
+
userRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
7722
7722
|
userRoutes.get("/", (c) => {
|
|
7723
7723
|
return c.redirect("/admin/dashboard");
|
|
7724
7724
|
});
|
|
@@ -7817,12 +7817,12 @@ userRoutes.put("/profile", async (c) => {
|
|
|
7817
7817
|
const db = c.env.DB;
|
|
7818
7818
|
try {
|
|
7819
7819
|
const formData = await c.req.formData();
|
|
7820
|
-
const firstName =
|
|
7821
|
-
const lastName =
|
|
7822
|
-
const username =
|
|
7820
|
+
const firstName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
7821
|
+
const lastName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
7822
|
+
const username = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
7823
7823
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
7824
|
-
const phone =
|
|
7825
|
-
const bio =
|
|
7824
|
+
const phone = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
7825
|
+
const bio = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
7826
7826
|
const timezone = formData.get("timezone")?.toString() || "UTC";
|
|
7827
7827
|
const language = formData.get("language")?.toString() || "en";
|
|
7828
7828
|
const emailNotifications = formData.get("email_notifications") === "1";
|
|
@@ -7873,7 +7873,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
7873
7873
|
Date.now(),
|
|
7874
7874
|
user.userId
|
|
7875
7875
|
).run();
|
|
7876
|
-
await
|
|
7876
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
7877
7877
|
db,
|
|
7878
7878
|
user.userId,
|
|
7879
7879
|
"profile.update",
|
|
@@ -7936,7 +7936,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
7936
7936
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
7937
7937
|
`);
|
|
7938
7938
|
const userData = await userStmt.bind(user.userId).first();
|
|
7939
|
-
await
|
|
7939
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
7940
7940
|
db,
|
|
7941
7941
|
user.userId,
|
|
7942
7942
|
"profile.avatar_update",
|
|
@@ -8007,7 +8007,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
8007
8007
|
dismissible: true
|
|
8008
8008
|
}));
|
|
8009
8009
|
}
|
|
8010
|
-
const validPassword = await
|
|
8010
|
+
const validPassword = await chunk3R7EQNGO_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
8011
8011
|
if (!validPassword) {
|
|
8012
8012
|
return c.html(renderAlert2({
|
|
8013
8013
|
type: "error",
|
|
@@ -8015,7 +8015,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
8015
8015
|
dismissible: true
|
|
8016
8016
|
}));
|
|
8017
8017
|
}
|
|
8018
|
-
const newPasswordHash = await
|
|
8018
|
+
const newPasswordHash = await chunk3R7EQNGO_cjs.AuthManager.hashPassword(newPassword);
|
|
8019
8019
|
const historyStmt = db.prepare(`
|
|
8020
8020
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
8021
8021
|
VALUES (?, ?, ?, ?)
|
|
@@ -8031,7 +8031,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
8031
8031
|
WHERE id = ?
|
|
8032
8032
|
`);
|
|
8033
8033
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
8034
|
-
await
|
|
8034
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8035
8035
|
db,
|
|
8036
8036
|
user.userId,
|
|
8037
8037
|
"profile.password_change",
|
|
@@ -8098,7 +8098,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
8098
8098
|
`);
|
|
8099
8099
|
const countResult = await countStmt.bind(...params).first();
|
|
8100
8100
|
const totalUsers = countResult?.total || 0;
|
|
8101
|
-
await
|
|
8101
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8102
8102
|
db,
|
|
8103
8103
|
user.userId,
|
|
8104
8104
|
"users.list_view",
|
|
@@ -8200,12 +8200,12 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
8200
8200
|
const user = c.get("user");
|
|
8201
8201
|
try {
|
|
8202
8202
|
const formData = await c.req.formData();
|
|
8203
|
-
const firstName =
|
|
8204
|
-
const lastName =
|
|
8205
|
-
const username =
|
|
8203
|
+
const firstName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8204
|
+
const lastName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8205
|
+
const username = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
8206
8206
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8207
|
-
const phone =
|
|
8208
|
-
const bio =
|
|
8207
|
+
const phone = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
8208
|
+
const bio = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
8209
8209
|
const role = formData.get("role")?.toString() || "viewer";
|
|
8210
8210
|
const password = formData.get("password")?.toString() || "";
|
|
8211
8211
|
const confirmPassword = formData.get("confirm_password")?.toString() || "";
|
|
@@ -8252,7 +8252,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
8252
8252
|
dismissible: true
|
|
8253
8253
|
}));
|
|
8254
8254
|
}
|
|
8255
|
-
const passwordHash = await
|
|
8255
|
+
const passwordHash = await chunk3R7EQNGO_cjs.AuthManager.hashPassword(password);
|
|
8256
8256
|
const userId = globalThis.crypto.randomUUID();
|
|
8257
8257
|
const createStmt = db.prepare(`
|
|
8258
8258
|
INSERT INTO users (
|
|
@@ -8275,7 +8275,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
8275
8275
|
Date.now(),
|
|
8276
8276
|
Date.now()
|
|
8277
8277
|
).run();
|
|
8278
|
-
await
|
|
8278
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8279
8279
|
db,
|
|
8280
8280
|
user.userId,
|
|
8281
8281
|
"user!.create",
|
|
@@ -8313,7 +8313,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
8313
8313
|
if (!userRecord) {
|
|
8314
8314
|
return c.json({ error: "User not found" }, 404);
|
|
8315
8315
|
}
|
|
8316
|
-
await
|
|
8316
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8317
8317
|
db,
|
|
8318
8318
|
user.userId,
|
|
8319
8319
|
"user!.view",
|
|
@@ -8406,12 +8406,12 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
8406
8406
|
const userId = c.req.param("id");
|
|
8407
8407
|
try {
|
|
8408
8408
|
const formData = await c.req.formData();
|
|
8409
|
-
const firstName =
|
|
8410
|
-
const lastName =
|
|
8411
|
-
const username =
|
|
8409
|
+
const firstName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8410
|
+
const lastName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8411
|
+
const username = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
8412
8412
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8413
|
-
const phone =
|
|
8414
|
-
const bio =
|
|
8413
|
+
const phone = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
8414
|
+
const bio = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
8415
8415
|
const role = formData.get("role")?.toString() || "viewer";
|
|
8416
8416
|
const isActive = formData.get("is_active") === "1";
|
|
8417
8417
|
const emailVerified = formData.get("email_verified") === "1";
|
|
@@ -8462,7 +8462,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
8462
8462
|
Date.now(),
|
|
8463
8463
|
userId
|
|
8464
8464
|
).run();
|
|
8465
|
-
await
|
|
8465
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8466
8466
|
db,
|
|
8467
8467
|
user.userId,
|
|
8468
8468
|
"user!.update",
|
|
@@ -8508,7 +8508,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
8508
8508
|
DELETE FROM users WHERE id = ?
|
|
8509
8509
|
`);
|
|
8510
8510
|
await deleteStmt.bind(userId).run();
|
|
8511
|
-
await
|
|
8511
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8512
8512
|
db,
|
|
8513
8513
|
user.userId,
|
|
8514
8514
|
"user!.hard_delete",
|
|
@@ -8527,7 +8527,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
8527
8527
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
8528
8528
|
`);
|
|
8529
8529
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
8530
|
-
await
|
|
8530
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8531
8531
|
db,
|
|
8532
8532
|
user.userId,
|
|
8533
8533
|
"user!.soft_delete",
|
|
@@ -8554,8 +8554,8 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
8554
8554
|
const formData = await c.req.formData();
|
|
8555
8555
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8556
8556
|
const role = formData.get("role")?.toString()?.trim() || "viewer";
|
|
8557
|
-
const firstName =
|
|
8558
|
-
const lastName =
|
|
8557
|
+
const firstName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8558
|
+
const lastName = chunkCHMO2DOC_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8559
8559
|
if (!email || !firstName || !lastName) {
|
|
8560
8560
|
return c.json({ error: "Email, first name, and last name are required" }, 400);
|
|
8561
8561
|
}
|
|
@@ -8594,7 +8594,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
8594
8594
|
Date.now(),
|
|
8595
8595
|
Date.now()
|
|
8596
8596
|
).run();
|
|
8597
|
-
await
|
|
8597
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8598
8598
|
db,
|
|
8599
8599
|
user.userId,
|
|
8600
8600
|
"user!.invite_sent",
|
|
@@ -8651,7 +8651,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
8651
8651
|
Date.now(),
|
|
8652
8652
|
userId
|
|
8653
8653
|
).run();
|
|
8654
|
-
await
|
|
8654
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8655
8655
|
db,
|
|
8656
8656
|
user.userId,
|
|
8657
8657
|
"user!.invitation_resent",
|
|
@@ -8687,7 +8687,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
8687
8687
|
}
|
|
8688
8688
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
8689
8689
|
await deleteStmt.bind(userId).run();
|
|
8690
|
-
await
|
|
8690
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8691
8691
|
db,
|
|
8692
8692
|
user.userId,
|
|
8693
8693
|
"user!.invitation_cancelled",
|
|
@@ -8770,7 +8770,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
8770
8770
|
...log,
|
|
8771
8771
|
details: log.details ? JSON.parse(log.details) : null
|
|
8772
8772
|
}));
|
|
8773
|
-
await
|
|
8773
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8774
8774
|
db,
|
|
8775
8775
|
user.userId,
|
|
8776
8776
|
"activity.logs_viewed",
|
|
@@ -8877,7 +8877,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
8877
8877
|
csvRows.push(row.join(","));
|
|
8878
8878
|
}
|
|
8879
8879
|
const csvContent = csvRows.join("\n");
|
|
8880
|
-
await
|
|
8880
|
+
await chunk3R7EQNGO_cjs.logActivity(
|
|
8881
8881
|
db,
|
|
8882
8882
|
user.userId,
|
|
8883
8883
|
"activity.logs_exported",
|
|
@@ -9095,7 +9095,7 @@ function getFileIcon(mimeType) {
|
|
|
9095
9095
|
}
|
|
9096
9096
|
|
|
9097
9097
|
// src/templates/pages/admin-media-library.template.ts
|
|
9098
|
-
|
|
9098
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
9099
9099
|
function renderMediaLibraryPage(data) {
|
|
9100
9100
|
const pageContent = `
|
|
9101
9101
|
<div>
|
|
@@ -10030,7 +10030,7 @@ function renderMediaLibraryPage(data) {
|
|
|
10030
10030
|
version: data.version,
|
|
10031
10031
|
content: pageContent
|
|
10032
10032
|
};
|
|
10033
|
-
return
|
|
10033
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
10034
10034
|
}
|
|
10035
10035
|
|
|
10036
10036
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -10216,7 +10216,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
10216
10216
|
// 50MB max
|
|
10217
10217
|
});
|
|
10218
10218
|
var adminMediaRoutes = new hono.Hono();
|
|
10219
|
-
adminMediaRoutes.use("*",
|
|
10219
|
+
adminMediaRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
10220
10220
|
adminMediaRoutes.get("/", async (c) => {
|
|
10221
10221
|
try {
|
|
10222
10222
|
const user = c.get("user");
|
|
@@ -10795,7 +10795,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
10795
10795
|
`);
|
|
10796
10796
|
}
|
|
10797
10797
|
});
|
|
10798
|
-
adminMediaRoutes.delete("/cleanup",
|
|
10798
|
+
adminMediaRoutes.delete("/cleanup", chunk3R7EQNGO_cjs.requireRole("admin"), async (c) => {
|
|
10799
10799
|
try {
|
|
10800
10800
|
const db = c.env.DB;
|
|
10801
10801
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -11044,7 +11044,7 @@ function formatFileSize(bytes) {
|
|
|
11044
11044
|
}
|
|
11045
11045
|
|
|
11046
11046
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
11047
|
-
|
|
11047
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
11048
11048
|
function renderPluginsListPage(data) {
|
|
11049
11049
|
const pageContent = `
|
|
11050
11050
|
<div>
|
|
@@ -11418,7 +11418,7 @@ function renderPluginsListPage(data) {
|
|
|
11418
11418
|
version: data.version,
|
|
11419
11419
|
content: pageContent
|
|
11420
11420
|
};
|
|
11421
|
-
return
|
|
11421
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
11422
11422
|
}
|
|
11423
11423
|
function renderPluginCard(plugin) {
|
|
11424
11424
|
const statusColors = {
|
|
@@ -12068,7 +12068,7 @@ function renderPluginSettingsPage(data) {
|
|
|
12068
12068
|
user,
|
|
12069
12069
|
content: pageContent
|
|
12070
12070
|
};
|
|
12071
|
-
return
|
|
12071
|
+
return chunk7XEESVSX_cjs.renderAdminLayout(layoutData);
|
|
12072
12072
|
}
|
|
12073
12073
|
function renderStatusBadge(status) {
|
|
12074
12074
|
const statusColors = {
|
|
@@ -12331,7 +12331,7 @@ function formatTimestamp(timestamp) {
|
|
|
12331
12331
|
|
|
12332
12332
|
// src/routes/admin-plugins.ts
|
|
12333
12333
|
var adminPluginRoutes = new hono.Hono();
|
|
12334
|
-
adminPluginRoutes.use("*",
|
|
12334
|
+
adminPluginRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
12335
12335
|
adminPluginRoutes.get("/", async (c) => {
|
|
12336
12336
|
try {
|
|
12337
12337
|
const user = c.get("user");
|
|
@@ -12339,7 +12339,7 @@ adminPluginRoutes.get("/", async (c) => {
|
|
|
12339
12339
|
if (user?.role !== "admin") {
|
|
12340
12340
|
return c.text("Access denied", 403);
|
|
12341
12341
|
}
|
|
12342
|
-
const pluginService = new
|
|
12342
|
+
const pluginService = new chunkYGVWY6KO_cjs.PluginService(db);
|
|
12343
12343
|
let plugins = [];
|
|
12344
12344
|
let stats = { total: 0, active: 0, inactive: 0, errors: 0 };
|
|
12345
12345
|
try {
|
|
@@ -12389,7 +12389,7 @@ adminPluginRoutes.get("/:id", async (c) => {
|
|
|
12389
12389
|
if (user?.role !== "admin") {
|
|
12390
12390
|
return c.redirect("/admin/plugins");
|
|
12391
12391
|
}
|
|
12392
|
-
const pluginService = new
|
|
12392
|
+
const pluginService = new chunkYGVWY6KO_cjs.PluginService(db);
|
|
12393
12393
|
const plugin = await pluginService.getPlugin(pluginId);
|
|
12394
12394
|
if (!plugin) {
|
|
12395
12395
|
return c.text("Plugin not found", 404);
|
|
@@ -12443,7 +12443,7 @@ adminPluginRoutes.post("/:id/activate", async (c) => {
|
|
|
12443
12443
|
if (user?.role !== "admin") {
|
|
12444
12444
|
return c.json({ error: "Access denied" }, 403);
|
|
12445
12445
|
}
|
|
12446
|
-
const pluginService = new
|
|
12446
|
+
const pluginService = new chunkYGVWY6KO_cjs.PluginService(db);
|
|
12447
12447
|
await pluginService.activatePlugin(pluginId);
|
|
12448
12448
|
return c.json({ success: true });
|
|
12449
12449
|
} catch (error) {
|
|
@@ -12460,7 +12460,7 @@ adminPluginRoutes.post("/:id/deactivate", async (c) => {
|
|
|
12460
12460
|
if (user?.role !== "admin") {
|
|
12461
12461
|
return c.json({ error: "Access denied" }, 403);
|
|
12462
12462
|
}
|
|
12463
|
-
const pluginService = new
|
|
12463
|
+
const pluginService = new chunkYGVWY6KO_cjs.PluginService(db);
|
|
12464
12464
|
await pluginService.deactivatePlugin(pluginId);
|
|
12465
12465
|
return c.json({ success: true });
|
|
12466
12466
|
} catch (error) {
|
|
@@ -12477,7 +12477,7 @@ adminPluginRoutes.post("/install", async (c) => {
|
|
|
12477
12477
|
return c.json({ error: "Access denied" }, 403);
|
|
12478
12478
|
}
|
|
12479
12479
|
const body = await c.req.json();
|
|
12480
|
-
const pluginService = new
|
|
12480
|
+
const pluginService = new chunkYGVWY6KO_cjs.PluginService(db);
|
|
12481
12481
|
if (body.name === "faq-plugin") {
|
|
12482
12482
|
const faqPlugin = await pluginService.installPlugin({
|
|
12483
12483
|
id: "third-party-faq",
|
|
@@ -12627,7 +12627,7 @@ adminPluginRoutes.post("/:id/uninstall", async (c) => {
|
|
|
12627
12627
|
if (user?.role !== "admin") {
|
|
12628
12628
|
return c.json({ error: "Access denied" }, 403);
|
|
12629
12629
|
}
|
|
12630
|
-
const pluginService = new
|
|
12630
|
+
const pluginService = new chunkYGVWY6KO_cjs.PluginService(db);
|
|
12631
12631
|
await pluginService.uninstallPlugin(pluginId);
|
|
12632
12632
|
return c.json({ success: true });
|
|
12633
12633
|
} catch (error) {
|
|
@@ -12645,7 +12645,7 @@ adminPluginRoutes.post("/:id/settings", async (c) => {
|
|
|
12645
12645
|
return c.json({ error: "Access denied" }, 403);
|
|
12646
12646
|
}
|
|
12647
12647
|
const settings = await c.req.json();
|
|
12648
|
-
const pluginService = new
|
|
12648
|
+
const pluginService = new chunkYGVWY6KO_cjs.PluginService(db);
|
|
12649
12649
|
await pluginService.updatePluginSettings(pluginId, settings);
|
|
12650
12650
|
return c.json({ success: true });
|
|
12651
12651
|
} catch (error) {
|
|
@@ -12666,7 +12666,7 @@ function formatLastUpdated(timestamp) {
|
|
|
12666
12666
|
}
|
|
12667
12667
|
|
|
12668
12668
|
// src/templates/pages/admin-logs-list.template.ts
|
|
12669
|
-
|
|
12669
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
12670
12670
|
function renderLogsListPage(data) {
|
|
12671
12671
|
const { logs, pagination, filters, user } = data;
|
|
12672
12672
|
const content = `
|
|
@@ -12977,7 +12977,7 @@ function renderLogsListPage(data) {
|
|
|
12977
12977
|
user,
|
|
12978
12978
|
content
|
|
12979
12979
|
};
|
|
12980
|
-
return
|
|
12980
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12981
12981
|
}
|
|
12982
12982
|
function renderLogDetailsPage(data) {
|
|
12983
12983
|
const { log, user } = data;
|
|
@@ -13189,7 +13189,7 @@ function renderLogDetailsPage(data) {
|
|
|
13189
13189
|
</div>
|
|
13190
13190
|
</div>
|
|
13191
13191
|
`;
|
|
13192
|
-
return
|
|
13192
|
+
return chunk7XEESVSX_cjs.adminLayoutV2({
|
|
13193
13193
|
title: `Log Details - ${log.id}`,
|
|
13194
13194
|
user,
|
|
13195
13195
|
content
|
|
@@ -13432,7 +13432,7 @@ function renderLogConfigPage(data) {
|
|
|
13432
13432
|
|
|
13433
13433
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
13434
13434
|
`;
|
|
13435
|
-
return
|
|
13435
|
+
return chunk7XEESVSX_cjs.adminLayoutV2({
|
|
13436
13436
|
title: "Log Configuration",
|
|
13437
13437
|
user,
|
|
13438
13438
|
content
|
|
@@ -13441,7 +13441,7 @@ function renderLogConfigPage(data) {
|
|
|
13441
13441
|
|
|
13442
13442
|
// src/routes/admin-logs.ts
|
|
13443
13443
|
var adminLogsRoutes = new hono.Hono();
|
|
13444
|
-
adminLogsRoutes.use("*",
|
|
13444
|
+
adminLogsRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
13445
13445
|
adminLogsRoutes.get("/", async (c) => {
|
|
13446
13446
|
try {
|
|
13447
13447
|
const user = c.get("user");
|
|
@@ -13813,7 +13813,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
13813
13813
|
role: user.role
|
|
13814
13814
|
} : void 0
|
|
13815
13815
|
};
|
|
13816
|
-
return c.html(
|
|
13816
|
+
return c.html(chunk7XEESVSX_cjs.renderDesignPage(pageData));
|
|
13817
13817
|
});
|
|
13818
13818
|
var adminCheckboxRoutes = new hono.Hono();
|
|
13819
13819
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -13825,7 +13825,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
13825
13825
|
role: user.role
|
|
13826
13826
|
} : void 0
|
|
13827
13827
|
};
|
|
13828
|
-
return c.html(
|
|
13828
|
+
return c.html(chunk7XEESVSX_cjs.renderCheckboxPage(pageData));
|
|
13829
13829
|
});
|
|
13830
13830
|
|
|
13831
13831
|
// src/templates/pages/admin-faq-form.template.ts
|
|
@@ -13853,7 +13853,7 @@ function renderFAQForm(data) {
|
|
|
13853
13853
|
</div>
|
|
13854
13854
|
</div>
|
|
13855
13855
|
|
|
13856
|
-
${message ?
|
|
13856
|
+
${message ? chunk7XEESVSX_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
13857
13857
|
|
|
13858
13858
|
<!-- Form -->
|
|
13859
13859
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -14066,7 +14066,7 @@ function renderFAQForm(data) {
|
|
|
14066
14066
|
user: data.user,
|
|
14067
14067
|
content: pageContent
|
|
14068
14068
|
};
|
|
14069
|
-
return
|
|
14069
|
+
return chunk7XEESVSX_cjs.renderAdminLayout(layoutData);
|
|
14070
14070
|
}
|
|
14071
14071
|
function escapeHtml4(unsafe) {
|
|
14072
14072
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -14091,7 +14091,7 @@ adminFAQRoutes.get("/", async (c) => {
|
|
|
14091
14091
|
const offset = (currentPage - 1) * limit;
|
|
14092
14092
|
const db = c.env?.DB;
|
|
14093
14093
|
if (!db) {
|
|
14094
|
-
return c.html(
|
|
14094
|
+
return c.html(chunk7XEESVSX_cjs.renderFAQList({
|
|
14095
14095
|
faqs: [],
|
|
14096
14096
|
totalCount: 0,
|
|
14097
14097
|
currentPage: 1,
|
|
@@ -14131,7 +14131,7 @@ adminFAQRoutes.get("/", async (c) => {
|
|
|
14131
14131
|
`;
|
|
14132
14132
|
const { results: faqs } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
14133
14133
|
const totalPages = Math.ceil(totalCount / limit);
|
|
14134
|
-
return c.html(
|
|
14134
|
+
return c.html(chunk7XEESVSX_cjs.renderFAQList({
|
|
14135
14135
|
faqs: faqs || [],
|
|
14136
14136
|
totalCount,
|
|
14137
14137
|
currentPage,
|
|
@@ -14145,7 +14145,7 @@ adminFAQRoutes.get("/", async (c) => {
|
|
|
14145
14145
|
} catch (error) {
|
|
14146
14146
|
console.error("Error fetching FAQs:", error);
|
|
14147
14147
|
const user = c.get("user");
|
|
14148
|
-
return c.html(
|
|
14148
|
+
return c.html(chunk7XEESVSX_cjs.renderFAQList({
|
|
14149
14149
|
faqs: [],
|
|
14150
14150
|
totalCount: 0,
|
|
14151
14151
|
currentPage: 1,
|
|
@@ -14458,7 +14458,7 @@ function renderTestimonialsForm(data) {
|
|
|
14458
14458
|
</div>
|
|
14459
14459
|
</div>
|
|
14460
14460
|
|
|
14461
|
-
${message ?
|
|
14461
|
+
${message ? chunk7XEESVSX_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
14462
14462
|
|
|
14463
14463
|
<!-- Form -->
|
|
14464
14464
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -14687,7 +14687,7 @@ function renderTestimonialsForm(data) {
|
|
|
14687
14687
|
user: data.user,
|
|
14688
14688
|
content: pageContent
|
|
14689
14689
|
};
|
|
14690
|
-
return
|
|
14690
|
+
return chunk7XEESVSX_cjs.renderAdminLayout(layoutData);
|
|
14691
14691
|
}
|
|
14692
14692
|
function escapeHtml5(unsafe) {
|
|
14693
14693
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -14713,7 +14713,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
14713
14713
|
const offset = (currentPage - 1) * limit;
|
|
14714
14714
|
const db = c.env?.DB;
|
|
14715
14715
|
if (!db) {
|
|
14716
|
-
return c.html(
|
|
14716
|
+
return c.html(chunk7XEESVSX_cjs.renderTestimonialsList({
|
|
14717
14717
|
testimonials: [],
|
|
14718
14718
|
totalCount: 0,
|
|
14719
14719
|
currentPage: 1,
|
|
@@ -14753,7 +14753,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
14753
14753
|
`;
|
|
14754
14754
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
14755
14755
|
const totalPages = Math.ceil(totalCount / limit);
|
|
14756
|
-
return c.html(
|
|
14756
|
+
return c.html(chunk7XEESVSX_cjs.renderTestimonialsList({
|
|
14757
14757
|
testimonials: testimonials || [],
|
|
14758
14758
|
totalCount,
|
|
14759
14759
|
currentPage,
|
|
@@ -14767,7 +14767,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
14767
14767
|
} catch (error) {
|
|
14768
14768
|
console.error("Error fetching testimonials:", error);
|
|
14769
14769
|
const user = c.get("user");
|
|
14770
|
-
return c.html(
|
|
14770
|
+
return c.html(chunk7XEESVSX_cjs.renderTestimonialsList({
|
|
14771
14771
|
testimonials: [],
|
|
14772
14772
|
totalCount: 0,
|
|
14773
14773
|
currentPage: 1,
|
|
@@ -15086,7 +15086,7 @@ function renderCodeExamplesForm(data) {
|
|
|
15086
15086
|
</div>
|
|
15087
15087
|
</div>
|
|
15088
15088
|
|
|
15089
|
-
${message ?
|
|
15089
|
+
${message ? chunk7XEESVSX_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
15090
15090
|
|
|
15091
15091
|
<!-- Form -->
|
|
15092
15092
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -15356,7 +15356,7 @@ function renderCodeExamplesForm(data) {
|
|
|
15356
15356
|
user: data.user,
|
|
15357
15357
|
content: pageContent
|
|
15358
15358
|
};
|
|
15359
|
-
return
|
|
15359
|
+
return chunk7XEESVSX_cjs.renderAdminLayout(layoutData);
|
|
15360
15360
|
}
|
|
15361
15361
|
function escapeHtml6(unsafe) {
|
|
15362
15362
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -15383,7 +15383,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
15383
15383
|
const offset = (currentPage - 1) * limit;
|
|
15384
15384
|
const db = c.env?.DB;
|
|
15385
15385
|
if (!db) {
|
|
15386
|
-
return c.html(
|
|
15386
|
+
return c.html(chunk7XEESVSX_cjs.renderCodeExamplesList({
|
|
15387
15387
|
codeExamples: [],
|
|
15388
15388
|
totalCount: 0,
|
|
15389
15389
|
currentPage: 1,
|
|
@@ -15423,7 +15423,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
15423
15423
|
`;
|
|
15424
15424
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
15425
15425
|
const totalPages = Math.ceil(totalCount / limit);
|
|
15426
|
-
return c.html(
|
|
15426
|
+
return c.html(chunk7XEESVSX_cjs.renderCodeExamplesList({
|
|
15427
15427
|
codeExamples: codeExamples || [],
|
|
15428
15428
|
totalCount,
|
|
15429
15429
|
currentPage,
|
|
@@ -15437,7 +15437,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
15437
15437
|
} catch (error) {
|
|
15438
15438
|
console.error("Error fetching code examples:", error);
|
|
15439
15439
|
const user = c.get("user");
|
|
15440
|
-
return c.html(
|
|
15440
|
+
return c.html(chunk7XEESVSX_cjs.renderCodeExamplesList({
|
|
15441
15441
|
codeExamples: [],
|
|
15442
15442
|
totalCount: 0,
|
|
15443
15443
|
currentPage: 1,
|
|
@@ -15826,7 +15826,7 @@ function renderDashboardPage(data) {
|
|
|
15826
15826
|
version: data.version,
|
|
15827
15827
|
content: pageContent
|
|
15828
15828
|
};
|
|
15829
|
-
return
|
|
15829
|
+
return chunk7XEESVSX_cjs.renderAdminLayout(layoutData);
|
|
15830
15830
|
}
|
|
15831
15831
|
function renderStatsCards(stats) {
|
|
15832
15832
|
const cards = [
|
|
@@ -16374,9 +16374,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
16374
16374
|
}
|
|
16375
16375
|
|
|
16376
16376
|
// src/routes/admin-dashboard.ts
|
|
16377
|
-
var VERSION =
|
|
16377
|
+
var VERSION = chunkCHMO2DOC_cjs.getCoreVersion();
|
|
16378
16378
|
var router = new hono.Hono();
|
|
16379
|
-
router.use("*",
|
|
16379
|
+
router.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
16380
16380
|
router.get("/", async (c) => {
|
|
16381
16381
|
const user = c.get("user");
|
|
16382
16382
|
try {
|
|
@@ -16601,7 +16601,7 @@ router.get("/system-status", async (c) => {
|
|
|
16601
16601
|
});
|
|
16602
16602
|
|
|
16603
16603
|
// src/templates/pages/admin-collections-list.template.ts
|
|
16604
|
-
|
|
16604
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
16605
16605
|
|
|
16606
16606
|
// src/templates/components/table.template.ts
|
|
16607
16607
|
function renderTable2(data) {
|
|
@@ -17075,11 +17075,11 @@ function renderCollectionsListPage(data) {
|
|
|
17075
17075
|
version: data.version,
|
|
17076
17076
|
content: pageContent
|
|
17077
17077
|
};
|
|
17078
|
-
return
|
|
17078
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
17079
17079
|
}
|
|
17080
17080
|
|
|
17081
17081
|
// src/templates/pages/admin-collections-form.template.ts
|
|
17082
|
-
|
|
17082
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
17083
17083
|
function renderCollectionFormPage(data) {
|
|
17084
17084
|
const isEdit = data.isEdit || !!data.id;
|
|
17085
17085
|
const title = isEdit ? "Edit Collection" : "Create New Collection";
|
|
@@ -17308,7 +17308,7 @@ function renderCollectionFormPage(data) {
|
|
|
17308
17308
|
}
|
|
17309
17309
|
</style>
|
|
17310
17310
|
|
|
17311
|
-
${
|
|
17311
|
+
${chunk7XEESVSX_cjs.renderForm(formData)}
|
|
17312
17312
|
|
|
17313
17313
|
${isEdit && !data.managed ? `
|
|
17314
17314
|
<!-- Fields Management Section -->
|
|
@@ -17852,12 +17852,12 @@ function renderCollectionFormPage(data) {
|
|
|
17852
17852
|
version: data.version,
|
|
17853
17853
|
content: pageContent
|
|
17854
17854
|
};
|
|
17855
|
-
return
|
|
17855
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
17856
17856
|
}
|
|
17857
17857
|
|
|
17858
17858
|
// src/routes/admin-collections.ts
|
|
17859
17859
|
var adminCollectionsRoutes = new hono.Hono();
|
|
17860
|
-
adminCollectionsRoutes.use("*",
|
|
17860
|
+
adminCollectionsRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
17861
17861
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
17862
17862
|
try {
|
|
17863
17863
|
const user = c.get("user");
|
|
@@ -18289,7 +18289,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
18289
18289
|
});
|
|
18290
18290
|
|
|
18291
18291
|
// src/templates/pages/admin-settings.template.ts
|
|
18292
|
-
|
|
18292
|
+
chunk7XEESVSX_cjs.init_admin_layout_catalyst_template();
|
|
18293
18293
|
function renderSettingsPage(data) {
|
|
18294
18294
|
const activeTab = data.activeTab || "general";
|
|
18295
18295
|
const pageContent = `
|
|
@@ -18720,7 +18720,7 @@ function renderSettingsPage(data) {
|
|
|
18720
18720
|
version: data.version,
|
|
18721
18721
|
content: pageContent
|
|
18722
18722
|
};
|
|
18723
|
-
return
|
|
18723
|
+
return chunk7XEESVSX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
18724
18724
|
}
|
|
18725
18725
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
18726
18726
|
const isActive = activeTab === tabId;
|
|
@@ -19737,7 +19737,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
19737
19737
|
|
|
19738
19738
|
// src/routes/admin-settings.ts
|
|
19739
19739
|
var adminSettingsRoutes = new hono.Hono();
|
|
19740
|
-
adminSettingsRoutes.use("*",
|
|
19740
|
+
adminSettingsRoutes.use("*", chunk3R7EQNGO_cjs.requireAuth());
|
|
19741
19741
|
function getMockSettings(user) {
|
|
19742
19742
|
return {
|
|
19743
19743
|
general: {
|
|
@@ -19905,7 +19905,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
19905
19905
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
19906
19906
|
try {
|
|
19907
19907
|
const db = c.env.DB;
|
|
19908
|
-
const migrationService = new
|
|
19908
|
+
const migrationService = new chunkYGVWY6KO_cjs.MigrationService(db);
|
|
19909
19909
|
const status = await migrationService.getMigrationStatus();
|
|
19910
19910
|
return c.json({
|
|
19911
19911
|
success: true,
|
|
@@ -19929,7 +19929,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
19929
19929
|
}, 403);
|
|
19930
19930
|
}
|
|
19931
19931
|
const db = c.env.DB;
|
|
19932
|
-
const migrationService = new
|
|
19932
|
+
const migrationService = new chunkYGVWY6KO_cjs.MigrationService(db);
|
|
19933
19933
|
const result = await migrationService.runPendingMigrations();
|
|
19934
19934
|
return c.json({
|
|
19935
19935
|
success: result.success,
|
|
@@ -19947,7 +19947,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
19947
19947
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
19948
19948
|
try {
|
|
19949
19949
|
const db = c.env.DB;
|
|
19950
|
-
const migrationService = new
|
|
19950
|
+
const migrationService = new chunkYGVWY6KO_cjs.MigrationService(db);
|
|
19951
19951
|
const validation = await migrationService.validateSchema();
|
|
19952
19952
|
return c.json({
|
|
19953
19953
|
success: true,
|
|
@@ -20191,5 +20191,5 @@ exports.api_system_default = api_system_default;
|
|
|
20191
20191
|
exports.auth_default = auth_default;
|
|
20192
20192
|
exports.router = router;
|
|
20193
20193
|
exports.userRoutes = userRoutes;
|
|
20194
|
-
//# sourceMappingURL=chunk-
|
|
20195
|
-
//# sourceMappingURL=chunk-
|
|
20194
|
+
//# sourceMappingURL=chunk-GN7Q6V5C.cjs.map
|
|
20195
|
+
//# sourceMappingURL=chunk-GN7Q6V5C.cjs.map
|