From cd2d8f5ab9ff6d399df68cf17fff67aac9d0b420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Mon, 8 Sep 2025 13:22:49 +0200 Subject: [PATCH 1/4] feat: add MCP server configuration for Serena and Context7 --- .mcp copy.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .mcp copy.json diff --git a/.mcp copy.json b/.mcp copy.json new file mode 100644 index 0000000..88ff178 --- /dev/null +++ b/.mcp copy.json @@ -0,0 +1,19 @@ +{ + "mcpServers": { + "serena": { + "command": "uvx", + "args": [ + "--from", + "git+https://github.com/oraios/serena", + "serena", + "start-mcp-server", + "--enable-web-dashboard", + "false" + ] + }, + "context7": { + "type": "http", + "url": "https://mcp.context7.com/mcp" + } + } +} \ No newline at end of file From e84188baf26390aa30641d50a1883a8d19d1dada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Mon, 8 Sep 2025 13:57:53 +0200 Subject: [PATCH 2/4] feat: add unauthenticated /share/attachment/[id] route for shared bill attachments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add /share/attachment/.* to public pages in middleware.ts - Create new /share/attachment/[id] route handler for downloading attachments without authentication - Add custom 404 page for missing shared attachments - Update ViewBillCard component to use shared attachment route instead of authenticated route This enables attachment downloads from shared bill pages without requiring user login. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../share/attachment/[id]/not-found.tsx | 6 +++++ app/[locale]/share/attachment/[id]/route.tsx | 27 +++++++++++++++++++ app/ui/ViewBillCard.tsx | 2 +- middleware.ts | 2 +- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 app/[locale]/share/attachment/[id]/not-found.tsx create mode 100644 app/[locale]/share/attachment/[id]/route.tsx diff --git a/app/[locale]/share/attachment/[id]/not-found.tsx b/app/[locale]/share/attachment/[id]/not-found.tsx new file mode 100644 index 0000000..c0991fe --- /dev/null +++ b/app/[locale]/share/attachment/[id]/not-found.tsx @@ -0,0 +1,6 @@ +import { NotFoundPage } from '@/app/ui/NotFoundPage'; + +const ShareAttachmentNotFound = () => +; + +export default ShareAttachmentNotFound; \ No newline at end of file diff --git a/app/[locale]/share/attachment/[id]/route.tsx b/app/[locale]/share/attachment/[id]/route.tsx new file mode 100644 index 0000000..b8099f8 --- /dev/null +++ b/app/[locale]/share/attachment/[id]/route.tsx @@ -0,0 +1,27 @@ +import { fetchBillById } from '@/app/lib/actions/billActions'; +import { notFound } from 'next/navigation'; + +export async function GET(request: Request, { params:{ id } }: { params: { id:string } }) { + const [locationID, billID] = id.split('-'); + + const [location, bill] = await fetchBillById(locationID, billID, true) ?? []; + + if(!bill?.attachment) { + notFound(); + } + + // convert fileContentsBase64 from Base64 string to binary string + const fileContentsBuffer = Buffer.from(bill.attachment.fileContentsBase64, 'base64'); + + // convert fileContentsBuffer to format that can be sent to the client + const fileContents = new Uint8Array(fileContentsBuffer); + + return new Response(fileContents, { + status: 200, + headers: { + 'Content-Type': "application/octet-stream", + 'Content-Disposition': `attachment; filename="${bill.attachment.fileName}"`, + 'Last-Modified': `${bill.attachment.fileLastModified}` + } + }); +} \ No newline at end of file diff --git a/app/ui/ViewBillCard.tsx b/app/ui/ViewBillCard.tsx index 88e8350..5b85c81 100644 --- a/app/ui/ViewBillCard.tsx +++ b/app/ui/ViewBillCard.tsx @@ -63,7 +63,7 @@ export const ViewBillCard:FC = ({ location, bill }) => { attachment ?

{t("attachment")}

- + {decodeURIComponent(attachment.fileName)} diff --git a/middleware.ts b/middleware.ts index 9dcd075..0c03375 100644 --- a/middleware.ts +++ b/middleware.ts @@ -10,7 +10,7 @@ import { locales, defaultLocale } from '@/app/i18n'; import { Session } from 'next-auth'; // http://localhost:3000/share/location/675c41b227d0df76a35f106e -const publicPages = ['/terms', '/policy', '/login', '/share/location/.*', '/share/bill/.*']; +const publicPages = ['/terms', '/policy', '/login', '/share/location/.*', '/share/bill/.*', '/share/attachment/.*']; const intlMiddleware = createIntlMiddleware({ locales, From ecc33f988db848598c54edd7233fedea6faef2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Mon, 8 Sep 2025 13:59:35 +0200 Subject: [PATCH 3/4] 1.58.0 --- package-lock.json | 6 ++++-- package.json | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd00143..01b56f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,8 @@ }, "engines": { "node": ">=18.17.0" - } + }, + "version": "1.58.0" }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", @@ -8077,5 +8078,6 @@ "url": "https://github.com/sponsors/colinhacks" } } - } + }, + "version": "1.58.0" } diff --git a/package.json b/package.json index 6b46a8a..c13ad51 100644 --- a/package.json +++ b/package.json @@ -50,5 +50,6 @@ }, "engines": { "node": ">=18.17.0" - } + }, + "version": "1.58.0" } From f86d2e240401e11bb59e5c945ded16dd9c05d3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Mon, 8 Sep 2025 14:00:44 +0200 Subject: [PATCH 4/4] chore: update package version to 1.59.0 in package.json and package-lock.json --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 01b56f7..f81ff92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "engines": { "node": ">=18.17.0" }, - "version": "1.58.0" + "version": "1.59.0" }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", @@ -8079,5 +8079,5 @@ } } }, - "version": "1.58.0" + "version": "1.59.0" } diff --git a/package.json b/package.json index c13ad51..1a8ca0d 100644 --- a/package.json +++ b/package.json @@ -51,5 +51,5 @@ "engines": { "node": ">=18.17.0" }, - "version": "1.58.0" + "version": "1.59.0" }