@sonicjs-cms/core 2.3.7 → 2.3.9
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 +8 -8
- package/dist/{chunk-47G6TMTB.js → chunk-624OTQ55.js} +2 -2
- package/dist/{chunk-47G6TMTB.js.map → chunk-624OTQ55.js.map} +1 -1
- package/dist/{chunk-CDQWX6HG.js → chunk-AUU4H5MP.js} +3 -3
- package/dist/{chunk-CDQWX6HG.js.map → chunk-AUU4H5MP.js.map} +1 -1
- package/dist/{chunk-THBO2XL6.js → chunk-HNHKS2XF.js} +3 -3
- package/dist/{chunk-THBO2XL6.js.map → chunk-HNHKS2XF.js.map} +1 -1
- package/dist/{chunk-N6HQSHY5.js → chunk-I3M6I2FY.js} +82 -66
- package/dist/chunk-I3M6I2FY.js.map +1 -0
- package/dist/{chunk-F3GLWP7L.cjs → chunk-N3EHA3AX.cjs} +3 -3
- package/dist/{chunk-F3GLWP7L.cjs.map → chunk-N3EHA3AX.cjs.map} +1 -1
- package/dist/{chunk-PFGBXSNH.cjs → chunk-O446Q45G.cjs} +2 -2
- package/dist/{chunk-PFGBXSNH.cjs.map → chunk-O446Q45G.cjs.map} +1 -1
- package/dist/{chunk-ULWF6BZ6.cjs → chunk-T7HDJE2H.cjs} +164 -148
- package/dist/chunk-T7HDJE2H.cjs.map +1 -0
- package/dist/{chunk-DAKMORAN.cjs → chunk-YLFQXTTX.cjs} +4 -4
- package/dist/{chunk-DAKMORAN.cjs.map → chunk-YLFQXTTX.cjs.map} +1 -1
- package/dist/index.cjs +74 -74
- package/dist/index.js +7 -7
- package/dist/middleware.cjs +23 -23
- package/dist/middleware.js +2 -2
- package/dist/migrations-ALSBVBV5.js +4 -0
- package/dist/{migrations-WXG46MGL.js.map → migrations-ALSBVBV5.js.map} +1 -1
- package/dist/migrations-RMI7TLPG.cjs +13 -0
- package/dist/{migrations-GLSUA5KH.cjs.map → migrations-RMI7TLPG.cjs.map} +1 -1
- package/dist/routes.cjs +24 -24
- package/dist/routes.js +4 -4
- package/dist/services.cjs +2 -2
- package/dist/services.js +1 -1
- package/dist/utils.cjs +11 -11
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-N6HQSHY5.js.map +0 -1
- package/dist/chunk-ULWF6BZ6.cjs.map +0 -1
- package/dist/migrations-GLSUA5KH.cjs +0 -13
- package/dist/migrations-WXG46MGL.js +0 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkES3BRZQJ_cjs = require('./chunk-ES3BRZQJ.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkYLFQXTTX_cjs = require('./chunk-YLFQXTTX.cjs');
|
|
5
5
|
var chunkNAYD76QF_cjs = require('./chunk-NAYD76QF.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkO446Q45G_cjs = require('./chunk-O446Q45G.cjs');
|
|
7
7
|
var chunkYU6QFFI4_cjs = require('./chunk-YU6QFFI4.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkN3EHA3AX_cjs = require('./chunk-N3EHA3AX.cjs');
|
|
9
9
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
10
10
|
var hono = require('hono');
|
|
11
11
|
var cors = require('hono/cors');
|
|
@@ -44,7 +44,7 @@ apiContentCrudRoutes.get("/:id", async (c) => {
|
|
|
44
44
|
}, 500);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
apiContentCrudRoutes.post("/",
|
|
47
|
+
apiContentCrudRoutes.post("/", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
48
48
|
try {
|
|
49
49
|
const db = c.env.DB;
|
|
50
50
|
const user = c.get("user");
|
|
@@ -110,7 +110,7 @@ apiContentCrudRoutes.post("/", chunkDAKMORAN_cjs.requireAuth(), async (c) => {
|
|
|
110
110
|
}, 500);
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
apiContentCrudRoutes.put("/:id",
|
|
113
|
+
apiContentCrudRoutes.put("/:id", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
114
114
|
try {
|
|
115
115
|
const id = c.req.param("id");
|
|
116
116
|
const db = c.env.DB;
|
|
@@ -174,7 +174,7 @@ apiContentCrudRoutes.put("/:id", chunkDAKMORAN_cjs.requireAuth(), async (c) => {
|
|
|
174
174
|
}, 500);
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
-
apiContentCrudRoutes.delete("/:id",
|
|
177
|
+
apiContentCrudRoutes.delete("/:id", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
178
178
|
try {
|
|
179
179
|
const id = c.req.param("id");
|
|
180
180
|
const db = c.env.DB;
|
|
@@ -210,7 +210,7 @@ apiRoutes.use("*", async (c, next) => {
|
|
|
210
210
|
c.header("X-Response-Time", `${totalTime}ms`);
|
|
211
211
|
});
|
|
212
212
|
apiRoutes.use("*", async (c, next) => {
|
|
213
|
-
const cacheEnabled = await
|
|
213
|
+
const cacheEnabled = await chunkYLFQXTTX_cjs.isPluginActive(c.env.DB, "core-cache");
|
|
214
214
|
c.set("cacheEnabled", cacheEnabled);
|
|
215
215
|
await next();
|
|
216
216
|
});
|
|
@@ -335,12 +335,12 @@ apiRoutes.get("/content", async (c) => {
|
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
const filter =
|
|
338
|
+
const filter = chunkN3EHA3AX_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
339
339
|
if (!filter.limit) {
|
|
340
340
|
filter.limit = 50;
|
|
341
341
|
}
|
|
342
342
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
343
|
-
const builder3 = new
|
|
343
|
+
const builder3 = new chunkN3EHA3AX_cjs.QueryFilterBuilder();
|
|
344
344
|
const queryResult = builder3.build("content", filter);
|
|
345
345
|
if (queryResult.errors.length > 0) {
|
|
346
346
|
return c.json({
|
|
@@ -427,7 +427,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
427
427
|
if (!collectionResult) {
|
|
428
428
|
return c.json({ error: "Collection not found" }, 404);
|
|
429
429
|
}
|
|
430
|
-
const filter =
|
|
430
|
+
const filter = chunkN3EHA3AX_cjs.QueryFilterBuilder.parseFromQuery(queryParams);
|
|
431
431
|
if (!filter.where) {
|
|
432
432
|
filter.where = { and: [] };
|
|
433
433
|
}
|
|
@@ -443,7 +443,7 @@ apiRoutes.get("/collections/:collection/content", async (c) => {
|
|
|
443
443
|
filter.limit = 50;
|
|
444
444
|
}
|
|
445
445
|
filter.limit = Math.min(filter.limit, 1e3);
|
|
446
|
-
const builder3 = new
|
|
446
|
+
const builder3 = new chunkN3EHA3AX_cjs.QueryFilterBuilder();
|
|
447
447
|
const queryResult = builder3.build("content", filter);
|
|
448
448
|
if (queryResult.errors.length > 0) {
|
|
449
449
|
return c.json({
|
|
@@ -568,7 +568,7 @@ var fileValidationSchema = zod.z.object({
|
|
|
568
568
|
// 50MB max
|
|
569
569
|
});
|
|
570
570
|
var apiMediaRoutes = new hono.Hono();
|
|
571
|
-
apiMediaRoutes.use("*",
|
|
571
|
+
apiMediaRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
572
572
|
apiMediaRoutes.post("/upload", async (c) => {
|
|
573
573
|
try {
|
|
574
574
|
const user = c.get("user");
|
|
@@ -1312,8 +1312,8 @@ apiSystemRoutes.get("/env", (c) => {
|
|
|
1312
1312
|
});
|
|
1313
1313
|
var api_system_default = apiSystemRoutes;
|
|
1314
1314
|
var adminApiRoutes = new hono.Hono();
|
|
1315
|
-
adminApiRoutes.use("*",
|
|
1316
|
-
adminApiRoutes.use("*",
|
|
1315
|
+
adminApiRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
1316
|
+
adminApiRoutes.use("*", chunkYLFQXTTX_cjs.requireRole(["admin", "editor"]));
|
|
1317
1317
|
adminApiRoutes.get("/stats", async (c) => {
|
|
1318
1318
|
try {
|
|
1319
1319
|
const db = c.env.DB;
|
|
@@ -1722,7 +1722,7 @@ adminApiRoutes.delete("/collections/:id", async (c) => {
|
|
|
1722
1722
|
});
|
|
1723
1723
|
adminApiRoutes.get("/migrations/status", async (c) => {
|
|
1724
1724
|
try {
|
|
1725
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1725
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-RMI7TLPG.cjs');
|
|
1726
1726
|
const db = c.env.DB;
|
|
1727
1727
|
const migrationService = new MigrationService2(db);
|
|
1728
1728
|
const status = await migrationService.getMigrationStatus();
|
|
@@ -1747,7 +1747,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
1747
1747
|
error: "Unauthorized. Admin access required."
|
|
1748
1748
|
}, 403);
|
|
1749
1749
|
}
|
|
1750
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1750
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-RMI7TLPG.cjs');
|
|
1751
1751
|
const db = c.env.DB;
|
|
1752
1752
|
const migrationService = new MigrationService2(db);
|
|
1753
1753
|
const result = await migrationService.runPendingMigrations();
|
|
@@ -1766,7 +1766,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
|
|
|
1766
1766
|
});
|
|
1767
1767
|
adminApiRoutes.get("/migrations/validate", async (c) => {
|
|
1768
1768
|
try {
|
|
1769
|
-
const { MigrationService: MigrationService2 } = await import('./migrations-
|
|
1769
|
+
const { MigrationService: MigrationService2 } = await import('./migrations-RMI7TLPG.cjs');
|
|
1770
1770
|
const db = c.env.DB;
|
|
1771
1771
|
const migrationService = new MigrationService2(db);
|
|
1772
1772
|
const validation = await migrationService.validateSchema();
|
|
@@ -2212,7 +2212,7 @@ authRoutes.post(
|
|
|
2212
2212
|
if (existingUser) {
|
|
2213
2213
|
return c.json({ error: "User with this email or username already exists" }, 400);
|
|
2214
2214
|
}
|
|
2215
|
-
const passwordHash = await
|
|
2215
|
+
const passwordHash = await chunkYLFQXTTX_cjs.AuthManager.hashPassword(password);
|
|
2216
2216
|
const userId = crypto.randomUUID();
|
|
2217
2217
|
const now = /* @__PURE__ */ new Date();
|
|
2218
2218
|
await db.prepare(`
|
|
@@ -2232,7 +2232,7 @@ authRoutes.post(
|
|
|
2232
2232
|
now.getTime(),
|
|
2233
2233
|
now.getTime()
|
|
2234
2234
|
).run();
|
|
2235
|
-
const token = await
|
|
2235
|
+
const token = await chunkYLFQXTTX_cjs.AuthManager.generateToken(userId, normalizedEmail, "viewer");
|
|
2236
2236
|
cookie.setCookie(c, "auth_token", token, {
|
|
2237
2237
|
httpOnly: true,
|
|
2238
2238
|
secure: true,
|
|
@@ -2285,11 +2285,11 @@ authRoutes.post("/login", async (c) => {
|
|
|
2285
2285
|
if (!user) {
|
|
2286
2286
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2287
2287
|
}
|
|
2288
|
-
const isValidPassword = await
|
|
2288
|
+
const isValidPassword = await chunkYLFQXTTX_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2289
2289
|
if (!isValidPassword) {
|
|
2290
2290
|
return c.json({ error: "Invalid email or password" }, 401);
|
|
2291
2291
|
}
|
|
2292
|
-
const token = await
|
|
2292
|
+
const token = await chunkYLFQXTTX_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2293
2293
|
cookie.setCookie(c, "auth_token", token, {
|
|
2294
2294
|
httpOnly: true,
|
|
2295
2295
|
secure: true,
|
|
@@ -2338,7 +2338,7 @@ authRoutes.get("/logout", (c) => {
|
|
|
2338
2338
|
});
|
|
2339
2339
|
return c.redirect("/auth/login?message=You have been logged out successfully");
|
|
2340
2340
|
});
|
|
2341
|
-
authRoutes.get("/me",
|
|
2341
|
+
authRoutes.get("/me", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
2342
2342
|
try {
|
|
2343
2343
|
const user = c.get("user");
|
|
2344
2344
|
if (!user) {
|
|
@@ -2355,13 +2355,13 @@ authRoutes.get("/me", chunkDAKMORAN_cjs.requireAuth(), async (c) => {
|
|
|
2355
2355
|
return c.json({ error: "Failed to get user" }, 500);
|
|
2356
2356
|
}
|
|
2357
2357
|
});
|
|
2358
|
-
authRoutes.post("/refresh",
|
|
2358
|
+
authRoutes.post("/refresh", chunkYLFQXTTX_cjs.requireAuth(), async (c) => {
|
|
2359
2359
|
try {
|
|
2360
2360
|
const user = c.get("user");
|
|
2361
2361
|
if (!user) {
|
|
2362
2362
|
return c.json({ error: "Not authenticated" }, 401);
|
|
2363
2363
|
}
|
|
2364
|
-
const token = await
|
|
2364
|
+
const token = await chunkYLFQXTTX_cjs.AuthManager.generateToken(user.userId, user.email, user.role);
|
|
2365
2365
|
cookie.setCookie(c, "auth_token", token, {
|
|
2366
2366
|
httpOnly: true,
|
|
2367
2367
|
secure: true,
|
|
@@ -2410,7 +2410,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2410
2410
|
</div>
|
|
2411
2411
|
`);
|
|
2412
2412
|
}
|
|
2413
|
-
const passwordHash = await
|
|
2413
|
+
const passwordHash = await chunkYLFQXTTX_cjs.AuthManager.hashPassword(password);
|
|
2414
2414
|
const userId = crypto.randomUUID();
|
|
2415
2415
|
const now = /* @__PURE__ */ new Date();
|
|
2416
2416
|
await db.prepare(`
|
|
@@ -2430,7 +2430,7 @@ authRoutes.post("/register/form", async (c) => {
|
|
|
2430
2430
|
now.getTime(),
|
|
2431
2431
|
now.getTime()
|
|
2432
2432
|
).run();
|
|
2433
|
-
const token = await
|
|
2433
|
+
const token = await chunkYLFQXTTX_cjs.AuthManager.generateToken(userId, normalizedEmail, "admin");
|
|
2434
2434
|
cookie.setCookie(c, "auth_token", token, {
|
|
2435
2435
|
httpOnly: true,
|
|
2436
2436
|
secure: false,
|
|
@@ -2481,7 +2481,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2481
2481
|
</div>
|
|
2482
2482
|
`);
|
|
2483
2483
|
}
|
|
2484
|
-
const isValidPassword = await
|
|
2484
|
+
const isValidPassword = await chunkYLFQXTTX_cjs.AuthManager.verifyPassword(password, user.password_hash);
|
|
2485
2485
|
if (!isValidPassword) {
|
|
2486
2486
|
return c.html(html.html`
|
|
2487
2487
|
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
|
@@ -2489,7 +2489,7 @@ authRoutes.post("/login/form", async (c) => {
|
|
|
2489
2489
|
</div>
|
|
2490
2490
|
`);
|
|
2491
2491
|
}
|
|
2492
|
-
const token = await
|
|
2492
|
+
const token = await chunkYLFQXTTX_cjs.AuthManager.generateToken(user.id, user.email, user.role);
|
|
2493
2493
|
cookie.setCookie(c, "auth_token", token, {
|
|
2494
2494
|
httpOnly: true,
|
|
2495
2495
|
secure: false,
|
|
@@ -2548,7 +2548,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2548
2548
|
`).run();
|
|
2549
2549
|
const existingAdmin = await db.prepare("SELECT id FROM users WHERE email = ? OR username = ?").bind("admin@sonicjs.com", "admin").first();
|
|
2550
2550
|
if (existingAdmin) {
|
|
2551
|
-
const passwordHash2 = await
|
|
2551
|
+
const passwordHash2 = await chunkYLFQXTTX_cjs.AuthManager.hashPassword("sonicjs!");
|
|
2552
2552
|
await db.prepare("UPDATE users SET password_hash = ?, updated_at = ? WHERE id = ?").bind(passwordHash2, Date.now(), existingAdmin.id).run();
|
|
2553
2553
|
return c.json({
|
|
2554
2554
|
message: "Admin user already exists (password updated)",
|
|
@@ -2560,7 +2560,7 @@ authRoutes.post("/seed-admin", async (c) => {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
});
|
|
2562
2562
|
}
|
|
2563
|
-
const passwordHash = await
|
|
2563
|
+
const passwordHash = await chunkYLFQXTTX_cjs.AuthManager.hashPassword("sonicjs!");
|
|
2564
2564
|
const userId = "admin-user-id";
|
|
2565
2565
|
const now = Date.now();
|
|
2566
2566
|
const adminEmail = "admin@sonicjs.com".toLowerCase();
|
|
@@ -2780,7 +2780,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2780
2780
|
if (existingUsername) {
|
|
2781
2781
|
return c.json({ error: "Username is already taken" }, 400);
|
|
2782
2782
|
}
|
|
2783
|
-
const passwordHash = await
|
|
2783
|
+
const passwordHash = await chunkYLFQXTTX_cjs.AuthManager.hashPassword(password);
|
|
2784
2784
|
const updateStmt = db.prepare(`
|
|
2785
2785
|
UPDATE users SET
|
|
2786
2786
|
username = ?,
|
|
@@ -2799,7 +2799,7 @@ authRoutes.post("/accept-invitation", async (c) => {
|
|
|
2799
2799
|
Date.now(),
|
|
2800
2800
|
invitedUser.id
|
|
2801
2801
|
).run();
|
|
2802
|
-
const authToken = await
|
|
2802
|
+
const authToken = await chunkYLFQXTTX_cjs.AuthManager.generateToken(invitedUser.id, invitedUser.email, invitedUser.role);
|
|
2803
2803
|
cookie.setCookie(c, "auth_token", authToken, {
|
|
2804
2804
|
httpOnly: true,
|
|
2805
2805
|
secure: true,
|
|
@@ -3029,7 +3029,7 @@ authRoutes.post("/reset-password", async (c) => {
|
|
|
3029
3029
|
if (Date.now() > user.password_reset_expires) {
|
|
3030
3030
|
return c.json({ error: "Reset token has expired" }, 400);
|
|
3031
3031
|
}
|
|
3032
|
-
const newPasswordHash = await
|
|
3032
|
+
const newPasswordHash = await chunkYLFQXTTX_cjs.AuthManager.hashPassword(password);
|
|
3033
3033
|
try {
|
|
3034
3034
|
const historyStmt = db.prepare(`
|
|
3035
3035
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
@@ -5068,17 +5068,17 @@ function renderContentFormPage(data) {
|
|
|
5068
5068
|
form.addEventListener('change', scheduleAutoSave);
|
|
5069
5069
|
});
|
|
5070
5070
|
|
|
5071
|
-
${data.tinymceEnabled ?
|
|
5071
|
+
${data.tinymceEnabled ? getTinyMCEInitScript({
|
|
5072
5072
|
skin: data.tinymceSettings?.skin,
|
|
5073
5073
|
defaultHeight: data.tinymceSettings?.defaultHeight,
|
|
5074
5074
|
defaultToolbar: data.tinymceSettings?.defaultToolbar
|
|
5075
|
-
})
|
|
5075
|
+
}) : ""}
|
|
5076
5076
|
|
|
5077
|
-
${data.mdxeditorEnabled ?
|
|
5077
|
+
${data.mdxeditorEnabled ? getMDXEditorInitScript({
|
|
5078
5078
|
defaultHeight: data.mdxeditorSettings?.defaultHeight,
|
|
5079
5079
|
toolbar: data.mdxeditorSettings?.toolbar,
|
|
5080
5080
|
placeholder: data.mdxeditorSettings?.placeholder
|
|
5081
|
-
})
|
|
5081
|
+
}) : ""}
|
|
5082
5082
|
</script>
|
|
5083
5083
|
`;
|
|
5084
5084
|
const layoutData = {
|
|
@@ -5924,7 +5924,7 @@ async function isPluginActive2(db, pluginId) {
|
|
|
5924
5924
|
|
|
5925
5925
|
// src/routes/admin-content.ts
|
|
5926
5926
|
var adminContentRoutes = new hono.Hono();
|
|
5927
|
-
adminContentRoutes.use("*",
|
|
5927
|
+
adminContentRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
5928
5928
|
async function getCollectionFields(db, collectionId) {
|
|
5929
5929
|
const cache = chunkES3BRZQJ_cjs.getCacheService(chunkES3BRZQJ_cjs.CACHE_CONFIGS.collection);
|
|
5930
5930
|
return cache.getOrSet(
|
|
@@ -7991,7 +7991,7 @@ function renderUserEditPage(data) {
|
|
|
7991
7991
|
<input
|
|
7992
7992
|
type="text"
|
|
7993
7993
|
name="first_name"
|
|
7994
|
-
value="${
|
|
7994
|
+
value="${chunkN3EHA3AX_cjs.escapeHtml(data.userToEdit.firstName || "")}"
|
|
7995
7995
|
required
|
|
7996
7996
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
7997
7997
|
/>
|
|
@@ -8002,7 +8002,7 @@ function renderUserEditPage(data) {
|
|
|
8002
8002
|
<input
|
|
8003
8003
|
type="text"
|
|
8004
8004
|
name="last_name"
|
|
8005
|
-
value="${
|
|
8005
|
+
value="${chunkN3EHA3AX_cjs.escapeHtml(data.userToEdit.lastName || "")}"
|
|
8006
8006
|
required
|
|
8007
8007
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
8008
8008
|
/>
|
|
@@ -8013,7 +8013,7 @@ function renderUserEditPage(data) {
|
|
|
8013
8013
|
<input
|
|
8014
8014
|
type="text"
|
|
8015
8015
|
name="username"
|
|
8016
|
-
value="${
|
|
8016
|
+
value="${chunkN3EHA3AX_cjs.escapeHtml(data.userToEdit.username || "")}"
|
|
8017
8017
|
required
|
|
8018
8018
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
8019
8019
|
/>
|
|
@@ -8024,7 +8024,7 @@ function renderUserEditPage(data) {
|
|
|
8024
8024
|
<input
|
|
8025
8025
|
type="email"
|
|
8026
8026
|
name="email"
|
|
8027
|
-
value="${
|
|
8027
|
+
value="${chunkN3EHA3AX_cjs.escapeHtml(data.userToEdit.email || "")}"
|
|
8028
8028
|
required
|
|
8029
8029
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
8030
8030
|
/>
|
|
@@ -8035,7 +8035,7 @@ function renderUserEditPage(data) {
|
|
|
8035
8035
|
<input
|
|
8036
8036
|
type="tel"
|
|
8037
8037
|
name="phone"
|
|
8038
|
-
value="${
|
|
8038
|
+
value="${chunkN3EHA3AX_cjs.escapeHtml(data.userToEdit.phone || "")}"
|
|
8039
8039
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
8040
8040
|
/>
|
|
8041
8041
|
</div>
|
|
@@ -8049,7 +8049,7 @@ function renderUserEditPage(data) {
|
|
|
8049
8049
|
class="col-start-1 row-start-1 w-full appearance-none rounded-md bg-white/5 dark:bg-white/5 py-1.5 pl-3 pr-8 text-base text-zinc-950 dark:text-white outline outline-1 -outline-offset-1 outline-zinc-500/30 dark:outline-zinc-400/30 *:bg-white dark:*:bg-zinc-800 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-zinc-500 dark:focus-visible:outline-zinc-400 sm:text-sm/6"
|
|
8050
8050
|
>
|
|
8051
8051
|
${data.roles.map((role) => `
|
|
8052
|
-
<option value="${
|
|
8052
|
+
<option value="${chunkN3EHA3AX_cjs.escapeHtml(role.value)}" ${data.userToEdit.role === role.value ? "selected" : ""}>${chunkN3EHA3AX_cjs.escapeHtml(role.label)}</option>
|
|
8053
8053
|
`).join("")}
|
|
8054
8054
|
</select>
|
|
8055
8055
|
<svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-zinc-600 dark:text-zinc-400 sm:size-4">
|
|
@@ -8065,7 +8065,7 @@ function renderUserEditPage(data) {
|
|
|
8065
8065
|
name="bio"
|
|
8066
8066
|
rows="3"
|
|
8067
8067
|
class="w-full rounded-lg bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-950 dark:text-white shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 dark:focus:ring-white transition-shadow"
|
|
8068
|
-
>${
|
|
8068
|
+
>${chunkN3EHA3AX_cjs.escapeHtml(data.userToEdit.bio || "")}</textarea>
|
|
8069
8069
|
</div>
|
|
8070
8070
|
</div>
|
|
8071
8071
|
|
|
@@ -8965,7 +8965,7 @@ function renderUsersListPage(data) {
|
|
|
8965
8965
|
|
|
8966
8966
|
// src/routes/admin-users.ts
|
|
8967
8967
|
var userRoutes = new hono.Hono();
|
|
8968
|
-
userRoutes.use("*",
|
|
8968
|
+
userRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
8969
8969
|
userRoutes.get("/", (c) => {
|
|
8970
8970
|
return c.redirect("/admin/dashboard");
|
|
8971
8971
|
});
|
|
@@ -9064,12 +9064,12 @@ userRoutes.put("/profile", async (c) => {
|
|
|
9064
9064
|
const db = c.env.DB;
|
|
9065
9065
|
try {
|
|
9066
9066
|
const formData = await c.req.formData();
|
|
9067
|
-
const firstName =
|
|
9068
|
-
const lastName =
|
|
9069
|
-
const username =
|
|
9067
|
+
const firstName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9068
|
+
const lastName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9069
|
+
const username = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
9070
9070
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9071
|
-
const phone =
|
|
9072
|
-
const bio =
|
|
9071
|
+
const phone = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
9072
|
+
const bio = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
9073
9073
|
const timezone = formData.get("timezone")?.toString() || "UTC";
|
|
9074
9074
|
const language = formData.get("language")?.toString() || "en";
|
|
9075
9075
|
const emailNotifications = formData.get("email_notifications") === "1";
|
|
@@ -9120,7 +9120,7 @@ userRoutes.put("/profile", async (c) => {
|
|
|
9120
9120
|
Date.now(),
|
|
9121
9121
|
user.userId
|
|
9122
9122
|
).run();
|
|
9123
|
-
await
|
|
9123
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9124
9124
|
db,
|
|
9125
9125
|
user.userId,
|
|
9126
9126
|
"profile.update",
|
|
@@ -9183,7 +9183,7 @@ userRoutes.post("/profile/avatar", async (c) => {
|
|
|
9183
9183
|
SELECT first_name, last_name FROM users WHERE id = ?
|
|
9184
9184
|
`);
|
|
9185
9185
|
const userData = await userStmt.bind(user.userId).first();
|
|
9186
|
-
await
|
|
9186
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9187
9187
|
db,
|
|
9188
9188
|
user.userId,
|
|
9189
9189
|
"profile.avatar_update",
|
|
@@ -9254,7 +9254,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
9254
9254
|
dismissible: true
|
|
9255
9255
|
}));
|
|
9256
9256
|
}
|
|
9257
|
-
const validPassword = await
|
|
9257
|
+
const validPassword = await chunkYLFQXTTX_cjs.AuthManager.verifyPassword(currentPassword, userData.password_hash);
|
|
9258
9258
|
if (!validPassword) {
|
|
9259
9259
|
return c.html(renderAlert2({
|
|
9260
9260
|
type: "error",
|
|
@@ -9262,7 +9262,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
9262
9262
|
dismissible: true
|
|
9263
9263
|
}));
|
|
9264
9264
|
}
|
|
9265
|
-
const newPasswordHash = await
|
|
9265
|
+
const newPasswordHash = await chunkYLFQXTTX_cjs.AuthManager.hashPassword(newPassword);
|
|
9266
9266
|
const historyStmt = db.prepare(`
|
|
9267
9267
|
INSERT INTO password_history (id, user_id, password_hash, created_at)
|
|
9268
9268
|
VALUES (?, ?, ?, ?)
|
|
@@ -9278,7 +9278,7 @@ userRoutes.post("/profile/password", async (c) => {
|
|
|
9278
9278
|
WHERE id = ?
|
|
9279
9279
|
`);
|
|
9280
9280
|
await updateStmt.bind(newPasswordHash, Date.now(), user.userId).run();
|
|
9281
|
-
await
|
|
9281
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9282
9282
|
db,
|
|
9283
9283
|
user.userId,
|
|
9284
9284
|
"profile.password_change",
|
|
@@ -9345,7 +9345,7 @@ userRoutes.get("/users", async (c) => {
|
|
|
9345
9345
|
`);
|
|
9346
9346
|
const countResult = await countStmt.bind(...params).first();
|
|
9347
9347
|
const totalUsers = countResult?.total || 0;
|
|
9348
|
-
await
|
|
9348
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9349
9349
|
db,
|
|
9350
9350
|
user.userId,
|
|
9351
9351
|
"users.list_view",
|
|
@@ -9447,12 +9447,12 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
9447
9447
|
const user = c.get("user");
|
|
9448
9448
|
try {
|
|
9449
9449
|
const formData = await c.req.formData();
|
|
9450
|
-
const firstName =
|
|
9451
|
-
const lastName =
|
|
9452
|
-
const username =
|
|
9450
|
+
const firstName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9451
|
+
const lastName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9452
|
+
const username = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
9453
9453
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9454
|
-
const phone =
|
|
9455
|
-
const bio =
|
|
9454
|
+
const phone = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
9455
|
+
const bio = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
9456
9456
|
const role = formData.get("role")?.toString() || "viewer";
|
|
9457
9457
|
const password = formData.get("password")?.toString() || "";
|
|
9458
9458
|
const confirmPassword = formData.get("confirm_password")?.toString() || "";
|
|
@@ -9499,7 +9499,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
9499
9499
|
dismissible: true
|
|
9500
9500
|
}));
|
|
9501
9501
|
}
|
|
9502
|
-
const passwordHash = await
|
|
9502
|
+
const passwordHash = await chunkYLFQXTTX_cjs.AuthManager.hashPassword(password);
|
|
9503
9503
|
const userId = crypto.randomUUID();
|
|
9504
9504
|
const createStmt = db.prepare(`
|
|
9505
9505
|
INSERT INTO users (
|
|
@@ -9522,7 +9522,7 @@ userRoutes.post("/users/new", async (c) => {
|
|
|
9522
9522
|
Date.now(),
|
|
9523
9523
|
Date.now()
|
|
9524
9524
|
).run();
|
|
9525
|
-
await
|
|
9525
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9526
9526
|
db,
|
|
9527
9527
|
user.userId,
|
|
9528
9528
|
"user!.create",
|
|
@@ -9560,7 +9560,7 @@ userRoutes.get("/users/:id", async (c) => {
|
|
|
9560
9560
|
if (!userRecord) {
|
|
9561
9561
|
return c.json({ error: "User not found" }, 404);
|
|
9562
9562
|
}
|
|
9563
|
-
await
|
|
9563
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9564
9564
|
db,
|
|
9565
9565
|
user.userId,
|
|
9566
9566
|
"user!.view",
|
|
@@ -9653,12 +9653,12 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
9653
9653
|
const userId = c.req.param("id");
|
|
9654
9654
|
try {
|
|
9655
9655
|
const formData = await c.req.formData();
|
|
9656
|
-
const firstName =
|
|
9657
|
-
const lastName =
|
|
9658
|
-
const username =
|
|
9656
|
+
const firstName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9657
|
+
const lastName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9658
|
+
const username = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("username")?.toString());
|
|
9659
9659
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9660
|
-
const phone =
|
|
9661
|
-
const bio =
|
|
9660
|
+
const phone = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("phone")?.toString()) || null;
|
|
9661
|
+
const bio = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("bio")?.toString()) || null;
|
|
9662
9662
|
const role = formData.get("role")?.toString() || "viewer";
|
|
9663
9663
|
const isActive = formData.get("is_active") === "1";
|
|
9664
9664
|
const emailVerified = formData.get("email_verified") === "1";
|
|
@@ -9709,7 +9709,7 @@ userRoutes.put("/users/:id", async (c) => {
|
|
|
9709
9709
|
Date.now(),
|
|
9710
9710
|
userId
|
|
9711
9711
|
).run();
|
|
9712
|
-
await
|
|
9712
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9713
9713
|
db,
|
|
9714
9714
|
user.userId,
|
|
9715
9715
|
"user!.update",
|
|
@@ -9754,7 +9754,7 @@ userRoutes.post("/users/:id/toggle", async (c) => {
|
|
|
9754
9754
|
UPDATE users SET is_active = ?, updated_at = ? WHERE id = ?
|
|
9755
9755
|
`);
|
|
9756
9756
|
await toggleStmt.bind(active ? 1 : 0, Date.now(), userId).run();
|
|
9757
|
-
await
|
|
9757
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9758
9758
|
db,
|
|
9759
9759
|
user.userId,
|
|
9760
9760
|
active ? "user.activate" : "user.deactivate",
|
|
@@ -9795,7 +9795,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
9795
9795
|
DELETE FROM users WHERE id = ?
|
|
9796
9796
|
`);
|
|
9797
9797
|
await deleteStmt.bind(userId).run();
|
|
9798
|
-
await
|
|
9798
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9799
9799
|
db,
|
|
9800
9800
|
user.userId,
|
|
9801
9801
|
"user!.hard_delete",
|
|
@@ -9814,7 +9814,7 @@ userRoutes.delete("/users/:id", async (c) => {
|
|
|
9814
9814
|
UPDATE users SET is_active = 0, updated_at = ? WHERE id = ?
|
|
9815
9815
|
`);
|
|
9816
9816
|
await deleteStmt.bind(Date.now(), userId).run();
|
|
9817
|
-
await
|
|
9817
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9818
9818
|
db,
|
|
9819
9819
|
user.userId,
|
|
9820
9820
|
"user!.soft_delete",
|
|
@@ -9841,8 +9841,8 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
9841
9841
|
const formData = await c.req.formData();
|
|
9842
9842
|
const email = formData.get("email")?.toString()?.trim().toLowerCase() || "";
|
|
9843
9843
|
const role = formData.get("role")?.toString()?.trim() || "viewer";
|
|
9844
|
-
const firstName =
|
|
9845
|
-
const lastName =
|
|
9844
|
+
const firstName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("first_name")?.toString());
|
|
9845
|
+
const lastName = chunkN3EHA3AX_cjs.sanitizeInput(formData.get("last_name")?.toString());
|
|
9846
9846
|
if (!email || !firstName || !lastName) {
|
|
9847
9847
|
return c.json({ error: "Email, first name, and last name are required" }, 400);
|
|
9848
9848
|
}
|
|
@@ -9880,7 +9880,7 @@ userRoutes.post("/invite-user", async (c) => {
|
|
|
9880
9880
|
Date.now(),
|
|
9881
9881
|
Date.now()
|
|
9882
9882
|
).run();
|
|
9883
|
-
await
|
|
9883
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9884
9884
|
db,
|
|
9885
9885
|
user.userId,
|
|
9886
9886
|
"user!.invite_sent",
|
|
@@ -9937,7 +9937,7 @@ userRoutes.post("/resend-invitation/:id", async (c) => {
|
|
|
9937
9937
|
Date.now(),
|
|
9938
9938
|
userId
|
|
9939
9939
|
).run();
|
|
9940
|
-
await
|
|
9940
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9941
9941
|
db,
|
|
9942
9942
|
user.userId,
|
|
9943
9943
|
"user!.invitation_resent",
|
|
@@ -9973,7 +9973,7 @@ userRoutes.delete("/cancel-invitation/:id", async (c) => {
|
|
|
9973
9973
|
}
|
|
9974
9974
|
const deleteStmt = db.prepare(`DELETE FROM users WHERE id = ?`);
|
|
9975
9975
|
await deleteStmt.bind(userId).run();
|
|
9976
|
-
await
|
|
9976
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
9977
9977
|
db,
|
|
9978
9978
|
user.userId,
|
|
9979
9979
|
"user!.invitation_cancelled",
|
|
@@ -10056,7 +10056,7 @@ userRoutes.get("/activity-logs", async (c) => {
|
|
|
10056
10056
|
...log,
|
|
10057
10057
|
details: log.details ? JSON.parse(log.details) : null
|
|
10058
10058
|
}));
|
|
10059
|
-
await
|
|
10059
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
10060
10060
|
db,
|
|
10061
10061
|
user.userId,
|
|
10062
10062
|
"activity.logs_viewed",
|
|
@@ -10163,7 +10163,7 @@ userRoutes.get("/activity-logs/export", async (c) => {
|
|
|
10163
10163
|
csvRows.push(row.join(","));
|
|
10164
10164
|
}
|
|
10165
10165
|
const csvContent = csvRows.join("\n");
|
|
10166
|
-
await
|
|
10166
|
+
await chunkYLFQXTTX_cjs.logActivity(
|
|
10167
10167
|
db,
|
|
10168
10168
|
user.userId,
|
|
10169
10169
|
"activity.logs_exported",
|
|
@@ -11502,7 +11502,7 @@ var fileValidationSchema2 = zod.z.object({
|
|
|
11502
11502
|
// 50MB max
|
|
11503
11503
|
});
|
|
11504
11504
|
var adminMediaRoutes = new hono.Hono();
|
|
11505
|
-
adminMediaRoutes.use("*",
|
|
11505
|
+
adminMediaRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
11506
11506
|
adminMediaRoutes.get("/", async (c) => {
|
|
11507
11507
|
try {
|
|
11508
11508
|
const user = c.get("user");
|
|
@@ -12088,7 +12088,7 @@ adminMediaRoutes.put("/:id", async (c) => {
|
|
|
12088
12088
|
`);
|
|
12089
12089
|
}
|
|
12090
12090
|
});
|
|
12091
|
-
adminMediaRoutes.delete("/cleanup",
|
|
12091
|
+
adminMediaRoutes.delete("/cleanup", chunkYLFQXTTX_cjs.requireRole("admin"), async (c) => {
|
|
12092
12092
|
try {
|
|
12093
12093
|
const db = c.env.DB;
|
|
12094
12094
|
const allMediaStmt = db.prepare("SELECT id, r2_key, filename FROM media WHERE deleted_at IS NULL");
|
|
@@ -13693,7 +13693,7 @@ function formatTimestamp(timestamp) {
|
|
|
13693
13693
|
|
|
13694
13694
|
// src/routes/admin-plugins.ts
|
|
13695
13695
|
var adminPluginRoutes = new hono.Hono();
|
|
13696
|
-
adminPluginRoutes.use("*",
|
|
13696
|
+
adminPluginRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
13697
13697
|
var AVAILABLE_PLUGINS = [
|
|
13698
13698
|
{
|
|
13699
13699
|
id: "third-party-faq",
|
|
@@ -14984,7 +14984,7 @@ function renderLogConfigPage(data) {
|
|
|
14984
14984
|
|
|
14985
14985
|
// src/routes/admin-logs.ts
|
|
14986
14986
|
var adminLogsRoutes = new hono.Hono();
|
|
14987
|
-
adminLogsRoutes.use("*",
|
|
14987
|
+
adminLogsRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
14988
14988
|
adminLogsRoutes.get("/", async (c) => {
|
|
14989
14989
|
try {
|
|
14990
14990
|
const user = c.get("user");
|
|
@@ -16684,7 +16684,7 @@ function renderDashboardPage(data) {
|
|
|
16684
16684
|
<p class="mt-2 text-sm/6 text-zinc-500 dark:text-zinc-400">Welcome to your SonicJS AI admin dashboard</p>
|
|
16685
16685
|
</div>
|
|
16686
16686
|
<div class="mt-4 sm:mt-0 flex items-center gap-x-3">
|
|
16687
|
-
<a href="/
|
|
16687
|
+
<a href="https://sonicjs.com/installation" target="_blank" class="inline-flex items-center justify-center gap-x-1.5 rounded-lg bg-lime-600 dark:bg-lime-700 px-3.5 py-2.5 text-sm font-semibold text-white hover:bg-lime-700 dark:hover:bg-lime-600 transition-colors shadow-sm">
|
|
16688
16688
|
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5">
|
|
16689
16689
|
<path stroke-linecap="round" stroke-linejoin="round" d="M4.26 10.147a60.436 60.436 0 00-.491 6.347A48.627 48.627 0 0112 20.904a48.627 48.627 0 018.232-4.41 60.46 60.46 0 00-.491-6.347m-15.482 0a50.57 50.57 0 00-2.658-.813A59.905 59.905 0 0112 3.493a59.902 59.902 0 0110.399 5.84c-.896.248-1.783.52-2.658.814m-15.482 0A50.697 50.697 0 0112 13.489a50.702 50.702 0 017.74-3.342M6.75 15a.75.75 0 100-1.5.75.75 0 000 1.5zm0 0v-3.675A55.378 55.378 0 0112 8.443m-7.007 11.55A5.981 5.981 0 006.75 15.75v-1.5"/>
|
|
16690
16690
|
</svg>
|
|
@@ -17312,9 +17312,9 @@ function renderStorageUsage(databaseSizeBytes, mediaSizeBytes) {
|
|
|
17312
17312
|
}
|
|
17313
17313
|
|
|
17314
17314
|
// src/routes/admin-dashboard.ts
|
|
17315
|
-
var VERSION =
|
|
17315
|
+
var VERSION = chunkN3EHA3AX_cjs.getCoreVersion();
|
|
17316
17316
|
var router = new hono.Hono();
|
|
17317
|
-
router.use("*",
|
|
17317
|
+
router.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
17318
17318
|
router.get("/", async (c) => {
|
|
17319
17319
|
const user = c.get("user");
|
|
17320
17320
|
try {
|
|
@@ -19068,7 +19068,7 @@ function renderCollectionFormPage(data) {
|
|
|
19068
19068
|
|
|
19069
19069
|
// src/routes/admin-collections.ts
|
|
19070
19070
|
var adminCollectionsRoutes = new hono.Hono();
|
|
19071
|
-
adminCollectionsRoutes.use("*",
|
|
19071
|
+
adminCollectionsRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
19072
19072
|
adminCollectionsRoutes.get("/", async (c) => {
|
|
19073
19073
|
try {
|
|
19074
19074
|
const user = c.get("user");
|
|
@@ -19692,26 +19692,6 @@ function renderSettingsPage(data) {
|
|
|
19692
19692
|
<h1 class="text-2xl/8 font-semibold text-zinc-950 dark:text-white sm:text-xl/8">Settings</h1>
|
|
19693
19693
|
<p class="mt-2 text-sm/6 text-zinc-500 dark:text-zinc-400">Manage your application settings and preferences</p>
|
|
19694
19694
|
</div>
|
|
19695
|
-
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none flex space-x-3">
|
|
19696
|
-
<button
|
|
19697
|
-
onclick="resetSettings()"
|
|
19698
|
-
class="inline-flex items-center justify-center rounded-lg bg-white dark:bg-zinc-800 px-3.5 py-2.5 text-sm font-semibold text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors shadow-sm"
|
|
19699
|
-
>
|
|
19700
|
-
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
19701
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
|
19702
|
-
</svg>
|
|
19703
|
-
Reset to Defaults
|
|
19704
|
-
</button>
|
|
19705
|
-
<button
|
|
19706
|
-
onclick="saveAllSettings()"
|
|
19707
|
-
class="inline-flex items-center justify-center rounded-lg bg-zinc-950 dark:bg-white px-3.5 py-2.5 text-sm font-semibold text-white dark:text-zinc-950 hover:bg-zinc-800 dark:hover:bg-zinc-100 transition-colors shadow-sm"
|
|
19708
|
-
>
|
|
19709
|
-
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
19710
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
19711
|
-
</svg>
|
|
19712
|
-
Save All Changes
|
|
19713
|
-
</button>
|
|
19714
|
-
</div>
|
|
19715
19695
|
</div>
|
|
19716
19696
|
|
|
19717
19697
|
<!-- Settings Navigation Tabs -->
|
|
@@ -19741,8 +19721,8 @@ function renderSettingsPage(data) {
|
|
|
19741
19721
|
// Initialize tab-specific features on page load
|
|
19742
19722
|
const currentTab = '${activeTab}';
|
|
19743
19723
|
|
|
19744
|
-
async function
|
|
19745
|
-
// Collect all form data
|
|
19724
|
+
async function saveGeneralSettings() {
|
|
19725
|
+
// Collect all form data from general settings
|
|
19746
19726
|
const formData = new FormData();
|
|
19747
19727
|
|
|
19748
19728
|
// Get all form inputs in the settings content area
|
|
@@ -19755,20 +19735,13 @@ function renderSettingsPage(data) {
|
|
|
19755
19735
|
});
|
|
19756
19736
|
|
|
19757
19737
|
// Show loading state
|
|
19758
|
-
const saveBtn = document.querySelector('button[onclick="
|
|
19738
|
+
const saveBtn = document.querySelector('button[onclick="saveGeneralSettings()"]');
|
|
19759
19739
|
const originalText = saveBtn.innerHTML;
|
|
19760
19740
|
saveBtn.innerHTML = '<svg class="animate-spin -ml-0.5 mr-1.5 h-5 w-5 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>Saving...';
|
|
19761
19741
|
saveBtn.disabled = true;
|
|
19762
19742
|
|
|
19763
19743
|
try {
|
|
19764
|
-
|
|
19765
|
-
let endpoint = '/admin/settings/general';
|
|
19766
|
-
if (currentTab === 'general') {
|
|
19767
|
-
endpoint = '/admin/settings/general';
|
|
19768
|
-
}
|
|
19769
|
-
// Add more endpoints for other tabs when implemented
|
|
19770
|
-
|
|
19771
|
-
const response = await fetch(endpoint, {
|
|
19744
|
+
const response = await fetch('/admin/settings/general', {
|
|
19772
19745
|
method: 'POST',
|
|
19773
19746
|
body: formData
|
|
19774
19747
|
});
|
|
@@ -19788,18 +19761,7 @@ function renderSettingsPage(data) {
|
|
|
19788
19761
|
saveBtn.disabled = false;
|
|
19789
19762
|
}
|
|
19790
19763
|
}
|
|
19791
|
-
|
|
19792
|
-
function resetSettings() {
|
|
19793
|
-
showConfirmDialog('reset-settings-confirm');
|
|
19794
|
-
}
|
|
19795
19764
|
|
|
19796
|
-
function performResetSettings() {
|
|
19797
|
-
showNotification('Settings reset to defaults', 'info');
|
|
19798
|
-
setTimeout(() => {
|
|
19799
|
-
window.location.reload();
|
|
19800
|
-
}, 1000);
|
|
19801
|
-
}
|
|
19802
|
-
|
|
19803
19765
|
// Migration functions
|
|
19804
19766
|
window.refreshMigrationStatus = async function() {
|
|
19805
19767
|
try {
|
|
@@ -20080,17 +20042,6 @@ function renderSettingsPage(data) {
|
|
|
20080
20042
|
</script>
|
|
20081
20043
|
|
|
20082
20044
|
<!-- Confirmation Dialogs -->
|
|
20083
|
-
${renderConfirmationDialog2({
|
|
20084
|
-
id: "reset-settings-confirm",
|
|
20085
|
-
title: "Reset Settings",
|
|
20086
|
-
message: "Are you sure you want to reset all settings to their default values? This action cannot be undone.",
|
|
20087
|
-
confirmText: "Reset",
|
|
20088
|
-
cancelText: "Cancel",
|
|
20089
|
-
iconColor: "yellow",
|
|
20090
|
-
confirmClass: "bg-yellow-500 hover:bg-yellow-400",
|
|
20091
|
-
onConfirm: "performResetSettings()"
|
|
20092
|
-
})}
|
|
20093
|
-
|
|
20094
20045
|
${renderConfirmationDialog2({
|
|
20095
20046
|
id: "run-migrations-confirm",
|
|
20096
20047
|
title: "Run Migrations",
|
|
@@ -20246,6 +20197,19 @@ function renderGeneralSettings(settings) {
|
|
|
20246
20197
|
</div>
|
|
20247
20198
|
</div>
|
|
20248
20199
|
</div>
|
|
20200
|
+
|
|
20201
|
+
<!-- Save Button -->
|
|
20202
|
+
<div class="mt-8 pt-6 border-t border-zinc-950/5 dark:border-white/10 flex justify-end">
|
|
20203
|
+
<button
|
|
20204
|
+
onclick="saveGeneralSettings()"
|
|
20205
|
+
class="inline-flex items-center justify-center rounded-lg bg-zinc-950 dark:bg-white px-3.5 py-2.5 text-sm font-semibold text-white dark:text-zinc-950 hover:bg-zinc-800 dark:hover:bg-zinc-100 transition-colors shadow-sm"
|
|
20206
|
+
>
|
|
20207
|
+
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
20208
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
20209
|
+
</svg>
|
|
20210
|
+
Save Changes
|
|
20211
|
+
</button>
|
|
20212
|
+
</div>
|
|
20249
20213
|
</div>
|
|
20250
20214
|
`;
|
|
20251
20215
|
}
|
|
@@ -20363,6 +20327,19 @@ function renderAppearanceSettings(settings) {
|
|
|
20363
20327
|
</div>
|
|
20364
20328
|
</div>
|
|
20365
20329
|
</div>
|
|
20330
|
+
|
|
20331
|
+
<!-- Save Button (Disabled for WIP) -->
|
|
20332
|
+
<div class="mt-8 pt-6 border-t border-zinc-950/5 dark:border-white/10 flex justify-end">
|
|
20333
|
+
<button
|
|
20334
|
+
disabled
|
|
20335
|
+
class="inline-flex items-center justify-center rounded-lg bg-zinc-950/50 dark:bg-white/50 px-3.5 py-2.5 text-sm font-semibold text-white/50 dark:text-zinc-950/50 cursor-not-allowed shadow-sm"
|
|
20336
|
+
>
|
|
20337
|
+
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
20338
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
20339
|
+
</svg>
|
|
20340
|
+
Save Changes
|
|
20341
|
+
</button>
|
|
20342
|
+
</div>
|
|
20366
20343
|
</div>
|
|
20367
20344
|
`;
|
|
20368
20345
|
}
|
|
@@ -20518,6 +20495,19 @@ function renderSecuritySettings(settings) {
|
|
|
20518
20495
|
</div>
|
|
20519
20496
|
</div>
|
|
20520
20497
|
</div>
|
|
20498
|
+
|
|
20499
|
+
<!-- Save Button (Disabled for WIP) -->
|
|
20500
|
+
<div class="mt-8 pt-6 border-t border-zinc-950/5 dark:border-white/10 flex justify-end">
|
|
20501
|
+
<button
|
|
20502
|
+
disabled
|
|
20503
|
+
class="inline-flex items-center justify-center rounded-lg bg-zinc-950/50 dark:bg-white/50 px-3.5 py-2.5 text-sm font-semibold text-white/50 dark:text-zinc-950/50 cursor-not-allowed shadow-sm"
|
|
20504
|
+
>
|
|
20505
|
+
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
20506
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
20507
|
+
</svg>
|
|
20508
|
+
Save Changes
|
|
20509
|
+
</button>
|
|
20510
|
+
</div>
|
|
20521
20511
|
</div>
|
|
20522
20512
|
`;
|
|
20523
20513
|
}
|
|
@@ -20664,6 +20654,19 @@ function renderNotificationSettings(settings) {
|
|
|
20664
20654
|
</div>
|
|
20665
20655
|
</div>
|
|
20666
20656
|
</div>
|
|
20657
|
+
|
|
20658
|
+
<!-- Save Button (Disabled for WIP) -->
|
|
20659
|
+
<div class="mt-8 pt-6 border-t border-zinc-950/5 dark:border-white/10 flex justify-end">
|
|
20660
|
+
<button
|
|
20661
|
+
disabled
|
|
20662
|
+
class="inline-flex items-center justify-center rounded-lg bg-zinc-950/50 dark:bg-white/50 px-3.5 py-2.5 text-sm font-semibold text-white/50 dark:text-zinc-950/50 cursor-not-allowed shadow-sm"
|
|
20663
|
+
>
|
|
20664
|
+
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
20665
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
20666
|
+
</svg>
|
|
20667
|
+
Save Changes
|
|
20668
|
+
</button>
|
|
20669
|
+
</div>
|
|
20667
20670
|
</div>
|
|
20668
20671
|
`;
|
|
20669
20672
|
}
|
|
@@ -20767,6 +20770,19 @@ function renderStorageSettings(settings) {
|
|
|
20767
20770
|
</div>
|
|
20768
20771
|
</div>
|
|
20769
20772
|
</div>
|
|
20773
|
+
|
|
20774
|
+
<!-- Save Button (Disabled for WIP) -->
|
|
20775
|
+
<div class="mt-8 pt-6 border-t border-zinc-950/5 dark:border-white/10 flex justify-end">
|
|
20776
|
+
<button
|
|
20777
|
+
disabled
|
|
20778
|
+
class="inline-flex items-center justify-center rounded-lg bg-zinc-950/50 dark:bg-white/50 px-3.5 py-2.5 text-sm font-semibold text-white/50 dark:text-zinc-950/50 cursor-not-allowed shadow-sm"
|
|
20779
|
+
>
|
|
20780
|
+
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
20781
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
20782
|
+
</svg>
|
|
20783
|
+
Save Changes
|
|
20784
|
+
</button>
|
|
20785
|
+
</div>
|
|
20770
20786
|
</div>
|
|
20771
20787
|
`;
|
|
20772
20788
|
}
|
|
@@ -21129,7 +21145,7 @@ function renderDatabaseToolsSettings(settings) {
|
|
|
21129
21145
|
|
|
21130
21146
|
// src/routes/admin-settings.ts
|
|
21131
21147
|
var adminSettingsRoutes = new hono.Hono();
|
|
21132
|
-
adminSettingsRoutes.use("*",
|
|
21148
|
+
adminSettingsRoutes.use("*", chunkYLFQXTTX_cjs.requireAuth());
|
|
21133
21149
|
function getMockSettings(user) {
|
|
21134
21150
|
return {
|
|
21135
21151
|
general: {
|
|
@@ -21297,7 +21313,7 @@ adminSettingsRoutes.get("/database-tools", (c) => {
|
|
|
21297
21313
|
adminSettingsRoutes.get("/api/migrations/status", async (c) => {
|
|
21298
21314
|
try {
|
|
21299
21315
|
const db = c.env.DB;
|
|
21300
|
-
const migrationService = new
|
|
21316
|
+
const migrationService = new chunkO446Q45G_cjs.MigrationService(db);
|
|
21301
21317
|
const status = await migrationService.getMigrationStatus();
|
|
21302
21318
|
return c.json({
|
|
21303
21319
|
success: true,
|
|
@@ -21321,7 +21337,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
21321
21337
|
}, 403);
|
|
21322
21338
|
}
|
|
21323
21339
|
const db = c.env.DB;
|
|
21324
|
-
const migrationService = new
|
|
21340
|
+
const migrationService = new chunkO446Q45G_cjs.MigrationService(db);
|
|
21325
21341
|
const result = await migrationService.runPendingMigrations();
|
|
21326
21342
|
return c.json({
|
|
21327
21343
|
success: result.success,
|
|
@@ -21339,7 +21355,7 @@ adminSettingsRoutes.post("/api/migrations/run", async (c) => {
|
|
|
21339
21355
|
adminSettingsRoutes.get("/api/migrations/validate", async (c) => {
|
|
21340
21356
|
try {
|
|
21341
21357
|
const db = c.env.DB;
|
|
21342
|
-
const migrationService = new
|
|
21358
|
+
const migrationService = new chunkO446Q45G_cjs.MigrationService(db);
|
|
21343
21359
|
const validation = await migrationService.validateSchema();
|
|
21344
21360
|
return c.json({
|
|
21345
21361
|
success: true,
|
|
@@ -21584,5 +21600,5 @@ exports.auth_default = auth_default;
|
|
|
21584
21600
|
exports.router = router;
|
|
21585
21601
|
exports.test_cleanup_default = test_cleanup_default;
|
|
21586
21602
|
exports.userRoutes = userRoutes;
|
|
21587
|
-
//# sourceMappingURL=chunk-
|
|
21588
|
-
//# sourceMappingURL=chunk-
|
|
21603
|
+
//# sourceMappingURL=chunk-T7HDJE2H.cjs.map
|
|
21604
|
+
//# sourceMappingURL=chunk-T7HDJE2H.cjs.map
|