mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-11-12 07:59:17 +00:00
chore: update packages
This commit is contained in:
parent
59866a00a5
commit
f0cf08f2a4
6 changed files with 1029 additions and 717 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"name": "@tomodachi-share/backend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@11.24.0",
|
||||
"packageManager": "pnpm@12.14.0",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
|
|
@ -19,30 +19,30 @@
|
|||
"charinfo-ex": "^0.0.5",
|
||||
"dayjs": "^1.11.23",
|
||||
"downshift": "^9.4.0",
|
||||
"file-type": "^22.0.2",
|
||||
"next": "16.3.3",
|
||||
"file-type": "^22.2.0",
|
||||
"next": "16.4.2",
|
||||
"next-auth": "5.0.0-beta.32",
|
||||
"qrcode-generator": "^2.0.4",
|
||||
"react": "^19.2.8",
|
||||
"react-dom": "^19.2.8",
|
||||
"redis": "^6.2.1",
|
||||
"satori": "^0.33.4",
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1",
|
||||
"redis": "^6.3.0",
|
||||
"satori": "0.33.4",
|
||||
"sharp": "^0.34.5",
|
||||
"sjcl-with-all": "1.0.8",
|
||||
"zod": "^4.5.4"
|
||||
"zod": "^4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.3.6",
|
||||
"@iconify/react": "^6.0.2",
|
||||
"@eslint/eslintrc": "^3.3.7",
|
||||
"@iconify/react": "^6.0.3",
|
||||
"@tailwindcss/postcss": "^4.3.3",
|
||||
"@types/node": "^26.4.0",
|
||||
"@types/react": "^19.2.18",
|
||||
"@types/react-dom": "^19.2.5",
|
||||
"@types/node": "^26.6.5",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@types/sjcl": "^1.0.34",
|
||||
"eslint": "^10.9.1",
|
||||
"eslint-config-next": "16.3.3",
|
||||
"eslint": "^10.13.0",
|
||||
"eslint-config-next": "16.4.2",
|
||||
"prisma": "^6.19.3",
|
||||
"schema-dts": "^2.0.0",
|
||||
"schema-dts": "^2.1.0",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"typescript": "^7.0.2"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ const fontCache: Record<string, Font | null> = {
|
|||
extraBold: null,
|
||||
black: null,
|
||||
};
|
||||
let logoCache: string | null = null;
|
||||
|
||||
// Load fonts only once and cache them
|
||||
const loadFonts = async (): Promise<Font[]> => {
|
||||
|
|
@ -98,11 +99,20 @@ const loadFonts = async (): Promise<Font[]> => {
|
|||
);
|
||||
};
|
||||
|
||||
// Load logo only once and cache them
|
||||
const loadLogo = async (): Promise<string> => {
|
||||
if (!logoCache) {
|
||||
const data = await fs.readFile(path.join(process.cwd(), "public/logo.svg"));
|
||||
logoCache = `data:image/svg+xml;base64,${data.toString("base64")}`;
|
||||
}
|
||||
return logoCache;
|
||||
};
|
||||
|
||||
export async function generateMetadataImage(mii: Mii, author: string): Promise<{ buffer?: Buffer; error?: string; status?: number }> {
|
||||
const miiUploadsDirectory = path.join(uploadsDirectory, mii.id.toString());
|
||||
|
||||
// Load assets concurrently
|
||||
const [miiImage, qrCodeImage, fonts] = await Promise.all([
|
||||
const [miiImage, qrCodeImage, fonts, logoImage] = await Promise.all([
|
||||
// Read and convert the images to data URI
|
||||
fs.readFile(path.join(miiUploadsDirectory, "mii.png")).then((buffer) =>
|
||||
sharp(buffer)
|
||||
|
|
@ -123,6 +133,7 @@ export async function generateMetadataImage(mii: Mii, author: string): Promise<{
|
|||
)
|
||||
: Promise.resolve(null),
|
||||
loadFonts(),
|
||||
loadLogo(),
|
||||
]);
|
||||
|
||||
const jsx: ReactNode = (
|
||||
|
|
@ -132,7 +143,7 @@ export async function generateMetadataImage(mii: Mii, author: string): Promise<{
|
|||
<div
|
||||
tw={`h-62 rounded-xl flex justify-center items-center mr-2 ${mii.platform === "THREE_DS" ? "w-80" : "w-100"}`}
|
||||
style={{
|
||||
backgroundImage: "linear-gradient(to bottom, #fef3c7, #fde68a);",
|
||||
backgroundImage: "linear-gradient(to bottom, #fef3c7, #fde68a)",
|
||||
}}
|
||||
>
|
||||
<img
|
||||
|
|
@ -177,7 +188,7 @@ export async function generateMetadataImage(mii: Mii, author: string): Promise<{
|
|||
))}
|
||||
</div>
|
||||
|
||||
<div tw="absolute inset-0" style={{ position: "absolute", backgroundImage: "linear-gradient(to right, #fffbeb00 70%, #fffbeb);" }}></div>
|
||||
<div tw="absolute inset-0" style={{ position: "absolute", backgroundImage: "linear-gradient(to right, #fffbeb00 70%, #fffbeb)" }}></div>
|
||||
</div>
|
||||
|
||||
{/* Author */}
|
||||
|
|
@ -190,7 +201,7 @@ export async function generateMetadataImage(mii: Mii, author: string): Promise<{
|
|||
|
||||
{/* Watermark */}
|
||||
<div tw="absolute bottom-0 right-0 flex items-center">
|
||||
<img src={`${process.env.NEXT_PUBLIC_FRONTEND_URL}/logo.svg`} height={32} />
|
||||
<img src={logoImage} height={32} />
|
||||
{/* I tried using text-orange-400 but it wasn't correct..? */}
|
||||
<span tw="ml-2 font-black text-xl" style={{ color: "#FF8904" }}>
|
||||
TomodachiShare
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue