release to live!
This commit is contained in:
parent
30ff3dbdcd
commit
5e130ed57e
5 changed files with 6 additions and 6 deletions
2
index.ts
2
index.ts
|
@ -71,7 +71,7 @@ fastify.addHook("preHandler", (req, res, done) => {
|
||||||
return done();
|
return done();
|
||||||
} else {
|
} else {
|
||||||
const urlParts = req.url.split("/");
|
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;
|
let media = hashLookupCache.get(urlParts[1]) ?? null;
|
||||||
if (!media) {
|
if (!media) {
|
||||||
media = await MediaService.GetByTag(urlParts[1]);
|
media = await MediaService.GetByTag(urlParts[1]);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"updateCheck": "check-outdated",
|
"updateCheck": "check-outdated",
|
||||||
"dev:legacy_node": "nodemon --watch './**/*.ts' ts-node index.ts",
|
"dev:legacy_node": "nodemon --watch './**/*.ts' ts-node index.ts",
|
||||||
"dev": "bun --watch index.ts",
|
"dev": "bun --watch index.ts",
|
||||||
"build": "tsc --build"
|
"build": "ncc build index.ts -o build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "^1.2.0",
|
"@types/bun": "^1.2.0",
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default abstract class MediaRepo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async SelectByUserHash(currentUserId: number, hash: string) {
|
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) {
|
if (dbMedia == null || dbMedia.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// Bundler mode
|
// Bundler mode
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": false,
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
<div class="row row-cols-1">
|
<div class="row row-cols-1">
|
||||||
<% for (const upload of recentUploads) { %>
|
<% for (const upload of recentUploads) { %>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row flex-nowrap">
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<% if (upload.MediaType.startsWith("image/")) { %>
|
<% if (upload.MediaType.startsWith("image/")) { %>
|
||||||
<img src="<%= domains[upload.DomainId].HasHttps ? "https" : "http" %>://<%= domains[upload.DomainId].Domain %>/<%= upload.MediaTag %>" height="30" width="50">
|
<img src="<%= domains[upload.DomainId].HasHttps ? "https" : "http" %>://<%= domains[upload.DomainId].Domain %>/<%= upload.MediaTag %>" height="30" width="50">
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
<div class="col"><%= upload.FileName %></div>
|
<div class="col"><a href="<%= domains[upload.DomainId].HasHttps ? "https" : "http" %>://<%= domains[upload.DomainId].Domain %>/<%= upload.MediaTag %>" target="_blank"><%= upload.FileName %></a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
Loading…
Add table
Reference in a new issue