1. 排行榜悬浮窗关闭后小按钮消失问题 - 修复面板居中模式关闭时按钮位置错误 - 保存并恢复按钮的居中状态 2. 首页tag按钮按素材数量排序 - 添加按素材数量降序排序逻辑 3. 上传弹窗输入框浅色模式文字不可见 - 添加 text-slate-900 确保浅色模式下文字可见 - 添加 placeholder 样式确保占位符正确显示
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
/**
|
||
* 生成favicon.ico文件
|
||
* 使用项目logo生成多尺寸的favicon
|
||
*/
|
||
const sharp = require('sharp');
|
||
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
async function generateFavicon() {
|
||
const logoPath = path.join(__dirname, '..', 'logo', 'logo1.png');
|
||
const outputPath = path.join(__dirname, '..', 'public', 'favicon.ico');
|
||
|
||
// 检查logo文件是否存在
|
||
if (!fs.existsSync(logoPath)) {
|
||
console.error('Logo file not found:', logoPath);
|
||
process.exit(1);
|
||
}
|
||
|
||
try {
|
||
// 生成32x32的PNG作为favicon(现代浏览器支持PNG格式的favicon)
|
||
await sharp(logoPath)
|
||
.resize(32, 32, {
|
||
fit: 'contain',
|
||
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
||
})
|
||
.png()
|
||
.toFile(outputPath.replace('.ico', '.png'));
|
||
|
||
// 复制为.ico(大多数浏览器也接受PNG格式的.ico文件)
|
||
const pngBuffer = await sharp(logoPath)
|
||
.resize(32, 32, {
|
||
fit: 'contain',
|
||
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
||
})
|
||
.png()
|
||
.toBuffer();
|
||
|
||
fs.writeFileSync(outputPath, pngBuffer);
|
||
|
||
console.log('Favicon generated successfully:', outputPath);
|
||
console.log('Also created PNG version:', outputPath.replace('.ico', '.png'));
|
||
} catch (error) {
|
||
console.error('Error generating favicon:', error);
|
||
process.exit(1);
|
||
}
|
||
}
|
||
|
||
generateFavicon();
|