vibora 1.3.1 → 1.5.0
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/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<link rel="icon" type="image/png" sizes="512x512" href="/vibora-icon.png" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>Vibora</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-IdRTHnwv.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Djf_9c_I.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -3722,7 +3722,7 @@ var sessionAuthMiddleware = createMiddleware(async (c, next) => {
|
|
|
3722
3722
|
});
|
|
3723
3723
|
|
|
3724
3724
|
// server/app.ts
|
|
3725
|
-
import { readFile } from "fs/promises";
|
|
3725
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
3726
3726
|
import { join as join11 } from "path";
|
|
3727
3727
|
import { existsSync as existsSync10 } from "fs";
|
|
3728
3728
|
|
|
@@ -139111,9 +139111,17 @@ app5.delete("/:key", (c) => {
|
|
|
139111
139111
|
var config_default = app5;
|
|
139112
139112
|
|
|
139113
139113
|
// server/routes/uploads.ts
|
|
139114
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
139114
|
+
import { mkdir, writeFile, readFile } from "fs/promises";
|
|
139115
139115
|
import { existsSync as existsSync8 } from "fs";
|
|
139116
139116
|
import { join as join9 } from "path";
|
|
139117
|
+
var mimeTypes = {
|
|
139118
|
+
png: "image/png",
|
|
139119
|
+
jpg: "image/jpeg",
|
|
139120
|
+
jpeg: "image/jpeg",
|
|
139121
|
+
gif: "image/gif",
|
|
139122
|
+
webp: "image/webp",
|
|
139123
|
+
svg: "image/svg+xml"
|
|
139124
|
+
};
|
|
139117
139125
|
var app6 = new Hono2;
|
|
139118
139126
|
function generateFilename(extension) {
|
|
139119
139127
|
const now = new Date;
|
|
@@ -139148,6 +139156,22 @@ app6.post("/", async (c) => {
|
|
|
139148
139156
|
await writeFile(filePath, Buffer.from(arrayBuffer));
|
|
139149
139157
|
return c.json({ path: filePath });
|
|
139150
139158
|
});
|
|
139159
|
+
app6.get("/:filename", async (c) => {
|
|
139160
|
+
const filename = c.req.param("filename");
|
|
139161
|
+
if (!/^clipboard-\d{4}-\d{2}-\d{2}-\d{6}\.\w+$/.test(filename)) {
|
|
139162
|
+
return c.notFound();
|
|
139163
|
+
}
|
|
139164
|
+
const filePath = join9(getViboraDir(), "uploads", filename);
|
|
139165
|
+
if (!existsSync8(filePath)) {
|
|
139166
|
+
return c.notFound();
|
|
139167
|
+
}
|
|
139168
|
+
const ext2 = filename.split(".").pop()?.toLowerCase() || "";
|
|
139169
|
+
const contentType = mimeTypes[ext2] || "application/octet-stream";
|
|
139170
|
+
const content = await readFile(filePath);
|
|
139171
|
+
return new Response(content, {
|
|
139172
|
+
headers: { "Content-Type": contentType }
|
|
139173
|
+
});
|
|
139174
|
+
});
|
|
139151
139175
|
var uploads_default = app6;
|
|
139152
139176
|
|
|
139153
139177
|
// node_modules/hono/dist/utils/stream.js
|
|
@@ -143442,7 +143466,7 @@ function createApp() {
|
|
|
143442
143466
|
const distPath = getDistPath();
|
|
143443
143467
|
const serveFile = async (filePath) => {
|
|
143444
143468
|
const ext2 = filePath.split(".").pop()?.toLowerCase();
|
|
143445
|
-
const
|
|
143469
|
+
const mimeTypes2 = {
|
|
143446
143470
|
html: "text/html",
|
|
143447
143471
|
css: "text/css",
|
|
143448
143472
|
js: "application/javascript",
|
|
@@ -143455,9 +143479,9 @@ function createApp() {
|
|
|
143455
143479
|
woff: "font/woff",
|
|
143456
143480
|
woff2: "font/woff2"
|
|
143457
143481
|
};
|
|
143458
|
-
const content = await
|
|
143482
|
+
const content = await readFile2(filePath);
|
|
143459
143483
|
return new Response(content, {
|
|
143460
|
-
headers: { "Content-Type":
|
|
143484
|
+
headers: { "Content-Type": mimeTypes2[ext2 || ""] || "application/octet-stream" }
|
|
143461
143485
|
});
|
|
143462
143486
|
};
|
|
143463
143487
|
app13.get("/assets/*", async (c) => {
|
|
@@ -143482,7 +143506,7 @@ function createApp() {
|
|
|
143482
143506
|
if (path9.startsWith("/api/") || path9.startsWith("/ws/") || path9 === "/health") {
|
|
143483
143507
|
return next();
|
|
143484
143508
|
}
|
|
143485
|
-
const html = await
|
|
143509
|
+
const html = await readFile2(join11(distPath, "index.html"), "utf-8");
|
|
143486
143510
|
return c.html(html);
|
|
143487
143511
|
});
|
|
143488
143512
|
}
|