@sonicjs-cms/core 2.0.9 → 2.0.10
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-TMIRVVQ7.cjs → chunk-3PHG75W4.cjs} +3 -3
- package/dist/{chunk-TMIRVVQ7.cjs.map → chunk-3PHG75W4.cjs.map} +1 -1
- package/dist/{chunk-MABBKINE.cjs → chunk-CAP6QQR2.cjs} +5 -5
- package/dist/{chunk-MABBKINE.cjs.map → chunk-CAP6QQR2.cjs.map} +1 -1
- package/dist/{chunk-OPGDMS7L.js → chunk-FTMKKKNH.js} +3 -3
- package/dist/{chunk-OPGDMS7L.js.map → chunk-FTMKKKNH.js.map} +1 -1
- package/dist/{chunk-DYYAXDXI.cjs → chunk-HXA5QSI3.cjs} +12 -8
- package/dist/chunk-HXA5QSI3.cjs.map +1 -0
- package/dist/{chunk-VEC5MLT3.js → chunk-LW33AOBF.js} +6 -8
- package/dist/chunk-LW33AOBF.js.map +1 -0
- package/dist/{chunk-EYMHWJTW.cjs → chunk-MU3MR2QR.cjs} +6 -8
- package/dist/chunk-MU3MR2QR.cjs.map +1 -0
- package/dist/{chunk-WRRLB6KG.js → chunk-MXJJN4IA.js} +3 -3
- package/dist/{chunk-WRRLB6KG.js.map → chunk-MXJJN4IA.js.map} +1 -1
- package/dist/{chunk-4I25AGUR.cjs → chunk-Q7SL7U43.cjs} +199 -157
- package/dist/chunk-Q7SL7U43.cjs.map +1 -0
- package/dist/{chunk-OKPDQO2Y.js → chunk-YHG45LMU.js} +12 -8
- package/dist/chunk-YHG45LMU.js.map +1 -0
- package/dist/{chunk-ABYMIXRN.js → chunk-Z4H6DBVF.js} +53 -11
- package/dist/chunk-Z4H6DBVF.js.map +1 -0
- package/dist/index.cjs +83 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +22 -22
- package/dist/middleware.js +1 -1
- package/dist/routes.cjs +24 -24
- package/dist/routes.js +4 -4
- 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 +1 -1
- package/dist/chunk-4I25AGUR.cjs.map +0 -1
- package/dist/chunk-ABYMIXRN.js.map +0 -1
- package/dist/chunk-DYYAXDXI.cjs.map +0 -1
- package/dist/chunk-EYMHWJTW.cjs.map +0 -1
- package/dist/chunk-OKPDQO2Y.js.map +0 -1
- package/dist/chunk-VEC5MLT3.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
|
|
4
|
+
var chunkHXA5QSI3_cjs = require('./chunk-HXA5QSI3.cjs');
|
|
5
5
|
var chunkNBDPIRQS_cjs = require('./chunk-NBDPIRQS.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkMU3MR2QR_cjs = require('./chunk-MU3MR2QR.cjs');
|
|
7
|
+
var chunk3PHG75W4_cjs = require('./chunk-3PHG75W4.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("/", chunkHXA5QSI3_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("/", chunkDYYAXDXI_cjs.requireAuth(), async (c) => {
|
|
|
109
109
|
}, 500);
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
apiContentCrudRoutes.put("/:id",
|
|
112
|
+
apiContentCrudRoutes.put("/:id", chunkHXA5QSI3_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", chunkDYYAXDXI_cjs.requireAuth(), async (c) => {
|
|
|
173
173
|
}, 500);
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
|
-
apiContentCrudRoutes.delete("/:id",
|
|
176
|
+
apiContentCrudRoutes.delete("/:id", chunkHXA5QSI3_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 chunkHXA5QSI3_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 = chunk3PHG75W4_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 chunk3PHG75W4_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 = chunk3PHG75W4_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 chunk3PHG75W4_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("*", chunkHXA5QSI3_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("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
1315
|
+
adminApiRoutes.use("*", chunkHXA5QSI3_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">${chunkMU3MR2QR_cjs.renderAlert({ type: "error", message: data.error })}</div>` : ""}
|
|
1782
|
+
${data.message ? `<div class="mb-6">${chunkMU3MR2QR_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">${chunkMU3MR2QR_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 chunkHXA5QSI3_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 chunkHXA5QSI3_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 chunkHXA5QSI3_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 chunkHXA5QSI3_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", chunkHXA5QSI3_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", chunkDYYAXDXI_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", chunkHXA5QSI3_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 chunkHXA5QSI3_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,
|
|
@@ -2334,7 +2334,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2334
2334
|
</div>
|
|
2335
2335
|
`);
|
|
2336
2336
|
}
|
|
2337
|
-
const passwordHash = await
|
|
2337
|
+
const passwordHash = await chunkHXA5QSI3_cjs.AuthManager.hashPassword(password);
|
|
2338
2338
|
const userId = crypto.randomUUID();
|
|
2339
2339
|
const now = /* @__PURE__ */ new Date();
|
|
2340
2340
|
await db.prepare(`
|
|
@@ -2354,7 +2354,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2354
2354
|
now.getTime(),
|
|
2355
2355
|
now.getTime()
|
|
2356
2356
|
).run();
|
|
2357
|
-
const token = await
|
|
2357
|
+
const token = await chunkHXA5QSI3_cjs.AuthManager.generateToken(userId, normalizedEmail, "admin");
|
|
2358
2358
|
cookie.setCookie(c, "auth_token", token, {
|
|
2359
2359
|
httpOnly: true,
|
|
2360
2360
|
secure: false,
|
|
@@ -2405,7 +2405,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2405
2405
|
</div>
|
|
2406
2406
|
`);
|
|
2407
2407
|
}
|
|
2408
|
-
const isValidPassword = await
|
|
2408
|
+
const isValidPassword = await chunkHXA5QSI3_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2409
2409
|
if (!isValidPassword) {
|
|
2410
2410
|
return c.html(html.html`
|
|
2411
2411
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -2413,7 +2413,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2413
2413
|
</div>
|
|
2414
2414
|
`);
|
|
2415
2415
|
}
|
|
2416
|
-
const token = await
|
|
2416
|
+
const token = await chunkHXA5QSI3_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2417
2417
|
cookie.setCookie(c, "auth_token", token, {
|
|
2418
2418
|
httpOnly: true,
|
|
2419
2419
|
secure: false,
|
|
@@ -2482,7 +2482,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2482
2482
|
}
|
|
2483
2483
|
});
|
|
2484
2484
|
}
|
|
2485
|
-
const passwordHash = await
|
|
2485
|
+
const passwordHash = await chunkHXA5QSI3_cjs.AuthManager.hashPassword("admin123");
|
|
2486
2486
|
const userId = "admin-user-id";
|
|
2487
2487
|
const now = Date.now();
|
|
2488
2488
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -2702,7 +2702,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2702
2702
|
if (existingUsername) {
|
|
2703
2703
|
return c.json({ error: "Username is already taken" }, 400);
|
|
2704
2704
|
}
|
|
2705
|
-
const passwordHash = await
|
|
2705
|
+
const passwordHash = await chunkHXA5QSI3_cjs.AuthManager.hashPassword(password);
|
|
2706
2706
|
const updateStmt = db.prepare(`
|
|
2707
2707
|
UPDATE users SET
|
|
2708
2708
|
username = ?,
|
|
@@ -2721,7 +2721,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2721
2721
|
Date.now(),
|
|
2722
2722
|
invitedUser.id
|
|
2723
2723
|
).run();
|
|
2724
|
-
const authToken = await
|
|
2724
|
+
const authToken = await chunkHXA5QSI3_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role);
|
|
2725
2725
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
2726
2726
|
httpOnly: true,
|
|
2727
2727
|
secure: true,
|
|
@@ -2951,7 +2951,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
2951
2951
|
if (Date.now() > user.password_reset_expires) {
|
|
2952
2952
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
2953
2953
|
}
|
|
2954
|
-
const newPasswordHash = await
|
|
2954
|
+
const newPasswordHash = await chunkHXA5QSI3_cjs.AuthManager.hashPassword(password);
|
|
2955
2955
|
try {
|
|
2956
2956
|
const historyStmt = db.prepare(`
|
|
2957
2957
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -2988,7 +2988,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
2988
2988
|
var auth_default = authRoutes;
|
|
2989
2989
|
|
|
2990
2990
|
// src/templates/pages/admin-content-form.template.ts
|
|
2991
|
-
|
|
2991
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
2992
2992
|
|
|
2993
2993
|
// src/templates/components/dynamic-field.template.ts
|
|
2994
2994
|
function renderDynamicField(field, options = {}) {
|
|
@@ -3392,8 +3392,8 @@ function renderContentFormPage(data) {
|
|
|
3392
3392
|
<!-- Form Content -->
|
|
3393
3393
|
<div class="px-6 py-6">
|
|
3394
3394
|
<div id="form-messages">
|
|
3395
|
-
${data.error ?
|
|
3396
|
-
${data.success ?
|
|
3395
|
+
${data.error ? chunkMU3MR2QR_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
3396
|
+
${data.success ? chunkMU3MR2QR_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
3397
3397
|
</div>
|
|
3398
3398
|
|
|
3399
3399
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
@@ -3628,7 +3628,7 @@ function renderContentFormPage(data) {
|
|
|
3628
3628
|
</div>
|
|
3629
3629
|
|
|
3630
3630
|
<!-- Confirmation Dialogs -->
|
|
3631
|
-
${
|
|
3631
|
+
${chunkMU3MR2QR_cjs.renderConfirmationDialog({
|
|
3632
3632
|
id: "duplicate-content-confirm",
|
|
3633
3633
|
title: "Duplicate Content",
|
|
3634
3634
|
message: "Create a copy of this content?",
|
|
@@ -3639,7 +3639,7 @@ function renderContentFormPage(data) {
|
|
|
3639
3639
|
onConfirm: "performDuplicateContent()"
|
|
3640
3640
|
})}
|
|
3641
3641
|
|
|
3642
|
-
${
|
|
3642
|
+
${chunkMU3MR2QR_cjs.renderConfirmationDialog({
|
|
3643
3643
|
id: "delete-content-confirm",
|
|
3644
3644
|
title: "Delete Content",
|
|
3645
3645
|
message: "Are you sure you want to delete this content? This action cannot be undone.",
|
|
@@ -3650,7 +3650,7 @@ function renderContentFormPage(data) {
|
|
|
3650
3650
|
onConfirm: `performDeleteContent('${data.id}')`
|
|
3651
3651
|
})}
|
|
3652
3652
|
|
|
3653
|
-
${
|
|
3653
|
+
${chunkMU3MR2QR_cjs.getConfirmationDialogScript()}
|
|
3654
3654
|
|
|
3655
3655
|
<!-- TinyMCE CDN -->
|
|
3656
3656
|
<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>
|
|
@@ -3938,11 +3938,11 @@ function renderContentFormPage(data) {
|
|
|
3938
3938
|
content: pageContent,
|
|
3939
3939
|
version: data.version
|
|
3940
3940
|
};
|
|
3941
|
-
return
|
|
3941
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
3942
3942
|
}
|
|
3943
3943
|
|
|
3944
3944
|
// src/templates/pages/admin-content-list.template.ts
|
|
3945
|
-
|
|
3945
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
3946
3946
|
function renderContentListPage(data) {
|
|
3947
3947
|
const urlParams = new URLSearchParams();
|
|
3948
3948
|
if (data.modelName && data.modelName !== "all") urlParams.set("model", data.modelName);
|
|
@@ -4338,8 +4338,8 @@ function renderContentListPage(data) {
|
|
|
4338
4338
|
|
|
4339
4339
|
<!-- Content List -->
|
|
4340
4340
|
<div id="content-list">
|
|
4341
|
-
${
|
|
4342
|
-
${
|
|
4341
|
+
${chunkMU3MR2QR_cjs.renderTable(tableData)}
|
|
4342
|
+
${chunkMU3MR2QR_cjs.renderPagination(paginationData)}
|
|
4343
4343
|
</div>
|
|
4344
4344
|
|
|
4345
4345
|
</div>
|
|
@@ -4548,7 +4548,7 @@ function renderContentListPage(data) {
|
|
|
4548
4548
|
</script>
|
|
4549
4549
|
|
|
4550
4550
|
<!-- Confirmation Dialog for Bulk Actions -->
|
|
4551
|
-
${
|
|
4551
|
+
${chunkMU3MR2QR_cjs.renderConfirmationDialog({
|
|
4552
4552
|
id: "bulk-action-confirm",
|
|
4553
4553
|
title: "Confirm Bulk Action",
|
|
4554
4554
|
message: "Are you sure you want to perform this action? This operation will affect multiple items.",
|
|
@@ -4560,7 +4560,7 @@ function renderContentListPage(data) {
|
|
|
4560
4560
|
})}
|
|
4561
4561
|
|
|
4562
4562
|
<!-- Confirmation Dialog Script -->
|
|
4563
|
-
${
|
|
4563
|
+
${chunkMU3MR2QR_cjs.getConfirmationDialogScript()}
|
|
4564
4564
|
`;
|
|
4565
4565
|
const layoutData = {
|
|
4566
4566
|
title: "Content Management",
|
|
@@ -4570,7 +4570,7 @@ function renderContentListPage(data) {
|
|
|
4570
4570
|
version: data.version,
|
|
4571
4571
|
content: pageContent
|
|
4572
4572
|
};
|
|
4573
|
-
return
|
|
4573
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
4574
4574
|
}
|
|
4575
4575
|
|
|
4576
4576
|
// src/templates/components/version-history.template.ts
|
|
@@ -4756,12 +4756,34 @@ var isPluginActive2 = () => false;
|
|
|
4756
4756
|
|
|
4757
4757
|
// src/routes/admin-content.ts
|
|
4758
4758
|
var adminContentRoutes = new hono.Hono();
|
|
4759
|
-
adminContentRoutes.use("*",
|
|
4759
|
+
adminContentRoutes.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
4760
4760
|
async function getCollectionFields(db, collectionId) {
|
|
4761
4761
|
const cache = chunkDOR2IU73_cjs.getCacheService(chunkDOR2IU73_cjs.CACHE_CONFIGS.collection);
|
|
4762
4762
|
return cache.getOrSet(
|
|
4763
4763
|
cache.generateKey("fields", collectionId),
|
|
4764
4764
|
async () => {
|
|
4765
|
+
const collectionStmt = db.prepare("SELECT schema FROM collections WHERE id = ?");
|
|
4766
|
+
const collectionRow = await collectionStmt.bind(collectionId).first();
|
|
4767
|
+
if (collectionRow && collectionRow.schema) {
|
|
4768
|
+
try {
|
|
4769
|
+
const schema = typeof collectionRow.schema === "string" ? JSON.parse(collectionRow.schema) : collectionRow.schema;
|
|
4770
|
+
if (schema && schema.properties) {
|
|
4771
|
+
let fieldOrder = 0;
|
|
4772
|
+
return Object.entries(schema.properties).map(([fieldName, fieldConfig]) => ({
|
|
4773
|
+
id: `schema-${fieldName}`,
|
|
4774
|
+
field_name: fieldName,
|
|
4775
|
+
field_type: fieldConfig.type || "string",
|
|
4776
|
+
field_label: fieldConfig.title || fieldName,
|
|
4777
|
+
field_options: fieldConfig,
|
|
4778
|
+
field_order: fieldOrder++,
|
|
4779
|
+
is_required: fieldConfig.required === true || schema.required && schema.required.includes(fieldName),
|
|
4780
|
+
is_searchable: false
|
|
4781
|
+
}));
|
|
4782
|
+
}
|
|
4783
|
+
} catch (e) {
|
|
4784
|
+
console.error("Error parsing collection schema:", e);
|
|
4785
|
+
}
|
|
4786
|
+
}
|
|
4765
4787
|
const stmt = db.prepare(`
|
|
4766
4788
|
SELECT * FROM content_fields
|
|
4767
4789
|
WHERE collection_id = ?
|
|
@@ -5209,9 +5231,9 @@ adminContentRoutes.post("/", async (c) => {
|
|
|
5209
5231
|
INSERT INTO content (
|
|
5210
5232
|
id, collection_id, slug, title, data, status,
|
|
5211
5233
|
scheduled_publish_at, scheduled_unpublish_at,
|
|
5212
|
-
meta_title, meta_description, author_id,
|
|
5234
|
+
meta_title, meta_description, author_id, created_at, updated_at
|
|
5213
5235
|
)
|
|
5214
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
|
5236
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
5215
5237
|
`);
|
|
5216
5238
|
await insertStmt.bind(
|
|
5217
5239
|
contentId,
|
|
@@ -5225,7 +5247,6 @@ adminContentRoutes.post("/", async (c) => {
|
|
|
5225
5247
|
data.meta_title || null,
|
|
5226
5248
|
data.meta_description || null,
|
|
5227
5249
|
user?.userId || "unknown",
|
|
5228
|
-
user?.userId || "unknown",
|
|
5229
5250
|
now,
|
|
5230
5251
|
now
|
|
5231
5252
|
).run();
|
|
@@ -5528,9 +5549,9 @@ adminContentRoutes.post("/duplicate", async (c) => {
|
|
|
5528
5549
|
const insertStmt = db.prepare(`
|
|
5529
5550
|
INSERT INTO content (
|
|
5530
5551
|
id, collection_id, slug, title, data, status,
|
|
5531
|
-
author_id,
|
|
5552
|
+
author_id, created_at, updated_at
|
|
5532
5553
|
)
|
|
5533
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?,
|
|
5554
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
5534
5555
|
`);
|
|
5535
5556
|
await insertStmt.bind(
|
|
5536
5557
|
newId,
|
|
@@ -5541,7 +5562,6 @@ adminContentRoutes.post("/duplicate", async (c) => {
|
|
|
5541
5562
|
"draft",
|
|
5542
5563
|
// Always start as draft
|
|
5543
5564
|
user?.userId || "unknown",
|
|
5544
|
-
user?.userId || "unknown",
|
|
5545
5565
|
now,
|
|
5546
5566
|
now
|
|
5547
5567
|
).run();
|
|
@@ -5891,7 +5911,7 @@ ${JSON.stringify(data, null, 2)}
|
|
|
5891
5911
|
var admin_content_default = adminContentRoutes;
|
|
5892
5912
|
|
|
5893
5913
|
// src/templates/pages/admin-profile.template.ts
|
|
5894
|
-
|
|
5914
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
5895
5915
|
function renderAvatarImage(avatarUrl, firstName, lastName) {
|
|
5896
5916
|
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">
|
|
5897
5917
|
${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>`}
|
|
@@ -5911,8 +5931,8 @@ function renderProfilePage(data) {
|
|
|
5911
5931
|
</div>
|
|
5912
5932
|
|
|
5913
5933
|
<!-- Alert Messages -->
|
|
5914
|
-
${data.error ?
|
|
5915
|
-
${data.success ?
|
|
5934
|
+
${data.error ? chunkMU3MR2QR_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
5935
|
+
${data.success ? chunkMU3MR2QR_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
5916
5936
|
|
|
5917
5937
|
<!-- Profile Form -->
|
|
5918
5938
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -6299,7 +6319,7 @@ function renderProfilePage(data) {
|
|
|
6299
6319
|
version: data.version,
|
|
6300
6320
|
content: pageContent
|
|
6301
6321
|
};
|
|
6302
|
-
return
|
|
6322
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
6303
6323
|
}
|
|
6304
6324
|
|
|
6305
6325
|
// src/templates/components/alert.template.ts
|
|
@@ -6582,7 +6602,7 @@ function renderActivityLogsPage(data) {
|
|
|
6582
6602
|
user: data.user,
|
|
6583
6603
|
content: pageContent
|
|
6584
6604
|
};
|
|
6585
|
-
return
|
|
6605
|
+
return chunkMU3MR2QR_cjs.renderAdminLayout(layoutData);
|
|
6586
6606
|
}
|
|
6587
6607
|
function getActionBadgeClass(action) {
|
|
6588
6608
|
if (action.includes("login") || action.includes("logout")) {
|
|
@@ -6602,7 +6622,7 @@ function formatAction(action) {
|
|
|
6602
6622
|
}
|
|
6603
6623
|
|
|
6604
6624
|
// src/templates/pages/admin-user-edit.template.ts
|
|
6605
|
-
|
|
6625
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
6606
6626
|
|
|
6607
6627
|
// src/templates/components/confirmation-dialog.template.ts
|
|
6608
6628
|
function renderConfirmationDialog2(options) {
|
|
@@ -6723,8 +6743,8 @@ function renderUserEditPage(data) {
|
|
|
6723
6743
|
|
|
6724
6744
|
<!-- Alert Messages -->
|
|
6725
6745
|
<div id="form-messages">
|
|
6726
|
-
${data.error ?
|
|
6727
|
-
${data.success ?
|
|
6746
|
+
${data.error ? chunkMU3MR2QR_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
6747
|
+
${data.success ? chunkMU3MR2QR_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
6728
6748
|
</div>
|
|
6729
6749
|
|
|
6730
6750
|
<!-- User Edit Form -->
|
|
@@ -6743,7 +6763,7 @@ function renderUserEditPage(data) {
|
|
|
6743
6763
|
<input
|
|
6744
6764
|
type="text"
|
|
6745
6765
|
name="first_name"
|
|
6746
|
-
value="${
|
|
6766
|
+
value="${chunk3PHG75W4_cjs.escapeHtml(data.userToEdit.firstName || "")}"
|
|
6747
6767
|
required
|
|
6748
6768
|
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"
|
|
6749
6769
|
/>
|
|
@@ -6754,7 +6774,7 @@ function renderUserEditPage(data) {
|
|
|
6754
6774
|
<input
|
|
6755
6775
|
type="text"
|
|
6756
6776
|
name="last_name"
|
|
6757
|
-
value="${
|
|
6777
|
+
value="${chunk3PHG75W4_cjs.escapeHtml(data.userToEdit.lastName || "")}"
|
|
6758
6778
|
required
|
|
6759
6779
|
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"
|
|
6760
6780
|
/>
|
|
@@ -6765,7 +6785,7 @@ function renderUserEditPage(data) {
|
|
|
6765
6785
|
<input
|
|
6766
6786
|
type="text"
|
|
6767
6787
|
name="username"
|
|
6768
|
-
value="${
|
|
6788
|
+
value="${chunk3PHG75W4_cjs.escapeHtml(data.userToEdit.username || "")}"
|
|
6769
6789
|
required
|
|
6770
6790
|
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"
|
|
6771
6791
|
/>
|
|
@@ -6776,7 +6796,7 @@ function renderUserEditPage(data) {
|
|
|
6776
6796
|
<input
|
|
6777
6797
|
type="email"
|
|
6778
6798
|
name="email"
|
|
6779
|
-
value="${
|
|
6799
|
+
value="${chunk3PHG75W4_cjs.escapeHtml(data.userToEdit.email || "")}"
|
|
6780
6800
|
required
|
|
6781
6801
|
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"
|
|
6782
6802
|
/>
|
|
@@ -6787,7 +6807,7 @@ function renderUserEditPage(data) {
|
|
|
6787
6807
|
<input
|
|
6788
6808
|
type="tel"
|
|
6789
6809
|
name="phone"
|
|
6790
|
-
value="${
|
|
6810
|
+
value="${chunk3PHG75W4_cjs.escapeHtml(data.userToEdit.phone || "")}"
|
|
6791
6811
|
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"
|
|
6792
6812
|
/>
|
|
6793
6813
|
</div>
|
|
@@ -6801,7 +6821,7 @@ function renderUserEditPage(data) {
|
|
|
6801
6821
|
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"
|
|
6802
6822
|
>
|
|
6803
6823
|
${data.roles.map((role) => `
|
|
6804
|
-
<option value="${
|
|
6824
|
+
<option value="${chunk3PHG75W4_cjs.escapeHtml(role.value)}" ${data.userToEdit.role === role.value ? "selected" : ""}>${chunk3PHG75W4_cjs.escapeHtml(role.label)}</option>
|
|
6805
6825
|
`).join("")}
|
|
6806
6826
|
</select>
|
|
6807
6827
|
<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">
|
|
@@ -6817,7 +6837,7 @@ function renderUserEditPage(data) {
|
|
|
6817
6837
|
name="bio"
|
|
6818
6838
|
rows="3"
|
|
6819
6839
|
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"
|
|
6820
|
-
>${
|
|
6840
|
+
>${chunk3PHG75W4_cjs.escapeHtml(data.userToEdit.bio || "")}</textarea>
|
|
6821
6841
|
</div>
|
|
6822
6842
|
</div>
|
|
6823
6843
|
|
|
@@ -7017,11 +7037,11 @@ function renderUserEditPage(data) {
|
|
|
7017
7037
|
user: data.user,
|
|
7018
7038
|
content: pageContent
|
|
7019
7039
|
};
|
|
7020
|
-
return
|
|
7040
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7021
7041
|
}
|
|
7022
7042
|
|
|
7023
7043
|
// src/templates/pages/admin-user-new.template.ts
|
|
7024
|
-
|
|
7044
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
7025
7045
|
function renderUserNewPage(data) {
|
|
7026
7046
|
const pageContent = `
|
|
7027
7047
|
<div>
|
|
@@ -7060,8 +7080,8 @@ function renderUserNewPage(data) {
|
|
|
7060
7080
|
|
|
7061
7081
|
<!-- Alert Messages -->
|
|
7062
7082
|
<div id="form-messages">
|
|
7063
|
-
${data.error ?
|
|
7064
|
-
${data.success ?
|
|
7083
|
+
${data.error ? chunkMU3MR2QR_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7084
|
+
${data.success ? chunkMU3MR2QR_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7065
7085
|
</div>
|
|
7066
7086
|
|
|
7067
7087
|
<!-- User New Form -->
|
|
@@ -7305,11 +7325,11 @@ function renderUserNewPage(data) {
|
|
|
7305
7325
|
user: data.user,
|
|
7306
7326
|
content: pageContent
|
|
7307
7327
|
};
|
|
7308
|
-
return
|
|
7328
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7309
7329
|
}
|
|
7310
7330
|
|
|
7311
7331
|
// src/templates/pages/admin-users-list.template.ts
|
|
7312
|
-
|
|
7332
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
7313
7333
|
function renderUsersListPage(data) {
|
|
7314
7334
|
const columns = [
|
|
7315
7335
|
{
|
|
@@ -7460,8 +7480,8 @@ function renderUsersListPage(data) {
|
|
|
7460
7480
|
</div>
|
|
7461
7481
|
|
|
7462
7482
|
<!-- Alert Messages -->
|
|
7463
|
-
${data.error ?
|
|
7464
|
-
${data.success ?
|
|
7483
|
+
${data.error ? chunkMU3MR2QR_cjs.renderAlert({ type: "error", message: data.error, dismissible: true }) : ""}
|
|
7484
|
+
${data.success ? chunkMU3MR2QR_cjs.renderAlert({ type: "success", message: data.success, dismissible: true }) : ""}
|
|
7465
7485
|
|
|
7466
7486
|
<!-- Stats -->
|
|
7467
7487
|
<div class="mb-6">
|
|
@@ -7638,10 +7658,10 @@ function renderUsersListPage(data) {
|
|
|
7638
7658
|
</div>
|
|
7639
7659
|
|
|
7640
7660
|
<!-- Users Table -->
|
|
7641
|
-
${
|
|
7661
|
+
${chunkMU3MR2QR_cjs.renderTable(tableData)}
|
|
7642
7662
|
|
|
7643
7663
|
<!-- Pagination -->
|
|
7644
|
-
${data.pagination ?
|
|
7664
|
+
${data.pagination ? chunkMU3MR2QR_cjs.renderPagination(data.pagination) : ""}
|
|
7645
7665
|
</div>
|
|
7646
7666
|
|
|
7647
7667
|
<script>
|
|
@@ -7712,12 +7732,12 @@ function renderUsersListPage(data) {
|
|
|
7712
7732
|
version: data.version,
|
|
7713
7733
|
content: pageContent
|
|
7714
7734
|
};
|
|
7715
|
-
return
|
|
7735
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
7716
7736
|
}
|
|
7717
7737
|
|
|
7718
7738
|
// src/routes/admin-users.ts
|
|
7719
7739
|
var userRoutes = new hono.Hono();
|
|
7720
|
-
userRoutes.use("*",
|
|
7740
|
+
userRoutes.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
7721
7741
|
userRoutes.get("/", (c) => {
|
|
7722
7742
|
return c.redirect("/admin/dashboard");
|
|
7723
7743
|
});
|
|
@@ -7816,12 +7836,12 @@ userRoutes.put("/profile", async (c) => {
|
|
|
7816
7836
|
const db = c.env.DB;
|
|
7817
7837
|
try {
|
|
7818
7838
|
const formData = await c.req.formData();
|
|
7819
|
-
const firstName =
|
|
7820
|
-
const lastName =
|
|
7821
|
-
const username =
|
|
7839
|
+
const firstName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
7840
|
+
const lastName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
7841
|
+
const username = chunk3PHG75W4_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
7822
7842
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
7823
|
-
const phone =
|
|
7824
|
-
const bio =
|
|
7843
|
+
const phone = chunk3PHG75W4_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
7844
|
+
const bio = chunk3PHG75W4_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
7825
7845
|
const timezone = formData.get("timezone")?.toString() || "UTC";
|
|
7826
7846
|
const language = formData.get("language")?.toString() || "en";
|
|
7827
7847
|
const emailNotifications = formData.get("email_notifications") === "1";
|
|
@@ -7872,7 +7892,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
7872
7892
|
Date.now(),
|
|
7873
7893
|
user.userId
|
|
7874
7894
|
).run();
|
|
7875
|
-
await
|
|
7895
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
7876
7896
|
db,
|
|
7877
7897
|
user.userId,
|
|
7878
7898
|
"profile.update",
|
|
@@ -7935,7 +7955,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
7935
7955
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
7936
7956
|
`);
|
|
7937
7957
|
const userData = await userStmt.bind(user.userId).first();
|
|
7938
|
-
await
|
|
7958
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
7939
7959
|
db,
|
|
7940
7960
|
user.userId,
|
|
7941
7961
|
"profile.avatar_update",
|
|
@@ -8006,7 +8026,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
8006
8026
|
dismissible: true
|
|
8007
8027
|
}));
|
|
8008
8028
|
}
|
|
8009
|
-
const validPassword = await
|
|
8029
|
+
const validPassword = await chunkHXA5QSI3_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
8010
8030
|
if (!validPassword) {
|
|
8011
8031
|
return c.html(renderAlert2({
|
|
8012
8032
|
type: "error",
|
|
@@ -8014,7 +8034,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
8014
8034
|
dismissible: true
|
|
8015
8035
|
}));
|
|
8016
8036
|
}
|
|
8017
|
-
const newPasswordHash = await
|
|
8037
|
+
const newPasswordHash = await chunkHXA5QSI3_cjs.AuthManager.hashPassword(newPassword);
|
|
8018
8038
|
const historyStmt = db.prepare(`
|
|
8019
8039
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
8020
8040
|
VALUES (?, ?, ?, ?)
|
|
@@ -8030,7 +8050,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
8030
8050
|
WHERE id = ?
|
|
8031
8051
|
`);
|
|
8032
8052
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
8033
|
-
await
|
|
8053
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8034
8054
|
db,
|
|
8035
8055
|
user.userId,
|
|
8036
8056
|
"profile.password_change",
|
|
@@ -8097,7 +8117,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
8097
8117
|
`);
|
|
8098
8118
|
const countResult = await countStmt.bind(...params).first();
|
|
8099
8119
|
const totalUsers = countResult?.total || 0;
|
|
8100
|
-
await
|
|
8120
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8101
8121
|
db,
|
|
8102
8122
|
user.userId,
|
|
8103
8123
|
"users.list_view",
|
|
@@ -8199,12 +8219,12 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
8199
8219
|
const user = c.get("user");
|
|
8200
8220
|
try {
|
|
8201
8221
|
const formData = await c.req.formData();
|
|
8202
|
-
const firstName =
|
|
8203
|
-
const lastName =
|
|
8204
|
-
const username =
|
|
8222
|
+
const firstName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8223
|
+
const lastName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8224
|
+
const username = chunk3PHG75W4_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
8205
8225
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8206
|
-
const phone =
|
|
8207
|
-
const bio =
|
|
8226
|
+
const phone = chunk3PHG75W4_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
8227
|
+
const bio = chunk3PHG75W4_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
8208
8228
|
const role = formData.get("role")?.toString() || "viewer";
|
|
8209
8229
|
const password = formData.get("password")?.toString() || "";
|
|
8210
8230
|
const confirmPassword = formData.get("confirm_password")?.toString() || "";
|
|
@@ -8251,7 +8271,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
8251
8271
|
dismissible: true
|
|
8252
8272
|
}));
|
|
8253
8273
|
}
|
|
8254
|
-
const passwordHash = await
|
|
8274
|
+
const passwordHash = await chunkHXA5QSI3_cjs.AuthManager.hashPassword(password);
|
|
8255
8275
|
const userId = crypto.randomUUID();
|
|
8256
8276
|
const createStmt = db.prepare(`
|
|
8257
8277
|
INSERT INTO users (
|
|
@@ -8274,7 +8294,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
8274
8294
|
Date.now(),
|
|
8275
8295
|
Date.now()
|
|
8276
8296
|
).run();
|
|
8277
|
-
await
|
|
8297
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8278
8298
|
db,
|
|
8279
8299
|
user.userId,
|
|
8280
8300
|
"user!.create",
|
|
@@ -8312,7 +8332,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
8312
8332
|
if (!userRecord) {
|
|
8313
8333
|
return c.json({ error: "User not found" }, 404);
|
|
8314
8334
|
}
|
|
8315
|
-
await
|
|
8335
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8316
8336
|
db,
|
|
8317
8337
|
user.userId,
|
|
8318
8338
|
"user!.view",
|
|
@@ -8405,12 +8425,12 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
8405
8425
|
const userId = c.req.param("id");
|
|
8406
8426
|
try {
|
|
8407
8427
|
const formData = await c.req.formData();
|
|
8408
|
-
const firstName =
|
|
8409
|
-
const lastName =
|
|
8410
|
-
const username =
|
|
8428
|
+
const firstName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8429
|
+
const lastName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8430
|
+
const username = chunk3PHG75W4_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
8411
8431
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8412
|
-
const phone =
|
|
8413
|
-
const bio =
|
|
8432
|
+
const phone = chunk3PHG75W4_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
8433
|
+
const bio = chunk3PHG75W4_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
8414
8434
|
const role = formData.get("role")?.toString() || "viewer";
|
|
8415
8435
|
const isActive = formData.get("is_active") === "1";
|
|
8416
8436
|
const emailVerified = formData.get("email_verified") === "1";
|
|
@@ -8461,7 +8481,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
8461
8481
|
Date.now(),
|
|
8462
8482
|
userId
|
|
8463
8483
|
).run();
|
|
8464
|
-
await
|
|
8484
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8465
8485
|
db,
|
|
8466
8486
|
user.userId,
|
|
8467
8487
|
"user!.update",
|
|
@@ -8507,7 +8527,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
8507
8527
|
DELETE FROM users WHERE id = ?
|
|
8508
8528
|
`);
|
|
8509
8529
|
await deleteStmt.bind(userId).run();
|
|
8510
|
-
await
|
|
8530
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8511
8531
|
db,
|
|
8512
8532
|
user.userId,
|
|
8513
8533
|
"user!.hard_delete",
|
|
@@ -8526,7 +8546,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
8526
8546
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
8527
8547
|
`);
|
|
8528
8548
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
8529
|
-
await
|
|
8549
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8530
8550
|
db,
|
|
8531
8551
|
user.userId,
|
|
8532
8552
|
"user!.soft_delete",
|
|
@@ -8553,8 +8573,8 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
8553
8573
|
const formData = await c.req.formData();
|
|
8554
8574
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
8555
8575
|
const role = formData.get("role")?.toString()?.trim() || "viewer";
|
|
8556
|
-
const firstName =
|
|
8557
|
-
const lastName =
|
|
8576
|
+
const firstName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
8577
|
+
const lastName = chunk3PHG75W4_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
8558
8578
|
if (!email || !firstName || !lastName) {
|
|
8559
8579
|
return c.json({ error: "Email, first name, and last name are required" }, 400);
|
|
8560
8580
|
}
|
|
@@ -8592,7 +8612,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
8592
8612
|
Date.now(),
|
|
8593
8613
|
Date.now()
|
|
8594
8614
|
).run();
|
|
8595
|
-
await
|
|
8615
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8596
8616
|
db,
|
|
8597
8617
|
user.userId,
|
|
8598
8618
|
"user!.invite_sent",
|
|
@@ -8649,7 +8669,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
8649
8669
|
Date.now(),
|
|
8650
8670
|
userId
|
|
8651
8671
|
).run();
|
|
8652
|
-
await
|
|
8672
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8653
8673
|
db,
|
|
8654
8674
|
user.userId,
|
|
8655
8675
|
"user!.invitation_resent",
|
|
@@ -8685,7 +8705,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
8685
8705
|
}
|
|
8686
8706
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
8687
8707
|
await deleteStmt.bind(userId).run();
|
|
8688
|
-
await
|
|
8708
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8689
8709
|
db,
|
|
8690
8710
|
user.userId,
|
|
8691
8711
|
"user!.invitation_cancelled",
|
|
@@ -8768,7 +8788,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
8768
8788
|
...log,
|
|
8769
8789
|
details: log.details ? JSON.parse(log.details) : null
|
|
8770
8790
|
}));
|
|
8771
|
-
await
|
|
8791
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8772
8792
|
db,
|
|
8773
8793
|
user.userId,
|
|
8774
8794
|
"activity.logs_viewed",
|
|
@@ -8875,7 +8895,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
8875
8895
|
csvRows.push(row.join(","));
|
|
8876
8896
|
}
|
|
8877
8897
|
const csvContent = csvRows.join("\n");
|
|
8878
|
-
await
|
|
8898
|
+
await chunkHXA5QSI3_cjs.logActivity(
|
|
8879
8899
|
db,
|
|
8880
8900
|
user.userId,
|
|
8881
8901
|
"activity.logs_exported",
|
|
@@ -9093,7 +9113,7 @@ function getFileIcon(mimeType) {
|
|
|
9093
9113
|
}
|
|
9094
9114
|
|
|
9095
9115
|
// src/templates/pages/admin-media-library.template.ts
|
|
9096
|
-
|
|
9116
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
9097
9117
|
function renderMediaLibraryPage(data) {
|
|
9098
9118
|
const pageContent = `
|
|
9099
9119
|
<div>
|
|
@@ -10028,7 +10048,7 @@ function renderMediaLibraryPage(data) {
|
|
|
10028
10048
|
version: data.version,
|
|
10029
10049
|
content: pageContent
|
|
10030
10050
|
};
|
|
10031
|
-
return
|
|
10051
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
10032
10052
|
}
|
|
10033
10053
|
|
|
10034
10054
|
// src/templates/components/media-file-details.template.ts
|
|
@@ -10214,7 +10234,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
10214
10234
|
// 50MB max
|
|
10215
10235
|
});
|
|
10216
10236
|
var adminMediaRoutes = new hono.Hono();
|
|
10217
|
-
adminMediaRoutes.use("*",
|
|
10237
|
+
adminMediaRoutes.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
10218
10238
|
adminMediaRoutes.get("/", async (c) => {
|
|
10219
10239
|
try {
|
|
10220
10240
|
const user = c.get("user");
|
|
@@ -10793,7 +10813,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
10793
10813
|
`);
|
|
10794
10814
|
}
|
|
10795
10815
|
});
|
|
10796
|
-
adminMediaRoutes.delete("/cleanup",
|
|
10816
|
+
adminMediaRoutes.delete("/cleanup", chunkHXA5QSI3_cjs.requireRole("admin"), async (c) => {
|
|
10797
10817
|
try {
|
|
10798
10818
|
const db = c.env.DB;
|
|
10799
10819
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -11042,7 +11062,7 @@ function formatFileSize(bytes) {
|
|
|
11042
11062
|
}
|
|
11043
11063
|
|
|
11044
11064
|
// src/templates/pages/admin-plugins-list.template.ts
|
|
11045
|
-
|
|
11065
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
11046
11066
|
function renderPluginsListPage(data) {
|
|
11047
11067
|
const pageContent = `
|
|
11048
11068
|
<div>
|
|
@@ -11092,6 +11112,28 @@ function renderPluginsListPage(data) {
|
|
|
11092
11112
|
</div>
|
|
11093
11113
|
</div>
|
|
11094
11114
|
|
|
11115
|
+
<!-- Experimental Notice -->
|
|
11116
|
+
<div class="mb-6 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/50 p-4">
|
|
11117
|
+
<div class="flex items-start">
|
|
11118
|
+
<div class="flex-shrink-0">
|
|
11119
|
+
<svg class="h-5 w-5 text-amber-600 dark:text-amber-400" viewBox="0 0 20 20" fill="currentColor">
|
|
11120
|
+
<path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
|
|
11121
|
+
</svg>
|
|
11122
|
+
</div>
|
|
11123
|
+
<div class="ml-3 flex-1">
|
|
11124
|
+
<h3 class="text-sm font-semibold text-amber-800 dark:text-amber-200">
|
|
11125
|
+
Experimental Feature
|
|
11126
|
+
</h3>
|
|
11127
|
+
<div class="mt-2 text-sm text-amber-700 dark:text-amber-300">
|
|
11128
|
+
<p>
|
|
11129
|
+
Plugin management is currently under active development. While functional, some features may change or have limitations.
|
|
11130
|
+
Please report any issues you encounter on our <a href="https://discord.gg/8bMy6bv3sZ" target="_blank" class="font-medium underline hover:text-amber-900 dark:hover:text-amber-100">Discord community</a>.
|
|
11131
|
+
</p>
|
|
11132
|
+
</div>
|
|
11133
|
+
</div>
|
|
11134
|
+
</div>
|
|
11135
|
+
</div>
|
|
11136
|
+
|
|
11095
11137
|
<!-- Stats -->
|
|
11096
11138
|
<div class="mb-6">
|
|
11097
11139
|
<h3 class="text-base font-semibold text-zinc-950 dark:text-white">Plugin Statistics</h3>
|
|
@@ -11416,7 +11458,7 @@ function renderPluginsListPage(data) {
|
|
|
11416
11458
|
version: data.version,
|
|
11417
11459
|
content: pageContent
|
|
11418
11460
|
};
|
|
11419
|
-
return
|
|
11461
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
11420
11462
|
}
|
|
11421
11463
|
function renderPluginCard(plugin) {
|
|
11422
11464
|
const statusColors = {
|
|
@@ -12066,7 +12108,7 @@ function renderPluginSettingsPage(data) {
|
|
|
12066
12108
|
user,
|
|
12067
12109
|
content: pageContent
|
|
12068
12110
|
};
|
|
12069
|
-
return
|
|
12111
|
+
return chunkMU3MR2QR_cjs.renderAdminLayout(layoutData);
|
|
12070
12112
|
}
|
|
12071
12113
|
function renderStatusBadge(status) {
|
|
12072
12114
|
const statusColors = {
|
|
@@ -12329,7 +12371,7 @@ function formatTimestamp(timestamp) {
|
|
|
12329
12371
|
|
|
12330
12372
|
// src/routes/admin-plugins.ts
|
|
12331
12373
|
var adminPluginRoutes = new hono.Hono();
|
|
12332
|
-
adminPluginRoutes.use("*",
|
|
12374
|
+
adminPluginRoutes.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
12333
12375
|
adminPluginRoutes.get("/", async (c) => {
|
|
12334
12376
|
try {
|
|
12335
12377
|
const user = c.get("user");
|
|
@@ -12664,7 +12706,7 @@ function formatLastUpdated(timestamp) {
|
|
|
12664
12706
|
}
|
|
12665
12707
|
|
|
12666
12708
|
// src/templates/pages/admin-logs-list.template.ts
|
|
12667
|
-
|
|
12709
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
12668
12710
|
function renderLogsListPage(data) {
|
|
12669
12711
|
const { logs, pagination, filters, user } = data;
|
|
12670
12712
|
const content = `
|
|
@@ -12975,7 +13017,7 @@ function renderLogsListPage(data) {
|
|
|
12975
13017
|
user,
|
|
12976
13018
|
content
|
|
12977
13019
|
};
|
|
12978
|
-
return
|
|
13020
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
12979
13021
|
}
|
|
12980
13022
|
function renderLogDetailsPage(data) {
|
|
12981
13023
|
const { log, user } = data;
|
|
@@ -13187,7 +13229,7 @@ function renderLogDetailsPage(data) {
|
|
|
13187
13229
|
</div>
|
|
13188
13230
|
</div>
|
|
13189
13231
|
`;
|
|
13190
|
-
return
|
|
13232
|
+
return chunkMU3MR2QR_cjs.adminLayoutV2({
|
|
13191
13233
|
title: `Log Details - ${log.id}`,
|
|
13192
13234
|
user,
|
|
13193
13235
|
content
|
|
@@ -13430,7 +13472,7 @@ function renderLogConfigPage(data) {
|
|
|
13430
13472
|
|
|
13431
13473
|
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
|
13432
13474
|
`;
|
|
13433
|
-
return
|
|
13475
|
+
return chunkMU3MR2QR_cjs.adminLayoutV2({
|
|
13434
13476
|
title: "Log Configuration",
|
|
13435
13477
|
user,
|
|
13436
13478
|
content
|
|
@@ -13439,7 +13481,7 @@ function renderLogConfigPage(data) {
|
|
|
13439
13481
|
|
|
13440
13482
|
// src/routes/admin-logs.ts
|
|
13441
13483
|
var adminLogsRoutes = new hono.Hono();
|
|
13442
|
-
adminLogsRoutes.use("*",
|
|
13484
|
+
adminLogsRoutes.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
13443
13485
|
adminLogsRoutes.get("/", async (c) => {
|
|
13444
13486
|
try {
|
|
13445
13487
|
const user = c.get("user");
|
|
@@ -13811,7 +13853,7 @@ adminDesignRoutes.get("/", (c) => {
|
|
|
13811
13853
|
role: user.role
|
|
13812
13854
|
} : void 0
|
|
13813
13855
|
};
|
|
13814
|
-
return c.html(
|
|
13856
|
+
return c.html(chunkMU3MR2QR_cjs.renderDesignPage(pageData));
|
|
13815
13857
|
});
|
|
13816
13858
|
var adminCheckboxRoutes = new hono.Hono();
|
|
13817
13859
|
adminCheckboxRoutes.get("/", (c) => {
|
|
@@ -13823,7 +13865,7 @@ adminCheckboxRoutes.get("/", (c) => {
|
|
|
13823
13865
|
role: user.role
|
|
13824
13866
|
} : void 0
|
|
13825
13867
|
};
|
|
13826
|
-
return c.html(
|
|
13868
|
+
return c.html(chunkMU3MR2QR_cjs.renderCheckboxPage(pageData));
|
|
13827
13869
|
});
|
|
13828
13870
|
|
|
13829
13871
|
// src/templates/pages/admin-faq-form.template.ts
|
|
@@ -13851,7 +13893,7 @@ function renderFAQForm(data) {
|
|
|
13851
13893
|
</div>
|
|
13852
13894
|
</div>
|
|
13853
13895
|
|
|
13854
|
-
${message ?
|
|
13896
|
+
${message ? chunkMU3MR2QR_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
13855
13897
|
|
|
13856
13898
|
<!-- Form -->
|
|
13857
13899
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -14064,7 +14106,7 @@ function renderFAQForm(data) {
|
|
|
14064
14106
|
user: data.user,
|
|
14065
14107
|
content: pageContent
|
|
14066
14108
|
};
|
|
14067
|
-
return
|
|
14109
|
+
return chunkMU3MR2QR_cjs.renderAdminLayout(layoutData);
|
|
14068
14110
|
}
|
|
14069
14111
|
function escapeHtml4(unsafe) {
|
|
14070
14112
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -14089,7 +14131,7 @@ adminFAQRoutes.get("/", async (c) => {
|
|
|
14089
14131
|
const offset = (currentPage - 1) * limit;
|
|
14090
14132
|
const db = c.env?.DB;
|
|
14091
14133
|
if (!db) {
|
|
14092
|
-
return c.html(
|
|
14134
|
+
return c.html(chunkMU3MR2QR_cjs.renderFAQList({
|
|
14093
14135
|
faqs: [],
|
|
14094
14136
|
totalCount: 0,
|
|
14095
14137
|
currentPage: 1,
|
|
@@ -14129,7 +14171,7 @@ adminFAQRoutes.get("/", async (c) => {
|
|
|
14129
14171
|
`;
|
|
14130
14172
|
const { results: faqs } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
14131
14173
|
const totalPages = Math.ceil(totalCount / limit);
|
|
14132
|
-
return c.html(
|
|
14174
|
+
return c.html(chunkMU3MR2QR_cjs.renderFAQList({
|
|
14133
14175
|
faqs: faqs || [],
|
|
14134
14176
|
totalCount,
|
|
14135
14177
|
currentPage,
|
|
@@ -14143,7 +14185,7 @@ adminFAQRoutes.get("/", async (c) => {
|
|
|
14143
14185
|
} catch (error) {
|
|
14144
14186
|
console.error("Error fetching FAQs:", error);
|
|
14145
14187
|
const user = c.get("user");
|
|
14146
|
-
return c.html(
|
|
14188
|
+
return c.html(chunkMU3MR2QR_cjs.renderFAQList({
|
|
14147
14189
|
faqs: [],
|
|
14148
14190
|
totalCount: 0,
|
|
14149
14191
|
currentPage: 1,
|
|
@@ -14456,7 +14498,7 @@ function renderTestimonialsForm(data) {
|
|
|
14456
14498
|
</div>
|
|
14457
14499
|
</div>
|
|
14458
14500
|
|
|
14459
|
-
${message ?
|
|
14501
|
+
${message ? chunkMU3MR2QR_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
14460
14502
|
|
|
14461
14503
|
<!-- Form -->
|
|
14462
14504
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -14685,7 +14727,7 @@ function renderTestimonialsForm(data) {
|
|
|
14685
14727
|
user: data.user,
|
|
14686
14728
|
content: pageContent
|
|
14687
14729
|
};
|
|
14688
|
-
return
|
|
14730
|
+
return chunkMU3MR2QR_cjs.renderAdminLayout(layoutData);
|
|
14689
14731
|
}
|
|
14690
14732
|
function escapeHtml5(unsafe) {
|
|
14691
14733
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -14711,7 +14753,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
14711
14753
|
const offset = (currentPage - 1) * limit;
|
|
14712
14754
|
const db = c.env?.DB;
|
|
14713
14755
|
if (!db) {
|
|
14714
|
-
return c.html(
|
|
14756
|
+
return c.html(chunkMU3MR2QR_cjs.renderTestimonialsList({
|
|
14715
14757
|
testimonials: [],
|
|
14716
14758
|
totalCount: 0,
|
|
14717
14759
|
currentPage: 1,
|
|
@@ -14751,7 +14793,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
14751
14793
|
`;
|
|
14752
14794
|
const { results: testimonials } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
14753
14795
|
const totalPages = Math.ceil(totalCount / limit);
|
|
14754
|
-
return c.html(
|
|
14796
|
+
return c.html(chunkMU3MR2QR_cjs.renderTestimonialsList({
|
|
14755
14797
|
testimonials: testimonials || [],
|
|
14756
14798
|
totalCount,
|
|
14757
14799
|
currentPage,
|
|
@@ -14765,7 +14807,7 @@ adminTestimonialsRoutes.get("/", async (c) => {
|
|
|
14765
14807
|
} catch (error) {
|
|
14766
14808
|
console.error("Error fetching testimonials:", error);
|
|
14767
14809
|
const user = c.get("user");
|
|
14768
|
-
return c.html(
|
|
14810
|
+
return c.html(chunkMU3MR2QR_cjs.renderTestimonialsList({
|
|
14769
14811
|
testimonials: [],
|
|
14770
14812
|
totalCount: 0,
|
|
14771
14813
|
currentPage: 1,
|
|
@@ -15084,7 +15126,7 @@ function renderCodeExamplesForm(data) {
|
|
|
15084
15126
|
</div>
|
|
15085
15127
|
</div>
|
|
15086
15128
|
|
|
15087
|
-
${message ?
|
|
15129
|
+
${message ? chunkMU3MR2QR_cjs.renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
|
|
15088
15130
|
|
|
15089
15131
|
<!-- Form -->
|
|
15090
15132
|
<div class="backdrop-blur-xl bg-white/10 rounded-xl border border-white/20 shadow-2xl">
|
|
@@ -15354,7 +15396,7 @@ function renderCodeExamplesForm(data) {
|
|
|
15354
15396
|
user: data.user,
|
|
15355
15397
|
content: pageContent
|
|
15356
15398
|
};
|
|
15357
|
-
return
|
|
15399
|
+
return chunkMU3MR2QR_cjs.renderAdminLayout(layoutData);
|
|
15358
15400
|
}
|
|
15359
15401
|
function escapeHtml6(unsafe) {
|
|
15360
15402
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -15381,7 +15423,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
15381
15423
|
const offset = (currentPage - 1) * limit;
|
|
15382
15424
|
const db = c.env?.DB;
|
|
15383
15425
|
if (!db) {
|
|
15384
|
-
return c.html(
|
|
15426
|
+
return c.html(chunkMU3MR2QR_cjs.renderCodeExamplesList({
|
|
15385
15427
|
codeExamples: [],
|
|
15386
15428
|
totalCount: 0,
|
|
15387
15429
|
currentPage: 1,
|
|
@@ -15421,7 +15463,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
15421
15463
|
`;
|
|
15422
15464
|
const { results: codeExamples } = await db.prepare(dataQuery).bind(...params, limit, offset).all();
|
|
15423
15465
|
const totalPages = Math.ceil(totalCount / limit);
|
|
15424
|
-
return c.html(
|
|
15466
|
+
return c.html(chunkMU3MR2QR_cjs.renderCodeExamplesList({
|
|
15425
15467
|
codeExamples: codeExamples || [],
|
|
15426
15468
|
totalCount,
|
|
15427
15469
|
currentPage,
|
|
@@ -15435,7 +15477,7 @@ adminCodeExamplesRoutes.get("/", async (c) => {
|
|
|
15435
15477
|
} catch (error) {
|
|
15436
15478
|
console.error("Error fetching code examples:", error);
|
|
15437
15479
|
const user = c.get("user");
|
|
15438
|
-
return c.html(
|
|
15480
|
+
return c.html(chunkMU3MR2QR_cjs.renderCodeExamplesList({
|
|
15439
15481
|
codeExamples: [],
|
|
15440
15482
|
totalCount: 0,
|
|
15441
15483
|
currentPage: 1,
|
|
@@ -15824,7 +15866,7 @@ function renderDashboardPage(data) {
|
|
|
15824
15866
|
version: data.version,
|
|
15825
15867
|
content: pageContent
|
|
15826
15868
|
};
|
|
15827
|
-
return
|
|
15869
|
+
return chunkMU3MR2QR_cjs.renderAdminLayout(layoutData);
|
|
15828
15870
|
}
|
|
15829
15871
|
function renderStatsCards(stats) {
|
|
15830
15872
|
const cards = [
|
|
@@ -16372,9 +16414,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
16372
16414
|
}
|
|
16373
16415
|
|
|
16374
16416
|
// src/routes/admin-dashboard.ts
|
|
16375
|
-
var VERSION =
|
|
16417
|
+
var VERSION = chunk3PHG75W4_cjs.getCoreVersion();
|
|
16376
16418
|
var router = new hono.Hono();
|
|
16377
|
-
router.use("*",
|
|
16419
|
+
router.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
16378
16420
|
router.get("/", async (c) => {
|
|
16379
16421
|
const user = c.get("user");
|
|
16380
16422
|
try {
|
|
@@ -16599,7 +16641,7 @@ router.get("/system-status", async (c) => {
|
|
|
16599
16641
|
});
|
|
16600
16642
|
|
|
16601
16643
|
// src/templates/pages/admin-collections-list.template.ts
|
|
16602
|
-
|
|
16644
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
16603
16645
|
|
|
16604
16646
|
// src/templates/components/table.template.ts
|
|
16605
16647
|
function renderTable2(data) {
|
|
@@ -17073,11 +17115,11 @@ function renderCollectionsListPage(data) {
|
|
|
17073
17115
|
version: data.version,
|
|
17074
17116
|
content: pageContent
|
|
17075
17117
|
};
|
|
17076
|
-
return
|
|
17118
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
17077
17119
|
}
|
|
17078
17120
|
|
|
17079
17121
|
// src/templates/pages/admin-collections-form.template.ts
|
|
17080
|
-
|
|
17122
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
17081
17123
|
function renderCollectionFormPage(data) {
|
|
17082
17124
|
const isEdit = data.isEdit || !!data.id;
|
|
17083
17125
|
const title = isEdit ? "Edit Collection" : "Create New Collection";
|
|
@@ -17306,7 +17348,7 @@ function renderCollectionFormPage(data) {
|
|
|
17306
17348
|
}
|
|
17307
17349
|
</style>
|
|
17308
17350
|
|
|
17309
|
-
${
|
|
17351
|
+
${chunkMU3MR2QR_cjs.renderForm(formData)}
|
|
17310
17352
|
|
|
17311
17353
|
${isEdit && data.managed ? `
|
|
17312
17354
|
<!-- Read-Only Fields Display for Managed Collections -->
|
|
@@ -17898,12 +17940,12 @@ function renderCollectionFormPage(data) {
|
|
|
17898
17940
|
version: data.version,
|
|
17899
17941
|
content: pageContent
|
|
17900
17942
|
};
|
|
17901
|
-
return
|
|
17943
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
17902
17944
|
}
|
|
17903
17945
|
|
|
17904
17946
|
// src/routes/admin-collections.ts
|
|
17905
17947
|
var adminCollectionsRoutes = new hono.Hono();
|
|
17906
|
-
adminCollectionsRoutes.use("*",
|
|
17948
|
+
adminCollectionsRoutes.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
17907
17949
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
17908
17950
|
try {
|
|
17909
17951
|
const user = c.get("user");
|
|
@@ -18371,7 +18413,7 @@ adminCollectionsRoutes.post("/:collectionId/fields/reorder", async (c) => {
|
|
|
18371
18413
|
});
|
|
18372
18414
|
|
|
18373
18415
|
// src/templates/pages/admin-settings.template.ts
|
|
18374
|
-
|
|
18416
|
+
chunkMU3MR2QR_cjs.init_admin_layout_catalyst_template();
|
|
18375
18417
|
function renderSettingsPage(data) {
|
|
18376
18418
|
const activeTab = data.activeTab || "general";
|
|
18377
18419
|
const pageContent = `
|
|
@@ -18802,7 +18844,7 @@ function renderSettingsPage(data) {
|
|
|
18802
18844
|
version: data.version,
|
|
18803
18845
|
content: pageContent
|
|
18804
18846
|
};
|
|
18805
|
-
return
|
|
18847
|
+
return chunkMU3MR2QR_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
18806
18848
|
}
|
|
18807
18849
|
function renderTabButton(tabId, label, iconPath, activeTab) {
|
|
18808
18850
|
const isActive = activeTab === tabId;
|
|
@@ -19819,7 +19861,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
19819
19861
|
|
|
19820
19862
|
// src/routes/admin-settings.ts
|
|
19821
19863
|
var adminSettingsRoutes = new hono.Hono();
|
|
19822
|
-
adminSettingsRoutes.use("*",
|
|
19864
|
+
adminSettingsRoutes.use("*", chunkHXA5QSI3_cjs.requireAuth());
|
|
19823
19865
|
function getMockSettings(user) {
|
|
19824
19866
|
return {
|
|
19825
19867
|
general: {
|
|
@@ -20273,5 +20315,5 @@ exports.api_system_default = api_system_default;
|
|
|
20273
20315
|
exports.auth_default = auth_default;
|
|
20274
20316
|
exports.router = router;
|
|
20275
20317
|
exports.userRoutes = userRoutes;
|
|
20276
|
-
//# sourceMappingURL=chunk-
|
|
20277
|
-
//# sourceMappingURL=chunk-
|
|
20318
|
+
//# sourceMappingURL=chunk-Q7SL7U43.cjs.map
|
|
20319
|
+
//# sourceMappingURL=chunk-Q7SL7U43.cjs.map
|