Fix four bugs and add logo/branding polish
- docker-compose: add register-user service (profiles: [tools]) with YAML anchor to avoid env duplication - src/index.ts: show localhost instead of 0.0.0.0 in startup message - file-view: render <img> inline for image/* MIME types - file-list: add Copy link button per row (requires baseUrl param) - layout: add hideLogo option; file view page hides the logo - style.css: remove uppercase from .logo (Nanodrop not NANODROP), add button.copy-link styles, add .file-view img styles, widen last td Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -133,6 +133,54 @@ describe('GET /f/:id and GET /f/:id/raw', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /f/:id — image inline', () => {
|
||||
let ctx: TestContext;
|
||||
let fileId: string;
|
||||
|
||||
beforeEach(async () => {
|
||||
ctx = await setup();
|
||||
const token = await loginAs(ctx.app, 'alice', 'secret');
|
||||
const uploadRes = await ctx.app.inject({
|
||||
method: 'POST',
|
||||
url: '/upload',
|
||||
cookies: { token },
|
||||
...buildMultipart({ file: { filename: 'photo.png', contentType: 'image/png', data: Buffer.from('fakepng') } }),
|
||||
});
|
||||
const match = uploadRes.body.match(/\/f\/([^/"]+)/);
|
||||
fileId = match?.[1] ?? '';
|
||||
});
|
||||
afterEach(async () => { await ctx.app.close(); ctx.cleanup(); });
|
||||
|
||||
it('shows <img> tag for image files', async () => {
|
||||
const res = await ctx.app.inject({ method: 'GET', url: `/f/${fileId}` });
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.body).toContain('<img');
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /files — copy link', () => {
|
||||
let ctx: TestContext;
|
||||
let token: string;
|
||||
|
||||
beforeEach(async () => {
|
||||
ctx = await setup();
|
||||
token = await loginAs(ctx.app, 'alice', 'secret');
|
||||
await ctx.app.inject({
|
||||
method: 'POST',
|
||||
url: '/upload',
|
||||
cookies: { token },
|
||||
...buildMultipart({ file: { filename: 'test.txt', contentType: 'text/plain', data: Buffer.from('hi') } }),
|
||||
});
|
||||
});
|
||||
afterEach(async () => { await ctx.app.close(); ctx.cleanup(); });
|
||||
|
||||
it('shows Copy link button for each file', async () => {
|
||||
const res = await ctx.app.inject({ method: 'GET', url: '/files', cookies: { token } });
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.body).toContain('Copy link');
|
||||
});
|
||||
});
|
||||
|
||||
describe('POST /files/:id/delete', () => {
|
||||
let ctx: TestContext;
|
||||
let token: string;
|
||||
|
||||
Reference in New Issue
Block a user