From 5e130ed57e1df8cc67006ea1c4443c4647face68 Mon Sep 17 00:00:00 2001 From: Holly Date: Sun, 26 Jan 2025 16:40:40 +0000 Subject: [PATCH] release to live! --- index.ts | 2 +- package.json | 2 +- repos/MediaRepo.ts | 2 +- tsconfig.json | 2 +- views/home/dashboard.ejs | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.ts b/index.ts index 90345d5..9b078aa 100644 --- a/index.ts +++ b/index.ts @@ -71,7 +71,7 @@ fastify.addHook("preHandler", (req, res, done) => { return done(); } else { const urlParts = req.url.split("/"); - if (urlParts.length === 2 && urlParts[1].length === 16) { + if (urlParts.length === 2 && urlParts[1].length <= 16) { let media = hashLookupCache.get(urlParts[1]) ?? null; if (!media) { media = await MediaService.GetByTag(urlParts[1]); diff --git a/package.json b/package.json index 30436f8..dd3ae5a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "updateCheck": "check-outdated", "dev:legacy_node": "nodemon --watch './**/*.ts' ts-node index.ts", "dev": "bun --watch index.ts", - "build": "tsc --build" + "build": "ncc build index.ts -o build" }, "devDependencies": { "@types/bun": "^1.2.0", diff --git a/repos/MediaRepo.ts b/repos/MediaRepo.ts index e9b1217..a7a55ba 100644 --- a/repos/MediaRepo.ts +++ b/repos/MediaRepo.ts @@ -38,7 +38,7 @@ export default abstract class MediaRepo { } public static async SelectByUserHash(currentUserId: number, hash: string) { - const dbMedia = await Database.Instance.query("SELECT * FROM Media WHERE Hash = ? LIMIT 1", [hash]); + const dbMedia = await Database.Instance.query("SELECT * FROM Media WHERE UserId = ? AND Hash = ? LIMIT 1", [currentUserId, hash]); if (dbMedia == null || dbMedia.length === 0) { return null; } else { diff --git a/tsconfig.json b/tsconfig.json index df029f1..a91c7c3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ // Bundler mode "moduleResolution": "bundler", - "allowImportingTsExtensions": true, + "allowImportingTsExtensions": false, "verbatimModuleSyntax": true, "noEmit": true, diff --git a/views/home/dashboard.ejs b/views/home/dashboard.ejs index 02c5d49..52aee37 100644 --- a/views/home/dashboard.ejs +++ b/views/home/dashboard.ejs @@ -14,13 +14,13 @@
<% for (const upload of recentUploads) { %>
-
+
<% if (upload.MediaType.startsWith("image/")) { %> ://<%= domains[upload.DomainId].Domain %>/<%= upload.MediaTag %>" height="30" width="50"> <% } %>
-
<%= upload.FileName %>
+
<% } %>