@riligar/elysia-sqlite 1.1.5 → 1.1.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +17 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riligar/elysia-sqlite",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Plugin ElysiaJS para gerenciamento de bancos de dados SQLite",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -28,6 +28,7 @@ const mimeTypes = {
28
28
  export const sqliteAdmin = ({ dbPath, prefix = "/admin", configPath = "./sqlite-admin-config.json" }) => {
29
29
  const db = new Database(dbPath);
30
30
  const uiPath = join(import.meta.dir, "ui", "dist");
31
+ console.log("[SQLite Admin] UI Path:", uiPath);
31
32
 
32
33
  // Gerenciador de Sessão
33
34
  const sessionManager = createSessionManager();
@@ -238,19 +239,32 @@ export const sqliteAdmin = ({ dbPath, prefix = "/admin", configPath = "./sqlite-
238
239
  // Servir index.html na raiz
239
240
  .get("/", async () => {
240
241
  const file = Bun.file(join(uiPath, "index.html"));
241
- return new Response(file, { headers: { "Content-Type": "text/html" } });
242
+ return new Response(file, {
243
+ headers: {
244
+ "Content-Type": "text/html",
245
+ "Cache-Control": "no-cache, no-store, must-revalidate",
246
+ "Pragma": "no-cache",
247
+ "Expires": "0"
248
+ }
249
+ });
242
250
  })
243
251
 
244
252
  // Servir arquivos estáticos da pasta assets
245
253
  .get("/assets/*", async ({ params }) => {
246
254
  const filePath = join(uiPath, "assets", params["*"]);
247
255
  const file = Bun.file(filePath);
248
- if (!(await file.exists()))
249
- return new Response("Not found", { status: 404 });
256
+ const exists = await file.exists();
257
+
258
+ if (!exists) {
259
+ console.log(`[SQLite Admin] Asset not found: ${filePath}`);
260
+ return new Response("Not found", { status: 404 });
261
+ }
262
+
250
263
  const ext = filePath.substring(filePath.lastIndexOf("."));
251
264
  return new Response(file, {
252
265
  headers: {
253
266
  "Content-Type": mimeTypes[ext] || "application/octet-stream",
267
+ "Cache-Control": "public, max-age=31536000, immutable"
254
268
  },
255
269
  });
256
270
  })