Update Site source

This commit is contained in:
Meghdad committed 2026-10-13 00:19:20 +03:30
1 parent 709785d67f
commit 80a257835f
6 files changed
+29 -6

No files matched your search

+9
View File
@@ -13,6 +13,15 @@ const image = {
export const metadata: Metadata = {
metadataBase: new URL(origin),
title,
icons: {
icon: [
{url:'/favicon.ico?v=energy-1',sizes:'16x16 32x32 48x48',type:'image/x-icon'},
{url:'/favicon-32.png?v=energy-1',sizes:'32x32',type:'image/png'},
{url:'/favicon.svg?v=energy-1',sizes:'any',type:'image/svg+xml'},
],
shortcut:'/favicon.ico?v=energy-1',
apple:{url:'/apple-touch-icon.png?v=energy-1',sizes:'180x180',type:'image/png'},
},
description,
alternates: { canonical: origin },
openGraph: {
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+1 -6
View File
@@ -1,6 +1 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22 19.2727C22 20.779 20.779 22 19.2727 22H14.7273C13.221 22 12 20.779 12 19.2727V12H19.2727C20.779 12 22 13.221 22 14.7273V19.2727Z" fill="#68C4FF"/>
<path d="M20 2C21.1046 2 22 2.89543 22 4V7C22 8.10457 21.1046 9 20 9H17C15.8954 9 15 8.10457 15 7V4C15 2.89543 15.8954 2 17 2H20Z" fill="#0C79D8"/>
<path d="M7 15C8.10457 15 9 15.8954 9 17V20C9 21.1046 8.10457 22 7 22H4C2.89543 22 2 21.1046 2 20V17C2 15.8954 2.89543 15 4 15H7Z" fill="#0C79D8"/>
<path d="M12 12H4.72727C3.22104 12 2 10.779 2 9.27273V4.72727C2 3.22104 3.22104 2 4.72727 2H9.27273C10.779 2 12 3.22104 12 4.72727V12Z" fill="#2E9EFF"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><title>نشان خزانه سایفوند انرژی</title><rect width="64" height="64" rx="14" fill="#141618"/><path d="M14 13h36v24c0 10-8 16-18 21-10-5-18-11-18-21V13Z" fill="#30291d" stroke="#d1ab6c" stroke-width="3" stroke-linejoin="round"/><g transform="translate(13.707 36.118) scale(0.47552)"><path d="M46.969 0L46.969 0Q45.406 0 44.172-0.469Q42.938-0.938 41.938-1.563L41.938-1.563Q41.219 6.469 36.234 11.266Q31.250 16.063 22.156 16.063L22.156 16.063Q15.406 16.063 11.109 13.516Q6.813 10.969 4.766 6.594Q2.719 2.219 2.719-3.219L2.719-3.219Q2.719-6.844 3.531-10.734Q4.344-14.625 5.781-18.469L5.781-18.469L12.875-15.719Q11.781-12.500 11.031-9.375Q10.281-6.250 10.281-3.469L10.281-3.469Q10.281-0.406 11.359 2.156Q12.438 4.719 15.031 6.250Q17.625 7.781 22.156 7.781L22.156 7.781Q26.781 7.781 29.438 6.297Q32.094 4.813 33.203 2.266Q34.313-0.281 34.313-3.406L34.313-3.406Q34.313-6.844 33.250-10.422Q32.188-14 30.938-17.094L30.938-17.094L38.688-20.031L40.781-13.688Q41.500-11.406 42.969-9.906Q44.438-8.406 47.031-8.406L47.031-8.406Q49.781-8.406 50.703-9.719Q51.625-11.031 51.625-13.875L51.625-13.875Q51.625-14.594 51.500-16.453Q51.375-18.313 51.219-20.094L51.219-20.094L58.563-21L59.219-12.906Q59.375-10.875 60.250-9.641Q61.125-8.406 63.281-8.406L63.281-8.406Q65.281-8.406 66.031-9.969Q66.781-11.531 66.781-13.688L66.781-13.688Q66.781-15.438 66.484-17.266Q66.188-19.094 65.813-20.625Q65.438-22.156 65.250-22.906L65.250-22.906L72.781-24.969Q73.406-22.563 73.813-19.859Q74.219-17.156 74.219-14.469L74.219-14.469Q74.219-10.688 73.219-7.391Q72.219-4.094 69.828-2.047Q67.438 0 63.313 0L63.313 0Q60.469 0 58.563-1.172Q56.656-2.344 55.375-4.156L55.375-4.156Q53.750-2.313 51.703-1.156Q49.656 0 46.969 0Z" fill="#f1cd8d"/></g></svg>

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 1.8 KiB

+19
View File
@@ -0,0 +1,19 @@
import fs from 'node:fs/promises';
import opentype from '@shuding/opentype.js';
import sharp from 'sharp';
const fontBytes=await fs.readFile(new URL('../lib/fonts/Vazirmatn-Bold.ttf',import.meta.url));
const font=opentype.parse(fontBytes.buffer.slice(fontBytes.byteOffset,fontBytes.byteOffset+fontBytes.byteLength));
const glyph=font.getPath('س',0,0,64);
const xs=glyph.commands.flatMap(c=>[c.x,c.x1,c.x2].filter(Number.isFinite));const ys=glyph.commands.flatMap(c=>[c.y,c.y1,c.y2].filter(Number.isFinite));
const box={x1:Math.min(...xs),x2:Math.max(...xs),y1:Math.min(...ys),y2:Math.max(...ys)};const scale=Math.min(34/(box.x2-box.x1),27/(box.y2-box.y1));
const dx=32-(box.x1+box.x2)/2*scale,dy=34-(box.y1+box.y2)/2*scale;
const svg=`<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><title>نشان خزانه سایفوند انرژی</title><rect width="64" height="64" rx="14" fill="#141618"/><path d="M14 13h36v24c0 10-8 16-18 21-10-5-18-11-18-21V13Z" fill="#30291d" stroke="#d1ab6c" stroke-width="3" stroke-linejoin="round"/><g transform="translate(${dx.toFixed(3)} ${dy.toFixed(3)}) scale(${scale.toFixed(5)})"><path d="${glyph.toPathData(3)}" fill="#f1cd8d"/></g></svg>`;
const publicDir=new URL('../public/',import.meta.url);
await fs.writeFile(new URL('favicon.svg',publicDir),svg);
await sharp(Buffer.from(svg)).resize(32,32).png().toFile(new URL('favicon-32.png',publicDir).pathname);
await sharp(Buffer.from(svg)).resize(180,180).png().toFile(new URL('apple-touch-icon.png',publicDir).pathname);
const sizes=[16,32,48];const pngs=await Promise.all(sizes.map(size=>sharp(Buffer.from(svg)).resize(size,size).png().toBuffer()));
const header=Buffer.alloc(6+16*sizes.length);header.writeUInt16LE(1,2);header.writeUInt16LE(sizes.length,4);let offset=header.length;
for(let i=0;i<sizes.length;i++){const pos=6+i*16;header[pos]=sizes[i];header[pos+1]=sizes[i];header.writeUInt16LE(1,pos+4);header.writeUInt16LE(32,pos+6);header.writeUInt32LE(pngs[i].length,pos+8);header.writeUInt32LE(offset,pos+12);offset+=pngs[i].length;}
await fs.writeFile(new URL('favicon.ico',publicDir),Buffer.concat([header,...pngs]));
console.log('Created SVG, 16/32/48 ICO, 32px PNG and 180px Apple icon.');