Merge branch 'release/1.59.0'
This commit is contained in:
19
.mcp copy.json
Normal file
19
.mcp copy.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
6
app/[locale]/share/attachment/[id]/not-found.tsx
Normal file
6
app/[locale]/share/attachment/[id]/not-found.tsx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { NotFoundPage } from '@/app/ui/NotFoundPage';
|
||||||
|
|
||||||
|
const ShareAttachmentNotFound = () =>
|
||||||
|
<NotFoundPage title="404 File Not Found" description="Could not find the requested shared attachment." />;
|
||||||
|
|
||||||
|
export default ShareAttachmentNotFound;
|
||||||
27
app/[locale]/share/attachment/[id]/route.tsx
Normal file
27
app/[locale]/share/attachment/[id]/route.tsx
Normal file
@@ -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}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -63,7 +63,7 @@ export const ViewBillCard:FC<ViewBillCardProps> = ({ location, bill }) => {
|
|||||||
attachment ?
|
attachment ?
|
||||||
<span className="textarea textarea-bordered max-w-[400px] w-full grow">
|
<span className="textarea textarea-bordered max-w-[400px] w-full grow">
|
||||||
<p className="font-bold uppercase">{t("attachment")}</p>
|
<p className="font-bold uppercase">{t("attachment")}</p>
|
||||||
<Link href={`/attachment/${locationID}-${billID}/`} target="_blank" className='text-center w-full max-w-[20em] text-nowrap truncate inline-block mt-2'>
|
<Link href={`/share/attachment/${locationID}-${billID}/`} target="_blank" className='text-center w-full max-w-[20em] text-nowrap truncate inline-block mt-2'>
|
||||||
<DocumentIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1" />
|
<DocumentIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1" />
|
||||||
{decodeURIComponent(attachment.fileName)}
|
{decodeURIComponent(attachment.fileName)}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { locales, defaultLocale } from '@/app/i18n';
|
|||||||
import { Session } from 'next-auth';
|
import { Session } from 'next-auth';
|
||||||
|
|
||||||
// http://localhost:3000/share/location/675c41b227d0df76a35f106e
|
// 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({
|
const intlMiddleware = createIntlMiddleware({
|
||||||
locales,
|
locales,
|
||||||
|
|||||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -46,7 +46,8 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17.0"
|
"node": ">=18.17.0"
|
||||||
}
|
},
|
||||||
|
"version": "1.59.0"
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
"version": "1.2.6",
|
"version": "1.2.6",
|
||||||
@@ -8077,5 +8078,6 @@
|
|||||||
"url": "https://github.com/sponsors/colinhacks"
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"version": "1.59.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,5 +50,6 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17.0"
|
"node": ">=18.17.0"
|
||||||
}
|
},
|
||||||
|
"version": "1.59.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user