Service Junk Drawer at /attic

This commit is contained in:
2024-11-08 15:03:06 -07:00
parent d6390d365c
commit fa502a45c6
3 changed files with 12 additions and 13 deletions

View File

@@ -8,7 +8,6 @@ import {
Render, Render,
Req, Req,
Res, Res,
UploadedFile,
UploadedFiles, UploadedFiles,
UseInterceptors, UseInterceptors,
} from '@nestjs/common'; } from '@nestjs/common';
@@ -20,8 +19,8 @@ import { JunkDrawerMetadata } from './types';
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { ipFromRequest } from 'src/utils/ip'; import { ipFromRequest } from 'src/utils/ip';
@Controller('junk-drawer') @Controller(['junk-drawer', 'attic'])
@ApiTags('junk-drawer') @ApiTags('attic')
export class JunkDrawerController { export class JunkDrawerController {
constructor(private readonly junkDrawerService: JunkDrawerService) {} constructor(private readonly junkDrawerService: JunkDrawerService) {}
@@ -119,6 +118,6 @@ export class JunkDrawerController {
if (remember && ip && !privateIsh) { if (remember && ip && !privateIsh) {
await this.junkDrawerService.recordItemForIp(ip, uniqueSlug); await this.junkDrawerService.recordItemForIp(ip, uniqueSlug);
} }
return { url: `/junk-drawer/${uniqueSlug}` }; return { url: `/attic/${uniqueSlug}` };
} }
} }

View File

@@ -2,7 +2,7 @@
<head> <head>
<meta charset='utf-8' /> <meta charset='utf-8' />
<title>Junk Drawer</title> <title>Chip's Attic</title>
<script src='https://cdn.tailwindcss.com'></script> <script src='https://cdn.tailwindcss.com'></script>
<meta name='viewport' content='width=device-width, initial-scale=1' /> <meta name='viewport' content='width=device-width, initial-scale=1' />
@@ -11,7 +11,7 @@
<form <form
method='post' method='post'
action='/junk-drawer/upload' action='/attic/upload'
enctype='multipart/form-data' enctype='multipart/form-data'
> >
<div> <div>

View File

@@ -4,35 +4,35 @@
<head> <head>
<meta charset='utf-8' /> <meta charset='utf-8' />
<title>Junk Drawer</title> <title>Chip's Attic</title>
<script src='https://cdn.tailwindcss.com'></script> <script src='https://cdn.tailwindcss.com'></script>
</head> </head>
<body> <body>
<div> <div>
<h1 class="text-xl">Junk Drawer Item</h1> <h1 class="text-xl">Attic Item</h1>
<p>The junk drawer item was uploaded {{lastModified}}</p> <p>The attic item was uploaded {{lastModified}}</p>
<h2>Description</h2> <h2>Description</h2>
<p class="bg-slate-100 px-2 py-4">{{description}}</p> <p class="bg-slate-100 px-2 py-4">{{description}}</p>
<p>Right-click copy: <a class="text-blue-500 underline" href='/junk-drawer/{{slug}}'>{{slug}}</a></p> <p>Right-click copy: <a class="text-blue-500 underline" href='/attic/{{slug}}'>{{slug}}</a></p>
{{#if items}} {{#if items}}
<p class="text-lg">Files:</p> <p class="text-lg">Files:</p>
<div class="list-disc list-inside ml-1"> <div class="list-disc list-inside ml-1">
{{#each items}} {{#each items}}
<div> <div>
<a target="_blank" class="text-emerald-600" href='/junk-drawer/{{../slug}}/{{filename}}'> <a target="_blank" class="text-emerald-600" href='/attic/{{../slug}}/{{filename}}'>
<p> <p>
{{filename}} {{filename}}
</p> </p>
{{#if isImage}} {{#if isImage}}
<img height="150" width="150" src='/junk-drawer/{{../slug}}/{{filename}}' alt='{{filename}}' /> <img height="150" width="150" src='/attic/{{../slug}}/{{filename}}' alt='{{filename}}' />
{{/if}} {{/if}}
</a> </a>
</div> </div>
{{/each}} {{/each}}
</div> </div>
{{/if}} {{/if}}
<p><a class="text-blue-500 underline" href='/junk-drawer'>Upload another file</a></p> <p><a class="text-blue-500 underline" href='/attic'>Upload another file</a></p>
</div> </div>
</body> </body>