feat: implement Figlet, Pastel, and Unit tools with a unified layout
- Add Figlet text converter with font selection and history - Add Pastel color palette generator and manipulation suite - Add comprehensive Units converter with category-based logic - Introduce AppShell with Sidebar and Header for navigation - Modernize theme system with CSS variables and new animations - Update project configuration and dependencies
This commit is contained in:
29
app/api/fonts/route.ts
Normal file
29
app/api/fonts/route.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const dynamic = 'force-static';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const fontsDir = path.join(process.cwd(), 'public/fonts/figlet-fonts');
|
||||
const files = fs.readdirSync(fontsDir);
|
||||
|
||||
const fonts = files
|
||||
.filter(file => file.endsWith('.flf'))
|
||||
.map(file => {
|
||||
const name = file.replace('.flf', '');
|
||||
return {
|
||||
name,
|
||||
fileName: file,
|
||||
path: `/fonts/figlet-fonts/${file}`,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
return NextResponse.json(fonts);
|
||||
} catch (error) {
|
||||
console.error('Error reading fonts directory:', error);
|
||||
return NextResponse.json({ error: 'Failed to load fonts' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user